use unsigned to avoid undefined behavior in shifts (nisharg joshi)

This commit is contained in:
christos 2020-02-16 15:03:22 +00:00
parent 2b1ba9ff43
commit a2b3598d26
2 changed files with 5 additions and 5 deletions

View File

@ -37,10 +37,10 @@ int MD4_Init(MD4_CTX *c)
void md4_block_data_order(MD4_CTX *c, const void *data_, size_t num) void md4_block_data_order(MD4_CTX *c, const void *data_, size_t num)
{ {
const unsigned char *data = data_; const unsigned char *data = data_;
register MD32_REG_T A, B, C, D, l; register unsigned MD32_REG_T A, B, C, D, l;
# ifndef MD32_XARRAY # ifndef MD32_XARRAY
/* See comment in crypto/sha/sha_locl.h for details. */ /* See comment in crypto/sha/sha_locl.h for details. */
MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15; XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15;
# define X(i) XX##i # define X(i) XX##i
# else # else

View File

@ -36,11 +36,11 @@ int RIPEMD160_Init(RIPEMD160_CTX *c)
void ripemd160_block_data_order(RIPEMD160_CTX *ctx, const void *p, size_t num) void ripemd160_block_data_order(RIPEMD160_CTX *ctx, const void *p, size_t num)
{ {
const unsigned char *data = p; const unsigned char *data = p;
register MD32_REG_T A, B, C, D, E; register unsigned MD32_REG_T A, B, C, D, E;
MD32_REG_T a, b, c, d, e, l; unsigned MD32_REG_T a, b, c, d, e, l;
# ifndef MD32_XARRAY # ifndef MD32_XARRAY
/* See comment in crypto/sha/sha_locl.h for details. */ /* See comment in crypto/sha/sha_locl.h for details. */
MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15; XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15;
# define X(i) XX##i # define X(i) XX##i
# else # else