Skip to content

Commit

Permalink
ossl_qrl_enc_level_set_provide_secret(): Avoid leaking keyslot in err…
Browse files Browse the repository at this point in the history
…or condition

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #22600)

(cherry picked from commit 0c2aabb)
  • Loading branch information
t8m authored and hlandau committed Nov 6, 2023
1 parent 57fc999 commit 478d14c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ssl/quic/quic_record_shared.c
Expand Up @@ -185,7 +185,7 @@ static int el_setup_keyslot(OSSL_QRL_ENC_LEVEL_SET *els,
EVP_CIPHER_free(cipher);
return 1;

err:
err:
EVP_CIPHER_CTX_free(cctx);
EVP_CIPHER_free(cipher);
OPENSSL_cleanse(el->iv[keyslot], sizeof(el->iv[keyslot]));
Expand Down Expand Up @@ -327,16 +327,16 @@ int ossl_qrl_enc_level_set_provide_secret(OSSL_QRL_ENC_LEVEL_SET *els,
el->state = QRL_EL_STATE_PROV_NORMAL;
return 1;

err:
err:
el->suite_id = 0;
el->md = NULL;
OPENSSL_cleanse(hpr_key, sizeof(hpr_key));
OPENSSL_cleanse(ku_key, sizeof(ku_key));
OPENSSL_cleanse(el->ku, sizeof(el->ku));
if (have_ks0)
el_teardown_keyslot(els, enc_level, 0);
el_teardown_keyslot(els, enc_level, init_keyslot);
if (have_ks1)
el_teardown_keyslot(els, enc_level, 1);
el_teardown_keyslot(els, enc_level, !init_keyslot);
if (own_md)
EVP_MD_free(md);
return 0;
Expand Down

0 comments on commit 478d14c

Please sign in to comment.