boringssl/crypto/x509
Martin Kreichgauer b86be3617d Guard against DoS in name constraints handling.
This guards against the name constraints check consuming large amounts
of CPU time when certificates in the presented chain contain an
excessive number of names (specifically subject email names or subject
alternative DNS names) and/or name constraints.

Name constraints checking compares the names presented in a certificate
against the name constraints included in a certificate higher up in the
chain using two nested for loops.

Move the name constraints check so that it happens after signature
verification so peers cannot exploit this using a chain with invalid
signatures. Also impose a hard limit on the number of name constraints
check loop iterations to further mitigate the issue.

Thanks to NCC for finding this issue.

Change-Id: I112ba76fe75d1579c45291042e448850b830cbb7
Reviewed-on: https://boringssl-review.googlesource.com/19164
Reviewed-by: Martin Kreichgauer <martinkr@google.com>
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
2017-09-06 22:00:46 +00:00
..
a_digest.c
a_sign.c Align EVP_PKEY Ed25519 API with upstream. 2017-06-12 12:04:11 +00:00
a_strex.c
a_verify.c Align EVP_PKEY Ed25519 API with upstream. 2017-06-12 12:04:11 +00:00
algorithm.c Align EVP_PKEY Ed25519 API with upstream. 2017-06-12 12:04:11 +00:00
asn1_gen.c Sync asn1_gen.c with upstream 1.0.2. 2017-07-05 21:37:08 +00:00
by_dir.c Convert stack.h to use inline functions. 2017-05-22 15:06:04 +00:00
by_file.c Remove needless type casting. 2017-06-12 21:39:15 +00:00
charmap.h
CMakeLists.txt Delete some dead code from crypto/x509. 2017-06-09 19:58:08 +00:00
i2d_pr.c
internal.h Align EVP_PKEY Ed25519 API with upstream. 2017-06-12 12:04:11 +00:00
rsa_pss.c Align EVP_PKEY Ed25519 API with upstream. 2017-06-12 12:04:11 +00:00
t_crl.c
t_req.c
t_x509.c ASN1_UTCTIME_print: fix, comment, test. 2017-01-10 23:32:12 +00:00
t_x509a.c
vpm_int.h
x509_att.c
x509_cmp.c Work around language and compiler bug in memcpy, etc. 2016-12-21 20:34:47 +00:00
x509_d2.c
x509_def.c Add default cert store on Fuchsia 2017-08-15 18:58:58 +00:00
x509_ext.c
x509_lu.c Fix a memory leak in X509_STORE_add_cert/crl error handling. 2017-03-21 14:51:17 +00:00
x509_obj.c Work around language and compiler bug in memcpy, etc. 2016-12-21 20:34:47 +00:00
x509_r2x.c Fix a few leaks in X509_REQ_to_X509. 2016-09-09 20:17:16 +00:00
x509_req.c
x509_set.c
x509_test.cc Align EVP_PKEY Ed25519 API with upstream. 2017-06-12 12:04:11 +00:00
x509_trs.c
x509_txt.c
x509_v3.c
x509_vfy.c Guard against DoS in name constraints handling. 2017-09-06 22:00:46 +00:00
x509_vpm.c Work around language and compiler bug in memcpy, etc. 2016-12-21 20:34:47 +00:00
x509.c
x509cset.c
x509name.c Work around language and compiler bug in memcpy, etc. 2016-12-21 20:34:47 +00:00
x509rset.c
x509spki.c
x_algor.c
x_all.c
x_attrib.c
x_crl.c Correctly find all critical CRL extensions. 2016-10-24 20:09:28 +00:00
x_exten.c
x_info.c
x_name.c Use functions that do not depend on the current locale. 2017-07-25 22:53:33 +00:00
x_pkey.c Work around language and compiler bug in memcpy, etc. 2016-12-21 20:34:47 +00:00
x_pubkey.c
x_req.c
x_sig.c
x_spki.c
x_val.c
x_x509.c Remove ex_data's dup hook. 2017-05-23 22:43:59 +00:00
x_x509a.c Delete some dead code from crypto/x509. 2017-06-09 19:58:08 +00:00