Skip to content

Commit

Permalink
also clean up memory
Browse files Browse the repository at this point in the history
  • Loading branch information
lrstewart committed Feb 28, 2025
1 parent 20a6819 commit 1b16375
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
8 changes: 0 additions & 8 deletions crypto/s2n_evp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
19 changes: 0 additions & 19 deletions tests/cbmc/sources/make_common_datastructures.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1b16375

Please sign in to comment.