From 8562223d577765e5729fbbc5525de93e5e7e4ea5 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Fri, 18 Jul 2014 15:32:55 +0100 Subject: [PATCH] fix some harmless warnings with LLVM with signed vs unsigned buffer types. --- cbits/cryptonite_md2.c | 35 ++++++++++++++++++----------------- cbits/cryptonite_sha512.c | 2 +- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/cbits/cryptonite_md2.c b/cbits/cryptonite_md2.c index fd4bf8b..42bf546 100644 --- a/cbits/cryptonite_md2.c +++ b/cbits/cryptonite_md2.c @@ -52,24 +52,25 @@ static uint8_t S_table[] = { 0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A, 0xDB, 0x99, 0x8D, 0x33, 0x9F, 0x11, 0x83, 0x14 }; +#define UBYTES(s) ((uint8_t *) s) static uint8_t *padding_table[] = { - "", - "\x1", - "\x2\x2", - "\x3\x3\x3", - "\x4\x4\x4\x4", - "\x5\x5\x5\x5\x5", - "\x6\x6\x6\x6\x6\x6", - "\x7\x7\x7\x7\x7\x7\x7", - "\x8\x8\x8\x8\x8\x8\x8\x8", - "\x9\x9\x9\x9\x9\x9\x9\x9\x9", - "\xa\xa\xa\xa\xa\xa\xa\xa\xa\xa", - "\xb\xb\xb\xb\xb\xb\xb\xb\xb\xb\xb", - "\xc\xc\xc\xc\xc\xc\xc\xc\xc\xc\xc\xc", - "\xd\xd\xd\xd\xd\xd\xd\xd\xd\xd\xd\xd\xd", - "\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe", - "\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf", - "\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10" + UBYTES(""), + UBYTES("\x1"), + UBYTES("\x2\x2"), + UBYTES("\x3\x3\x3"), + UBYTES("\x4\x4\x4\x4"), + UBYTES("\x5\x5\x5\x5\x5"), + UBYTES("\x6\x6\x6\x6\x6\x6"), + UBYTES("\x7\x7\x7\x7\x7\x7\x7"), + UBYTES("\x8\x8\x8\x8\x8\x8\x8\x8"), + UBYTES("\x9\x9\x9\x9\x9\x9\x9\x9\x9"), + UBYTES("\xa\xa\xa\xa\xa\xa\xa\xa\xa\xa"), + UBYTES("\xb\xb\xb\xb\xb\xb\xb\xb\xb\xb\xb"), + UBYTES("\xc\xc\xc\xc\xc\xc\xc\xc\xc\xc\xc\xc"), + UBYTES("\xd\xd\xd\xd\xd\xd\xd\xd\xd\xd\xd\xd\xd"), + UBYTES("\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe\xe"), + UBYTES("\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf"), + UBYTES("\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10") }; static void md2_do_chunk(struct md2_ctx *ctx, uint8_t *buf) diff --git a/cbits/cryptonite_sha512.c b/cbits/cryptonite_sha512.c index 9a0791c..b72f1d8 100644 --- a/cbits/cryptonite_sha512.c +++ b/cbits/cryptonite_sha512.c @@ -233,7 +233,7 @@ void cryptonite_sha512_init_t(struct sha512_ctx *ctx, int t) ctx->h[i] ^= 0xa5a5a5a5a5a5a5a5ULL; i = sprintf(buf, "SHA-512/%d", t); - cryptonite_sha512_update(ctx, buf, i); + cryptonite_sha512_update(ctx, (uint8_t *) buf, i); cryptonite_sha512_finalize(ctx, out); /* re-init the context, otherwise len is changed */