openssl/crypto/bn/asm
Tomas Mraz 0ae365e1f8 Always end BN_mod_exp_mont_consttime with normal Montgomery reduction.
This partially fixes a bug where, on x86_64, BN_mod_exp_mont_consttime
would sometimes return m, the modulus, when it should have returned
zero. Thanks to Guido Vranken for reporting it. It is only a partial fix
because the same bug also exists in the "rsaz" codepath.

The bug only affects zero outputs (with non-zero inputs), so we believe
it has no security impact on our cryptographic functions.

The fx is to delete lowercase bn_from_montgomery altogether, and have the
mont5 path use the same BN_from_montgomery ending as the non-mont5 path.
This only impacts the final step of the whole exponentiation and has no
measurable perf impact.

See the original BoringSSL commit
https://boringssl.googlesource.com/boringssl/+/13c9d5c69d04485a7a8840c12185c832026c8315
for further analysis.

Original-author: David Benjamin <davidben@google.com>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18510)
2022-06-16 15:22:35 +02:00
..
alpha-mont.pl
armv4-gf2m.pl
armv4-mont.pl
armv8-mont.pl aarch64: support BTI and pointer authentication in assembly 2021-10-01 09:35:38 +02:00
bn-586.pl
bn-c64xplus.asm
c64xplus-gf2m.pl
co-586.pl
ia64-mont.pl
ia64.S
mips-mont.pl
mips.pl Fix a carry overflow bug in bn_sqr_comba4/8 for mips 32-bit targets 2021-12-14 06:43:04 +01:00
parisc-mont.pl
ppc64-mont-fixed.pl Revert "bn: Add fixed length (n=6), unrolled PPC Montgomery Multiplication" 2022-06-15 09:54:02 +02:00
ppc64-mont.pl
ppc-mont.pl
ppc.pl
rsaz-2k-avx512.pl Update copyright year 2022-05-03 13:34:51 +01:00
rsaz-3k-avx512.pl Update copyright year 2022-05-03 13:34:51 +01:00
rsaz-4k-avx512.pl Update copyright year 2022-05-03 13:34:51 +01:00
rsaz-avx2.pl
rsaz-x86_64.pl
s390x-gf2m.pl
s390x-mont.pl
s390x.S
sparct4-mont.pl Update copyright year 2021-07-29 15:41:35 +01:00
sparcv8.S fix some code with obvious wrong coding style 2021-10-28 13:10:46 +10:00
sparcv8plus.S fix some code with obvious wrong coding style 2021-10-28 13:10:46 +10:00
sparcv9-gf2m.pl Update copyright year 2021-07-29 15:41:35 +01:00
sparcv9-mont.pl Update copyright year 2021-07-29 15:41:35 +01:00
sparcv9a-mont.pl Update copyright year 2021-07-29 15:41:35 +01:00
via-mont.pl
vis3-mont.pl Update copyright year 2021-07-29 15:41:35 +01:00
x86_64-gcc.c
x86_64-gf2m.pl
x86_64-mont5.pl Always end BN_mod_exp_mont_consttime with normal Montgomery reduction. 2022-06-16 15:22:35 +02:00
x86_64-mont.pl
x86-gf2m.pl
x86-mont.pl