boringssl/crypto
David Benjamin f6094e05ef Don't allow EVP_PKEY_RSA2.
OpenSSL accepts both OID 2.5.8.1.1 and OID 1.2.840.113549.1.1.1 for RSA
public keys. The latter comes from RFC 3279 and is widely implemented.
The former comes from the ITU-T version of X.509. Interestingly,
2.5.8.1.1 actually has a parameter, which OpenSSL ignores:

  rsa ALGORITHM ::= {
     KeySize
     IDENTIFIED BY id-ea-rsa
  }
  KeySize ::= INTEGER

Remove support for 2.5.8.1.1 completely. In tests with a self-signed
certificate and code inspection:

- IE11 on Win8 does not accept the certificate in a TLS handshake at
  all. Such a certificate is fatal and unbypassable. However Microsoft's
  libraries do seem to parse it, so Chrome on Windows allows one to
  click through the error. I'm guessing either the X.509 stack accepts
  it while the TLS stack doesn't recognize it as RSA or the X.509 stack
  is able to lightly parse it but not actually understand the key. (The
  system certificate UI didn't display it as an RSA key, so probably the
  latter?)

- Apple's certificate library on 10.11.2 does not parse the certificate
  at all. Both Safari and Chrome on Mac treat it as a fatal and
  unbypassable error.

- mozilla::pkix, from code inspection, does not accept such
  certificates. However, Firefox does allow clicking through the error.
  This is likely a consequence of mozilla::pkix and NSS having different
  ASN.1 stacks. I did not test this, but I expect this means Chrome on
  Linux also accepts it.

Given IE and Safari's results, it should be safe to simply remove this.
Firefox's data point is weak (perhaps someone is relying on being able
to click-through a self-signed 2.5.8.1.1 certificate), but it does
further ensure no valid certificate could be doing this.

The following is the 2.5.8.1.1 certificate I constructed to test with.
The private key is key.pem from ssl/test/runner:

-----BEGIN CERTIFICATE-----
MIICVTCCAb6gAwIBAgIJAPuwTC6rEJsMMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
aWRnaXRzIFB0eSBMdGQwHhcNMTQwNDIzMjA1MDQwWhcNMTcwNDIyMjA1MDQwWjBF
MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGcMAoGBFUIAQECAgQAA4GNADCBiQKBgQDY
K8imMuRi/03z0K1Zi0WnvfFHvwlYeyK9Na6XJYaUoIDAtB92kWdGMdAQhLciHnAj
kXLI6W15OoV3gA/ElRZ1xUpxTMhjP6PyY5wqT5r6y8FxbiiFKKAnHmUcrgfVW28t
Q+0rkLGMryRtrukXOgXBv7gcrmU7G1jC2a7WqmeI8QIDAQABo1AwTjAdBgNVHQ4E
FgQUi3XVrMsIvg4fZbf6Vr5sp3Xaha8wHwYDVR0jBBgwFoAUi3XVrMsIvg4fZbf6
Vr5sp3Xaha8wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQAIZuUICtYv
w3cbpCGX6HNCtyI0guOfbytcdwzRkQaCsYNSDrTxrSSWxHwqg3Dl/RlvS+T3Yaua
Xkioadstwt7GDP6MwpIpdbjchh0XZd3kjdJWqXSvihUDpRePNjNS2LmJW8GWfB3c
F6UVyNK+wcApRY+goREIhyYupAHUexR7FQ==
-----END CERTIFICATE-----

BUG=522228

