boringssl/crypto/fipsmodule
David Benjamin 23af438ccd Compute p - q in constant time.
Expose the constant-time abs_sub functions from the fixed Karatsuba code
in BIGNUM form for RSA to call into. RSA key generation involves
checking if |p - q| is above some lower bound.

BN_sub internally branches on which of p or q is bigger. For any given
iteration, this is not secret---one of p or q is necessarily the larger,
and whether we happened to pick the larger or smaller first is
irrelevant. Accordingly, there is no need to perform the p/q swap at the
end in constant-time.

However, this stage of the algorithm picks p first, sticks with it, and
then computes |p - q| for various q candidates. The distribution of
comparisons leaks information about p. The leak is unlikely to be
problematic, but plug it anyway.

Median of 29 RSA keygens: 0m0.210s -> 0m0.212s
(Accuracy beyond 0.1s is questionable.)

Bug: 238
Change-Id: I024b4e51b364f5ca2bcb419a0393e7be13249aec
Reviewed-on: https://boringssl-review.googlesource.com/26368
Reviewed-by: Adam Langley <alangley@gmail.com>
2018-03-30 19:53:28 +00:00
..
aes Always use adr with __thumb2__. 2018-02-22 22:28:15 +00:00
bn Compute p - q in constant time. 2018-03-30 19:53:28 +00:00
cipher Require only that the nonce be strictly monotonic in TLS's AES-GCM 2018-01-26 20:09:44 +00:00
des Move OPENSSL_FALLTHROUGH to internal headers. 2018-01-29 18:17:57 +00:00
digest
ec Name constant-time functions more consistently. 2018-03-29 23:30:55 +00:00
ecdsa Store EC_KEY's private key as an EC_SCALAR. 2018-03-07 21:17:31 +00:00
hmac
md4
md5
modes Actually use the u64 cast. 2018-02-16 20:02:56 +00:00
policydocs
rand Fix up CTR_DRBG_update comment. 2018-01-23 22:19:03 +00:00
rsa Compute p - q in constant time. 2018-03-30 19:53:28 +00:00
self_check Split BORINGSSL_self_test into its own file. 2018-01-22 23:06:41 +00:00
sha Sync up some perlasm license headers and easy fixes. 2018-02-11 01:00:35 +00:00
tls add missing #includes 2018-01-22 21:54:08 +00:00
bcm.c Add AES_128_CCM AEAD. 2018-02-16 15:57:27 +00:00
CMakeLists.txt
delocate.h
FIPS.md Update link to CMVP certificate. 2018-02-26 22:14:35 +00:00
intcheck1.png
intcheck2.png
intcheck3.png
is_fips.c