@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
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* Hudson (tjh@cryptsoft.com). */
|
|
57
57
|
|
|
58
58
|
#if defined(__linux__) && !defined(_POSIX_C_SOURCE)
|
|
59
|
-
#define _POSIX_C_SOURCE 201410L
|
|
59
|
+
#define _POSIX_C_SOURCE 201410L // for gmtime_r
|
|
60
60
|
#endif
|
|
61
61
|
|
|
62
62
|
#include "internal.h"
|
|
@@ -77,7 +77,7 @@ struct tm *OPENSSL_gmtime(const time_t *time, struct tm *result) {
|
|
|
77
77
|
#endif
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
// Convert date to and from julian day Uses Fliegel & Van Flandern algorithm
|
|
81
81
|
static long date_to_julian(int y, int m, int d) {
|
|
82
82
|
return (1461 * (y + 4800 + (m - 14) / 12)) / 4 +
|
|
83
83
|
(367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 -
|
|
@@ -99,20 +99,20 @@ static void julian_to_date(long jd, int *y, int *m, int *d) {
|
|
|
99
99
|
*y = 100 * (n - 49) + i + L;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
// Convert tm structure and offset into julian day and seconds
|
|
103
103
|
static int julian_adj(const struct tm *tm, int off_day, long offset_sec,
|
|
104
104
|
long *pday, int *psec) {
|
|
105
105
|
int offset_hms, offset_day;
|
|
106
106
|
long time_jd;
|
|
107
107
|
int time_year, time_month, time_day;
|
|
108
|
-
|
|
108
|
+
// split offset into days and day seconds
|
|
109
109
|
offset_day = offset_sec / SECS_PER_DAY;
|
|
110
|
-
|
|
110
|
+
// Avoid sign issues with % operator
|
|
111
111
|
offset_hms = offset_sec - (offset_day * SECS_PER_DAY);
|
|
112
112
|
offset_day += off_day;
|
|
113
|
-
|
|
113
|
+
// Add current time seconds to offset
|
|
114
114
|
offset_hms += tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;
|
|
115
|
-
|
|
115
|
+
// Adjust day seconds if overflow
|
|
116
116
|
if (offset_hms >= SECS_PER_DAY) {
|
|
117
117
|
offset_day++;
|
|
118
118
|
offset_hms -= SECS_PER_DAY;
|
|
@@ -121,7 +121,7 @@ static int julian_adj(const struct tm *tm, int off_day, long offset_sec,
|
|
|
121
121
|
offset_hms += SECS_PER_DAY;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
// Convert date of time structure into a Julian day number.
|
|
125
125
|
|
|
126
126
|
time_year = tm->tm_year + 1900;
|
|
127
127
|
time_month = tm->tm_mon + 1;
|
|
@@ -129,7 +129,7 @@ static int julian_adj(const struct tm *tm, int off_day, long offset_sec,
|
|
|
129
129
|
|
|
130
130
|
time_jd = date_to_julian(time_year, time_month, time_day);
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
// Work out Julian day of new date
|
|
133
133
|
time_jd += offset_day;
|
|
134
134
|
|
|
135
135
|
if (time_jd < 0) {
|
|
@@ -145,12 +145,12 @@ int OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec) {
|
|
|
145
145
|
int time_sec, time_year, time_month, time_day;
|
|
146
146
|
long time_jd;
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
// Convert time and offset into julian day and seconds
|
|
149
149
|
if (!julian_adj(tm, off_day, offset_sec, &time_jd, &time_sec)) {
|
|
150
150
|
return 0;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
// Convert Julian day back to date
|
|
154
154
|
|
|
155
155
|
julian_to_date(time_jd, &time_year, &time_month, &time_day);
|
|
156
156
|
|
|
@@ -158,7 +158,7 @@ int OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec) {
|
|
|
158
158
|
return 0;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
// Update tm structure
|
|
162
162
|
|
|
163
163
|
tm->tm_year = time_year - 1900;
|
|
164
164
|
tm->tm_mon = time_month - 1;
|
|
@@ -185,7 +185,7 @@ int OPENSSL_gmtime_diff(int *out_days, int *out_secs, const struct tm *from,
|
|
|
185
185
|
|
|
186
186
|
diff_day = to_jd - from_jd;
|
|
187
187
|
diff_sec = to_sec - from_sec;
|
|
188
|
-
|
|
188
|
+
// Adjust differences so both positive or both negative
|
|
189
189
|
if (diff_day > 0 && diff_sec < 0) {
|
|
190
190
|
diff_day--;
|
|
191
191
|
diff_sec += SECS_PER_DAY;
|
|
@@ -117,7 +117,8 @@ static int closesocket(int sock) {
|
|
|
117
117
|
// split_host_and_port sets |*out_host| and |*out_port| to the host and port
|
|
118
118
|
// parsed from |name|. It returns one on success or zero on error. Even when
|
|
119
119
|
// successful, |*out_port| may be NULL on return if no port was specified.
|
|
120
|
-
static int split_host_and_port(char **out_host, char **out_port,
|
|
120
|
+
static int split_host_and_port(char **out_host, char **out_port,
|
|
121
|
+
const char *name) {
|
|
121
122
|
const char *host, *port = NULL;
|
|
122
123
|
size_t host_len = 0;
|
|
123
124
|
|
|
@@ -466,8 +467,7 @@ static long conn_ctrl(BIO *bio, int cmd, long num, void *ptr) {
|
|
|
466
467
|
case BIO_CTRL_FLUSH:
|
|
467
468
|
break;
|
|
468
469
|
case BIO_CTRL_GET_CALLBACK: {
|
|
469
|
-
int (**fptr)(const BIO *bio, int state, int xret);
|
|
470
|
-
fptr = (int (**)(const BIO *bio, int state, int xret))ptr;
|
|
470
|
+
int (**fptr)(const BIO *bio, int state, int xret) = ptr;
|
|
471
471
|
*fptr = data->info_callback;
|
|
472
472
|
} break;
|
|
473
473
|
default:
|
|
@@ -485,7 +485,13 @@ static long conn_callback_ctrl(BIO *bio, int cmd, bio_info_cb fp) {
|
|
|
485
485
|
|
|
486
486
|
switch (cmd) {
|
|
487
487
|
case BIO_CTRL_SET_CALLBACK:
|
|
488
|
+
// This is the actual type signature of |fp|. The caller is expected to
|
|
489
|
+
// cast it to |bio_info_cb| due to the |BIO_callback_ctrl| calling
|
|
490
|
+
// convention.
|
|
491
|
+
OPENSSL_MSVC_PRAGMA(warning(push))
|
|
492
|
+
OPENSSL_MSVC_PRAGMA(warning(disable : 4191))
|
|
488
493
|
data->info_callback = (int (*)(const struct bio_st *, int, int))fp;
|
|
494
|
+
OPENSSL_MSVC_PRAGMA(warning(pop))
|
|
489
495
|
break;
|
|
490
496
|
default:
|
|
491
497
|
ret = 0;
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
#include <openssl/crypto.h>
|
|
25
25
|
#include <openssl/span.h>
|
|
26
26
|
|
|
27
|
-
#include "internal.h"
|
|
28
27
|
#include "../internal.h"
|
|
29
28
|
#include "../test/test_util.h"
|
|
29
|
+
#include "internal.h"
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
TEST(CBSTest, Skip) {
|
|
@@ -1493,3 +1493,127 @@ TEST(CBBTest, Unicode) {
|
|
|
1493
1493
|
EXPECT_EQ(4u, cbb_get_utf8_len(0x10000));
|
|
1494
1494
|
EXPECT_EQ(4u, cbb_get_utf8_len(0x10ffff));
|
|
1495
1495
|
}
|
|
1496
|
+
|
|
1497
|
+
TEST(CBSTest, BogusTime) {
|
|
1498
|
+
static const struct {
|
|
1499
|
+
const char *timestring;
|
|
1500
|
+
} kBogusTimeTests[] = {
|
|
1501
|
+
{""},
|
|
1502
|
+
{"invalidtimesZ"},
|
|
1503
|
+
{"Z"},
|
|
1504
|
+
{"0000"},
|
|
1505
|
+
{"9999Z"},
|
|
1506
|
+
{"00000000000000000000000000000Z"},
|
|
1507
|
+
{"19491231235959"},
|
|
1508
|
+
{"500101000000.001Z"},
|
|
1509
|
+
{"500101000000+6"},
|
|
1510
|
+
{"-1970010100000Z"},
|
|
1511
|
+
{"7a0101000000Z"},
|
|
1512
|
+
{"20500101000000-6"},
|
|
1513
|
+
{"20500101000000.001"},
|
|
1514
|
+
{"20500229000000Z"},
|
|
1515
|
+
{"220229000000Z"},
|
|
1516
|
+
{"20500132000000Z"},
|
|
1517
|
+
{"220132000000Z"},
|
|
1518
|
+
{"20500332000000Z"},
|
|
1519
|
+
{"220332000000Z"},
|
|
1520
|
+
{"20500532000000Z"},
|
|
1521
|
+
{"220532000000Z"},
|
|
1522
|
+
{"20500732000000Z"},
|
|
1523
|
+
{"220732000000Z"},
|
|
1524
|
+
{"20500832000000Z"},
|
|
1525
|
+
{"220832000000Z"},
|
|
1526
|
+
{"20501032000000Z"},
|
|
1527
|
+
{"221032000000Z"},
|
|
1528
|
+
{"20501232000000Z"},
|
|
1529
|
+
{"221232000000Z"},
|
|
1530
|
+
{"20500431000000Z"},
|
|
1531
|
+
{"220431000000Z"},
|
|
1532
|
+
{"20500631000000Z"},
|
|
1533
|
+
{"220631000000Z"},
|
|
1534
|
+
{"20500931000000Z"},
|
|
1535
|
+
{"220931000000Z"},
|
|
1536
|
+
{"20501131000000Z"},
|
|
1537
|
+
{"221131000000Z"},
|
|
1538
|
+
{"20501100000000Z"},
|
|
1539
|
+
{"221100000000Z"},
|
|
1540
|
+
{"19500101000000+0600"},
|
|
1541
|
+
};
|
|
1542
|
+
for (const auto &t : kBogusTimeTests) {
|
|
1543
|
+
SCOPED_TRACE(t.timestring);
|
|
1544
|
+
CBS cbs;
|
|
1545
|
+
CBS_init(&cbs, (const uint8_t *)t.timestring, strlen(t.timestring));
|
|
1546
|
+
EXPECT_FALSE(CBS_parse_generalized_time(&cbs, NULL,
|
|
1547
|
+
/*allow_timezone_offset=*/0));
|
|
1548
|
+
EXPECT_FALSE(CBS_parse_utc_time(&cbs, NULL, /*allow_timezone_offset=*/1));
|
|
1549
|
+
}
|
|
1550
|
+
static const struct {
|
|
1551
|
+
const char *timestring;
|
|
1552
|
+
} kUTCTZTests[] = {
|
|
1553
|
+
{"480711220333-0700"},
|
|
1554
|
+
{"140704000000-0700"},
|
|
1555
|
+
{"480222202332-0500"},
|
|
1556
|
+
{"480726113216-0000"},
|
|
1557
|
+
{"480726113216-2359"},
|
|
1558
|
+
};
|
|
1559
|
+
for (const auto &t : kUTCTZTests) {
|
|
1560
|
+
SCOPED_TRACE(t.timestring);
|
|
1561
|
+
CBS cbs;
|
|
1562
|
+
CBS_init(&cbs, (const uint8_t *)t.timestring, strlen(t.timestring));
|
|
1563
|
+
EXPECT_FALSE(CBS_parse_generalized_time(&cbs, NULL,
|
|
1564
|
+
/*allow_timezone_offset=*/0));
|
|
1565
|
+
EXPECT_FALSE(CBS_parse_generalized_time(&cbs, NULL,
|
|
1566
|
+
/*allow_timezone_offset=*/1));
|
|
1567
|
+
EXPECT_TRUE(CBS_parse_utc_time(&cbs, NULL, /*allow_timezone_offset=*/1));
|
|
1568
|
+
EXPECT_FALSE(CBS_parse_utc_time(&cbs, NULL, /*allow_timezone_offset=*/0));
|
|
1569
|
+
}
|
|
1570
|
+
static const struct {
|
|
1571
|
+
const char *timestring;
|
|
1572
|
+
} kBogusUTCTZTests[] = {
|
|
1573
|
+
{"480711220333-0160"},
|
|
1574
|
+
{"140704000000-9999"},
|
|
1575
|
+
{"480222202332-2400"},
|
|
1576
|
+
};
|
|
1577
|
+
for (const auto &t : kBogusUTCTZTests) {
|
|
1578
|
+
SCOPED_TRACE(t.timestring);
|
|
1579
|
+
CBS cbs;
|
|
1580
|
+
CBS_init(&cbs, (const uint8_t *)t.timestring, strlen(t.timestring));
|
|
1581
|
+
EXPECT_FALSE(CBS_parse_generalized_time(&cbs, NULL,
|
|
1582
|
+
/*allow_timezone_offset=*/0));
|
|
1583
|
+
EXPECT_FALSE(CBS_parse_utc_time(&cbs, NULL, /*allow_timezone_offset=*/1));
|
|
1584
|
+
}
|
|
1585
|
+
static const struct {
|
|
1586
|
+
const char *timestring;
|
|
1587
|
+
} kGenTZTests[] = {
|
|
1588
|
+
{"20480711220333-0000"},
|
|
1589
|
+
{"20140704000000-0100"},
|
|
1590
|
+
{"20460311174630-0300"},
|
|
1591
|
+
{"20140704000000-2359"},
|
|
1592
|
+
};
|
|
1593
|
+
for (const auto &t : kGenTZTests) {
|
|
1594
|
+
SCOPED_TRACE(t.timestring);
|
|
1595
|
+
CBS cbs;
|
|
1596
|
+
CBS_init(&cbs, (const uint8_t *)t.timestring, strlen(t.timestring));
|
|
1597
|
+
EXPECT_FALSE(CBS_parse_generalized_time(&cbs, NULL,
|
|
1598
|
+
/*allow_timezone_offset=*/0));
|
|
1599
|
+
EXPECT_TRUE(CBS_parse_generalized_time(&cbs, NULL,
|
|
1600
|
+
/*allow_timezone_offset=*/1));
|
|
1601
|
+
EXPECT_FALSE(CBS_parse_utc_time(&cbs, NULL, /*allow_timezone_offset=*/1));
|
|
1602
|
+
EXPECT_FALSE(CBS_parse_utc_time(&cbs, NULL, /*allow_timezone_offset=*/0));
|
|
1603
|
+
}
|
|
1604
|
+
static const struct {
|
|
1605
|
+
const char *timestring;
|
|
1606
|
+
} kBogusGenTZTests[] = {
|
|
1607
|
+
{"20480222202332-2400"},
|
|
1608
|
+
{"20140704000000-9999"},
|
|
1609
|
+
{"20480726113216-0160"},
|
|
1610
|
+
};
|
|
1611
|
+
for (const auto &t : kBogusGenTZTests) {
|
|
1612
|
+
SCOPED_TRACE(t.timestring);
|
|
1613
|
+
CBS cbs;
|
|
1614
|
+
CBS_init(&cbs, (const uint8_t *)t.timestring, strlen(t.timestring));
|
|
1615
|
+
EXPECT_FALSE(CBS_parse_generalized_time(&cbs, NULL,
|
|
1616
|
+
/*allow_timezone_offset=*/0));
|
|
1617
|
+
EXPECT_FALSE(CBS_parse_utc_time(&cbs, NULL, /*allow_timezone_offset=*/1));
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
@@ -542,14 +542,11 @@ int CBB_add_asn1_int64(CBB *cbb, int64_t value) {
|
|
|
542
542
|
return CBB_add_asn1_uint64(cbb, value);
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
uint8_t bytes[sizeof(int64_t)];
|
|
548
|
-
} u;
|
|
549
|
-
u.i = value;
|
|
545
|
+
uint8_t bytes[sizeof(int64_t)];
|
|
546
|
+
memcpy(bytes, &value, sizeof(value));
|
|
550
547
|
int start = 7;
|
|
551
548
|
// Skip leading sign-extension bytes unless they are necessary.
|
|
552
|
-
while (start > 0 && (
|
|
549
|
+
while (start > 0 && (bytes[start] == 0xff && (bytes[start - 1] & 0x80))) {
|
|
553
550
|
start--;
|
|
554
551
|
}
|
|
555
552
|
|
|
@@ -558,7 +555,7 @@ int CBB_add_asn1_int64(CBB *cbb, int64_t value) {
|
|
|
558
555
|
return 0;
|
|
559
556
|
}
|
|
560
557
|
for (int i = start; i >= 0; i--) {
|
|
561
|
-
if (!CBB_add_u8(&child,
|
|
558
|
+
if (!CBB_add_u8(&child, bytes[i])) {
|
|
562
559
|
return 0;
|
|
563
560
|
}
|
|
564
561
|
}
|
|
@@ -12,15 +12,18 @@
|
|
|
12
12
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
13
13
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
|
14
14
|
|
|
15
|
-
#include <openssl/
|
|
15
|
+
#include <openssl/asn1.h>
|
|
16
16
|
#include <openssl/bytestring.h>
|
|
17
|
+
#include <openssl/mem.h>
|
|
17
18
|
|
|
18
19
|
#include <assert.h>
|
|
20
|
+
#include <ctype.h>
|
|
19
21
|
#include <inttypes.h>
|
|
20
22
|
#include <string.h>
|
|
21
23
|
|
|
22
|
-
#include "internal.h"
|
|
24
|
+
#include "../asn1/internal.h"
|
|
23
25
|
#include "../internal.h"
|
|
26
|
+
#include "internal.h"
|
|
24
27
|
|
|
25
28
|
|
|
26
29
|
void CBS_init(CBS *cbs, const uint8_t *data, size_t len) {
|
|
@@ -496,15 +499,12 @@ int CBS_get_asn1_int64(CBS *cbs, int64_t *out) {
|
|
|
496
499
|
if (len > sizeof(int64_t)) {
|
|
497
500
|
return 0;
|
|
498
501
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
uint8_t bytes[sizeof(int64_t)];
|
|
502
|
-
} u;
|
|
503
|
-
memset(u.bytes, is_negative ? 0xff : 0, sizeof(u.bytes)); // Sign-extend.
|
|
502
|
+
uint8_t sign_extend[sizeof(int64_t)];
|
|
503
|
+
memset(sign_extend, is_negative ? 0xff : 0, sizeof(sign_extend));
|
|
504
504
|
for (size_t i = 0; i < len; i++) {
|
|
505
|
-
|
|
505
|
+
sign_extend[i] = data[len - i - 1];
|
|
506
506
|
}
|
|
507
|
-
|
|
507
|
+
memcpy(out, sign_extend, sizeof(sign_extend));
|
|
508
508
|
return 1;
|
|
509
509
|
}
|
|
510
510
|
|
|
@@ -723,3 +723,161 @@ err:
|
|
|
723
723
|
CBB_cleanup(&cbb);
|
|
724
724
|
return NULL;
|
|
725
725
|
}
|
|
726
|
+
|
|
727
|
+
static int cbs_get_two_digits(CBS *cbs, int *out) {
|
|
728
|
+
uint8_t first_digit, second_digit;
|
|
729
|
+
if (!CBS_get_u8(cbs, &first_digit)) {
|
|
730
|
+
return 0;
|
|
731
|
+
}
|
|
732
|
+
if (!isdigit(first_digit)) {
|
|
733
|
+
return 0;
|
|
734
|
+
}
|
|
735
|
+
if (!CBS_get_u8(cbs, &second_digit)) {
|
|
736
|
+
return 0;
|
|
737
|
+
}
|
|
738
|
+
if (!isdigit(second_digit)) {
|
|
739
|
+
return 0;
|
|
740
|
+
}
|
|
741
|
+
*out = (first_digit - '0') * 10 + (second_digit - '0');
|
|
742
|
+
return 1;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
static int is_valid_day(int year, int month, int day) {
|
|
746
|
+
if (day < 1) {
|
|
747
|
+
return 0;
|
|
748
|
+
}
|
|
749
|
+
switch (month) {
|
|
750
|
+
case 1:
|
|
751
|
+
case 3:
|
|
752
|
+
case 5:
|
|
753
|
+
case 7:
|
|
754
|
+
case 8:
|
|
755
|
+
case 10:
|
|
756
|
+
case 12:
|
|
757
|
+
return day <= 31;
|
|
758
|
+
case 4:
|
|
759
|
+
case 6:
|
|
760
|
+
case 9:
|
|
761
|
+
case 11:
|
|
762
|
+
return day <= 30;
|
|
763
|
+
case 2:
|
|
764
|
+
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
|
|
765
|
+
return day <= 29;
|
|
766
|
+
} else {
|
|
767
|
+
return day <= 28;
|
|
768
|
+
}
|
|
769
|
+
default:
|
|
770
|
+
return 0;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
static int CBS_parse_rfc5280_time_internal(const CBS *cbs, int is_gentime,
|
|
775
|
+
int allow_timezone_offset,
|
|
776
|
+
struct tm *out_tm) {
|
|
777
|
+
int year, month, day, hour, min, sec, tmp;
|
|
778
|
+
CBS copy = *cbs;
|
|
779
|
+
uint8_t tz;
|
|
780
|
+
|
|
781
|
+
if (is_gentime) {
|
|
782
|
+
if (!cbs_get_two_digits(©, &tmp)) {
|
|
783
|
+
return 0;
|
|
784
|
+
}
|
|
785
|
+
year = tmp * 100;
|
|
786
|
+
if (!cbs_get_two_digits(©, &tmp)) {
|
|
787
|
+
return 0;
|
|
788
|
+
}
|
|
789
|
+
year += tmp;
|
|
790
|
+
} else {
|
|
791
|
+
year = 1900;
|
|
792
|
+
if (!cbs_get_two_digits(©, &tmp)) {
|
|
793
|
+
return 0;
|
|
794
|
+
}
|
|
795
|
+
year += tmp;
|
|
796
|
+
if (year < 1950) {
|
|
797
|
+
year += 100;
|
|
798
|
+
}
|
|
799
|
+
if (year >= 2050) {
|
|
800
|
+
return 0; // A Generalized time must be used.
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
if (!cbs_get_two_digits(©, &month) || month < 1 ||
|
|
804
|
+
month > 12 || // Reject invalid months.
|
|
805
|
+
!cbs_get_two_digits(©, &day) ||
|
|
806
|
+
!is_valid_day(year, month, day) || // Reject invalid days.
|
|
807
|
+
!cbs_get_two_digits(©, &hour) ||
|
|
808
|
+
hour > 23 || // Reject invalid hours.
|
|
809
|
+
!cbs_get_two_digits(©, &min) ||
|
|
810
|
+
min > 59 || // Reject invalid minutes.
|
|
811
|
+
!cbs_get_two_digits(©, &sec) || sec > 59 || !CBS_get_u8(©, &tz)) {
|
|
812
|
+
return 0;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
int offset_sign = 0;
|
|
816
|
+
switch (tz) {
|
|
817
|
+
case 'Z':
|
|
818
|
+
break; // We correctly have 'Z' on the end as per spec.
|
|
819
|
+
case '+':
|
|
820
|
+
offset_sign = 1;
|
|
821
|
+
break; // Should not be allowed per RFC 5280.
|
|
822
|
+
case '-':
|
|
823
|
+
offset_sign = -1;
|
|
824
|
+
break; // Should not be allowed per RFC 5280.
|
|
825
|
+
default:
|
|
826
|
+
return 0; // Reject anything else after the time.
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// If allow_timezone_offset is non-zero, allow for a four digit timezone
|
|
830
|
+
// offset to be specified even though this is not allowed by RFC 5280. We are
|
|
831
|
+
// permissive of this for UTCTimes due to the unfortunate existence of
|
|
832
|
+
// artisinally rolled long lived certificates that were baked into places that
|
|
833
|
+
// are now difficult to change. These certificates were generated with the
|
|
834
|
+
// 'openssl' command that permissively allowed the creation of certificates
|
|
835
|
+
// with notBefore and notAfter times specified as strings for direct
|
|
836
|
+
// certificate inclusion on the command line. For context see cl/237068815.
|
|
837
|
+
//
|
|
838
|
+
// TODO(bbe): This has been expunged from public web-pki as the ecosystem has
|
|
839
|
+
// managed to encourage CA compliance with standards. We should find a way to
|
|
840
|
+
// get rid of this or make it off by default.
|
|
841
|
+
int offset_seconds = 0;
|
|
842
|
+
if (offset_sign != 0) {
|
|
843
|
+
if (!allow_timezone_offset) {
|
|
844
|
+
return 0;
|
|
845
|
+
}
|
|
846
|
+
int offset_hours, offset_minutes;
|
|
847
|
+
if (!cbs_get_two_digits(©, &offset_hours) ||
|
|
848
|
+
offset_hours > 23 || // Reject invalid hours.
|
|
849
|
+
!cbs_get_two_digits(©, &offset_minutes) ||
|
|
850
|
+
offset_minutes > 59) { // Reject invalid minutes.
|
|
851
|
+
return 0;
|
|
852
|
+
}
|
|
853
|
+
offset_seconds = offset_sign * (offset_hours * 3600 + offset_minutes * 60);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
if (CBS_len(©) != 0) {
|
|
857
|
+
return 0; // Reject invalid lengths.
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
if (out_tm != NULL) {
|
|
861
|
+
// Fill in the tm fields corresponding to what we validated.
|
|
862
|
+
out_tm->tm_year = year - 1900;
|
|
863
|
+
out_tm->tm_mon = month - 1;
|
|
864
|
+
out_tm->tm_mday = day;
|
|
865
|
+
out_tm->tm_hour = hour;
|
|
866
|
+
out_tm->tm_min = min;
|
|
867
|
+
out_tm->tm_sec = sec;
|
|
868
|
+
if (offset_seconds && !OPENSSL_gmtime_adj(out_tm, 0, offset_seconds)) {
|
|
869
|
+
return 0;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
return 1;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
int CBS_parse_generalized_time(const CBS *cbs, struct tm *out_tm,
|
|
876
|
+
int allow_timezone_offset) {
|
|
877
|
+
return CBS_parse_rfc5280_time_internal(cbs, 1, allow_timezone_offset, out_tm);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
int CBS_parse_utc_time(const CBS *cbs, struct tm *out_tm,
|
|
881
|
+
int allow_timezone_offset) {
|
|
882
|
+
return CBS_parse_rfc5280_time_internal(cbs, 0, allow_timezone_offset, out_tm);
|
|
883
|
+
}
|
|
@@ -38,11 +38,9 @@ struct aead_aes_ctr_hmac_sha256_ctx {
|
|
|
38
38
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
|
|
39
39
|
sizeof(struct aead_aes_ctr_hmac_sha256_ctx),
|
|
40
40
|
"AEAD state is too small");
|
|
41
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
42
41
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >=
|
|
43
42
|
alignof(struct aead_aes_ctr_hmac_sha256_ctx),
|
|
44
43
|
"AEAD state has insufficient alignment");
|
|
45
|
-
#endif
|
|
46
44
|
|
|
47
45
|
static void hmac_init(SHA256_CTX *out_inner, SHA256_CTX *out_outer,
|
|
48
46
|
const uint8_t hmac_key[32]) {
|
|
@@ -45,10 +45,8 @@ struct aead_aes_gcm_siv_asm_ctx {
|
|
|
45
45
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) + 8 >=
|
|
46
46
|
sizeof(struct aead_aes_gcm_siv_asm_ctx),
|
|
47
47
|
"AEAD state is too small");
|
|
48
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
49
48
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >= 8,
|
|
50
49
|
"AEAD state has insufficient alignment");
|
|
51
|
-
#endif
|
|
52
50
|
|
|
53
51
|
// asm_ctx_from_ctx returns a 16-byte aligned context pointer from |ctx|.
|
|
54
52
|
static struct aead_aes_gcm_siv_asm_ctx *asm_ctx_from_ctx(
|
|
@@ -262,17 +260,10 @@ static void gcm_siv_asm_polyval(uint8_t out_tag[16], const uint8_t *in,
|
|
|
262
260
|
aesgcmsiv_polyval_horner(out_tag, auth_key, scratch, 1);
|
|
263
261
|
}
|
|
264
262
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
uint64_t in;
|
|
270
|
-
} bitlens;
|
|
271
|
-
} length_block;
|
|
272
|
-
|
|
273
|
-
length_block.bitlens.ad = ad_len * 8;
|
|
274
|
-
length_block.bitlens.in = in_len * 8;
|
|
275
|
-
aesgcmsiv_polyval_horner(out_tag, auth_key, length_block.c, 1);
|
|
263
|
+
uint8_t length_block[16];
|
|
264
|
+
CRYPTO_store_u64_le(length_block, ad_len * 8);
|
|
265
|
+
CRYPTO_store_u64_le(length_block + 8, in_len * 8);
|
|
266
|
+
aesgcmsiv_polyval_horner(out_tag, auth_key, length_block, 1);
|
|
276
267
|
|
|
277
268
|
for (size_t i = 0; i < 12; i++) {
|
|
278
269
|
out_tag[i] ^= nonce[i];
|
|
@@ -289,18 +280,15 @@ static void aead_aes_gcm_siv_asm_crypt_last_block(
|
|
|
289
280
|
int is_128_bit, uint8_t *out, const uint8_t *in, size_t in_len,
|
|
290
281
|
const uint8_t tag[16],
|
|
291
282
|
const struct aead_aes_gcm_siv_asm_ctx *enc_key_expanded) {
|
|
292
|
-
alignas(16)
|
|
293
|
-
uint8_t c[16];
|
|
294
|
-
uint32_t u32[4];
|
|
295
|
-
} counter;
|
|
283
|
+
alignas(16) uint8_t counter[16];
|
|
296
284
|
OPENSSL_memcpy(&counter, tag, sizeof(counter));
|
|
297
|
-
counter
|
|
298
|
-
counter
|
|
285
|
+
counter[15] |= 0x80;
|
|
286
|
+
CRYPTO_store_u32_le(counter, CRYPTO_load_u32_le(counter) + in_len / 16);
|
|
299
287
|
|
|
300
288
|
if (is_128_bit) {
|
|
301
|
-
aes128gcmsiv_ecb_enc_block(
|
|
289
|
+
aes128gcmsiv_ecb_enc_block(counter, counter, enc_key_expanded);
|
|
302
290
|
} else {
|
|
303
|
-
aes256gcmsiv_ecb_enc_block(
|
|
291
|
+
aes256gcmsiv_ecb_enc_block(counter, counter, enc_key_expanded);
|
|
304
292
|
}
|
|
305
293
|
|
|
306
294
|
const size_t last_bytes_offset = in_len & ~15;
|
|
@@ -308,7 +296,7 @@ static void aead_aes_gcm_siv_asm_crypt_last_block(
|
|
|
308
296
|
uint8_t *last_bytes_out = &out[last_bytes_offset];
|
|
309
297
|
const uint8_t *last_bytes_in = &in[last_bytes_offset];
|
|
310
298
|
for (size_t i = 0; i < last_bytes_len; i++) {
|
|
311
|
-
last_bytes_out[i] = last_bytes_in[i] ^ counter
|
|
299
|
+
last_bytes_out[i] = last_bytes_in[i] ^ counter[i];
|
|
312
300
|
}
|
|
313
301
|
}
|
|
314
302
|
|
|
@@ -489,18 +477,11 @@ static int aead_aes_gcm_siv_asm_open(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
|
|
489
477
|
scratch, 1);
|
|
490
478
|
}
|
|
491
479
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
uint64_t ad;
|
|
496
|
-
uint64_t in;
|
|
497
|
-
} bitlens;
|
|
498
|
-
} length_block;
|
|
499
|
-
|
|
500
|
-
length_block.bitlens.ad = ad_len * 8;
|
|
501
|
-
length_block.bitlens.in = plaintext_len * 8;
|
|
480
|
+
uint8_t length_block[16];
|
|
481
|
+
CRYPTO_store_u64_le(length_block, ad_len * 8);
|
|
482
|
+
CRYPTO_store_u64_le(length_block + 8, plaintext_len * 8);
|
|
502
483
|
aesgcmsiv_polyval_horner(calculated_tag, (const uint8_t *)record_auth_key,
|
|
503
|
-
length_block
|
|
484
|
+
length_block, 1);
|
|
504
485
|
|
|
505
486
|
for (size_t i = 0; i < 12; i++) {
|
|
506
487
|
calculated_tag[i] ^= nonce[i];
|
|
@@ -572,11 +553,9 @@ struct aead_aes_gcm_siv_ctx {
|
|
|
572
553
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
|
|
573
554
|
sizeof(struct aead_aes_gcm_siv_ctx),
|
|
574
555
|
"AEAD state is too small");
|
|
575
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
576
556
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >=
|
|
577
557
|
alignof(struct aead_aes_gcm_siv_ctx),
|
|
578
558
|
"AEAD state has insufficient alignment");
|
|
579
|
-
#endif
|
|
580
559
|
|
|
581
560
|
static int aead_aes_gcm_siv_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
|
582
561
|
size_t key_len, size_t tag_len) {
|
|
@@ -619,18 +598,15 @@ static void aead_aes_gcm_siv_cleanup(EVP_AEAD_CTX *ctx) {}
|
|
|
619
598
|
static void gcm_siv_crypt(uint8_t *out, const uint8_t *in, size_t in_len,
|
|
620
599
|
const uint8_t initial_counter[AES_BLOCK_SIZE],
|
|
621
600
|
block128_f enc_block, const AES_KEY *key) {
|
|
622
|
-
|
|
623
|
-
uint32_t w[4];
|
|
624
|
-
uint8_t c[16];
|
|
625
|
-
} counter;
|
|
601
|
+
uint8_t counter[16];
|
|
626
602
|
|
|
627
|
-
OPENSSL_memcpy(counter
|
|
628
|
-
counter
|
|
603
|
+
OPENSSL_memcpy(counter, initial_counter, AES_BLOCK_SIZE);
|
|
604
|
+
counter[15] |= 0x80;
|
|
629
605
|
|
|
630
606
|
for (size_t done = 0; done < in_len;) {
|
|
631
607
|
uint8_t keystream[AES_BLOCK_SIZE];
|
|
632
|
-
enc_block(counter
|
|
633
|
-
counter
|
|
608
|
+
enc_block(counter, keystream, key);
|
|
609
|
+
CRYPTO_store_u32_le(counter, CRYPTO_load_u32_le(counter) + 1);
|
|
634
610
|
|
|
635
611
|
size_t todo = AES_BLOCK_SIZE;
|
|
636
612
|
if (in_len - done < todo) {
|
|
@@ -670,17 +646,10 @@ static void gcm_siv_polyval(
|
|
|
670
646
|
CRYPTO_POLYVAL_update_blocks(&polyval_ctx, scratch, sizeof(scratch));
|
|
671
647
|
}
|
|
672
648
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
uint64_t in;
|
|
678
|
-
} bitlens;
|
|
679
|
-
} length_block;
|
|
680
|
-
|
|
681
|
-
length_block.bitlens.ad = ad_len * 8;
|
|
682
|
-
length_block.bitlens.in = in_len * 8;
|
|
683
|
-
CRYPTO_POLYVAL_update_blocks(&polyval_ctx, length_block.c,
|
|
649
|
+
uint8_t length_block[16];
|
|
650
|
+
CRYPTO_store_u64_le(length_block, ad_len * 8);
|
|
651
|
+
CRYPTO_store_u64_le(length_block + 8, in_len * 8);
|
|
652
|
+
CRYPTO_POLYVAL_update_blocks(&polyval_ctx, length_block,
|
|
684
653
|
sizeof(length_block));
|
|
685
654
|
|
|
686
655
|
CRYPTO_POLYVAL_finish(&polyval_ctx, out_tag);
|
|
@@ -35,11 +35,9 @@ struct aead_chacha20_poly1305_ctx {
|
|
|
35
35
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
|
|
36
36
|
sizeof(struct aead_chacha20_poly1305_ctx),
|
|
37
37
|
"AEAD state is too small");
|
|
38
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
39
38
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >=
|
|
40
39
|
alignof(struct aead_chacha20_poly1305_ctx),
|
|
41
40
|
"AEAD state has insufficient alignment");
|
|
42
|
-
#endif
|
|
43
41
|
|
|
44
42
|
static int aead_chacha20_poly1305_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
|
45
43
|
size_t key_len, size_t tag_len) {
|
|
@@ -48,11 +48,9 @@ OPENSSL_STATIC_ASSERT(EVP_MAX_MD_SIZE < 256,
|
|
|
48
48
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
|
|
49
49
|
sizeof(AEAD_TLS_CTX),
|
|
50
50
|
"AEAD state is too small");
|
|
51
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
52
51
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >=
|
|
53
52
|
alignof(AEAD_TLS_CTX),
|
|
54
53
|
"AEAD state has insufficient alignment");
|
|
55
|
-
#endif
|
|
56
54
|
|
|
57
55
|
static void aead_tls_cleanup(EVP_AEAD_CTX *ctx) {
|
|
58
56
|
AEAD_TLS_CTX *tls_ctx = (AEAD_TLS_CTX *)&ctx->state;
|