Change-Id: I031d03c0f53a16cbc749c4a5d8be6efca50dc863
Reviewed-on: https://boringssl-review.googlesource.com/6852
Reviewed-by: Adam Langley <alangley@gmail.com>
2016-01-28 00:43:37 +00:00
..
aes Fix the shared builders by exporting GCM symbols. 2015-10-26 23:26:40 +00:00
asn1 OpenSSL reformat x509/, x509v3/, pem/ and asn1/. 2016-01-19 17:01:51 +00:00
base64 Remove calls to ERR_load_crypto_strings. 2016-01-25 23:09:08 +00:00
bio Remove calls to ERR_load_crypto_strings. 2016-01-25 23:09:08 +00:00
bn Rename the BIGNUM ASN.1 functions. 2016-01-27 22:37:44 +00:00
buf Make |BUF_memdup| look for zero length, not NULL. 2015-10-06 18:11:33 -07:00
bytestring Rewrite ssl3_send_server_key_exchange to use CBB. 2015-12-22 17:23:58 +00:00
chacha Use |alignas| more in crypto/chacha/chacha_vec.c. 2016-01-27 22:12:22 +00:00
cipher Use Barrett reduction in CBC processing rather than tricks. 2016-01-27 22:05:01 +00:00
cmac Add a run_tests target to run all tests. 2015-10-26 20:33:44 +00:00
conf Also add a no-op stub for OPENSSL_config. 2016-01-26 15:48:51 +00:00
curve25519 Rename the curve25519 precomputed tables. 2016-01-15 19:51:05 +00:00
des Use the straight-forward ROTATE macro. 2015-12-16 19:57:31 +00:00
dh Remove the CRYPTO_EX_new callback. 2015-12-15 21:29:46 +00:00
digest Remove the arch-specific HOST_c2l/HOST_l2c implementations. 2016-01-27 22:26:32 +00:00
dsa Fix memory leak in DSA redo case. 2015-12-16 21:17:09 +00:00
ec Remove group_clear_finish EC_GROUP hooks. 2016-01-28 00:17:43 +00:00
ecdh Clean up |ECDH_compute_key|. 2015-10-27 17:00:25 +00:00
ecdsa Rename the BIGNUM ASN.1 functions. 2016-01-27 22:37:44 +00:00
engine Unwind DH_METHOD and DSA_METHOD. 2015-11-03 22:54:36 +00:00
err Remove ASN1_R_MALLOC_FAILURE. 2015-12-22 00:12:24 +00:00
evp Don't allow EVP_PKEY_RSA2. 2016-01-28 00:43:37 +00:00
hkdf Remove calls to ERR_load_crypto_strings. 2016-01-25 23:09:08 +00:00
hmac Remove condition which always evaluates to true (size_t >= 0). 2015-11-11 22:20:19 +00:00
lhash Add a run_tests target to run all tests. 2015-10-26 20:33:44 +00:00
md4 Make HOST_l2c return void. 2015-12-16 20:02:37 +00:00
md5 Make HOST_l2c return void. 2015-12-16 20:02:37 +00:00
modes Fix trivial -Wcast-qual violations. 2016-01-21 21:06:02 +00:00
obj Allocate a NID for X25519. 2015-12-22 18:56:53 +00:00
pem OpenSSL reformat x509/, x509v3/, pem/ and asn1/. 2016-01-19 17:01:51 +00:00
perlasm Fix arm perlasm trailing newline. 2016-01-19 16:35:20 +00:00
pkcs8 Remove calls to ERR_load_crypto_strings. 2016-01-25 23:09:08 +00:00
poly1305 Use |inline| in crypto/poly1305/poly1305_vec.c. 2016-01-27 22:15:34 +00:00
rand Add a few more no-op stubs for cURL compatibility. 2016-01-26 15:48:41 +00:00
rc4 Remove the stitched RC4-MD5 code and use the generic one. 2015-12-16 23:57:42 +00:00
rsa Rename the BIGNUM ASN.1 functions. 2016-01-27 22:37:44 +00:00
sha Remove asm __asm__ define. 2015-12-16 20:03:17 +00:00
stack
test Define |OPENSSL_PRINTF_FORMAT_FUNC| for format string annotations. 2016-01-21 20:58:51 +00:00
x509 Fix build of x509_test. 2016-01-20 23:08:03 +00:00
x509v3 OpenSSL reformat x509/, x509v3/, pem/ and asn1/. 2016-01-19 17:01:51 +00:00
CMakeLists.txt Add X25519 and Ed25519 support. 2015-11-17 21:56:12 +00:00
constant_time_test.c
cpu-arm-asm.S
cpu-arm.c Allow |CRYPTO_is_NEON_capable| to be known at compile time, if possible. 2015-11-19 00:15:11 +00:00
cpu-intel.c Fix |sscanf| format string in cpu-intel.c. 2016-01-21 20:59:35 +00:00
crypto.c Add a few more no-op stubs for cURL compatibility. 2016-01-26 15:48:41 +00:00
directory_posix.c
directory_win.c
directory.h
ex_data.c Skip free callbacks on empty CRYPTO_EX_DATAs. 2015-12-15 21:32:14 +00:00
internal.h Fix 32-bit build. 2016-01-27 22:29:52 +00:00
mem.c
refcount_c11.c
refcount_lock.c
refcount_test.c
thread_none.c
thread_pthread.c Make sure pthread_once() succeeds. 2015-11-17 21:44:40 +00:00
thread_test.c
thread_win.c Fix data <-> function pointer casts in thread_win.c. 2016-01-27 22:08:26 +00:00
thread.c
time_support.c Remove some mingw support cruft. 2016-01-25 23:05:45 +00:00