Skip to content

Commit

Permalink
fixed memory issues with single sigs
Browse files Browse the repository at this point in the history
  • Loading branch information
feventura committed Mar 16, 2024
1 parent e1f5a55 commit 81ccca0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions oqsprov/oqsprov_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name,
break;
case KEY_TYPE_ECX_HYB_KEM:
case KEY_TYPE_ECP_HYB_KEM:
ret->oqsx_provider_ctx = OPENSSL_malloc(sizeof(void *));
ret->oqsx_provider_ctx = OPENSSL_malloc(sizeof(OQSX_PROVIDER_CTX));
ret->oqsx_provider_ctx[0].oqsx_qs_ctx.kem = OQS_KEM_new(oqs_name);
if (!ret->oqsx_provider_ctx[0].oqsx_qs_ctx.kem) {
fprintf(
Expand Down Expand Up @@ -1462,7 +1462,7 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name,
ret->evp_info = evp_ctx->evp_info;
break;
case KEY_TYPE_HYB_SIG:
ret->oqsx_provider_ctx = OPENSSL_malloc(sizeof(void *));
ret->oqsx_provider_ctx = OPENSSL_malloc(sizeof(OQSX_PROVIDER_CTX));
ret->oqsx_provider_ctx[0].oqsx_qs_ctx.sig = OQS_SIG_new(oqs_name);
if (!ret->oqsx_provider_ctx[0].oqsx_qs_ctx.sig) {
fprintf(
Expand Down Expand Up @@ -1628,6 +1628,7 @@ void oqsx_key_free(OQSX_KEY *key)
#ifdef OQS_PROVIDER_NOATOMIC
CRYPTO_THREAD_lock_free(key->lock);
#endif
OPENSSL_free(key->oqsx_provider_ctx);
OPENSSL_free(key->classical_pkey);
OPENSSL_free(key->cmp_classical_pkey);
OPENSSL_free(key);
Expand Down

0 comments on commit 81ccca0

Please sign in to comment.