diff options
author | Xi Ruoyao <xry111@xry111.site> | 2022-06-22 18:07:05 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-06-23 12:52:09 +1000 |
commit | a1f7034bbd8f0730d360211f5ba0feeaef0b7b2c (patch) | |
tree | 62bf9da38267b4dfcccb53ffdbe22a3c71498a0d /crypto/bn | |
parent | 3cb3708c2bf86dbf0cb8a1ada0964738c96a9b07 (diff) |
rsa: fix bn_reduce_once_in_place call for rsaz_mod_exp_avx512_x2
bn_reduce_once_in_place expects the number of BN_ULONG, but factor_size
is moduli bit size.
Fixes #18625.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18626)
(cherry picked from commit 4d8a88c134df634ba610ff8db1eb8478ac5fd345)
Diffstat (limited to 'crypto/bn')
-rw-r--r-- | crypto/bn/rsaz_exp_x2.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/bn/rsaz_exp_x2.c b/crypto/bn/rsaz_exp_x2.c index 5613aa19d8..22c9627269 100644 --- a/crypto/bn/rsaz_exp_x2.c +++ b/crypto/bn/rsaz_exp_x2.c @@ -220,6 +220,9 @@ int ossl_rsaz_mod_exp_avx512_x2(BN_ULONG *res1, from_words52(res1, factor_size, rr1_red); from_words52(res2, factor_size, rr2_red); + /* bn_reduce_once_in_place expects number of BN_ULONG, not bit size */ + factor_size /= sizeof(BN_ULONG) * 8; + bn_reduce_once_in_place(res1, /*carry=*/0, m1, storage, factor_size); bn_reduce_once_in_place(res2, /*carry=*/0, m2, storage, factor_size); |