diff --git a/wolfcrypt/src/sha512.c b/wolfcrypt/src/sha512.c index 4fd0e5bb8..5c05cba7f 100644 --- a/wolfcrypt/src/sha512.c +++ b/wolfcrypt/src/sha512.c @@ -499,7 +499,7 @@ static int _Transform(Sha512* sha512) static INLINE void AddLength(Sha512* sha512, word32 len) { - word32 tmp = sha512->loLen; + word64 tmp = sha512->loLen; if ( (sha512->loLen += len) < tmp) sha512->hiLen++; /* carry low to high */ } @@ -1418,7 +1418,7 @@ static int _Transform384(Sha384* sha384) static INLINE void AddLength384(Sha384* sha384, word32 len) { - word32 tmp = sha384->loLen; + word64 tmp = sha384->loLen; if ( (sha384->loLen += len) < tmp) sha384->hiLen++; /* carry low to high */ } diff --git a/wolfssl/wolfcrypt/sha512.h b/wolfssl/wolfcrypt/sha512.h index 7869c6f15..eaef8c056 100644 --- a/wolfssl/wolfcrypt/sha512.h +++ b/wolfssl/wolfcrypt/sha512.h @@ -54,8 +54,8 @@ enum { /* Sha512 digest */ typedef struct Sha512 { word32 buffLen; /* in bytes */ - word32 loLen; /* length in bytes */ - word32 hiLen; /* length in bytes */ + word64 loLen; /* length in bytes */ + word64 hiLen; /* length in bytes */ word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)]; word64 buffer[SHA512_BLOCK_SIZE / sizeof(word64)]; } Sha512; @@ -81,8 +81,8 @@ enum { /* Sha384 digest */ typedef struct Sha384 { word32 buffLen; /* in bytes */ - word32 loLen; /* length in bytes */ - word32 hiLen; /* length in bytes */ + word64 loLen; /* length in bytes */ + word64 hiLen; /* length in bytes */ word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)]; /* for transform 512 */ word64 buffer[SHA384_BLOCK_SIZE / sizeof(word64)]; } Sha384;