Skip to content

Commit

Permalink
fixed signed overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
LoupVaillant committed Jul 18, 2017
1 parent 4a444ff commit 347189c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/monocypher.c
Expand Up @@ -290,7 +290,7 @@ void crypto_poly1305_update(crypto_poly1305_ctx *ctx,
poly_clear_c(ctx);
}
// feed the input buffer
ctx->c[ctx->c_index / 4] |= msg[i] << ((ctx->c_index % 4) * 8);
ctx->c[ctx->c_index / 4] |= (u32)msg[i] << ((ctx->c_index % 4) * 8);
ctx->c_index++;
}
}
Expand All @@ -302,7 +302,7 @@ void crypto_poly1305_final(crypto_poly1305_ctx *ctx, u8 mac[16])
// move the final 1 according to remaining input length
// (We may add less than 2^130 to the last input block)
ctx->c[4] = 0;
ctx->c[ctx->c_index / 4] |= 1 << ((ctx->c_index % 4) * 8);
ctx->c[ctx->c_index / 4] |= (u32)1 << ((ctx->c_index % 4) * 8);
// one last hash update
poly_block(ctx);
}
Expand Down

0 comments on commit 347189c

Please sign in to comment.