boringssl/crypto/fipsmodule/rsa
David Benjamin 76ce04bec8 Fix up BN_MONT_CTX_set with non-minimal values.
Give a non-minimal modulus, there are two possible values of R we might
pick: 2^(BN_BITS2 * width) or 2^(BN_BITS2 * bn_minimal_width).
Potentially secret moduli would make the former attractive and things
might even work, but our only secret moduli (RSA) have public bit
widths. It's more cases to test and the usual BIGNUM invariant is that
widths do not affect numerical output.

Thus, settle on minimizing mont->N for now. With the top explicitly made
minimal, computing |lgBigR| is also a little simpler.

This CL also abstracts out the < R check in the RSA code, and implements
it in a width-agnostic way.

Bug: 232
Change-Id: I354643df30530db7866bb7820e34241d7614f3c2
Reviewed-on: https://boringssl-review.googlesource.com/25250
Reviewed-by: Adam Langley <agl@google.com>
2018-02-02 18:52:15 +00:00
..
blinding.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
internal.h Make BN_generate_dsa_nonce internally constant-time. 2017-11-20 16:18:30 +00:00
padding.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
rsa_impl.c Fix up BN_MONT_CTX_set with non-minimal values. 2018-02-02 18:52:15 +00:00
rsa.c Add RSA_flags and RSA_METHOD_FLAG_NO_CHECK. 2017-12-18 23:56:15 +00:00