Skip to content

Commit 19ef100

Browse files
committed
RSA test case for free added, and update the RSA free crypto callback call
1 parent 2c28f66 commit 19ef100

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

wolfcrypt/src/rsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ int wc_FreeRsaKey(RsaKey* key)
563563
#endif
564564
{
565565
ret = wc_CryptoCb_Free(key->devId, WC_ALGO_TYPE_PK,
566-
WC_PK_TYPE_RSA, key);
566+
WC_PK_TYPE_RSA, 0, key);
567567
/* If callback wants standard free, it returns CRYPTOCB_UNAVAILABLE.
568568
* Otherwise assume the callback handled cleanup. */
569569
if (ret != WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE))

wolfcrypt/test/test.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65441,13 +65441,21 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
6544165441
break;
6544265442
}
6544365443
#endif
65444+
#ifndef NO_RSA
65445+
case WC_PK_TYPE_RSA:
65446+
{
65447+
RsaKey* rsa = (RsaKey*)info->free.obj;
65448+
rsa->devId = INVALID_DEVID;
65449+
wc_FreeRsaKey(rsa);
65450+
ret = 0;
65451+
break;
65452+
}
65453+
#endif
6544465454
#ifdef HAVE_DILITHIUM
6544565455
case WC_PK_TYPE_PQC_SIG_KEYGEN:
6544665456
{
65447-
if (info->free.subType ==
65448-
WC_PQC_SIG_TYPE_DILITHIUM) {
65449-
dilithium_key* dil =
65450-
(dilithium_key*)info->free.obj;
65457+
if (info->free.subType == WC_PQC_SIG_TYPE_DILITHIUM) {
65458+
dilithium_key* dil = (dilithium_key*)info->free.obj;
6545165459
dil->devId = INVALID_DEVID;
6545265460
wc_dilithium_free(dil);
6545365461
ret = 0;

0 commit comments

Comments
 (0)