CVE-2025-5987 libcrypto: Correctly detect failures of chacha initialization

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2025-05-06 22:51:41 +02:00
committed by Andreas Schneider
parent acb158e827
commit bc4804aa9b

View File

@@ -794,9 +794,9 @@ chacha20_poly1305_set_key(struct ssh_cipher_struct *cipher,
SSH_LOG(SSH_LOG_TRACE, "EVP_CIPHER_CTX_new failed"); SSH_LOG(SSH_LOG_TRACE, "EVP_CIPHER_CTX_new failed");
goto out; goto out;
} }
ret = EVP_EncryptInit_ex(ctx->header_evp, EVP_chacha20(), NULL, rv = EVP_EncryptInit_ex(ctx->header_evp, EVP_chacha20(), NULL,
u8key + CHACHA20_KEYLEN, NULL); u8key + CHACHA20_KEYLEN, NULL);
if (ret != 1) { if (rv != 1) {
SSH_LOG(SSH_LOG_TRACE, "EVP_CipherInit failed"); SSH_LOG(SSH_LOG_TRACE, "EVP_CipherInit failed");
goto out; goto out;
} }