From 1b16375e91a568133eba84d141a0f2df75deea53 Mon Sep 17 00:00:00 2001 From: Lindsay Stewart Date: Thu, 27 Feb 2025 19:44:23 -0800 Subject: [PATCH] also clean up memory --- crypto/s2n_evp.h | 8 -------- .../cbmc/sources/make_common_datastructures.c | 19 ------------------- 2 files changed, 27 deletions(-) diff --git a/crypto/s2n_evp.h b/crypto/s2n_evp.h index 8764d1ade81..931d834d38c 100644 --- a/crypto/s2n_evp.h +++ b/crypto/s2n_evp.h @@ -26,14 +26,6 @@ struct s2n_evp_digest { EVP_MD_CTX *ctx; }; -struct s2n_evp_hmac_state { - struct s2n_evp_digest evp_digest; - union { - HMAC_CTX *hmac_ctx; - EVP_PKEY *evp_pkey; - } ctx; -}; - /* Define API's that change based on the OpenSSL Major Version. */ #if S2N_OPENSSL_VERSION_AT_LEAST(1, 1, 0) && !defined(LIBRESSL_VERSION_NUMBER) #define S2N_EVP_MD_CTX_NEW() (EVP_MD_CTX_new()) diff --git a/tests/cbmc/sources/make_common_datastructures.c b/tests/cbmc/sources/make_common_datastructures.c index 59c7590f10d..2e720e32ab1 100644 --- a/tests/cbmc/sources/make_common_datastructures.c +++ b/tests/cbmc/sources/make_common_datastructures.c @@ -244,24 +244,6 @@ struct s2n_evp_digest* cbmc_allocate_s2n_evp_digest() return evp_digest; } -void cbmc_populate_s2n_evp_hmac_state(struct s2n_evp_hmac_state *evp_hmac_state) -{ - CBMC_ENSURE_REF(evp_hmac_state); - cbmc_populate_s2n_evp_digest(&(evp_hmac_state->evp_digest)); - if (s2n_libcrypto_is_awslc() || s2n_libcrypto_is_boringssl()) { - evp_hmac_state->ctx.hmac_ctx = malloc(sizeof(*(evp_hmac_state->ctx.hmac_ctx))); - } else { - evp_hmac_state->ctx.evp_pkey = malloc(sizeof(*(evp_hmac_state->ctx.evp_pkey))); - } -} - -struct s2n_evp_hmac_state *cbmc_allocate_s2n_evp_hmac_state() -{ - struct s2n_evp_hmac_state *evp_hmac_state = malloc(sizeof(*evp_hmac_state)); - cbmc_populate_s2n_evp_hmac_state(evp_hmac_state); - return evp_hmac_state; -} - void cbmc_populate_s2n_hash_state(struct s2n_hash_state* state) { CBMC_ENSURE_REF(state); @@ -716,7 +698,6 @@ void cbmc_populate_s2n_prf_working_space(struct s2n_prf_working_space *s2n_prf_w * If required, this initialization should be done in the validation function. */ cbmc_populate_s2n_hmac_state(&(s2n_prf_working_space->p_hash.s2n_hmac)); - cbmc_populate_s2n_evp_hmac_state(&(s2n_prf_working_space->p_hash.evp_hmac)); } struct s2n_prf_working_space* cbmc_allocate_s2n_prf_working_space()