Check result of acquiring OSSL_FN

These calls might return NULL because they allocate memory.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Richard Levitte <levitte@openssl.org>
MergeDate: Tue Jun 30 06:45:42 2026
(Merged from https://github.com/openssl/openssl/pull/31754)
This commit is contained in:
Igor Ustinov 2026-06-27 08:40:57 +02:00 committed by Richard Levitte
parent 5072424737
commit 1a87fdb411

View file

@ -46,6 +46,8 @@ int BN_lshift1(BIGNUM *r, const BIGNUM *a)
size_t top = a->top + 1;
OSSL_FN *rf = bn_acquire_ossl_fn(r, (int)top);
if (rf == NULL)
return 0;
int ret = OSSL_FN_lshift1(rf, a->data);
bn_release(r, (int)top);
@ -112,6 +114,8 @@ int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
size_t top = a->top + n / BN_BITS2 + 1;
OSSL_FN *rf = bn_acquire_ossl_fn(r, (int)top);
if (rf == NULL)
return 0;
ret = OSSL_FN_lshift(rf, a->data, n);
bn_release(r, (int)top);