Commit 3b3dc2af authored by johan's avatar johan

More compilation warnings fix on windows

parent cb985e53
......@@ -243,11 +243,11 @@ void decaf_sha512_final(decaf_sha512_ctx_t ctx, uint8_t *out, size_t length) {
}
for (size_t i=0; i<8; i++)
ctx->block[120 + i] = bp >> (56 - 8*i);
ctx->block[120 + i] = (uint8_t)(bp >> (56 - 8*i));
hashblock(ctx);
for (size_t i=0; i<length; i++) {
out[i] = ctx->state[i/8] >> (56 - 8*(i%8));
out[i] = (uint8_t)(ctx->state[i/8] >> (56 - 8*(i%8)));
}
decaf_sha512_init(ctx);
......
......@@ -98,7 +98,7 @@ decaf_error_t decaf_sha3_update (
uint8_t* state = &decaf_sponge->state->b[decaf_sponge->params->position];
if (cando > len) {
for (i = 0; i < len; i += 1) state[i] ^= in[i];
decaf_sponge->params->position += len;
decaf_sponge->params->position += (uint8_t)len;
break;
} else {
for (i = 0; i < cando; i += 1) state[i] ^= in[i];
......@@ -121,7 +121,7 @@ decaf_error_t decaf_sha3_output (
if (decaf_sponge->params->max_out != 0xFF) {
if (decaf_sponge->params->remaining >= len) {
decaf_sponge->params->remaining -= len;
decaf_sponge->params->remaining -= (uint8_t)len;
} else {
decaf_sponge->params->remaining = 0;
ret = DECAF_FAILURE;
......@@ -148,7 +148,7 @@ decaf_error_t decaf_sha3_output (
uint8_t* state = &decaf_sponge->state->b[decaf_sponge->params->position];
if (cando > len) {
memcpy(out, state, len);
decaf_sponge->params->position += len;
decaf_sponge->params->position += (uint8_t)len;
return ret;
} else {
memcpy(out, state, cando);
......
......@@ -25,6 +25,9 @@
#if defined(_MSC_VER)
# include <io.h>
#include <BaseTsd.h>
#define open _open
#define read _read
#define close _close
typedef SSIZE_T ssize_t;
#else
# include <unistd.h>
......@@ -110,7 +113,7 @@ void decaf_spongerng_next (
uint8_t lenx[8];
size_t len1 = len;
for (unsigned i=0; i<sizeof(lenx); i++) {
lenx[i] = len1;
lenx[i] = (uint8_t)len1;
len1 >>= 8;
}
decaf_sha3_update(prng->sponge,lenx,sizeof(lenx));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment