From d09b94747835715ae02483164f7b275be80caa49 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Tue, 19 May 2020 18:13:39 -0700 Subject: [PATCH] update for test case and sha3 --- wolfcrypt/src/port/xilinx/xil-sha3.c | 21 +++++++++++++++------ wolfcrypt/test/test.c | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/wolfcrypt/src/port/xilinx/xil-sha3.c b/wolfcrypt/src/port/xilinx/xil-sha3.c index a9db6b955..2f42e1d78 100644 --- a/wolfcrypt/src/port/xilinx/xil-sha3.c +++ b/wolfcrypt/src/port/xilinx/xil-sha3.c @@ -130,13 +130,17 @@ int wc_Sha3_384_GetHash(wc_Sha3* sha, byte* out) if (sha == NULL || out == NULL) { return BAD_FUNC_ARG; } +#ifdef WOLFSSL_XILINX_CRYPTO_OLD + if (wc_Sha3_384_Copy(sha, &s) != 0) { + WOLFSSL_MSG("Unable to copy SHA3 structure"); + return MEMORY_E; + } - if (wc_Sha3_384_Copy(sha, &s) != 0) { - WOLFSSL_MSG("Unable to copy SHA3 structure"); - return MEMORY_E; - } - - return wc_Sha3_384_Final(&s, out); + return wc_Sha3_384_Final(&s, out); +#else + XSecure_Sha3_ReadHash(&(sha->hw), out); + return 0; +#endif } @@ -151,8 +155,13 @@ int wc_Sha3_384_Copy(wc_Sha3* src, wc_Sha3* dst) return BAD_FUNC_ARG; } +#ifdef WOLFSSL_XILINX_CRYPTO_OLD XMEMCPY((byte*)dst, (byte*)src, sizeof(wc_Sha3)); return 0; +#else + WOLFSSL_MSG("Copy of SHA3 struct not supported with this build"); + return -1; +#endif } #endif diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index d581c5fa1..25d0cf24c 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -11251,7 +11251,7 @@ static int rsa_sig_test(RsaKey* key, word32 keyLen, int modLen, WC_RNG* rng) * -101 = USER_CRYPTO_ERROR */ if (ret == 0) -#elif defined(WOLFSSL_AFALG_XILINX_RSA) +#elif defined(WOLFSSL_AFALG_XILINX_RSA) || defined(WOLFSSL_XILINX_CRYPT) /* blinding / rng handled with hardware acceleration */ if (ret != 0) #elif defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLF_CRYPTO_CB)