boringssl/crypto/fipsmodule/bn
David Benjamin 4ca8d131d3 Rewrite BN_CTX.
While allocating near INT_MAX BIGNUMs or stack frames would never happen, we
should properly handle overflow here. Rewrite it to just be a STACK_OF(BIGNUM)
plus a stack of indices. Also simplify the error-handling. If we make the
errors truly sticky (rather than just sticky per frame), we don't need to keep
track of err_stack and friends.

Thanks to mlbrown for reporting the integer overflows in the original
implementation.

Bug: chromium:942269
Change-Id: Ie9c9baea3eeb82d65d88b1cb1388861f5cd84fe5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/35328
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2019-03-18 19:18:31 +00:00
..
asm Add ABI tests for x86_64-mont5.pl. 2019-02-11 19:27:13 +00:00
add.c Name constant-time functions more consistently. 2018-03-29 23:30:55 +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 Add ABI tests for x86_64-mont5.pl. 2019-02-11 19:27:13 +00:00
bn_tests.txt Fix bn_mod_exp_mont_small when exponentiating to zero. 2018-04-18 22:13:16 +00:00
bn.c Modernize OPENSSL_COMPILE_ASSERT, part 2. 2018-11-14 16:06:37 +00:00
bytes.c Simplify BN_bn2bin_padded. 2018-02-06 02:41:38 +00:00
check_bn_tests.go Add new GCD and related primitives. 2018-03-30 19:53:36 +00:00
cmp.c Modernize OPENSSL_COMPILE_ASSERT, part 2. 2018-11-14 16:06:37 +00:00
ctx.c Rewrite BN_CTX. 2019-03-18 19:18:31 +00:00
div_extra.c Move some RSA keygen support code into separate files. 2018-05-08 21:25:46 +00:00
div.c Fix div.c to divide BN_ULLONG only if BN_CAN_DIVIDE_ULLONG defined. 2018-10-10 15:33:35 +00:00
exponentiation.c Save a temporary in BN_mod_exp_mont's w=1 case. 2019-03-18 17:20:32 +00:00
gcd_extra.c Move some RSA keygen support code into separate files. 2018-05-08 21:25:46 +00:00
gcd.c Move some RSA keygen support code into separate files. 2018-05-08 21:25:46 +00:00
generic.c Enable __asm__ and uint128_t code in clang-cl. 2017-12-11 22:46:26 +00:00
internal.h Add ABI tests for x86_64-mont5.pl. 2019-02-11 19:27:13 +00:00
jacobi.c Rename bn->top to bn->width. 2018-02-05 23:44:24 +00:00
montgomery_inv.c Modernize OPENSSL_COMPILE_ASSERT, part 2. 2018-11-14 16:06:37 +00:00
montgomery.c Add ABI tests for bn_mul_mont. 2019-01-04 19:21:31 +00:00
mul.c Modernize OPENSSL_COMPILE_ASSERT, part 2. 2018-11-14 16:06:37 +00:00
prime.c Hyperlink DOI to preferred resolver 2019-02-08 19:20:05 +00:00
random.c Modernize OPENSSL_COMPILE_ASSERT, part 2. 2018-11-14 16:06:37 +00:00
rsaz_exp.c Add RSAZ ABI tests. 2019-01-28 21:00:49 +00:00
rsaz_exp.h Add RSAZ ABI tests. 2019-01-28 21:00:49 +00:00
shift.c Modernize OPENSSL_COMPILE_ASSERT, part 2. 2018-11-14 16:06:37 +00:00
sqrt.c Name constant-time functions more consistently. 2018-03-29 23:30:55 +00:00