change sha512 hi/loLen to 64bits

This commit is contained in:
toddouska
2016-11-16 09:30:35 -08:00
parent f922d3f2d6
commit afc54c3dff
2 changed files with 6 additions and 6 deletions

View File

@ -499,7 +499,7 @@ static int _Transform(Sha512* sha512)
static INLINE void AddLength(Sha512* sha512, word32 len) static INLINE void AddLength(Sha512* sha512, word32 len)
{ {
word32 tmp = sha512->loLen; word64 tmp = sha512->loLen;
if ( (sha512->loLen += len) < tmp) if ( (sha512->loLen += len) < tmp)
sha512->hiLen++; /* carry low to high */ sha512->hiLen++; /* carry low to high */
} }
@ -1418,7 +1418,7 @@ static int _Transform384(Sha384* sha384)
static INLINE void AddLength384(Sha384* sha384, word32 len) static INLINE void AddLength384(Sha384* sha384, word32 len)
{ {
word32 tmp = sha384->loLen; word64 tmp = sha384->loLen;
if ( (sha384->loLen += len) < tmp) if ( (sha384->loLen += len) < tmp)
sha384->hiLen++; /* carry low to high */ sha384->hiLen++; /* carry low to high */
} }

View File

@ -54,8 +54,8 @@ enum {
/* Sha512 digest */ /* Sha512 digest */
typedef struct Sha512 { typedef struct Sha512 {
word32 buffLen; /* in bytes */ word32 buffLen; /* in bytes */
word32 loLen; /* length in bytes */ word64 loLen; /* length in bytes */
word32 hiLen; /* length in bytes */ word64 hiLen; /* length in bytes */
word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)]; word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)];
word64 buffer[SHA512_BLOCK_SIZE / sizeof(word64)]; word64 buffer[SHA512_BLOCK_SIZE / sizeof(word64)];
} Sha512; } Sha512;
@ -81,8 +81,8 @@ enum {
/* Sha384 digest */ /* Sha384 digest */
typedef struct Sha384 { typedef struct Sha384 {
word32 buffLen; /* in bytes */ word32 buffLen; /* in bytes */
word32 loLen; /* length in bytes */ word64 loLen; /* length in bytes */
word32 hiLen; /* length in bytes */ word64 hiLen; /* length in bytes */
word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)]; /* for transform 512 */ word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)]; /* for transform 512 */
word64 buffer[SHA384_BLOCK_SIZE / sizeof(word64)]; word64 buffer[SHA384_BLOCK_SIZE / sizeof(word64)];
} Sha384; } Sha384;