From 81ccca02ec483ae89b9064c3393e44c712d779c4 Mon Sep 17 00:00:00 2001 From: Felipe Ventura Date: Fri, 1 Dec 2023 13:28:39 -0600 Subject: [PATCH] fixed memory issues with single sigs --- oqsprov/oqsprov_keys.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oqsprov/oqsprov_keys.c b/oqsprov/oqsprov_keys.c index 2abc22ad..525a021b 100644 --- a/oqsprov/oqsprov_keys.c +++ b/oqsprov/oqsprov_keys.c @@ -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( @@ -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( @@ -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);