diff options
author | Niels Dossche <7771979+nielsdos@users.noreply.github.com> | 2024-10-08 16:03:13 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-10-23 15:14:08 +0200 |
commit | e8d963594f8e2be6428e6244eee37e31ad7eca36 (patch) | |
tree | 28e2614cd2017859508cac606e0b665fb67d8666 /ssl | |
parent | Improve documentation about duplicate algorithm registrations (diff) | |
download | openssl-e8d963594f8e2be6428e6244eee37e31ad7eca36.tar.xz openssl-e8d963594f8e2be6428e6244eee37e31ad7eca36.zip |
Fix memory leaks in ossl_quic_calculate_retry_integrity_tag()
Fixes #25625
Several error paths return 0 directly instead of going to err to clean
up the objects.
CLA: trivial
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25636)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/quic/quic_wire_pkt.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ssl/quic/quic_wire_pkt.c b/ssl/quic/quic_wire_pkt.c index acb926ad38..00f4afb7c0 100644 --- a/ssl/quic/quic_wire_pkt.c +++ b/ssl/quic/quic_wire_pkt.c @@ -887,7 +887,7 @@ int ossl_quic_calculate_retry_integrity_tag(OSSL_LIB_CTX *libctx, if (!WPACKET_get_total_written(&wpkt, &hdr_enc_len)) { ERR_raise(ERR_LIB_SSL, ERR_R_CRYPTO_LIB); - return 0; + goto err; } /* Create and initialise cipher context. */ @@ -911,27 +911,27 @@ int ossl_quic_calculate_retry_integrity_tag(OSSL_LIB_CTX *libctx, /* Feed packet header as AAD data. */ if (EVP_CipherUpdate(cctx, NULL, &l, buf, hdr_enc_len) != 1) { ERR_raise(ERR_LIB_SSL, ERR_R_EVP_LIB); - return 0; + goto err; } /* Feed packet body as AAD data. */ if (EVP_CipherUpdate(cctx, NULL, &l, hdr->data, hdr->len - QUIC_RETRY_INTEGRITY_TAG_LEN) != 1) { ERR_raise(ERR_LIB_SSL, ERR_R_EVP_LIB); - return 0; + goto err; } /* Finalise and get tag. */ if (EVP_CipherFinal_ex(cctx, NULL, &l2) != 1) { ERR_raise(ERR_LIB_SSL, ERR_R_EVP_LIB); - return 0; + goto err; } if (EVP_CIPHER_CTX_ctrl(cctx, EVP_CTRL_AEAD_GET_TAG, QUIC_RETRY_INTEGRITY_TAG_LEN, tag) != 1) { ERR_raise(ERR_LIB_SSL, ERR_R_EVP_LIB); - return 0; + goto err; } ok = 1; |