Eliminate hash free in DoRound with non-TI case

This commit is contained in:
Takashi Kojo
2015-08-18 11:22:51 +09:00
parent 6376736129
commit 82aaff9e43
2 changed files with 23 additions and 13 deletions

View File

@ -43,8 +43,6 @@ WOLFSSL_API void wc_Md5RestorePos(Md5* m1, Md5* m2) {
*m1 = *m2 ;
}
WOLFSSL_API void wc_Md5Free(Md5* md5) { (void) md5 ; }
#endif
#if !defined(NO_SHA)
@ -92,8 +90,6 @@ int wc_ShaHash(const byte* data, word32 len, byte* hash)
}
WOLFSSL_API void wc_ShaFree(Sha* sha) { (void) sha ; }
#endif /* !defined(NO_SHA) */
#if !defined(NO_SHA256)
@ -142,8 +138,6 @@ int wc_Sha256Hash(const byte* data, word32 len, byte* hash)
return ret;
}
WOLFSSL_API void wc_Sha256Free(Sha256* sha256) { (void)sha256 ; }
#endif /* !defined(NO_SHA256) */
#endif /* !defined(WOLFSSL_TI_HASH) */
@ -181,8 +175,6 @@ int wc_Sha512Hash(const byte* data, word32 len, byte* hash)
return ret;
}
WOLFSSL_API void wc_Sha512Free(Sha512* sha512) { (void)sha512 ; }
#if defined(WOLFSSL_SHA384)
int wc_Sha384Hash(const byte* data, word32 len, byte* hash)
{
@ -216,7 +208,5 @@ int wc_Sha384Hash(const byte* data, word32 len, byte* hash)
return ret;
}
WOLFSSL_API void wc_Sha384Free(Sha384* sha384) { (void) sha384 ; }
#endif /* defined(WOLFSSL_SHA384) */
#endif /* defined(WOLFSSL_SHA512) */

View File

@ -28,7 +28,11 @@
#include <wolfssl/wolfcrypt/md5.h>
WOLFSSL_API void wc_Md5GetHash(Md5*, byte*);
WOLFSSL_API void wc_Md5RestorePos(Md5*, Md5*) ;
WOLFSSL_API void wc_Md5Free(Md5*);
#if defined(WOLFSSL_TI_HASH)
WOLFSSL_API void wc_Md5Free(Md5*);
#else
#define wc_Md5Free(d)
#endif
#endif
#ifndef NO_SHA
@ -36,7 +40,11 @@ WOLFSSL_API void wc_Md5Free(Md5*);
WOLFSSL_API int wc_ShaGetHash(Sha*, byte*);
WOLFSSL_API void wc_ShaRestorePos(Sha*, Sha*) ;
WOLFSSL_API int wc_ShaHash(const byte*, word32, byte*);
WOLFSSL_API void wc_ShaFree(Sha*);
#if defined(WOLFSSL_TI_HASH)
WOLFSSL_API void wc_ShaFree(Sha*);
#else
#define wc_ShaFree(d)
#endif
#endif
#ifndef NO_SHA256
@ -44,16 +52,28 @@ WOLFSSL_API void wc_ShaFree(Sha*);
WOLFSSL_API int wc_Sha256GetHash(Sha256*, byte*);
WOLFSSL_API void wc_Sha256RestorePos(Sha256*, Sha256*) ;
WOLFSSL_API int wc_Sha256Hash(const byte*, word32, byte*);
WOLFSSL_API void wc_Sha256Free(Sha256*);
#if defined(WOLFSSL_TI_HASH)
WOLFSSL_API void wc_Sha256Free(Sha256*);
#else
#define wc_Sha256Free(d)
#endif
#endif
#ifdef WOLFSSL_SHA512
#include <wolfssl/wolfcrypt/sha512.h>
WOLFSSL_API int wc_Sha512Hash(const byte*, word32, byte*);
#if defined(WOLFSSL_TI_HASH)
WOLFSSL_API void wc_Sha512Free(Sha512*);
#else
#define wc_Sha512Free(d)
#endif
#if defined(WOLFSSL_SHA384)
WOLFSSL_API int wc_Sha384Hash(const byte*, word32, byte*);
#if defined(WOLFSSL_TI_HASH)
WOLFSSL_API void wc_Sha384Free(Sha384*);
#else
#define wc_Sha384Free(d)
#endif
#endif /* defined(WOLFSSL_SHA384) */
#endif /* WOLFSSL_SHA512 */