Skip to content

Commit 352daa0

Browse files
committed
Add test case for free ecc/dilithum callback for expected behavior to match existing free callback code paths
1 parent a05a3ed commit 352daa0

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/os-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
'--enable-sessionexport',
7777
'--enable-cryptocb --enable-aesgcm CPPFLAGS="-DWOLF_CRYPTO_CB_AES_SETKEY -DWOLF_CRYPTO_CB_FREE"',
7878
'--disable-tls --enable-cryptocb --enable-aesgcm CPPFLAGS="-DWOLF_CRYPTO_CB_AES_SETKEY -DWOLF_CRYPTO_CB_FREE"',
79+
'--enable-all --enable-dilithium --enable-cryptocb --enable-cryptocbutils --enable-pkcallbacks',
7980
'--enable-cryptocb --enable-aesgcm CPPFLAGS="-DWOLF_CRYPTO_CB_AES_SETKEY"',
8081
'--disable-examples CPPFLAGS=-DWOLFSSL_NO_MALLOC',
8182
'CPPFLAGS=-DNO_WOLFSSL_CLIENT',

wolfcrypt/test/test.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65407,6 +65407,37 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
6540765407
ret = 0;
6540865408
break;
6540965409
}
65410+
#endif
65411+
default:
65412+
ret = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
65413+
break;
65414+
}
65415+
}
65416+
else if (info->free.algo == WC_ALGO_TYPE_PK) {
65417+
switch (info->free.type) {
65418+
#ifdef HAVE_ECC
65419+
case WC_PK_TYPE_EC_KEYGEN:
65420+
{
65421+
ecc_key* ecc = (ecc_key*)info->free.obj;
65422+
ecc->devId = INVALID_DEVID;
65423+
wc_ecc_free(ecc);
65424+
ret = 0;
65425+
break;
65426+
}
65427+
#endif
65428+
#ifdef HAVE_DILITHIUM
65429+
case WC_PK_TYPE_PQC_SIG_KEYGEN:
65430+
{
65431+
if (info->free.subType ==
65432+
WC_PQC_SIG_TYPE_DILITHIUM) {
65433+
dilithium_key* dil =
65434+
(dilithium_key*)info->free.obj;
65435+
dil->devId = INVALID_DEVID;
65436+
wc_dilithium_free(dil);
65437+
ret = 0;
65438+
}
65439+
break;
65440+
}
6541065441
#endif
6541165442
default:
6541265443
ret = WC_NO_ERR_TRACE(NOT_COMPILED_IN);

0 commit comments

Comments
 (0)