boringssl/include/openssl
David Benjamin 08805fe279 Normalize RSA private component widths.
d, dmp1, dmq1, and iqmp have private magnitudes. This is awkward because
the RSAPrivateKey serialization leaks the magnitudes. Do the best we can
and fix them up before any RSA operations.

This moves the piecemeal BN_MONT_CTX_set_locked into a common function
where we can do more complex canonicalization on the keys.  Ideally this
would be done on key import, but the exposed struct (and OpenSSL 1.1.0's
bad API design) mean there is no single point in time when key import is
finished.

Also document the constraints on RSA_set0_* functions. (These
constraints aren't new. They just were never documented before.)

Update-Note: If someone tried to use an invalid RSA key where d >= n,
   dmp1 >= p, dmq1 >= q, or iqmp >= p, this may break. Such keys would not
   have passed RSA_check_key, but it's possible to manually assemble
   keys that bypass it.
Bug: 232
Change-Id: I421f883128952f892ac0cde0d224873a625f37c5
Reviewed-on: https://boringssl-review.googlesource.com/25259
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
2018-02-05 23:58:53 +00:00
..
aead.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
aes.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
arm_arch.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
asn1_mac.h Purge the remainder of asn1_mac.h. 2016-08-03 21:37:31 +00:00
asn1.h Add ASN1_INTEGET_set_uint64. 2018-01-02 16:01:31 +00:00
asn1t.h Remove ASN1_template_(i2d,d2i). 2017-09-15 22:53:43 +00:00
base64.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
base.h Move OPENSSL_FALLTHROUGH to internal headers. 2018-01-29 18:17:57 +00:00
bio.h Fix reference to nonexistent function. 2018-01-16 16:23:36 +00:00
blowfish.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
bn.h Rename bn->top to bn->width. 2018-02-05 23:44:24 +00:00
buf.h Always process handshake records in full. 2017-10-17 14:53:11 +00:00
buffer.h Add buffer.h for compatibility. 2015-05-12 00:09:57 +00:00
bytestring.h Add some more utility functions to bytestring. 2018-01-25 23:51:36 +00:00
cast.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
chacha.h Add chacha.h to the list of documented headers. 2017-10-12 15:27:34 +00:00
cipher.h Add more compatibility symbols for Node. 2017-11-03 01:31:50 +00:00
cmac.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
conf.h Add more compatibility symbols for Node. 2017-11-03 01:31:50 +00:00
cpu.h Add CRYPTO_needs_hwcap2_workaround. 2017-09-18 14:05:46 +00:00
crypto.h Extract FIPS KAT tests into a function. 2018-01-22 20:16:38 +00:00
curve25519.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
des.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
dh.h Switch OPENSSL_VERSION_NUMBER to 1.1.0. 2017-09-29 04:51:27 +00:00
digest.h Switch OPENSSL_VERSION_NUMBER to 1.1.0. 2017-09-29 04:51:27 +00:00
dsa.h Remove DSA_sign_setup too. 2017-11-22 21:01:11 +00:00
dtls1.h Opaquify DTLS structs. 2015-05-08 18:02:02 +00:00
ec_key.h Tighten EC_KEY's association with its group. 2018-01-03 22:15:11 +00:00
ec.h Make ECDSA signing 10% faster and plug some timing leaks. 2017-11-22 22:51:40 +00:00
ecdh.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
ecdsa.h Remove ECDSA_sign_setup and friends. 2017-11-22 20:23:40 +00:00
engine.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
err.h Bring ERR_ERROR_STRING_BUF_LEN down to 120. 2017-12-14 19:47:23 +00:00
evp.h Documentation typo. 2018-01-25 14:47:06 +00:00
ex_data.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
hkdf.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
hmac.h Switch OPENSSL_VERSION_NUMBER to 1.1.0. 2017-09-29 04:51:27 +00:00
is_boringssl.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
lhash_macros.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
lhash.h Unexport more of lhash. 2017-10-25 04:17:18 +00:00
md4.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
md5.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
mem.h Remove redundant calls to |OPENSSL_cleanse| and |OPENSSL_realloc_clean|. 2017-09-18 19:16:51 +00:00
nid.h Add OpenSSL 1.1.0's cipher property functions. 2017-08-11 02:08:58 +00:00
obj_mac.h Rename obj_mac.h to nid.h and make it a multiply-includable header. 2016-03-31 20:45:35 +00:00
obj.h Reimplement OBJ_txt2obj and add a lower-level function. 2017-11-27 21:29:00 +00:00
objects.h Move public headers to include/openssl/ 2014-07-14 22:42:18 +00:00
opensslconf.h Switch OPENSSL_VERSION_NUMBER to 1.1.0. 2017-09-29 04:51:27 +00:00
opensslv.h Get version-related functions from crypto.h rather than ssl.h. 2015-05-20 22:58:14 +00:00
ossl_typ.h Move public headers to include/openssl/ 2014-07-14 22:42:18 +00:00
pem.h Switch a number of files to C++. 2017-07-12 20:54:02 +00:00
pkcs7.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
pkcs8.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
pkcs12.h Move public headers to include/openssl/ 2014-07-14 22:42:18 +00:00
poly1305.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
pool.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
rand.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
rc4.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
ripemd.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
rsa.h Normalize RSA private component widths. 2018-02-05 23:58:53 +00:00
safestack.h Rename safe_stack.h to safestack.h. 2015-02-20 23:33:48 +00:00
sha.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
span.h Push Span down a layer. 2017-10-10 14:27:58 +00:00
srtp.h Fold srtp.h into ssl.h. 2015-09-14 23:59:37 +00:00
ssl3.h Adding support for draft 21 as a TLS 1.3 variant. 2017-11-01 21:32:36 +00:00
ssl.h Push an error if custom private keys fail. 2018-02-01 21:43:42 +00:00
stack.h Tidy up some warnings. 2018-01-09 16:01:32 +00:00
thread.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
tls1.h Remove draft22 and experiment2. 2018-01-31 18:07:53 +00:00
type_check.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
x509_vfy.h Unexport more of lhash. 2017-10-25 04:17:18 +00:00
x509.h Add X509_NAME_get0_der from OpenSSL 1.1.0. 2017-12-06 17:49:04 +00:00
x509v3.h Unexport more of lhash. 2017-10-25 04:17:18 +00:00