SiLabs: add cleanup and address PR comments

This commit is contained in:
Elms
2020-12-09 16:28:39 -08:00
parent 586a75302b
commit 93fc37f87b
3 changed files with 10 additions and 5 deletions

View File

@ -7974,12 +7974,15 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
ret = mp_read_unsigned_bin(&key->k, priv, privSz); ret = mp_read_unsigned_bin(&key->k, priv, privSz);
} }
#elif defined(WOLFSSL_SILABS_SE_ACCEL) #elif defined(WOLFSSL_SILABS_SE_ACCEL)
if (ret == MP_OKAY)
ret = mp_read_unsigned_bin(&key->k, priv, privSz);
if (ret == MP_OKAY) { if (ret == MP_OKAY) {
if (pub) { if (pub) {
ret = silabs_ecc_import(key, privSz); ret = silabs_ecc_import(key, key->dp->size);
} else } else
{ {
ret = silabs_ecc_import_private(key, privSz); ret = silabs_ecc_import_private(key, key->dp->size);
} }
} }
#else #else

View File

@ -333,6 +333,9 @@ int wolfCrypt_Cleanup(void)
#if defined(WOLFSSL_CRYPTOCELL) #if defined(WOLFSSL_CRYPTOCELL)
cc310_Free(); cc310_Free();
#endif #endif
#ifdef WOLFSSL_SILABS_SE_ACCEL
ret = sl_se_deinit();
#endif
#if defined(WOLFSSL_RENESAS_TSIP_CRYPT) #if defined(WOLFSSL_RENESAS_TSIP_CRYPT)
tsip_Close(); tsip_Close();
#endif #endif

View File

@ -22337,20 +22337,19 @@ static int ecc_test_buffers(void)
TEST_SLEEP(); TEST_SLEEP();
XMEMSET(plain, 0, sizeof(plain)); XMEMSET(plain, 0, sizeof(plain));
verify = 1;
do { do {
#if defined(WOLFSSL_ASYNC_CRYPT) #if defined(WOLFSSL_ASYNC_CRYPT)
ret = wc_AsyncWait(ret, cliKey.asyncDev, WC_ASYNC_FLAG_CALL_AGAIN); ret = wc_AsyncWait(ret, cliKey.asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
#endif #endif
if (ret == 0) if (ret == 0)
ret = wc_ecc_verify_hash(out, x, plain, inLen, &verify, ret = wc_ecc_verify_hash(out, x, in, inLen, &verify,
cliKey); cliKey);
} while (ret == WC_PENDING_E); } while (ret == WC_PENDING_E);
if (ret < 0) if (ret < 0)
ERROR_OUT(-10430, done); ERROR_OUT(-10430, done);
if (verify != 0) if (verify != 1)
ERROR_OUT(-10431, done); ERROR_OUT(-10431, done);
TEST_SLEEP(); TEST_SLEEP();