Fix to initialize hash flag.

This commit is contained in:
David Garske
2019-08-21 06:36:37 -07:00
parent a5d222a20e
commit e298b3290d
6 changed files with 27 additions and 0 deletions

View File

@@ -255,6 +255,9 @@ static int _InitMd5(wc_Md5* md5)
md5->buffLen = 0; md5->buffLen = 0;
md5->loLen = 0; md5->loLen = 0;
md5->hiLen = 0; md5->hiLen = 0;
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
md5->flags = 0;
#endif
return ret; return ret;
} }

View File

@@ -61,6 +61,9 @@ static int InitSha512(wc_Sha512* sha512)
sha512->buffLen = 0; sha512->buffLen = 0;
sha512->loLen = 0; sha512->loLen = 0;
sha512->hiLen = 0; sha512->hiLen = 0;
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
sha512->flags = 0;
#endif
return 0; return 0;
} }
@@ -501,6 +504,9 @@ static int InitSha384(wc_Sha384* sha384)
sha384->buffLen = 0; sha384->buffLen = 0;
sha384->loLen = 0; sha384->loLen = 0;
sha384->hiLen = 0; sha384->hiLen = 0;
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
sha384->flags = 0;
#endif
return 0; return 0;
} }

View File

@@ -298,6 +298,9 @@
sha->buffLen = 0; sha->buffLen = 0;
sha->loLen = 0; sha->loLen = 0;
sha->hiLen = 0; sha->hiLen = 0;
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
sha->flags = 0;
#endif
return ret; return ret;
} }

View File

@@ -184,6 +184,9 @@ static int InitSha256(wc_Sha256* sha256)
sha256->buffLen = 0; sha256->buffLen = 0;
sha256->loLen = 0; sha256->loLen = 0;
sha256->hiLen = 0; sha256->hiLen = 0;
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
sha256->flags = 0;
#endif
return ret; return ret;
} }
@@ -1198,6 +1201,9 @@ static int InitSha256(wc_Sha256* sha256)
/* choose best Transform function under this runtime environment */ /* choose best Transform function under this runtime environment */
Sha256_SetTransform(); Sha256_SetTransform();
#endif #endif
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
sha224->flags = 0;
#endif
return ret; return ret;
} }

View File

@@ -570,6 +570,9 @@ static int InitSha3(wc_Sha3* sha3)
for (i = 0; i < 25; i++) for (i = 0; i < 25; i++)
sha3->s[i] = 0; sha3->s[i] = 0;
sha3->i = 0; sha3->i = 0;
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
sha3->flags = 0;
#endif
return 0; return 0;
} }

View File

@@ -224,6 +224,9 @@ static int InitSha512(wc_Sha512* sha512)
* whether using HW or SW is detemined at first call of update() * whether using HW or SW is detemined at first call of update()
*/ */
sha512->ctx.mode = ESP32_SHA_INIT; sha512->ctx.mode = ESP32_SHA_INIT;
#endif
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
sha512->flags = 0;
#endif #endif
return 0; return 0;
} }
@@ -934,6 +937,9 @@ static int InitSha384(wc_Sha384* sha384)
*/ */
sha384->ctx.mode = ESP32_SHA_INIT; sha384->ctx.mode = ESP32_SHA_INIT;
#endif
#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
sha384->flags = 0;
#endif #endif
return 0; return 0;