@fails-components/webtransport 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/readme.md +1 -3
- package/src/http3eventloop.cc +83 -9
- package/src/http3eventloop.h +13 -3
- package/src/http3server.cc +22 -22
- package/src/http3server.h +7 -20
- package/src/http3wtstreamvisitor.cc +31 -10
- package/src/http3wtstreamvisitor.h +38 -11
- package/src/webtransport.js +91 -23
- package/test/echoserver.js +29 -5
- package/test/testsuite.js +242 -220
- package/third_party/boringssl/src/CMakeLists.txt +2 -0
- package/third_party/boringssl/src/crypto/CMakeLists.txt +1 -0
- package/third_party/boringssl/src/crypto/asn1/a_bitstr.c +174 -177
- package/third_party/boringssl/src/crypto/asn1/a_bool.c +46 -48
- package/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c +21 -23
- package/third_party/boringssl/src/crypto/asn1/a_dup.c +21 -23
- package/third_party/boringssl/src/crypto/asn1/a_gentm.c +84 -187
- package/third_party/boringssl/src/crypto/asn1/a_i2d_fp.c +19 -21
- package/third_party/boringssl/src/crypto/asn1/a_int.c +305 -329
- package/third_party/boringssl/src/crypto/asn1/a_mbstr.c +190 -195
- package/third_party/boringssl/src/crypto/asn1/a_object.c +182 -189
- package/third_party/boringssl/src/crypto/asn1/a_octet.c +6 -9
- package/third_party/boringssl/src/crypto/asn1/a_print.c +15 -16
- package/third_party/boringssl/src/crypto/asn1/a_strex.c +386 -399
- package/third_party/boringssl/src/crypto/asn1/a_strnid.c +110 -131
- package/third_party/boringssl/src/crypto/asn1/a_time.c +118 -111
- package/third_party/boringssl/src/crypto/asn1/a_type.c +59 -60
- package/third_party/boringssl/src/crypto/asn1/a_utctm.c +114 -186
- package/third_party/boringssl/src/crypto/asn1/a_utf8.c +171 -159
- package/third_party/boringssl/src/crypto/asn1/asn1_lib.c +245 -260
- package/third_party/boringssl/src/crypto/asn1/asn1_par.c +41 -40
- package/third_party/boringssl/src/crypto/asn1/asn1_test.cc +31 -0
- package/third_party/boringssl/src/crypto/asn1/asn_pack.c +31 -33
- package/third_party/boringssl/src/crypto/asn1/f_int.c +36 -33
- package/third_party/boringssl/src/crypto/asn1/f_string.c +29 -26
- package/third_party/boringssl/src/crypto/asn1/internal.h +62 -61
- package/third_party/boringssl/src/crypto/asn1/tasn_dec.c +706 -702
- package/third_party/boringssl/src/crypto/asn1/tasn_enc.c +507 -524
- package/third_party/boringssl/src/crypto/asn1/tasn_fre.c +141 -133
- package/third_party/boringssl/src/crypto/asn1/tasn_new.c +207 -199
- package/third_party/boringssl/src/crypto/asn1/tasn_typ.c +19 -22
- package/third_party/boringssl/src/crypto/asn1/tasn_utl.c +24 -24
- package/third_party/boringssl/src/crypto/asn1/time_support.c +13 -13
- package/third_party/boringssl/src/crypto/bio/connect.c +9 -3
- package/third_party/boringssl/src/crypto/bytestring/bytestring_test.cc +125 -1
- package/third_party/boringssl/src/crypto/bytestring/cbb.c +4 -7
- package/third_party/boringssl/src/crypto/bytestring/cbs.c +167 -9
- package/third_party/boringssl/src/crypto/cipher_extra/e_aesctrhmac.c +0 -2
- package/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c +23 -54
- package/third_party/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c +0 -2
- package/third_party/boringssl/src/crypto/cipher_extra/e_tls.c +0 -2
- package/third_party/boringssl/src/crypto/curve25519/curve25519.c +6 -8
- package/third_party/boringssl/src/crypto/evp/evp_ctx.c +25 -22
- package/third_party/boringssl/src/crypto/evp/internal.h +15 -9
- package/third_party/boringssl/src/crypto/evp/p_dsa_asn1.c +2 -0
- package/third_party/boringssl/src/crypto/evp/p_ec_asn1.c +2 -0
- package/third_party/boringssl/src/crypto/evp/p_ed25519.c +3 -3
- package/third_party/boringssl/src/crypto/evp/p_ed25519_asn1.c +10 -7
- package/third_party/boringssl/src/crypto/evp/p_hkdf.c +241 -0
- package/third_party/boringssl/src/crypto/evp/p_rsa_asn1.c +2 -0
- package/third_party/boringssl/src/crypto/evp/p_x25519_asn1.c +1 -0
- package/third_party/boringssl/src/crypto/fipsmodule/aes/aes_nohw.c +9 -10
- package/third_party/boringssl/src/crypto/fipsmodule/aes/key_wrap.c +2 -6
- package/third_party/boringssl/src/crypto/fipsmodule/bn/exponentiation.c +5 -11
- package/third_party/boringssl/src/crypto/fipsmodule/bn/internal.h +1 -1
- package/third_party/boringssl/src/crypto/fipsmodule/bn/prime.c +2 -0
- package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aes.c +10 -26
- package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aesccm.c +2 -3
- package/third_party/boringssl/src/crypto/fipsmodule/digestsign/digestsign.c +1 -0
- package/third_party/boringssl/src/crypto/fipsmodule/ec/p256-nistz.c +44 -43
- package/third_party/boringssl/src/crypto/fipsmodule/modes/cbc.c +5 -9
- package/third_party/boringssl/src/crypto/fipsmodule/modes/gcm.c +14 -21
- package/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c +8 -8
- package/third_party/boringssl/src/crypto/fipsmodule/rand/internal.h +1 -4
- package/third_party/boringssl/src/crypto/hkdf/hkdf_test.cc +104 -0
- package/third_party/boringssl/src/crypto/internal.h +18 -4
- package/third_party/boringssl/src/crypto/lhash/internal.h +13 -1
- package/third_party/boringssl/src/crypto/obj/obj_dat.h +4 -1
- package/third_party/boringssl/src/crypto/obj/obj_mac.num +1 -0
- package/third_party/boringssl/src/crypto/obj/objects.txt +2 -0
- package/third_party/boringssl/src/crypto/pem/pem_all.c +77 -86
- package/third_party/boringssl/src/crypto/pem/pem_info.c +221 -233
- package/third_party/boringssl/src/crypto/pem/pem_lib.c +639 -608
- package/third_party/boringssl/src/crypto/pem/pem_oth.c +17 -16
- package/third_party/boringssl/src/crypto/pem/pem_pk8.c +133 -142
- package/third_party/boringssl/src/crypto/pem/pem_pkey.c +96 -92
- package/third_party/boringssl/src/crypto/poly1305/poly1305_vec.c +12 -28
- package/third_party/boringssl/src/crypto/siphash/siphash.c +8 -11
- package/third_party/boringssl/src/crypto/siphash/siphash_test.cc +5 -7
- package/third_party/boringssl/src/crypto/stack/stack.c +33 -16
- package/third_party/boringssl/src/crypto/thread_pthread.c +0 -2
- package/third_party/boringssl/src/crypto/thread_win.c +0 -2
- package/third_party/boringssl/src/crypto/trust_token/internal.h +14 -0
- package/third_party/boringssl/src/crypto/trust_token/pmbtoken.c +127 -30
- package/third_party/boringssl/src/crypto/trust_token/trust_token.c +40 -0
- package/third_party/boringssl/src/crypto/trust_token/trust_token_test.cc +165 -0
- package/third_party/boringssl/src/crypto/trust_token/voprf.c +55 -6
- package/third_party/boringssl/src/crypto/x509/a_digest.c +23 -24
- package/third_party/boringssl/src/crypto/x509/a_sign.c +52 -55
- package/third_party/boringssl/src/crypto/x509/a_verify.c +33 -34
- package/third_party/boringssl/src/crypto/x509/algorithm.c +17 -18
- package/third_party/boringssl/src/crypto/x509/asn1_gen.c +618 -612
- package/third_party/boringssl/src/crypto/x509/by_dir.c +320 -337
- package/third_party/boringssl/src/crypto/x509/by_file.c +186 -186
- package/third_party/boringssl/src/crypto/x509/i2d_pr.c +11 -14
- package/third_party/boringssl/src/crypto/x509/internal.h +22 -22
- package/third_party/boringssl/src/crypto/x509/name_print.c +155 -150
- package/third_party/boringssl/src/crypto/x509/rsa_pss.c +27 -29
- package/third_party/boringssl/src/crypto/x509/t_crl.c +67 -70
- package/third_party/boringssl/src/crypto/x509/t_req.c +3 -5
- package/third_party/boringssl/src/crypto/x509/t_x509.c +280 -251
- package/third_party/boringssl/src/crypto/x509/t_x509a.c +52 -47
- package/third_party/boringssl/src/crypto/x509/x509.c +3 -4
- package/third_party/boringssl/src/crypto/x509/x509_att.c +234 -223
- package/third_party/boringssl/src/crypto/x509/x509_cmp.c +286 -296
- package/third_party/boringssl/src/crypto/x509/x509_d2.c +37 -32
- package/third_party/boringssl/src/crypto/x509/x509_def.c +14 -30
- package/third_party/boringssl/src/crypto/x509/x509_ext.c +55 -84
- package/third_party/boringssl/src/crypto/x509/x509_lu.c +545 -581
- package/third_party/boringssl/src/crypto/x509/x509_obj.c +131 -121
- package/third_party/boringssl/src/crypto/x509/x509_req.c +120 -139
- package/third_party/boringssl/src/crypto/x509/x509_set.c +128 -142
- package/third_party/boringssl/src/crypto/x509/x509_trs.c +185 -193
- package/third_party/boringssl/src/crypto/x509/x509_txt.c +70 -72
- package/third_party/boringssl/src/crypto/x509/x509_v3.c +172 -161
- package/third_party/boringssl/src/crypto/x509/x509_vfy.c +2041 -2053
- package/third_party/boringssl/src/crypto/x509/x509_vpm.c +441 -461
- package/third_party/boringssl/src/crypto/x509/x509cset.c +152 -170
- package/third_party/boringssl/src/crypto/x509/x509name.c +274 -260
- package/third_party/boringssl/src/crypto/x509/x509rset.c +43 -20
- package/third_party/boringssl/src/crypto/x509/x509spki.c +62 -63
- package/third_party/boringssl/src/crypto/x509/x_algor.c +64 -62
- package/third_party/boringssl/src/crypto/x509/x_all.c +103 -133
- package/third_party/boringssl/src/crypto/x509/x_attrib.c +23 -24
- package/third_party/boringssl/src/crypto/x509/x_crl.c +310 -321
- package/third_party/boringssl/src/crypto/x509/x_exten.c +6 -5
- package/third_party/boringssl/src/crypto/x509/x_info.c +31 -28
- package/third_party/boringssl/src/crypto/x509/x_name.c +361 -365
- package/third_party/boringssl/src/crypto/x509/x_pkey.c +38 -32
- package/third_party/boringssl/src/crypto/x509/x_pubkey.c +114 -117
- package/third_party/boringssl/src/crypto/x509/x_req.c +27 -29
- package/third_party/boringssl/src/crypto/x509/x_sig.c +2 -2
- package/third_party/boringssl/src/crypto/x509/x_spki.c +8 -10
- package/third_party/boringssl/src/crypto/x509/x_val.c +2 -2
- package/third_party/boringssl/src/crypto/x509/x_x509.c +212 -226
- package/third_party/boringssl/src/crypto/x509/x_x509a.c +112 -109
- package/third_party/boringssl/src/crypto/x509v3/ext_dat.h +10 -13
- package/third_party/boringssl/src/crypto/x509v3/internal.h +72 -87
- package/third_party/boringssl/src/crypto/x509v3/pcy_cache.c +184 -176
- package/third_party/boringssl/src/crypto/x509v3/pcy_data.c +58 -56
- package/third_party/boringssl/src/crypto/x509v3/pcy_lib.c +71 -70
- package/third_party/boringssl/src/crypto/x509v3/pcy_map.c +56 -58
- package/third_party/boringssl/src/crypto/x509v3/pcy_node.c +89 -91
- package/third_party/boringssl/src/crypto/x509v3/pcy_tree.c +585 -590
- package/third_party/boringssl/src/crypto/x509v3/v3_akey.c +118 -112
- package/third_party/boringssl/src/crypto/x509v3/v3_akeya.c +3 -3
- package/third_party/boringssl/src/crypto/x509v3/v3_alt.c +447 -451
- package/third_party/boringssl/src/crypto/x509v3/v3_bcons.c +44 -38
- package/third_party/boringssl/src/crypto/x509v3/v3_bitst.c +39 -43
- package/third_party/boringssl/src/crypto/x509v3/v3_conf.c +321 -320
- package/third_party/boringssl/src/crypto/x509v3/v3_cpols.c +352 -327
- package/third_party/boringssl/src/crypto/x509v3/v3_crld.c +437 -383
- package/third_party/boringssl/src/crypto/x509v3/v3_enum.c +23 -16
- package/third_party/boringssl/src/crypto/x509v3/v3_extku.c +62 -53
- package/third_party/boringssl/src/crypto/x509v3/v3_genn.c +118 -115
- package/third_party/boringssl/src/crypto/x509v3/v3_ia5.c +30 -31
- package/third_party/boringssl/src/crypto/x509v3/v3_info.c +112 -98
- package/third_party/boringssl/src/crypto/x509v3/v3_int.c +40 -15
- package/third_party/boringssl/src/crypto/x509v3/v3_lib.c +248 -252
- package/third_party/boringssl/src/crypto/x509v3/v3_ncons.c +390 -386
- package/third_party/boringssl/src/crypto/x509v3/v3_ocsp.c +45 -32
- package/third_party/boringssl/src/crypto/x509v3/v3_pci.c +206 -209
- package/third_party/boringssl/src/crypto/x509v3/v3_pcia.c +6 -8
- package/third_party/boringssl/src/crypto/x509v3/v3_pcons.c +54 -50
- package/third_party/boringssl/src/crypto/x509v3/v3_pmaps.c +66 -65
- package/third_party/boringssl/src/crypto/x509v3/v3_prn.c +144 -133
- package/third_party/boringssl/src/crypto/x509v3/v3_purp.c +695 -709
- package/third_party/boringssl/src/crypto/x509v3/v3_skey.c +75 -69
- package/third_party/boringssl/src/crypto/x509v3/v3_utl.c +1102 -1082
- package/third_party/boringssl/src/include/openssl/base.h +3 -1
- package/third_party/boringssl/src/include/openssl/bn.h +3 -0
- package/third_party/boringssl/src/include/openssl/bytestring.h +20 -0
- package/third_party/boringssl/src/include/openssl/evp.h +6 -5
- package/third_party/boringssl/src/include/openssl/kdf.h +91 -0
- package/third_party/boringssl/src/include/openssl/nid.h +4 -0
- package/third_party/boringssl/src/include/openssl/ssl.h +6 -1
- package/third_party/boringssl/src/include/openssl/stack.h +47 -32
- package/third_party/boringssl/src/include/openssl/trust_token.h +18 -3
- package/third_party/boringssl/src/include/openssl/x509.h +18 -0
- package/third_party/boringssl/src/ssl/ssl_file.cc +61 -99
- package/third_party/boringssl/src/ssl/ssl_test.cc +101 -0
- package/third_party/boringssl/src/util/doc.config +2 -1
- package/third_party/boringssl/src/util/fipstools/acvp/acvptool/subprocess/subprocess.go +8 -0
- package/third_party/googleurl/AUTHORS +16 -2
- package/third_party/googleurl/base/BUILD +1 -0
- package/third_party/googleurl/base/compiler_specific.h +16 -17
- package/third_party/googleurl/base/containers/contiguous_iterator.h +13 -9
- package/third_party/googleurl/base/containers/span.h +23 -8
- package/third_party/googleurl/base/memory/raw_ptr.h +17 -25
- package/third_party/googleurl/base/memory/raw_ptr_exclusion.h +21 -0
- package/third_party/googleurl/base/strings/escape.cc +14 -2
- package/third_party/googleurl/base/strings/safe_sprintf.h +1 -1
- package/third_party/googleurl/base/strings/string_number_conversions.cc +5 -3
- package/third_party/googleurl/base/strings/string_number_conversions_internal.h +5 -5
- package/third_party/googleurl/base/strings/string_piece.h +3 -3
- package/third_party/googleurl/base/strings/string_util.cc +4 -27
- package/third_party/googleurl/base/strings/string_util.h +43 -8
- package/third_party/googleurl/base/strings/string_util_internal.h +11 -12
- package/third_party/googleurl/base/strings/string_util_unittest.cc +33 -0
- package/third_party/googleurl/base/strings/string_util_win.cc +0 -5
- package/third_party/googleurl/base/strings/string_util_win.h +9 -1
- package/third_party/googleurl/base/strings/utf_offset_string_conversions.cc +1 -1
- package/third_party/googleurl/base/strings/utf_string_conversion_utils.cc +5 -8
- package/third_party/googleurl/base/strings/utf_string_conversion_utils.h +13 -10
- package/third_party/googleurl/base/strings/utf_string_conversions.cc +32 -25
- package/third_party/googleurl/base/template_util.h +23 -35
- package/third_party/googleurl/build/build_config.h +14 -3
- package/third_party/googleurl/copy.bara.sky +1 -1
- package/third_party/googleurl/url/gurl.cc +8 -4
- package/third_party/googleurl/url/gurl.h +1 -0
- package/third_party/googleurl/url/gurl_unittest.cc +1 -0
- package/third_party/googleurl/url/origin.h +36 -26
- package/third_party/googleurl/url/scheme_host_port.h +4 -1
- package/third_party/googleurl/url/url_canon.h +2 -1
- package/third_party/googleurl/url/url_canon_internal.cc +9 -7
- package/third_party/googleurl/url/url_canon_internal.h +16 -16
- package/third_party/googleurl/url/url_canon_stdstring.h +2 -1
- package/third_party/googleurl/url/url_util.cc +9 -8
- package/third_party/quiche/build/source_list.bzl +7 -0
- package/third_party/quiche/build/source_list.gni +7 -0
- package/third_party/quiche/build/source_list.json +7 -0
- package/third_party/quiche/quiche/common/platform/api/quiche_mem_slice.h +7 -3
- package/third_party/quiche/quiche/http2/adapter/nghttp2_adapter_test.cc +86 -2
- package/third_party/quiche/quiche/http2/adapter/oghttp2_adapter_test.cc +104 -2
- package/third_party/quiche/quiche/http2/adapter/oghttp2_session.cc +23 -0
- package/third_party/quiche/quiche/http2/adapter/oghttp2_session.h +6 -1
- package/third_party/quiche/quiche/quic/core/congestion_control/send_algorithm_test.cc +0 -16
- package/third_party/quiche/quiche/quic/core/crypto/crypto_protocol.h +1 -1
- package/third_party/quiche/quiche/quic/core/http/end_to_end_test.cc +56 -2
- package/third_party/quiche/quiche/quic/core/http/http_constants.cc +1 -0
- package/third_party/quiche/quiche/quic/core/http/http_constants.h +1 -0
- package/third_party/quiche/quiche/quic/core/http/http_encoder.cc +28 -17
- package/third_party/quiche/quiche/quic/core/http/http_encoder.h +5 -0
- package/third_party/quiche/quiche/quic/core/http/http_encoder_test.cc +26 -30
- package/third_party/quiche/quiche/quic/core/http/http_frames.h +1 -0
- package/third_party/quiche/quiche/quic/core/http/quic_server_session_base.cc +4 -4
- package/third_party/quiche/quiche/quic/core/http/quic_server_session_base_test.cc +1 -1
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_client_session.cc +5 -1
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.cc +6 -33
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.h +0 -17
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream_test.cc +5 -20
- package/third_party/quiche/quiche/quic/core/io/quic_event_loop.h +81 -0
- package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop.cc +265 -0
- package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop.h +152 -0
- package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop_test.cc +341 -0
- package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store.cc +3 -1
- package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store.h +7 -7
- package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store_test.cc +4 -3
- package/third_party/quiche/quiche/quic/core/quic_connection.cc +69 -19
- package/third_party/quiche/quiche/quic/core/quic_connection.h +9 -3
- package/third_party/quiche/quiche/quic/core/quic_connection_id_manager.cc +29 -10
- package/third_party/quiche/quiche/quic/core/quic_connection_id_manager.h +5 -3
- package/third_party/quiche/quiche/quic/core/quic_connection_id_manager_test.cc +85 -22
- package/third_party/quiche/quiche/quic/core/quic_connection_test.cc +186 -30
- package/third_party/quiche/quiche/quic/core/quic_crypto_stream.cc +2 -1
- package/third_party/quiche/quiche/quic/core/quic_default_clock.cc +31 -0
- package/third_party/quiche/quiche/quic/core/quic_default_clock.h +34 -0
- package/third_party/quiche/quiche/quic/core/quic_default_connection_helper.h +49 -0
- package/third_party/quiche/quiche/quic/core/quic_dispatcher.cc +53 -37
- package/third_party/quiche/quiche/quic/core/quic_dispatcher.h +19 -11
- package/third_party/quiche/quiche/quic/core/quic_dispatcher_test.cc +15 -2
- package/third_party/quiche/quiche/quic/core/quic_flags_list.h +10 -4
- package/third_party/quiche/quiche/quic/core/quic_idle_network_detector.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_idle_network_detector_test.cc +4 -4
- package/third_party/quiche/quiche/quic/core/quic_packet_creator.cc +14 -3
- package/third_party/quiche/quiche/quic/core/quic_packet_creator_test.cc +145 -2
- package/third_party/quiche/quiche/quic/core/quic_packets.cc +3 -1
- package/third_party/quiche/quiche/quic/core/quic_packets.h +4 -0
- package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.cc +13 -11
- package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.h +9 -0
- package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager_test.cc +6 -0
- package/third_party/quiche/quiche/quic/core/quic_session.cc +3 -2
- package/third_party/quiche/quiche/quic/core/quic_session.h +8 -3
- package/third_party/quiche/quiche/quic/core/quic_types.cc +18 -0
- package/third_party/quiche/quiche/quic/core/quic_types.h +3 -0
- package/third_party/quiche/quiche/quic/core/tls_chlo_extractor.cc +3 -0
- package/third_party/quiche/quiche/quic/core/tls_chlo_extractor.h +10 -0
- package/third_party/quiche/quiche/quic/test_tools/mock_quic_session_visitor.h +1 -1
- package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.h +1 -1
- package/third_party/quiche/quiche/quic/test_tools/server_thread.cc +3 -2
- package/third_party/quiche/quiche/quic/test_tools/simple_session_notifier.cc +7 -1
- package/third_party/quiche/quiche/quic/test_tools/simple_session_notifier.h +3 -0
- package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint.h +4 -2
- package/certs/ca.cnf +0 -69
- package/certs/generate_certs.sh +0 -53
- package/certs/generate_certs_leaf.sh +0 -53
- package/certs/leaf.cnf +0 -24
- package/certs/readme.txt +0 -2
- package/third_party/quiche/build/BUILD.bazel +0 -7
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
|
|
60
60
|
#include <string.h>
|
|
61
61
|
|
|
62
|
-
#include <openssl/err.h>
|
|
63
62
|
#include <openssl/digest.h>
|
|
63
|
+
#include <openssl/err.h>
|
|
64
64
|
#include <openssl/mem.h>
|
|
65
65
|
#include <openssl/obj.h>
|
|
66
66
|
#include <openssl/thread.h>
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
#include "../x509/internal.h"
|
|
71
71
|
#include "internal.h"
|
|
72
72
|
|
|
73
|
-
#define V1_ROOT (EXFLAG_V1|EXFLAG_SS)
|
|
73
|
+
#define V1_ROOT (EXFLAG_V1 | EXFLAG_SS)
|
|
74
74
|
#define ku_reject(x, usage) \
|
|
75
|
-
|
|
75
|
+
(((x)->ex_flags & EXFLAG_KUSAGE) && !((x)->ex_kusage & (usage)))
|
|
76
76
|
#define xku_reject(x, usage) \
|
|
77
|
-
|
|
77
|
+
(((x)->ex_flags & EXFLAG_XKUSAGE) && !((x)->ex_xkusage & (usage)))
|
|
78
78
|
#define ns_reject(x, usage) \
|
|
79
|
-
|
|
79
|
+
(((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage)))
|
|
80
80
|
|
|
81
81
|
static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x,
|
|
82
82
|
int ca);
|
|
@@ -101,11 +101,9 @@ static void xptable_free(X509_PURPOSE *p);
|
|
|
101
101
|
|
|
102
102
|
static X509_PURPOSE xstandard[] = {
|
|
103
103
|
{X509_PURPOSE_SSL_CLIENT, X509_TRUST_SSL_CLIENT, 0,
|
|
104
|
-
check_purpose_ssl_client, (char *)"SSL client", (char *)"sslclient",
|
|
105
|
-
NULL},
|
|
104
|
+
check_purpose_ssl_client, (char *)"SSL client", (char *)"sslclient", NULL},
|
|
106
105
|
{X509_PURPOSE_SSL_SERVER, X509_TRUST_SSL_SERVER, 0,
|
|
107
|
-
check_purpose_ssl_server, (char *)"SSL server", (char *)"sslserver",
|
|
108
|
-
NULL},
|
|
106
|
+
check_purpose_ssl_server, (char *)"SSL server", (char *)"sslserver", NULL},
|
|
109
107
|
{X509_PURPOSE_NS_SSL_SERVER, X509_TRUST_SSL_SERVER, 0,
|
|
110
108
|
check_purpose_ns_ssl_server, (char *)"Netscape SSL server",
|
|
111
109
|
(char *)"nssslserver", NULL},
|
|
@@ -125,805 +123,793 @@ static X509_PURPOSE xstandard[] = {
|
|
|
125
123
|
(char *)"timestampsign", NULL},
|
|
126
124
|
};
|
|
127
125
|
|
|
128
|
-
#define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE))
|
|
126
|
+
#define X509_PURPOSE_COUNT (sizeof(xstandard) / sizeof(X509_PURPOSE))
|
|
129
127
|
|
|
130
128
|
static STACK_OF(X509_PURPOSE) *xptable = NULL;
|
|
131
129
|
|
|
132
|
-
static int xp_cmp(const X509_PURPOSE **a, const X509_PURPOSE **b)
|
|
133
|
-
|
|
134
|
-
return (*a)->purpose - (*b)->purpose;
|
|
130
|
+
static int xp_cmp(const X509_PURPOSE **a, const X509_PURPOSE **b) {
|
|
131
|
+
return (*a)->purpose - (*b)->purpose;
|
|
135
132
|
}
|
|
136
133
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (!x509v3_cache_extensions(x)) {
|
|
147
|
-
return -1;
|
|
148
|
-
}
|
|
134
|
+
// As much as I'd like to make X509_check_purpose use a "const" X509* I
|
|
135
|
+
// really can't because it does recalculate hashes and do other non-const
|
|
136
|
+
// things.
|
|
137
|
+
int X509_check_purpose(X509 *x, int id, int ca) {
|
|
138
|
+
int idx;
|
|
139
|
+
const X509_PURPOSE *pt;
|
|
140
|
+
if (!x509v3_cache_extensions(x)) {
|
|
141
|
+
return -1;
|
|
142
|
+
}
|
|
149
143
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
144
|
+
if (id == -1) {
|
|
145
|
+
return 1;
|
|
146
|
+
}
|
|
147
|
+
idx = X509_PURPOSE_get_by_id(id);
|
|
148
|
+
if (idx == -1) {
|
|
149
|
+
return -1;
|
|
150
|
+
}
|
|
151
|
+
pt = X509_PURPOSE_get0(idx);
|
|
152
|
+
return pt->check_purpose(pt, x, ca);
|
|
157
153
|
}
|
|
158
154
|
|
|
159
|
-
int X509_PURPOSE_set(int *p, int purpose)
|
|
160
|
-
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return 1;
|
|
155
|
+
int X509_PURPOSE_set(int *p, int purpose) {
|
|
156
|
+
if (X509_PURPOSE_get_by_id(purpose) == -1) {
|
|
157
|
+
OPENSSL_PUT_ERROR(X509V3, X509V3_R_INVALID_PURPOSE);
|
|
158
|
+
return 0;
|
|
159
|
+
}
|
|
160
|
+
*p = purpose;
|
|
161
|
+
return 1;
|
|
167
162
|
}
|
|
168
163
|
|
|
169
|
-
int X509_PURPOSE_get_count(void)
|
|
170
|
-
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
164
|
+
int X509_PURPOSE_get_count(void) {
|
|
165
|
+
if (!xptable) {
|
|
166
|
+
return X509_PURPOSE_COUNT;
|
|
167
|
+
}
|
|
168
|
+
return sk_X509_PURPOSE_num(xptable) + X509_PURPOSE_COUNT;
|
|
174
169
|
}
|
|
175
170
|
|
|
176
|
-
X509_PURPOSE *X509_PURPOSE_get0(int idx)
|
|
177
|
-
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
171
|
+
X509_PURPOSE *X509_PURPOSE_get0(int idx) {
|
|
172
|
+
if (idx < 0) {
|
|
173
|
+
return NULL;
|
|
174
|
+
}
|
|
175
|
+
if (idx < (int)X509_PURPOSE_COUNT) {
|
|
176
|
+
return xstandard + idx;
|
|
177
|
+
}
|
|
178
|
+
return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
|
|
183
179
|
}
|
|
184
180
|
|
|
185
|
-
int X509_PURPOSE_get_by_sname(char *sname)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return i;
|
|
181
|
+
int X509_PURPOSE_get_by_sname(char *sname) {
|
|
182
|
+
int i;
|
|
183
|
+
X509_PURPOSE *xptmp;
|
|
184
|
+
for (i = 0; i < X509_PURPOSE_get_count(); i++) {
|
|
185
|
+
xptmp = X509_PURPOSE_get0(i);
|
|
186
|
+
if (!strcmp(xptmp->sname, sname)) {
|
|
187
|
+
return i;
|
|
193
188
|
}
|
|
194
|
-
|
|
189
|
+
}
|
|
190
|
+
return -1;
|
|
195
191
|
}
|
|
196
192
|
|
|
197
|
-
int X509_PURPOSE_get_by_id(int purpose)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
size_t idx;
|
|
193
|
+
int X509_PURPOSE_get_by_id(int purpose) {
|
|
194
|
+
X509_PURPOSE tmp;
|
|
195
|
+
size_t idx;
|
|
201
196
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
197
|
+
if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX)) {
|
|
198
|
+
return purpose - X509_PURPOSE_MIN;
|
|
199
|
+
}
|
|
200
|
+
tmp.purpose = purpose;
|
|
201
|
+
if (!xptable) {
|
|
202
|
+
return -1;
|
|
203
|
+
}
|
|
207
204
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
205
|
+
sk_X509_PURPOSE_sort(xptable);
|
|
206
|
+
if (!sk_X509_PURPOSE_find(xptable, &idx, &tmp)) {
|
|
207
|
+
return -1;
|
|
208
|
+
}
|
|
209
|
+
return idx + X509_PURPOSE_COUNT;
|
|
212
210
|
}
|
|
213
211
|
|
|
214
212
|
int X509_PURPOSE_add(int id, int trust, int flags,
|
|
215
|
-
int (*ck)
|
|
216
|
-
char *name, char *sname, void *arg)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (name_dup
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
OPENSSL_free(sname_dup);
|
|
249
|
-
if (idx == -1)
|
|
250
|
-
OPENSSL_free(ptmp);
|
|
251
|
-
return 0;
|
|
213
|
+
int (*ck)(const X509_PURPOSE *, const X509 *, int),
|
|
214
|
+
char *name, char *sname, void *arg) {
|
|
215
|
+
int idx;
|
|
216
|
+
X509_PURPOSE *ptmp;
|
|
217
|
+
char *name_dup, *sname_dup;
|
|
218
|
+
|
|
219
|
+
// This is set according to what we change: application can't set it
|
|
220
|
+
flags &= ~X509_PURPOSE_DYNAMIC;
|
|
221
|
+
// This will always be set for application modified trust entries
|
|
222
|
+
flags |= X509_PURPOSE_DYNAMIC_NAME;
|
|
223
|
+
// Get existing entry if any
|
|
224
|
+
idx = X509_PURPOSE_get_by_id(id);
|
|
225
|
+
// Need a new entry
|
|
226
|
+
if (idx == -1) {
|
|
227
|
+
if (!(ptmp = OPENSSL_malloc(sizeof(X509_PURPOSE)))) {
|
|
228
|
+
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
|
229
|
+
return 0;
|
|
230
|
+
}
|
|
231
|
+
ptmp->flags = X509_PURPOSE_DYNAMIC;
|
|
232
|
+
} else {
|
|
233
|
+
ptmp = X509_PURPOSE_get0(idx);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Duplicate the supplied names.
|
|
237
|
+
name_dup = OPENSSL_strdup(name);
|
|
238
|
+
sname_dup = OPENSSL_strdup(sname);
|
|
239
|
+
if (name_dup == NULL || sname_dup == NULL) {
|
|
240
|
+
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
|
241
|
+
if (name_dup != NULL) {
|
|
242
|
+
OPENSSL_free(name_dup);
|
|
243
|
+
}
|
|
244
|
+
if (sname_dup != NULL) {
|
|
245
|
+
OPENSSL_free(sname_dup);
|
|
252
246
|
}
|
|
253
|
-
|
|
254
|
-
/* OPENSSL_free existing name if dynamic */
|
|
255
|
-
if (ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) {
|
|
256
|
-
OPENSSL_free(ptmp->name);
|
|
257
|
-
OPENSSL_free(ptmp->sname);
|
|
258
|
-
}
|
|
259
|
-
/* dup supplied name */
|
|
260
|
-
ptmp->name = name_dup;
|
|
261
|
-
ptmp->sname = sname_dup;
|
|
262
|
-
/* Keep the dynamic flag of existing entry */
|
|
263
|
-
ptmp->flags &= X509_PURPOSE_DYNAMIC;
|
|
264
|
-
/* Set all other flags */
|
|
265
|
-
ptmp->flags |= flags;
|
|
266
|
-
|
|
267
|
-
ptmp->purpose = id;
|
|
268
|
-
ptmp->trust = trust;
|
|
269
|
-
ptmp->check_purpose = ck;
|
|
270
|
-
ptmp->usr_data = arg;
|
|
271
|
-
|
|
272
|
-
/* If its a new entry manage the dynamic table */
|
|
273
247
|
if (idx == -1) {
|
|
274
|
-
|
|
275
|
-
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
|
276
|
-
xptable_free(ptmp);
|
|
277
|
-
return 0;
|
|
278
|
-
}
|
|
279
|
-
if (!sk_X509_PURPOSE_push(xptable, ptmp)) {
|
|
280
|
-
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
|
281
|
-
xptable_free(ptmp);
|
|
282
|
-
return 0;
|
|
283
|
-
}
|
|
248
|
+
OPENSSL_free(ptmp);
|
|
284
249
|
}
|
|
285
|
-
return 1;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
static void xptable_free(X509_PURPOSE *p)
|
|
289
|
-
{
|
|
290
|
-
if (!p)
|
|
291
|
-
return;
|
|
292
|
-
if (p->flags & X509_PURPOSE_DYNAMIC) {
|
|
293
|
-
if (p->flags & X509_PURPOSE_DYNAMIC_NAME) {
|
|
294
|
-
OPENSSL_free(p->name);
|
|
295
|
-
OPENSSL_free(p->sname);
|
|
296
|
-
}
|
|
297
|
-
OPENSSL_free(p);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
void X509_PURPOSE_cleanup(void)
|
|
302
|
-
{
|
|
303
|
-
unsigned int i;
|
|
304
|
-
sk_X509_PURPOSE_pop_free(xptable, xptable_free);
|
|
305
|
-
for (i = 0; i < X509_PURPOSE_COUNT; i++)
|
|
306
|
-
xptable_free(xstandard + i);
|
|
307
|
-
xptable = NULL;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
int X509_PURPOSE_get_id(const X509_PURPOSE *xp)
|
|
311
|
-
{
|
|
312
|
-
return xp->purpose;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp)
|
|
316
|
-
{
|
|
317
|
-
return xp->name;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp)
|
|
321
|
-
{
|
|
322
|
-
return xp->sname;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
int X509_PURPOSE_get_trust(const X509_PURPOSE *xp)
|
|
326
|
-
{
|
|
327
|
-
return xp->trust;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
static int nid_cmp(const void *void_a, const void *void_b)
|
|
331
|
-
{
|
|
332
|
-
const int *a = void_a, *b = void_b;
|
|
333
|
-
|
|
334
|
-
return *a - *b;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
int X509_supported_extension(X509_EXTENSION *ex)
|
|
338
|
-
{
|
|
339
|
-
/*
|
|
340
|
-
* This table is a list of the NIDs of supported extensions: that is
|
|
341
|
-
* those which are used by the verify process. If an extension is
|
|
342
|
-
* critical and doesn't appear in this list then the verify process will
|
|
343
|
-
* normally reject the certificate. The list must be kept in numerical
|
|
344
|
-
* order because it will be searched using bsearch.
|
|
345
|
-
*/
|
|
346
|
-
|
|
347
|
-
static const int supported_nids[] = {
|
|
348
|
-
NID_netscape_cert_type, /* 71 */
|
|
349
|
-
NID_key_usage, /* 83 */
|
|
350
|
-
NID_subject_alt_name, /* 85 */
|
|
351
|
-
NID_basic_constraints, /* 87 */
|
|
352
|
-
NID_certificate_policies, /* 89 */
|
|
353
|
-
NID_ext_key_usage, /* 126 */
|
|
354
|
-
NID_policy_constraints, /* 401 */
|
|
355
|
-
NID_proxyCertInfo, /* 663 */
|
|
356
|
-
NID_name_constraints, /* 666 */
|
|
357
|
-
NID_policy_mappings, /* 747 */
|
|
358
|
-
NID_inhibit_any_policy /* 748 */
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex));
|
|
362
|
-
|
|
363
|
-
if (ex_nid == NID_undef)
|
|
364
|
-
return 0;
|
|
365
|
-
|
|
366
|
-
if (bsearch
|
|
367
|
-
(&ex_nid, supported_nids, sizeof(supported_nids) / sizeof(int),
|
|
368
|
-
sizeof(int), nid_cmp) != NULL)
|
|
369
|
-
return 1;
|
|
370
250
|
return 0;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
{
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// OPENSSL_free existing name if dynamic
|
|
254
|
+
if (ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) {
|
|
255
|
+
OPENSSL_free(ptmp->name);
|
|
256
|
+
OPENSSL_free(ptmp->sname);
|
|
257
|
+
}
|
|
258
|
+
// dup supplied name
|
|
259
|
+
ptmp->name = name_dup;
|
|
260
|
+
ptmp->sname = sname_dup;
|
|
261
|
+
// Keep the dynamic flag of existing entry
|
|
262
|
+
ptmp->flags &= X509_PURPOSE_DYNAMIC;
|
|
263
|
+
// Set all other flags
|
|
264
|
+
ptmp->flags |= flags;
|
|
265
|
+
|
|
266
|
+
ptmp->purpose = id;
|
|
267
|
+
ptmp->trust = trust;
|
|
268
|
+
ptmp->check_purpose = ck;
|
|
269
|
+
ptmp->usr_data = arg;
|
|
270
|
+
|
|
271
|
+
// If its a new entry manage the dynamic table
|
|
272
|
+
if (idx == -1) {
|
|
273
|
+
if (!xptable && !(xptable = sk_X509_PURPOSE_new(xp_cmp))) {
|
|
274
|
+
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
|
275
|
+
xptable_free(ptmp);
|
|
276
|
+
return 0;
|
|
277
|
+
}
|
|
278
|
+
if (!sk_X509_PURPOSE_push(xptable, ptmp)) {
|
|
279
|
+
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
|
280
|
+
xptable_free(ptmp);
|
|
281
|
+
return 0;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return 1;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
static void xptable_free(X509_PURPOSE *p) {
|
|
288
|
+
if (!p) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (p->flags & X509_PURPOSE_DYNAMIC) {
|
|
292
|
+
if (p->flags & X509_PURPOSE_DYNAMIC_NAME) {
|
|
293
|
+
OPENSSL_free(p->name);
|
|
294
|
+
OPENSSL_free(p->sname);
|
|
295
|
+
}
|
|
296
|
+
OPENSSL_free(p);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
void X509_PURPOSE_cleanup(void) {
|
|
301
|
+
unsigned int i;
|
|
302
|
+
sk_X509_PURPOSE_pop_free(xptable, xptable_free);
|
|
303
|
+
for (i = 0; i < X509_PURPOSE_COUNT; i++) {
|
|
304
|
+
xptable_free(xstandard + i);
|
|
305
|
+
}
|
|
306
|
+
xptable = NULL;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
int X509_PURPOSE_get_id(const X509_PURPOSE *xp) { return xp->purpose; }
|
|
310
|
+
|
|
311
|
+
char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp) { return xp->name; }
|
|
312
|
+
|
|
313
|
+
char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp) { return xp->sname; }
|
|
314
|
+
|
|
315
|
+
int X509_PURPOSE_get_trust(const X509_PURPOSE *xp) { return xp->trust; }
|
|
316
|
+
|
|
317
|
+
static int nid_cmp(const void *void_a, const void *void_b) {
|
|
318
|
+
const int *a = void_a, *b = void_b;
|
|
319
|
+
|
|
320
|
+
return *a - *b;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
int X509_supported_extension(X509_EXTENSION *ex) {
|
|
324
|
+
// This table is a list of the NIDs of supported extensions: that is
|
|
325
|
+
// those which are used by the verify process. If an extension is
|
|
326
|
+
// critical and doesn't appear in this list then the verify process will
|
|
327
|
+
// normally reject the certificate. The list must be kept in numerical
|
|
328
|
+
// order because it will be searched using bsearch.
|
|
329
|
+
|
|
330
|
+
static const int supported_nids[] = {
|
|
331
|
+
NID_netscape_cert_type, // 71
|
|
332
|
+
NID_key_usage, // 83
|
|
333
|
+
NID_subject_alt_name, // 85
|
|
334
|
+
NID_basic_constraints, // 87
|
|
335
|
+
NID_certificate_policies, // 89
|
|
336
|
+
NID_ext_key_usage, // 126
|
|
337
|
+
NID_policy_constraints, // 401
|
|
338
|
+
NID_proxyCertInfo, // 663
|
|
339
|
+
NID_name_constraints, // 666
|
|
340
|
+
NID_policy_mappings, // 747
|
|
341
|
+
NID_inhibit_any_policy // 748
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex));
|
|
345
|
+
|
|
346
|
+
if (ex_nid == NID_undef) {
|
|
347
|
+
return 0;
|
|
348
|
+
}
|
|
399
349
|
|
|
400
|
-
|
|
401
|
-
{
|
|
402
|
-
int j;
|
|
403
|
-
x->crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, &j, NULL);
|
|
404
|
-
if (x->crldp == NULL && j != -1) {
|
|
405
|
-
return 0;
|
|
406
|
-
}
|
|
407
|
-
for (size_t i = 0; i < sk_DIST_POINT_num(x->crldp); i++) {
|
|
408
|
-
if (!setup_dp(x, sk_DIST_POINT_value(x->crldp, i))) {
|
|
409
|
-
return 0;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
350
|
+
if (bsearch(&ex_nid, supported_nids, sizeof(supported_nids) / sizeof(int),
|
|
351
|
+
sizeof(int), nid_cmp) != NULL) {
|
|
412
352
|
return 1;
|
|
353
|
+
}
|
|
354
|
+
return 0;
|
|
413
355
|
}
|
|
414
356
|
|
|
415
|
-
int
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
EXTENDED_KEY_USAGE *extusage;
|
|
422
|
-
X509_EXTENSION *ex;
|
|
423
|
-
size_t i;
|
|
424
|
-
int j;
|
|
425
|
-
|
|
426
|
-
CRYPTO_MUTEX_lock_read(&x->lock);
|
|
427
|
-
const int is_set = x->ex_flags & EXFLAG_SET;
|
|
428
|
-
CRYPTO_MUTEX_unlock_read(&x->lock);
|
|
429
|
-
|
|
430
|
-
if (is_set) {
|
|
431
|
-
return (x->ex_flags & EXFLAG_INVALID) == 0;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
CRYPTO_MUTEX_lock_write(&x->lock);
|
|
435
|
-
if (x->ex_flags & EXFLAG_SET) {
|
|
436
|
-
CRYPTO_MUTEX_unlock_write(&x->lock);
|
|
437
|
-
return (x->ex_flags & EXFLAG_INVALID) == 0;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
if (!X509_digest(x, EVP_sha256(), x->cert_hash, NULL))
|
|
441
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
442
|
-
/* V1 should mean no extensions ... */
|
|
443
|
-
if (X509_get_version(x) == X509_VERSION_1)
|
|
444
|
-
x->ex_flags |= EXFLAG_V1;
|
|
445
|
-
/* Handle basic constraints */
|
|
446
|
-
if ((bs = X509_get_ext_d2i(x, NID_basic_constraints, &j, NULL))) {
|
|
447
|
-
if (bs->ca)
|
|
448
|
-
x->ex_flags |= EXFLAG_CA;
|
|
449
|
-
if (bs->pathlen) {
|
|
450
|
-
if ((bs->pathlen->type == V_ASN1_NEG_INTEGER)
|
|
451
|
-
|| !bs->ca) {
|
|
452
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
453
|
-
x->ex_pathlen = 0;
|
|
454
|
-
} else {
|
|
455
|
-
/* TODO(davidben): |ASN1_INTEGER_get| returns -1 on overflow,
|
|
456
|
-
* which currently acts as if the constraint isn't present. This
|
|
457
|
-
* works (an overflowing path length constraint may as well be
|
|
458
|
-
* infinity), but Chromium's verifier simply treats values above
|
|
459
|
-
* 255 as an error. */
|
|
460
|
-
x->ex_pathlen = ASN1_INTEGER_get(bs->pathlen);
|
|
461
|
-
}
|
|
462
|
-
} else
|
|
463
|
-
x->ex_pathlen = -1;
|
|
464
|
-
BASIC_CONSTRAINTS_free(bs);
|
|
465
|
-
x->ex_flags |= EXFLAG_BCONS;
|
|
466
|
-
} else if (j != -1) {
|
|
467
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
357
|
+
static int setup_dp(X509 *x, DIST_POINT *dp) {
|
|
358
|
+
X509_NAME *iname = NULL;
|
|
359
|
+
size_t i;
|
|
360
|
+
if (dp->reasons) {
|
|
361
|
+
if (dp->reasons->length > 0) {
|
|
362
|
+
dp->dp_reasons = dp->reasons->data[0];
|
|
468
363
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
if (x->ex_flags & EXFLAG_CA
|
|
472
|
-
|| X509_get_ext_by_NID(x, NID_subject_alt_name, -1) >= 0
|
|
473
|
-
|| X509_get_ext_by_NID(x, NID_issuer_alt_name, -1) >= 0) {
|
|
474
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
475
|
-
}
|
|
476
|
-
if (pci->pcPathLengthConstraint) {
|
|
477
|
-
x->ex_pcpathlen = ASN1_INTEGER_get(pci->pcPathLengthConstraint);
|
|
478
|
-
} else
|
|
479
|
-
x->ex_pcpathlen = -1;
|
|
480
|
-
PROXY_CERT_INFO_EXTENSION_free(pci);
|
|
481
|
-
x->ex_flags |= EXFLAG_PROXY;
|
|
482
|
-
} else if (j != -1) {
|
|
483
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
364
|
+
if (dp->reasons->length > 1) {
|
|
365
|
+
dp->dp_reasons |= (dp->reasons->data[1] << 8);
|
|
484
366
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
x->ex_xkusage = 0;
|
|
499
|
-
if ((extusage = X509_get_ext_d2i(x, NID_ext_key_usage, &j, NULL))) {
|
|
500
|
-
x->ex_flags |= EXFLAG_XKUSAGE;
|
|
501
|
-
for (i = 0; i < sk_ASN1_OBJECT_num(extusage); i++) {
|
|
502
|
-
switch (OBJ_obj2nid(sk_ASN1_OBJECT_value(extusage, i))) {
|
|
503
|
-
case NID_server_auth:
|
|
504
|
-
x->ex_xkusage |= XKU_SSL_SERVER;
|
|
505
|
-
break;
|
|
506
|
-
|
|
507
|
-
case NID_client_auth:
|
|
508
|
-
x->ex_xkusage |= XKU_SSL_CLIENT;
|
|
509
|
-
break;
|
|
510
|
-
|
|
511
|
-
case NID_email_protect:
|
|
512
|
-
x->ex_xkusage |= XKU_SMIME;
|
|
513
|
-
break;
|
|
514
|
-
|
|
515
|
-
case NID_code_sign:
|
|
516
|
-
x->ex_xkusage |= XKU_CODE_SIGN;
|
|
517
|
-
break;
|
|
518
|
-
|
|
519
|
-
case NID_ms_sgc:
|
|
520
|
-
case NID_ns_sgc:
|
|
521
|
-
x->ex_xkusage |= XKU_SGC;
|
|
522
|
-
break;
|
|
523
|
-
|
|
524
|
-
case NID_OCSP_sign:
|
|
525
|
-
x->ex_xkusage |= XKU_OCSP_SIGN;
|
|
526
|
-
break;
|
|
527
|
-
|
|
528
|
-
case NID_time_stamp:
|
|
529
|
-
x->ex_xkusage |= XKU_TIMESTAMP;
|
|
530
|
-
break;
|
|
531
|
-
|
|
532
|
-
case NID_dvcs:
|
|
533
|
-
x->ex_xkusage |= XKU_DVCS;
|
|
534
|
-
break;
|
|
535
|
-
|
|
536
|
-
case NID_anyExtendedKeyUsage:
|
|
537
|
-
x->ex_xkusage |= XKU_ANYEKU;
|
|
538
|
-
break;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
sk_ASN1_OBJECT_pop_free(extusage, ASN1_OBJECT_free);
|
|
542
|
-
} else if (j != -1) {
|
|
543
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
367
|
+
dp->dp_reasons &= CRLDP_ALL_REASONS;
|
|
368
|
+
} else {
|
|
369
|
+
dp->dp_reasons = CRLDP_ALL_REASONS;
|
|
370
|
+
}
|
|
371
|
+
if (!dp->distpoint || (dp->distpoint->type != 1)) {
|
|
372
|
+
return 1;
|
|
373
|
+
}
|
|
374
|
+
for (i = 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++) {
|
|
375
|
+
GENERAL_NAME *gen = sk_GENERAL_NAME_value(dp->CRLissuer, i);
|
|
376
|
+
if (gen->type == GEN_DIRNAME) {
|
|
377
|
+
iname = gen->d.directoryName;
|
|
378
|
+
break;
|
|
544
379
|
}
|
|
380
|
+
}
|
|
381
|
+
if (!iname) {
|
|
382
|
+
iname = X509_get_issuer_name(x);
|
|
383
|
+
}
|
|
545
384
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
x->ex_nscert = ns->data[0];
|
|
549
|
-
else
|
|
550
|
-
x->ex_nscert = 0;
|
|
551
|
-
x->ex_flags |= EXFLAG_NSCERT;
|
|
552
|
-
ASN1_BIT_STRING_free(ns);
|
|
553
|
-
} else if (j != -1) {
|
|
554
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
555
|
-
}
|
|
556
|
-
x->skid = X509_get_ext_d2i(x, NID_subject_key_identifier, &j, NULL);
|
|
557
|
-
if (x->skid == NULL && j != -1) {
|
|
558
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
559
|
-
}
|
|
560
|
-
x->akid = X509_get_ext_d2i(x, NID_authority_key_identifier, &j, NULL);
|
|
561
|
-
if (x->akid == NULL && j != -1) {
|
|
562
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
563
|
-
}
|
|
564
|
-
/* Does subject name match issuer ? */
|
|
565
|
-
if (!X509_NAME_cmp(X509_get_subject_name(x), X509_get_issuer_name(x))) {
|
|
566
|
-
x->ex_flags |= EXFLAG_SI;
|
|
567
|
-
/* If SKID matches AKID also indicate self signed */
|
|
568
|
-
if (X509_check_akid(x, x->akid) == X509_V_OK &&
|
|
569
|
-
!ku_reject(x, KU_KEY_CERT_SIGN))
|
|
570
|
-
x->ex_flags |= EXFLAG_SS;
|
|
571
|
-
}
|
|
572
|
-
x->altname = X509_get_ext_d2i(x, NID_subject_alt_name, &j, NULL);
|
|
573
|
-
if (x->altname == NULL && j != -1) {
|
|
574
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
575
|
-
}
|
|
576
|
-
x->nc = X509_get_ext_d2i(x, NID_name_constraints, &j, NULL);
|
|
577
|
-
if (x->nc == NULL && j != -1) {
|
|
578
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
579
|
-
}
|
|
580
|
-
if (!setup_crldp(x)) {
|
|
581
|
-
x->ex_flags |= EXFLAG_INVALID;
|
|
582
|
-
}
|
|
385
|
+
return DIST_POINT_set_dpname(dp->distpoint, iname);
|
|
386
|
+
}
|
|
583
387
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
388
|
+
static int setup_crldp(X509 *x) {
|
|
389
|
+
int j;
|
|
390
|
+
x->crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, &j, NULL);
|
|
391
|
+
if (x->crldp == NULL && j != -1) {
|
|
392
|
+
return 0;
|
|
393
|
+
}
|
|
394
|
+
for (size_t i = 0; i < sk_DIST_POINT_num(x->crldp); i++) {
|
|
395
|
+
if (!setup_dp(x, sk_DIST_POINT_value(x->crldp, i))) {
|
|
396
|
+
return 0;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return 1;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
int x509v3_cache_extensions(X509 *x) {
|
|
403
|
+
BASIC_CONSTRAINTS *bs;
|
|
404
|
+
PROXY_CERT_INFO_EXTENSION *pci;
|
|
405
|
+
ASN1_BIT_STRING *usage;
|
|
406
|
+
ASN1_BIT_STRING *ns;
|
|
407
|
+
EXTENDED_KEY_USAGE *extusage;
|
|
408
|
+
X509_EXTENSION *ex;
|
|
409
|
+
size_t i;
|
|
410
|
+
int j;
|
|
411
|
+
|
|
412
|
+
CRYPTO_MUTEX_lock_read(&x->lock);
|
|
413
|
+
const int is_set = x->ex_flags & EXFLAG_SET;
|
|
414
|
+
CRYPTO_MUTEX_unlock_read(&x->lock);
|
|
415
|
+
|
|
416
|
+
if (is_set) {
|
|
417
|
+
return (x->ex_flags & EXFLAG_INVALID) == 0;
|
|
418
|
+
}
|
|
597
419
|
|
|
420
|
+
CRYPTO_MUTEX_lock_write(&x->lock);
|
|
421
|
+
if (x->ex_flags & EXFLAG_SET) {
|
|
598
422
|
CRYPTO_MUTEX_unlock_write(&x->lock);
|
|
599
423
|
return (x->ex_flags & EXFLAG_INVALID) == 0;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (!X509_digest(x, EVP_sha256(), x->cert_hash, NULL)) {
|
|
427
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
428
|
+
}
|
|
429
|
+
// V1 should mean no extensions ...
|
|
430
|
+
if (X509_get_version(x) == X509_VERSION_1) {
|
|
431
|
+
x->ex_flags |= EXFLAG_V1;
|
|
432
|
+
}
|
|
433
|
+
// Handle basic constraints
|
|
434
|
+
if ((bs = X509_get_ext_d2i(x, NID_basic_constraints, &j, NULL))) {
|
|
435
|
+
if (bs->ca) {
|
|
436
|
+
x->ex_flags |= EXFLAG_CA;
|
|
437
|
+
}
|
|
438
|
+
if (bs->pathlen) {
|
|
439
|
+
if ((bs->pathlen->type == V_ASN1_NEG_INTEGER) || !bs->ca) {
|
|
440
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
441
|
+
x->ex_pathlen = 0;
|
|
442
|
+
} else {
|
|
443
|
+
// TODO(davidben): |ASN1_INTEGER_get| returns -1 on overflow,
|
|
444
|
+
// which currently acts as if the constraint isn't present. This
|
|
445
|
+
// works (an overflowing path length constraint may as well be
|
|
446
|
+
// infinity), but Chromium's verifier simply treats values above
|
|
447
|
+
// 255 as an error.
|
|
448
|
+
x->ex_pathlen = ASN1_INTEGER_get(bs->pathlen);
|
|
449
|
+
}
|
|
450
|
+
} else {
|
|
451
|
+
x->ex_pathlen = -1;
|
|
452
|
+
}
|
|
453
|
+
BASIC_CONSTRAINTS_free(bs);
|
|
454
|
+
x->ex_flags |= EXFLAG_BCONS;
|
|
455
|
+
} else if (j != -1) {
|
|
456
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
457
|
+
}
|
|
458
|
+
// Handle proxy certificates
|
|
459
|
+
if ((pci = X509_get_ext_d2i(x, NID_proxyCertInfo, &j, NULL))) {
|
|
460
|
+
if (x->ex_flags & EXFLAG_CA ||
|
|
461
|
+
X509_get_ext_by_NID(x, NID_subject_alt_name, -1) >= 0 ||
|
|
462
|
+
X509_get_ext_by_NID(x, NID_issuer_alt_name, -1) >= 0) {
|
|
463
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
464
|
+
}
|
|
465
|
+
if (pci->pcPathLengthConstraint) {
|
|
466
|
+
x->ex_pcpathlen = ASN1_INTEGER_get(pci->pcPathLengthConstraint);
|
|
467
|
+
} else {
|
|
468
|
+
x->ex_pcpathlen = -1;
|
|
469
|
+
}
|
|
470
|
+
PROXY_CERT_INFO_EXTENSION_free(pci);
|
|
471
|
+
x->ex_flags |= EXFLAG_PROXY;
|
|
472
|
+
} else if (j != -1) {
|
|
473
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
474
|
+
}
|
|
475
|
+
// Handle key usage
|
|
476
|
+
if ((usage = X509_get_ext_d2i(x, NID_key_usage, &j, NULL))) {
|
|
477
|
+
if (usage->length > 0) {
|
|
478
|
+
x->ex_kusage = usage->data[0];
|
|
479
|
+
if (usage->length > 1) {
|
|
480
|
+
x->ex_kusage |= usage->data[1] << 8;
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
x->ex_kusage = 0;
|
|
484
|
+
}
|
|
485
|
+
x->ex_flags |= EXFLAG_KUSAGE;
|
|
486
|
+
ASN1_BIT_STRING_free(usage);
|
|
487
|
+
} else if (j != -1) {
|
|
488
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
489
|
+
}
|
|
490
|
+
x->ex_xkusage = 0;
|
|
491
|
+
if ((extusage = X509_get_ext_d2i(x, NID_ext_key_usage, &j, NULL))) {
|
|
492
|
+
x->ex_flags |= EXFLAG_XKUSAGE;
|
|
493
|
+
for (i = 0; i < sk_ASN1_OBJECT_num(extusage); i++) {
|
|
494
|
+
switch (OBJ_obj2nid(sk_ASN1_OBJECT_value(extusage, i))) {
|
|
495
|
+
case NID_server_auth:
|
|
496
|
+
x->ex_xkusage |= XKU_SSL_SERVER;
|
|
497
|
+
break;
|
|
498
|
+
|
|
499
|
+
case NID_client_auth:
|
|
500
|
+
x->ex_xkusage |= XKU_SSL_CLIENT;
|
|
501
|
+
break;
|
|
502
|
+
|
|
503
|
+
case NID_email_protect:
|
|
504
|
+
x->ex_xkusage |= XKU_SMIME;
|
|
505
|
+
break;
|
|
506
|
+
|
|
507
|
+
case NID_code_sign:
|
|
508
|
+
x->ex_xkusage |= XKU_CODE_SIGN;
|
|
509
|
+
break;
|
|
510
|
+
|
|
511
|
+
case NID_ms_sgc:
|
|
512
|
+
case NID_ns_sgc:
|
|
513
|
+
x->ex_xkusage |= XKU_SGC;
|
|
514
|
+
break;
|
|
515
|
+
|
|
516
|
+
case NID_OCSP_sign:
|
|
517
|
+
x->ex_xkusage |= XKU_OCSP_SIGN;
|
|
518
|
+
break;
|
|
519
|
+
|
|
520
|
+
case NID_time_stamp:
|
|
521
|
+
x->ex_xkusage |= XKU_TIMESTAMP;
|
|
522
|
+
break;
|
|
523
|
+
|
|
524
|
+
case NID_dvcs:
|
|
525
|
+
x->ex_xkusage |= XKU_DVCS;
|
|
526
|
+
break;
|
|
527
|
+
|
|
528
|
+
case NID_anyExtendedKeyUsage:
|
|
529
|
+
x->ex_xkusage |= XKU_ANYEKU;
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
sk_ASN1_OBJECT_pop_free(extusage, ASN1_OBJECT_free);
|
|
534
|
+
} else if (j != -1) {
|
|
535
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if ((ns = X509_get_ext_d2i(x, NID_netscape_cert_type, &j, NULL))) {
|
|
539
|
+
if (ns->length > 0) {
|
|
540
|
+
x->ex_nscert = ns->data[0];
|
|
541
|
+
} else {
|
|
542
|
+
x->ex_nscert = 0;
|
|
543
|
+
}
|
|
544
|
+
x->ex_flags |= EXFLAG_NSCERT;
|
|
545
|
+
ASN1_BIT_STRING_free(ns);
|
|
546
|
+
} else if (j != -1) {
|
|
547
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
548
|
+
}
|
|
549
|
+
x->skid = X509_get_ext_d2i(x, NID_subject_key_identifier, &j, NULL);
|
|
550
|
+
if (x->skid == NULL && j != -1) {
|
|
551
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
552
|
+
}
|
|
553
|
+
x->akid = X509_get_ext_d2i(x, NID_authority_key_identifier, &j, NULL);
|
|
554
|
+
if (x->akid == NULL && j != -1) {
|
|
555
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
556
|
+
}
|
|
557
|
+
// Does subject name match issuer ?
|
|
558
|
+
if (!X509_NAME_cmp(X509_get_subject_name(x), X509_get_issuer_name(x))) {
|
|
559
|
+
x->ex_flags |= EXFLAG_SI;
|
|
560
|
+
// If SKID matches AKID also indicate self signed
|
|
561
|
+
if (X509_check_akid(x, x->akid) == X509_V_OK &&
|
|
562
|
+
!ku_reject(x, KU_KEY_CERT_SIGN)) {
|
|
563
|
+
x->ex_flags |= EXFLAG_SS;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
x->altname = X509_get_ext_d2i(x, NID_subject_alt_name, &j, NULL);
|
|
567
|
+
if (x->altname == NULL && j != -1) {
|
|
568
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
569
|
+
}
|
|
570
|
+
x->nc = X509_get_ext_d2i(x, NID_name_constraints, &j, NULL);
|
|
571
|
+
if (x->nc == NULL && j != -1) {
|
|
572
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
573
|
+
}
|
|
574
|
+
if (!setup_crldp(x)) {
|
|
575
|
+
x->ex_flags |= EXFLAG_INVALID;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
for (j = 0; j < X509_get_ext_count(x); j++) {
|
|
579
|
+
ex = X509_get_ext(x, j);
|
|
580
|
+
if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) == NID_freshest_crl) {
|
|
581
|
+
x->ex_flags |= EXFLAG_FRESHEST;
|
|
582
|
+
}
|
|
583
|
+
if (!X509_EXTENSION_get_critical(ex)) {
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
if (!X509_supported_extension(ex)) {
|
|
587
|
+
x->ex_flags |= EXFLAG_CRITICAL;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
x->ex_flags |= EXFLAG_SET;
|
|
592
|
+
|
|
593
|
+
CRYPTO_MUTEX_unlock_write(&x->lock);
|
|
594
|
+
return (x->ex_flags & EXFLAG_INVALID) == 0;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// check_ca returns one if |x| should be considered a CA certificate and zero
|
|
598
|
+
// otherwise.
|
|
599
|
+
static int check_ca(const X509 *x) {
|
|
600
|
+
// keyUsage if present should allow cert signing
|
|
601
|
+
if (ku_reject(x, KU_KEY_CERT_SIGN)) {
|
|
602
|
+
return 0;
|
|
603
|
+
}
|
|
604
|
+
// Version 1 certificates are considered CAs and don't have extensions.
|
|
605
|
+
if ((x->ex_flags & V1_ROOT) == V1_ROOT) {
|
|
606
|
+
return 1;
|
|
607
|
+
}
|
|
608
|
+
// Otherwise, it's only a CA if basicConstraints says so.
|
|
609
|
+
return ((x->ex_flags & EXFLAG_BCONS) && (x->ex_flags & EXFLAG_CA));
|
|
600
610
|
}
|
|
601
611
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
if (ku_reject(x, KU_KEY_CERT_SIGN))
|
|
608
|
-
return 0;
|
|
609
|
-
/* Version 1 certificates are considered CAs and don't have extensions. */
|
|
610
|
-
if ((x->ex_flags & V1_ROOT) == V1_ROOT) {
|
|
611
|
-
return 1;
|
|
612
|
-
}
|
|
613
|
-
/* Otherwise, it's only a CA if basicConstraints says so. */
|
|
614
|
-
return ((x->ex_flags & EXFLAG_BCONS) &&
|
|
615
|
-
(x->ex_flags & EXFLAG_CA));
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
int X509_check_ca(X509 *x)
|
|
619
|
-
{
|
|
620
|
-
if (!x509v3_cache_extensions(x)) {
|
|
621
|
-
return 0;
|
|
622
|
-
}
|
|
623
|
-
return check_ca(x);
|
|
612
|
+
int X509_check_ca(X509 *x) {
|
|
613
|
+
if (!x509v3_cache_extensions(x)) {
|
|
614
|
+
return 0;
|
|
615
|
+
}
|
|
616
|
+
return check_ca(x);
|
|
624
617
|
}
|
|
625
618
|
|
|
626
619
|
static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x,
|
|
627
|
-
int ca)
|
|
628
|
-
{
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
620
|
+
int ca) {
|
|
621
|
+
if (xku_reject(x, XKU_SSL_CLIENT)) {
|
|
622
|
+
return 0;
|
|
623
|
+
}
|
|
624
|
+
if (ca) {
|
|
625
|
+
return check_ca(x);
|
|
626
|
+
}
|
|
627
|
+
// We need to do digital signatures or key agreement
|
|
628
|
+
if (ku_reject(x, KU_DIGITAL_SIGNATURE | KU_KEY_AGREEMENT)) {
|
|
629
|
+
return 0;
|
|
630
|
+
}
|
|
631
|
+
// nsCertType if present should allow SSL client use
|
|
632
|
+
if (ns_reject(x, NS_SSL_CLIENT)) {
|
|
633
|
+
return 0;
|
|
634
|
+
}
|
|
635
|
+
return 1;
|
|
640
636
|
}
|
|
641
637
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
*/
|
|
647
|
-
#define KU_TLS \
|
|
648
|
-
(KU_DIGITAL_SIGNATURE|KU_KEY_ENCIPHERMENT|KU_KEY_AGREEMENT)
|
|
638
|
+
// Key usage needed for TLS/SSL server: digital signature, encipherment or
|
|
639
|
+
// key agreement. The ssl code can check this more thoroughly for individual
|
|
640
|
+
// key types.
|
|
641
|
+
#define KU_TLS (KU_DIGITAL_SIGNATURE | KU_KEY_ENCIPHERMENT | KU_KEY_AGREEMENT)
|
|
649
642
|
|
|
650
643
|
static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x,
|
|
651
|
-
int ca)
|
|
652
|
-
{
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
if (ns_reject(x, NS_SSL_SERVER))
|
|
659
|
-
return 0;
|
|
660
|
-
if (ku_reject(x, KU_TLS))
|
|
661
|
-
return 0;
|
|
644
|
+
int ca) {
|
|
645
|
+
if (xku_reject(x, XKU_SSL_SERVER)) {
|
|
646
|
+
return 0;
|
|
647
|
+
}
|
|
648
|
+
if (ca) {
|
|
649
|
+
return check_ca(x);
|
|
650
|
+
}
|
|
662
651
|
|
|
663
|
-
|
|
652
|
+
if (ns_reject(x, NS_SSL_SERVER)) {
|
|
653
|
+
return 0;
|
|
654
|
+
}
|
|
655
|
+
if (ku_reject(x, KU_TLS)) {
|
|
656
|
+
return 0;
|
|
657
|
+
}
|
|
664
658
|
|
|
659
|
+
return 1;
|
|
665
660
|
}
|
|
666
661
|
|
|
667
662
|
static int check_purpose_ns_ssl_server(const X509_PURPOSE *xp, const X509 *x,
|
|
668
|
-
int ca)
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
if (!ret || ca)
|
|
673
|
-
return ret;
|
|
674
|
-
/* We need to encipher or Netscape complains */
|
|
675
|
-
if (ku_reject(x, KU_KEY_ENCIPHERMENT))
|
|
676
|
-
return 0;
|
|
663
|
+
int ca) {
|
|
664
|
+
int ret;
|
|
665
|
+
ret = check_purpose_ssl_server(xp, x, ca);
|
|
666
|
+
if (!ret || ca) {
|
|
677
667
|
return ret;
|
|
668
|
+
}
|
|
669
|
+
// We need to encipher or Netscape complains
|
|
670
|
+
if (ku_reject(x, KU_KEY_ENCIPHERMENT)) {
|
|
671
|
+
return 0;
|
|
672
|
+
}
|
|
673
|
+
return ret;
|
|
678
674
|
}
|
|
679
675
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
static int purpose_smime(const X509 *x, int ca)
|
|
683
|
-
{
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
return 0;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
return check_ca(x);
|
|
694
|
-
}
|
|
695
|
-
if (x->ex_flags & EXFLAG_NSCERT) {
|
|
696
|
-
return (x->ex_nscert & NS_SMIME) == NS_SMIME;
|
|
676
|
+
// purpose_smime returns one if |x| is a valid S/MIME leaf (|ca| is zero) or CA
|
|
677
|
+
// (|ca| is one) certificate, and zero otherwise.
|
|
678
|
+
static int purpose_smime(const X509 *x, int ca) {
|
|
679
|
+
if (xku_reject(x, XKU_SMIME)) {
|
|
680
|
+
return 0;
|
|
681
|
+
}
|
|
682
|
+
if (ca) {
|
|
683
|
+
// check nsCertType if present
|
|
684
|
+
if ((x->ex_flags & EXFLAG_NSCERT) && (x->ex_nscert & NS_SMIME_CA) == 0) {
|
|
685
|
+
return 0;
|
|
697
686
|
}
|
|
698
|
-
|
|
687
|
+
|
|
688
|
+
return check_ca(x);
|
|
689
|
+
}
|
|
690
|
+
if (x->ex_flags & EXFLAG_NSCERT) {
|
|
691
|
+
return (x->ex_nscert & NS_SMIME) == NS_SMIME;
|
|
692
|
+
}
|
|
693
|
+
return 1;
|
|
699
694
|
}
|
|
700
695
|
|
|
701
696
|
static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x,
|
|
702
|
-
int ca)
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
if (!ret || ca)
|
|
707
|
-
return ret;
|
|
708
|
-
if (ku_reject(x, KU_DIGITAL_SIGNATURE | KU_NON_REPUDIATION))
|
|
709
|
-
return 0;
|
|
697
|
+
int ca) {
|
|
698
|
+
int ret;
|
|
699
|
+
ret = purpose_smime(x, ca);
|
|
700
|
+
if (!ret || ca) {
|
|
710
701
|
return ret;
|
|
702
|
+
}
|
|
703
|
+
if (ku_reject(x, KU_DIGITAL_SIGNATURE | KU_NON_REPUDIATION)) {
|
|
704
|
+
return 0;
|
|
705
|
+
}
|
|
706
|
+
return ret;
|
|
711
707
|
}
|
|
712
708
|
|
|
713
709
|
static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x,
|
|
714
|
-
int ca)
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (!ret || ca)
|
|
719
|
-
return ret;
|
|
720
|
-
if (ku_reject(x, KU_KEY_ENCIPHERMENT))
|
|
721
|
-
return 0;
|
|
710
|
+
int ca) {
|
|
711
|
+
int ret;
|
|
712
|
+
ret = purpose_smime(x, ca);
|
|
713
|
+
if (!ret || ca) {
|
|
722
714
|
return ret;
|
|
715
|
+
}
|
|
716
|
+
if (ku_reject(x, KU_KEY_ENCIPHERMENT)) {
|
|
717
|
+
return 0;
|
|
718
|
+
}
|
|
719
|
+
return ret;
|
|
723
720
|
}
|
|
724
721
|
|
|
725
722
|
static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x,
|
|
726
|
-
int ca)
|
|
727
|
-
{
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
723
|
+
int ca) {
|
|
724
|
+
if (ca) {
|
|
725
|
+
return check_ca(x);
|
|
726
|
+
}
|
|
727
|
+
if (ku_reject(x, KU_CRL_SIGN)) {
|
|
728
|
+
return 0;
|
|
729
|
+
}
|
|
730
|
+
return 1;
|
|
734
731
|
}
|
|
735
732
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
* is valid. Additional checks must be made on the chain.
|
|
739
|
-
*/
|
|
733
|
+
// OCSP helper: this is *not* a full OCSP check. It just checks that each CA
|
|
734
|
+
// is valid. Additional checks must be made on the chain.
|
|
740
735
|
|
|
741
|
-
static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca)
|
|
742
|
-
{
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
736
|
+
static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca) {
|
|
737
|
+
if (ca) {
|
|
738
|
+
return check_ca(x);
|
|
739
|
+
}
|
|
740
|
+
// leaf certificate is checked in OCSP_verify()
|
|
741
|
+
return 1;
|
|
747
742
|
}
|
|
748
743
|
|
|
749
744
|
static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x,
|
|
750
|
-
int ca)
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
745
|
+
int ca) {
|
|
746
|
+
int i_ext;
|
|
747
|
+
|
|
748
|
+
// If ca is true we must return if this is a valid CA certificate.
|
|
749
|
+
if (ca) {
|
|
750
|
+
return check_ca(x);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
// Check the optional key usage field:
|
|
754
|
+
// if Key Usage is present, it must be one of digitalSignature
|
|
755
|
+
// and/or nonRepudiation (other values are not consistent and shall
|
|
756
|
+
// be rejected).
|
|
757
|
+
if ((x->ex_flags & EXFLAG_KUSAGE) &&
|
|
758
|
+
((x->ex_kusage & ~(KU_NON_REPUDIATION | KU_DIGITAL_SIGNATURE)) ||
|
|
759
|
+
!(x->ex_kusage & (KU_NON_REPUDIATION | KU_DIGITAL_SIGNATURE)))) {
|
|
760
|
+
return 0;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// Only time stamp key usage is permitted and it's required.
|
|
764
|
+
if (!(x->ex_flags & EXFLAG_XKUSAGE) || x->ex_xkusage != XKU_TIMESTAMP) {
|
|
765
|
+
return 0;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// Extended Key Usage MUST be critical
|
|
769
|
+
i_ext = X509_get_ext_by_NID((X509 *)x, NID_ext_key_usage, -1);
|
|
770
|
+
if (i_ext >= 0) {
|
|
771
|
+
X509_EXTENSION *ext = X509_get_ext((X509 *)x, i_ext);
|
|
772
|
+
if (!X509_EXTENSION_get_critical(ext)) {
|
|
773
|
+
return 0;
|
|
779
774
|
}
|
|
775
|
+
}
|
|
780
776
|
|
|
781
|
-
|
|
777
|
+
return 1;
|
|
782
778
|
}
|
|
783
779
|
|
|
784
|
-
static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca)
|
|
785
|
-
{
|
|
786
|
-
return 1;
|
|
787
|
-
}
|
|
780
|
+
static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca) { return 1; }
|
|
788
781
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
* reasons match codes for X509_verify_cert()
|
|
797
|
-
*/
|
|
782
|
+
// Various checks to see if one certificate issued the second. This can be
|
|
783
|
+
// used to prune a set of possible issuer certificates which have been looked
|
|
784
|
+
// up using some simple method such as by subject name. These are: 1. Check
|
|
785
|
+
// issuer_name(subject) == subject_name(issuer) 2. If akid(subject) exists
|
|
786
|
+
// check it matches issuer 3. If key_usage(issuer) exists check it supports
|
|
787
|
+
// certificate signing returns 0 for OK, positive for reason for mismatch,
|
|
788
|
+
// reasons match codes for X509_verify_cert()
|
|
798
789
|
|
|
799
|
-
int X509_check_issued(X509 *issuer, X509 *subject)
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
790
|
+
int X509_check_issued(X509 *issuer, X509 *subject) {
|
|
791
|
+
if (X509_NAME_cmp(X509_get_subject_name(issuer),
|
|
792
|
+
X509_get_issuer_name(subject))) {
|
|
793
|
+
return X509_V_ERR_SUBJECT_ISSUER_MISMATCH;
|
|
794
|
+
}
|
|
795
|
+
if (!x509v3_cache_extensions(issuer) || !x509v3_cache_extensions(subject)) {
|
|
796
|
+
return X509_V_ERR_UNSPECIFIED;
|
|
797
|
+
}
|
|
808
798
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
799
|
+
if (subject->akid) {
|
|
800
|
+
int ret = X509_check_akid(issuer, subject->akid);
|
|
801
|
+
if (ret != X509_V_OK) {
|
|
802
|
+
return ret;
|
|
813
803
|
}
|
|
804
|
+
}
|
|
814
805
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
return
|
|
806
|
+
if (subject->ex_flags & EXFLAG_PROXY) {
|
|
807
|
+
if (ku_reject(issuer, KU_DIGITAL_SIGNATURE)) {
|
|
808
|
+
return X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE;
|
|
809
|
+
}
|
|
810
|
+
} else if (ku_reject(issuer, KU_KEY_CERT_SIGN)) {
|
|
811
|
+
return X509_V_ERR_KEYUSAGE_NO_CERTSIGN;
|
|
812
|
+
}
|
|
813
|
+
return X509_V_OK;
|
|
821
814
|
}
|
|
822
815
|
|
|
823
|
-
int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid)
|
|
824
|
-
{
|
|
825
|
-
|
|
826
|
-
if (!akid)
|
|
827
|
-
return X509_V_OK;
|
|
828
|
-
|
|
829
|
-
/* Check key ids (if present) */
|
|
830
|
-
if (akid->keyid && issuer->skid &&
|
|
831
|
-
ASN1_OCTET_STRING_cmp(akid->keyid, issuer->skid))
|
|
832
|
-
return X509_V_ERR_AKID_SKID_MISMATCH;
|
|
833
|
-
/* Check serial number */
|
|
834
|
-
if (akid->serial &&
|
|
835
|
-
ASN1_INTEGER_cmp(X509_get_serialNumber(issuer), akid->serial))
|
|
836
|
-
return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
|
|
837
|
-
/* Check issuer name */
|
|
838
|
-
if (akid->issuer) {
|
|
839
|
-
/*
|
|
840
|
-
* Ugh, for some peculiar reason AKID includes SEQUENCE OF
|
|
841
|
-
* GeneralName. So look for a DirName. There may be more than one but
|
|
842
|
-
* we only take any notice of the first.
|
|
843
|
-
*/
|
|
844
|
-
GENERAL_NAMES *gens;
|
|
845
|
-
GENERAL_NAME *gen;
|
|
846
|
-
X509_NAME *nm = NULL;
|
|
847
|
-
size_t i;
|
|
848
|
-
gens = akid->issuer;
|
|
849
|
-
for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) {
|
|
850
|
-
gen = sk_GENERAL_NAME_value(gens, i);
|
|
851
|
-
if (gen->type == GEN_DIRNAME) {
|
|
852
|
-
nm = gen->d.dirn;
|
|
853
|
-
break;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
if (nm && X509_NAME_cmp(nm, X509_get_issuer_name(issuer)))
|
|
857
|
-
return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
|
|
858
|
-
}
|
|
816
|
+
int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid) {
|
|
817
|
+
if (!akid) {
|
|
859
818
|
return X509_V_OK;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// Check key ids (if present)
|
|
822
|
+
if (akid->keyid && issuer->skid &&
|
|
823
|
+
ASN1_OCTET_STRING_cmp(akid->keyid, issuer->skid)) {
|
|
824
|
+
return X509_V_ERR_AKID_SKID_MISMATCH;
|
|
825
|
+
}
|
|
826
|
+
// Check serial number
|
|
827
|
+
if (akid->serial &&
|
|
828
|
+
ASN1_INTEGER_cmp(X509_get_serialNumber(issuer), akid->serial)) {
|
|
829
|
+
return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
|
|
830
|
+
}
|
|
831
|
+
// Check issuer name
|
|
832
|
+
if (akid->issuer) {
|
|
833
|
+
// Ugh, for some peculiar reason AKID includes SEQUENCE OF
|
|
834
|
+
// GeneralName. So look for a DirName. There may be more than one but
|
|
835
|
+
// we only take any notice of the first.
|
|
836
|
+
GENERAL_NAMES *gens;
|
|
837
|
+
GENERAL_NAME *gen;
|
|
838
|
+
X509_NAME *nm = NULL;
|
|
839
|
+
size_t i;
|
|
840
|
+
gens = akid->issuer;
|
|
841
|
+
for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) {
|
|
842
|
+
gen = sk_GENERAL_NAME_value(gens, i);
|
|
843
|
+
if (gen->type == GEN_DIRNAME) {
|
|
844
|
+
nm = gen->d.dirn;
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
if (nm && X509_NAME_cmp(nm, X509_get_issuer_name(issuer))) {
|
|
849
|
+
return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return X509_V_OK;
|
|
860
853
|
}
|
|
861
854
|
|
|
862
|
-
uint32_t X509_get_extension_flags(X509 *x)
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
return x->ex_flags;
|
|
855
|
+
uint32_t X509_get_extension_flags(X509 *x) {
|
|
856
|
+
// Ignore the return value. On failure, |x->ex_flags| will include
|
|
857
|
+
// |EXFLAG_INVALID|.
|
|
858
|
+
x509v3_cache_extensions(x);
|
|
859
|
+
return x->ex_flags;
|
|
868
860
|
}
|
|
869
861
|
|
|
870
|
-
uint32_t X509_get_key_usage(X509 *x)
|
|
871
|
-
{
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
862
|
+
uint32_t X509_get_key_usage(X509 *x) {
|
|
863
|
+
if (!x509v3_cache_extensions(x)) {
|
|
864
|
+
return 0;
|
|
865
|
+
}
|
|
866
|
+
if (x->ex_flags & EXFLAG_KUSAGE) {
|
|
867
|
+
return x->ex_kusage;
|
|
868
|
+
}
|
|
869
|
+
return UINT32_MAX;
|
|
878
870
|
}
|
|
879
871
|
|
|
880
|
-
uint32_t X509_get_extended_key_usage(X509 *x)
|
|
881
|
-
{
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
872
|
+
uint32_t X509_get_extended_key_usage(X509 *x) {
|
|
873
|
+
if (!x509v3_cache_extensions(x)) {
|
|
874
|
+
return 0;
|
|
875
|
+
}
|
|
876
|
+
if (x->ex_flags & EXFLAG_XKUSAGE) {
|
|
877
|
+
return x->ex_xkusage;
|
|
878
|
+
}
|
|
879
|
+
return UINT32_MAX;
|
|
888
880
|
}
|
|
889
881
|
|
|
890
|
-
const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x509)
|
|
891
|
-
{
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
return x509->skid;
|
|
882
|
+
const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x509) {
|
|
883
|
+
if (!x509v3_cache_extensions(x509)) {
|
|
884
|
+
return NULL;
|
|
885
|
+
}
|
|
886
|
+
return x509->skid;
|
|
896
887
|
}
|
|
897
888
|
|
|
898
|
-
const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x509)
|
|
899
|
-
{
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
return x509->akid != NULL ? x509->akid->keyid : NULL;
|
|
889
|
+
const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x509) {
|
|
890
|
+
if (!x509v3_cache_extensions(x509)) {
|
|
891
|
+
return NULL;
|
|
892
|
+
}
|
|
893
|
+
return x509->akid != NULL ? x509->akid->keyid : NULL;
|
|
904
894
|
}
|
|
905
895
|
|
|
906
|
-
const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x509)
|
|
907
|
-
{
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
return x509->akid != NULL ? x509->akid->issuer : NULL;
|
|
896
|
+
const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x509) {
|
|
897
|
+
if (!x509v3_cache_extensions(x509)) {
|
|
898
|
+
return NULL;
|
|
899
|
+
}
|
|
900
|
+
return x509->akid != NULL ? x509->akid->issuer : NULL;
|
|
912
901
|
}
|
|
913
902
|
|
|
914
|
-
const ASN1_INTEGER *X509_get0_authority_serial(X509 *x509)
|
|
915
|
-
{
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
return x509->akid != NULL ? x509->akid->serial : NULL;
|
|
903
|
+
const ASN1_INTEGER *X509_get0_authority_serial(X509 *x509) {
|
|
904
|
+
if (!x509v3_cache_extensions(x509)) {
|
|
905
|
+
return NULL;
|
|
906
|
+
}
|
|
907
|
+
return x509->akid != NULL ? x509->akid->serial : NULL;
|
|
920
908
|
}
|
|
921
909
|
|
|
922
|
-
long X509_get_pathlen(X509 *x509)
|
|
923
|
-
{
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
}
|
|
928
|
-
return x509->ex_pathlen;
|
|
910
|
+
long X509_get_pathlen(X509 *x509) {
|
|
911
|
+
if (!x509v3_cache_extensions(x509) || (x509->ex_flags & EXFLAG_BCONS) == 0) {
|
|
912
|
+
return -1;
|
|
913
|
+
}
|
|
914
|
+
return x509->ex_pathlen;
|
|
929
915
|
}
|