1044553d6d
RSA key generation requires computing a GCD (p-1 and q-1 are relatively prime with e) and an LCM (the Carmichael totient). I haven't made BN_gcd itself constant-time here to save having to implement bn_lshift_secret_shift, since the two necessary operations can be served by bn_rshift_secret_shift, already added for Rabin-Miller. However, the guts of BN_gcd are replaced. Otherwise, the new functions are only connected to tests for now, they'll be used in subsequent CLs. To support LCM, there is also now a constant-time division function. This does not replace BN_div because bn_div_consttime is some 40x slower than BN_div. That penalty is fine for RSA keygen because that operation is not bottlenecked on division, so we prefer simplicity over performance. Median of 29 RSA keygens: 0m0.212s -> 0m0.225s (Accuracy beyond 0.1s is questionable.) Bug: 238 Change-Id: Idbfbfa6e7f5a3b8782ce227fa130417b3702cf97 Reviewed-on: https://boringssl-review.googlesource.com/26369 Reviewed-by: Adam Langley <alangley@gmail.com> |
||
---|---|---|
.. | ||
asm | ||
add.c | ||
bn_test_to_fuzzer.go | ||
bn_test.cc | ||
bn_tests.txt | ||
bn.c | ||
bytes.c | ||
check_bn_tests.go | ||
cmp.c | ||
ctx.c | ||
div.c | ||
exponentiation.c | ||
gcd.c | ||
generic.c | ||
internal.h | ||
jacobi.c | ||
montgomery_inv.c | ||
montgomery.c | ||
mul.c | ||
prime.c | ||
random.c | ||
rsaz_exp.c | ||
rsaz_exp.h | ||
shift.c | ||
sqrt.c |