Skip to content

Commit 817523d

Browse files
committed
Adjust execution flow
1 parent 1707ace commit 817523d

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

wolfcrypt/src/wc_pkcs11.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4741,28 +4741,27 @@ int wc_Pkcs11_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
47414741
ret = NOT_COMPILED_IN;
47424742
#endif
47434743
}
4744-
else
4745-
ret = NOT_COMPILED_IN;
4746-
}
4747-
#ifdef WOLF_CRYPTO_CB_FREE
4748-
else if (info->algo_type == WC_ALGO_TYPE_FREE) {
4744+
else if (info->algo_type == WC_ALGO_TYPE_FREE) {
47494745
#ifdef HAVE_ECC
4750-
if (info->free.algo == WC_ALGO_TYPE_PK &&
4751-
info->free.type == WC_PK_TYPE_EC_KEYGEN) {
4752-
ecc_key* key = (ecc_key*)info->free.obj;
4753-
if (key != NULL && key->devCtx != NULL) {
4754-
if (token->handle != NULL_PTR) {
4755-
CK_OBJECT_HANDLE handle =
4756-
(CK_OBJECT_HANDLE)(uintptr_t)key->devCtx;
4757-
token->func->C_DestroyObject(token->handle, handle);
4746+
if (info->free.algo == WC_ALGO_TYPE_PK &&
4747+
info->free.type == WC_PK_TYPE_EC_KEYGEN) {
4748+
ecc_key* key = (ecc_key*)info->free.obj;
4749+
if (key != NULL && key->devCtx != NULL) {
4750+
if (token->handle != NULL_PTR) {
4751+
CK_OBJECT_HANDLE handle =
4752+
(CK_OBJECT_HANDLE)(uintptr_t)key->devCtx;
4753+
token->func->C_DestroyObject(token->handle, handle);
4754+
}
4755+
key->devCtx = NULL;
47584756
}
4759-
key->devCtx = NULL;
4757+
ret = 0;
47604758
}
4761-
ret = 0;
4762-
}
47634759
#endif
4760+
}
4761+
else {
4762+
ret = NOT_COMPILED_IN;
4763+
}
47644764
}
4765-
#endif /* WOLF_CRYPTO_CB_FREE */
47664765

47674766
return ret;
47684767
}

0 commit comments

Comments
 (0)