1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-26 02:46:13 -04:00

[signdness] Compilation fixes

This commit is contained in:
Witold Filipczyk 2021-01-02 21:14:03 +01:00
parent 0fea79cc8f
commit 66fb230326
6 changed files with 18 additions and 18 deletions

View File

@ -115,18 +115,18 @@ init_response_digest(md5_digest_hex_T response, struct auth_entry *entry,
init_uri_method_digest(Ha2_hex, uri);
MD5_Init(&MD5Ctx);
MD5_Update(&MD5Ctx, ha1, sizeof(md5_digest_hex_T));
MD5_Update(&MD5Ctx, (char *)ha1, sizeof(md5_digest_hex_T));
MD5_Update(&MD5Ctx, ":", 1);
if (entry->nonce)
MD5_Update(&MD5Ctx, entry->nonce, strlen(entry->nonce));
MD5_Update(&MD5Ctx, ":", 1);
MD5_Update(&MD5Ctx, hexl(entry->nc), 8);
MD5_Update(&MD5Ctx, ":", 1);
MD5_Update(&MD5Ctx, cnonce, sizeof(md5_digest_hex_T));
MD5_Update(&MD5Ctx, (char *)cnonce, sizeof(md5_digest_hex_T));
MD5_Update(&MD5Ctx, ":", 1);
MD5_Update(&MD5Ctx, "auth", 4);
MD5_Update(&MD5Ctx, ":", 1);
MD5_Update(&MD5Ctx, Ha2_hex, sizeof(md5_digest_hex_T));
MD5_Update(&MD5Ctx, (char *)Ha2_hex, sizeof(md5_digest_hex_T));
MD5_Final(Ha2, &MD5Ctx);
convert_to_md5_digest_hex_T(Ha2, response);

View File

@ -180,11 +180,11 @@ do_send_bittorrent_tracker_request(struct connection *conn)
add_uri_to_string(&request, uri, URI_BASE);
add_to_string(&request, "?info_hash=");
encode_uri_string(&request, bittorrent->meta.info_hash,
encode_uri_string(&request, (char *)bittorrent->meta.info_hash,
sizeof(bittorrent->meta.info_hash), 1);
add_to_string(&request, "&peer_id=");
encode_uri_string(&request, bittorrent->peer_id,
encode_uri_string(&request, (char *)bittorrent->peer_id,
sizeof(bittorrent->peer_id), 1);
add_format_to_string(&request, "&uploaded=%ld", bittorrent->uploaded);

View File

@ -31,7 +31,7 @@ static void transform_md5(uint32_t buf[4], uint32_t const in[16]);
* This code is harmless on little-endian machines.
* @todo FIXME: Optimize it away on little-endian machines. */
static void
reverse_md5_bytes(char *buf, unsigned int longs)
reverse_md5_bytes(unsigned char *buf, unsigned int longs)
{
uint32_t t;
@ -114,7 +114,7 @@ void
done_md5(struct md5_context *ctx, md5_digest_bin_T digest)
{
unsigned int count;
char *p;
unsigned char *p;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
@ -148,12 +148,12 @@ done_md5(struct md5_context *ctx, md5_digest_bin_T digest)
((uint32_t *) ctx->in)[15] = ctx->bits[1];
transform_md5(ctx->buf, (uint32_t *) ctx->in);
reverse_md5_bytes((char *) ctx->buf, 4);
reverse_md5_bytes((unsigned char *)ctx->buf, 4);
memmove(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
char *
unsigned char *
digest_md5(const char *data, unsigned long length,
md5_digest_bin_T digest)
{

View File

@ -44,7 +44,7 @@ void done_md5(struct md5_context *context, md5_digest_bin_T digest);
/** Digest the passed @a data with the given length and stores the MD5
* digest in the @a digest parameter. */
char *
unsigned char *
digest_md5(const char *data, unsigned long length, md5_digest_bin_T digest);
#ifdef CONFIG_MD5

View File

@ -58,7 +58,7 @@ init_sha1(struct sha1_context *ctx)
void
update_sha1(struct sha1_context *ctx, const char *dataIn,
update_sha1(struct sha1_context *ctx, const unsigned char *dataIn,
unsigned long len)
{
int i;
@ -112,8 +112,8 @@ done_sha1(struct sha1_context *ctx, sha1_digest_bin_T digest)
init_sha1(ctx);
}
char *
digest_sha1(const char *data, unsigned long length,
unsigned char *
digest_sha1(const unsigned char *data, unsigned long length,
sha1_digest_bin_T digest)
{
struct sha1_context ctx;

View File

@ -55,8 +55,8 @@ extern "C" {
#define SHA_HEX_DIGEST_LENGTH (SHA_DIGEST_LENGTH * 2)
typedef char sha1_digest_bin_T[SHA_DIGEST_LENGTH];
typedef char sha1_digest_hex_T[SHA_HEX_DIGEST_LENGTH];
typedef unsigned char sha1_digest_bin_T[SHA_DIGEST_LENGTH];
typedef unsigned char sha1_digest_hex_T[SHA_HEX_DIGEST_LENGTH];
struct sha1_context {
unsigned int H[5];
@ -66,11 +66,11 @@ struct sha1_context {
};
void init_sha1(struct sha1_context *context);
void update_sha1(struct sha1_context *context, const char *data, unsigned long length);
void update_sha1(struct sha1_context *context, const unsigned char *data, unsigned long length);
void done_sha1(struct sha1_context *context, sha1_digest_bin_T digest);
char *
digest_sha1(const char *data, unsigned long length, sha1_digest_bin_T digest);
unsigned char *
digest_sha1(const unsigned char *data, unsigned long length, sha1_digest_bin_T digest);
#ifdef CONFIG_SHA1
/* Provide compatibility with the OpenSSL interface: */