Remove special case SHA-384 copy code

SHA-384 implementation has a GetHash API and TLS code uses it.
This commit is contained in:
Sean Parkinson
2018-07-17 08:16:46 +10:00
parent f0422bec41
commit 87f378efb5

View File

@@ -7050,30 +7050,10 @@ static int BuildSHA(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
static int BuildFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
{
int ret = 0;
#ifdef WOLFSSL_SHA384
#ifdef WOLFSSL_SMALL_STACK
wc_Sha384* sha384;
#else
wc_Sha384 sha384[1];
#endif /* WOLFSSL_SMALL_STACK */
#endif /* WOLFSSL_SHA384 */
if (ssl == NULL)
return BAD_FUNC_ARG;
#ifdef WOLFSSL_SHA384
#ifdef WOLFSSL_SMALL_STACK
sha384 = (wc_Sha384*)XMALLOC(sizeof(wc_Sha384), ssl->heap, DYNAMIC_TYPE_HASHCTX);
if (sha384 == NULL)
return MEMORY_E;
#endif /* WOLFSSL_SMALL_STACK */
#endif /* WOLFSSL_SHA384 */
/* store current states, building requires get_digest which resets state */
#ifdef WOLFSSL_SHA384
sha384[0] = ssl->hsHashes->hashSha384;
#endif
#ifndef NO_TLS
if (ssl->options.tls) {
ret = BuildTlsFinished(ssl, hashes, sender);
@@ -7088,19 +7068,6 @@ static int BuildFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
}
#endif
/* restore */
if (IsAtLeastTLSv1_2(ssl)) {
#ifdef WOLFSSL_SHA384
ssl->hsHashes->hashSha384 = sha384[0];
#endif
}
#ifdef WOLFSSL_SHA384
#ifdef WOLFSSL_SMALL_STACK
XFREE(sha384, ssl->heap, DYNAMIC_TYPE_HASHCTX);
#endif
#endif
return ret;
}