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> |
||
---|---|---|
.. | ||
asn1 | ||
base64 | ||
bio | ||
bn_extra | ||
buf | ||
bytestring | ||
chacha | ||
cipher_extra | ||
cmac | ||
conf | ||
curve25519 | ||
dh | ||
digest_extra | ||
dsa | ||
ec_extra | ||
ecdh | ||
ecdsa_extra | ||
engine | ||
err | ||
evp | ||
fipsmodule | ||
hkdf | ||
hmac_extra | ||
lhash | ||
obj | ||
pem | ||
perlasm | ||
pkcs7 | ||
pkcs8 | ||
poly1305 | ||
pool | ||
rand_extra | ||
rc4 | ||
rsa_extra | ||
stack | ||
test | ||
x509 | ||
x509v3 | ||
CMakeLists.txt | ||
compiler_test.cc | ||
constant_time_test.cc | ||
cpu-aarch64-fuchsia.c | ||
cpu-aarch64-linux.c | ||
cpu-arm-linux.c | ||
cpu-arm.c | ||
cpu-intel.c | ||
cpu-ppc64le.c | ||
crypto.c | ||
ex_data.c | ||
internal.h | ||
mem.c | ||
refcount_c11.c | ||
refcount_lock.c | ||
refcount_test.cc | ||
self_test.cc | ||
thread_none.c | ||
thread_pthread.c | ||
thread_test.cc | ||
thread_win.c | ||
thread.c |