add wc_Sha384/512GetHash() functions

This commit is contained in:
Chris Conlon
2016-09-01 15:05:27 -06:00
parent a0b02236b8
commit 5bf8806655
2 changed files with 32 additions and 0 deletions

View File

@@ -324,6 +324,21 @@ int wc_Sha256Hash(const byte* data, word32 len, byte* hash)
#endif /* !defined(WOLFSSL_TI_HASH) */
#if defined(WOLFSSL_SHA512)
int wc_Sha512GetHash(Sha512* sha512, byte* hash)
{
int ret;
Sha512 save;
if (sha512 == NULL || hash == NULL)
return BAD_FUNC_ARG;
save= *sha512;
ret = wc_Sha512Final(sha512, hash);
*sha512 = save;
return ret;
}
int wc_Sha512Hash(const byte* data, word32 len, byte* hash)
{
int ret = 0;
@@ -357,6 +372,21 @@ int wc_Sha512Hash(const byte* data, word32 len, byte* hash)
}
#if defined(WOLFSSL_SHA384)
int wc_Sha384GetHash(Sha384* sha384, byte* hash)
{
int ret;
Sha384 save;
if (sha384 == NULL || hash == NULL)
return BAD_FUNC_ARG;
save= *sha384;
ret = wc_Sha384Final(sha384, hash);
*sha384 = save;
return ret;
}
int wc_Sha384Hash(const byte* data, word32 len, byte* hash)
{
int ret = 0;

View File

@@ -105,10 +105,12 @@ WOLFSSL_API int wc_Sha256Hash(const byte*, word32, byte*);
#ifdef WOLFSSL_SHA512
#include <wolfssl/wolfcrypt/sha512.h>
WOLFSSL_API int wc_Sha512GetHash(Sha512*, byte*);
WOLFSSL_API int wc_Sha512Hash(const byte*, word32, byte*);
#define wc_Sha512Free(d)
#if defined(WOLFSSL_SHA384)
WOLFSSL_API int wc_Sha384GetHash(Sha384*, byte*);
WOLFSSL_API int wc_Sha384Hash(const byte*, word32, byte*);
#define wc_Sha384Free(d)
#endif /* defined(WOLFSSL_SHA384) */