boringssl/crypto/fipsmodule/bn
David Benjamin 6541308ff3 Don't allocate oversized arrays for bn_mul_recursive.
The power of two computations here were extremely confusing and one of
the comments mixed && and ||. Remove the cached k = j + j value.
Optimizing the j*8, j*8, j*2, and j*4 multiplications is the compiler's
job. If it doesn't manage it, it was only a couple shifts anyway.

With that fixed, it becomes easier to tell that rr was actaully
allocated twice as large as necessary. I suspect rr is also
incorrectly-allocated in the bn_mul_part_recursive case, but I'll wait
until I've checked that function over first. (The array size
documentation on the other bn_{mul,sqr}_recursive functions have had
mistakes before.)

Change-Id: I298400b988e3bd108d01d6a7c8a5b262ddf81feb
Reviewed-on: https://boringssl-review.googlesource.com/25364
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
2018-02-06 02:51:44 +00:00
..
asm Silence ARMv8 deprecated IT instruction warnings. 2017-12-14 01:56:22 +00:00
add.c Split BN_uadd into a bn_uadd_fixed. 2018-02-06 02:39:45 +00:00
bn_test_to_fuzzer.go Generate bn_div and bn_mod_exp corpus from bn_tests.txt. 2017-10-27 18:57:48 +00:00
bn_test.cc Rename bn->top to bn->width. 2018-02-05 23:44:24 +00:00
bn_tests.txt Make bn_mul_recursive constant-time. 2018-02-06 02:51:34 +00:00
bn.c Make bn_sqr_recursive constant-time. 2018-02-06 02:47:34 +00:00
bytes.c Simplify BN_bn2bin_padded. 2018-02-06 02:41:38 +00:00
check_bn_tests.go
cmp.c Rename bn->top to bn->width. 2018-02-05 23:44:24 +00:00
ctx.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
div.c Make bn_sqr_recursive constant-time. 2018-02-06 02:47:34 +00:00
exponentiation.c Remove some easy bn_set_minimal_width calls. 2018-02-05 23:47:14 +00:00
gcd.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
generic.c Enable __asm__ and uint128_t code in clang-cl. 2017-12-11 22:46:26 +00:00
internal.h Make bn_sqr_recursive constant-time. 2018-02-06 02:47:34 +00:00
jacobi.c Rename bn->top to bn->width. 2018-02-05 23:44:24 +00:00
montgomery_inv.c Compute mont->RR in constant-time. 2018-02-06 01:40:24 +00:00
montgomery.c Compute mont->RR in constant-time. 2018-02-06 01:40:24 +00:00
mul.c Don't allocate oversized arrays for bn_mul_recursive. 2018-02-06 02:51:44 +00:00
prime.c Add a function which folds BN_MONT_CTX_{new,set} together. 2018-02-02 20:23:25 +00:00
random.c Remove some easy bn_set_minimal_width calls. 2018-02-05 23:47:14 +00:00
rsaz_exp.c Fix alignment-violating cast. 2017-12-01 22:32:17 +00:00
rsaz_exp.h
shift.c Rename bn->top to bn->width. 2018-02-05 23:44:24 +00:00
sqrt.c Make BN_mod_*_quick constant-time. 2018-02-06 01:16:04 +00:00