add hashtype property to wc_Sha512

This commit is contained in:
Hideki Miyazaki
2025-08-13 11:53:09 +09:00
parent 22b221a8be
commit b67e063535
3 changed files with 13 additions and 0 deletions

View File

@@ -844,6 +844,7 @@ WOLFSSL_SERVER_EXAMPLE
WOLFSSL_SETTINGS_FILE
WOLFSSL_SH224
WOLFSSL_SHA256_ALT_CH_MAJ
WOLFSSL_SHA512_HASHTYPE
WOLFSSL_SHUTDOWNONCE
WOLFSSL_SILABS_TRNG
WOLFSSL_SM4_EBC

View File

@@ -325,6 +325,9 @@ static int InitSha512(wc_Sha512* sha512)
#ifdef WOLFSSL_HASH_FLAGS
sha512->flags = 0;
#endif
#if defined(WOLFSSL_SHA512_HASHTYPE)
sha512->hashType = WC_HASH_TYPE_SHA512;
#endif /* WOLFSSL_SHA512_HASHTYPE */
return 0;
}
@@ -378,6 +381,9 @@ static int InitSha512_224(wc_Sha512* sha512)
#ifdef WOLFSSL_HASH_FLAGS
sha512->flags = 0;
#endif
#if defined(WOLFSSL_SHA512_HASHTYPE)
sha512->hashType = WC_HASH_TYPE_SHA512_224;
#endif /* WOLFSSL_SHA512_HASHTYPE */
return 0;
}
#endif /* !WOLFSSL_NOSHA512_224 && !FIPS ... */
@@ -431,6 +437,9 @@ static int InitSha512_256(wc_Sha512* sha512)
#ifdef WOLFSSL_HASH_FLAGS
sha512->flags = 0;
#endif
#if defined(WOLFSSL_SHA512_HASHTYPE)
sha512->hashType = WC_HASH_TYPE_SHA512_256;
#endif /* WOLFSSL_SHA512_HASHTYPE */
return 0;
}
#endif /* !WOLFSSL_NOSHA512_256 && !FIPS... */

View File

@@ -209,6 +209,9 @@ struct wc_Sha512 {
#if defined(STM32_HASH_SHA512)
STM32_HASH_Context stmCtx;
#endif
#if defined(WOLFSSL_SHA512_HASHTYPE)
int hashType; /* used to determine which SHA512 is used */
#endif /* WOLFSSL_SHA512_HASHTYPE */
#endif /* WOLFSSL_PSOC6_CRYPTO */
};