@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
|
@@ -99,16 +99,13 @@ static void vpaes_ctr32_encrypt_blocks_with_bsaes(const uint8_t *in,
|
|
|
99
99
|
out += 16 * bsaes_blocks;
|
|
100
100
|
blocks -= bsaes_blocks;
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
memcpy(new_ivec.u8, ivec, 16);
|
|
107
|
-
uint32_t ctr = CRYPTO_bswap4(new_ivec.u32[3]) + bsaes_blocks;
|
|
108
|
-
new_ivec.u32[3] = CRYPTO_bswap4(ctr);
|
|
102
|
+
uint8_t new_ivec[16];
|
|
103
|
+
memcpy(new_ivec, ivec, 12);
|
|
104
|
+
uint32_t ctr = CRYPTO_load_u32_be(ivec + 12) + bsaes_blocks;
|
|
105
|
+
CRYPTO_store_u32_be(new_ivec + 12, ctr);
|
|
109
106
|
|
|
110
107
|
// Finish any remaining blocks with |vpaes_ctr32_encrypt_blocks|.
|
|
111
|
-
vpaes_ctr32_encrypt_blocks(in, out, blocks, key, new_ivec
|
|
108
|
+
vpaes_ctr32_encrypt_blocks(in, out, blocks, key, new_ivec);
|
|
112
109
|
}
|
|
113
110
|
#endif // BSAES
|
|
114
111
|
|
|
@@ -338,11 +335,9 @@ ctr128_f aes_ctr_set_key(AES_KEY *aes_key, GCM128_KEY *gcm_key,
|
|
|
338
335
|
#endif
|
|
339
336
|
|
|
340
337
|
static EVP_AES_GCM_CTX *aes_gcm_from_cipher_ctx(EVP_CIPHER_CTX *ctx) {
|
|
341
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
342
338
|
OPENSSL_STATIC_ASSERT(
|
|
343
339
|
alignof(EVP_AES_GCM_CTX) <= 16,
|
|
344
340
|
"EVP_AES_GCM_CTX needs more alignment than this function provides");
|
|
345
|
-
#endif
|
|
346
341
|
|
|
347
342
|
// |malloc| guarantees up to 4-byte alignment on 32-bit and 8-byte alignment
|
|
348
343
|
// on 64-bit systems, so we need to adjust to reach 16-byte alignment.
|
|
@@ -929,11 +924,9 @@ static int aead_aes_gcm_init_impl(struct aead_aes_gcm_ctx *gcm_ctx,
|
|
|
929
924
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
|
|
930
925
|
sizeof(struct aead_aes_gcm_ctx),
|
|
931
926
|
"AEAD state is too small");
|
|
932
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
933
927
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >=
|
|
934
928
|
alignof(struct aead_aes_gcm_ctx),
|
|
935
929
|
"AEAD state has insufficient alignment");
|
|
936
|
-
#endif
|
|
937
930
|
|
|
938
931
|
static int aead_aes_gcm_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
|
939
932
|
size_t key_len, size_t requested_tag_len) {
|
|
@@ -1269,11 +1262,9 @@ struct aead_aes_gcm_tls12_ctx {
|
|
|
1269
1262
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
|
|
1270
1263
|
sizeof(struct aead_aes_gcm_tls12_ctx),
|
|
1271
1264
|
"AEAD state is too small");
|
|
1272
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
1273
1265
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >=
|
|
1274
1266
|
alignof(struct aead_aes_gcm_tls12_ctx),
|
|
1275
1267
|
"AEAD state has insufficient alignment");
|
|
1276
|
-
#endif
|
|
1277
1268
|
|
|
1278
1269
|
static int aead_aes_gcm_tls12_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
|
1279
1270
|
size_t key_len, size_t requested_tag_len) {
|
|
@@ -1306,12 +1297,9 @@ static int aead_aes_gcm_tls12_seal_scatter(
|
|
|
1306
1297
|
}
|
|
1307
1298
|
|
|
1308
1299
|
// The given nonces must be strictly monotonically increasing.
|
|
1309
|
-
uint64_t given_counter
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
given_counter = CRYPTO_bswap8(given_counter);
|
|
1313
|
-
if (given_counter == UINT64_MAX ||
|
|
1314
|
-
given_counter < gcm_ctx->min_next_nonce) {
|
|
1300
|
+
uint64_t given_counter =
|
|
1301
|
+
CRYPTO_load_u64_be(nonce + nonce_len - sizeof(uint64_t));
|
|
1302
|
+
if (given_counter == UINT64_MAX || given_counter < gcm_ctx->min_next_nonce) {
|
|
1315
1303
|
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_INVALID_NONCE);
|
|
1316
1304
|
return 0;
|
|
1317
1305
|
}
|
|
@@ -1368,11 +1356,9 @@ struct aead_aes_gcm_tls13_ctx {
|
|
|
1368
1356
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
|
|
1369
1357
|
sizeof(struct aead_aes_gcm_tls13_ctx),
|
|
1370
1358
|
"AEAD state is too small");
|
|
1371
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
1372
1359
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >=
|
|
1373
1360
|
alignof(struct aead_aes_gcm_tls13_ctx),
|
|
1374
1361
|
"AEAD state has insufficient alignment");
|
|
1375
|
-
#endif
|
|
1376
1362
|
|
|
1377
1363
|
static int aead_aes_gcm_tls13_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
|
1378
1364
|
size_t key_len, size_t requested_tag_len) {
|
|
@@ -1408,10 +1394,8 @@ static int aead_aes_gcm_tls13_seal_scatter(
|
|
|
1408
1394
|
// The given nonces must be strictly monotonically increasing. See
|
|
1409
1395
|
// https://tools.ietf.org/html/rfc8446#section-5.3 for details of the TLS 1.3
|
|
1410
1396
|
// nonce construction.
|
|
1411
|
-
uint64_t given_counter
|
|
1412
|
-
|
|
1413
|
-
sizeof(given_counter));
|
|
1414
|
-
given_counter = CRYPTO_bswap8(given_counter);
|
|
1397
|
+
uint64_t given_counter =
|
|
1398
|
+
CRYPTO_load_u64_be(nonce + nonce_len - sizeof(uint64_t));
|
|
1415
1399
|
|
|
1416
1400
|
if (gcm_ctx->first) {
|
|
1417
1401
|
// In the first call the sequence number will be zero and therefore the
|
|
@@ -54,8 +54,9 @@
|
|
|
54
54
|
#include <openssl/err.h>
|
|
55
55
|
#include <openssl/mem.h>
|
|
56
56
|
|
|
57
|
-
#include "
|
|
57
|
+
#include "../delocate.h"
|
|
58
58
|
#include "../service_indicator/internal.h"
|
|
59
|
+
#include "internal.h"
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
struct ccm128_context {
|
|
@@ -278,11 +279,9 @@ struct aead_aes_ccm_ctx {
|
|
|
278
279
|
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *)NULL)->state) >=
|
|
279
280
|
sizeof(struct aead_aes_ccm_ctx),
|
|
280
281
|
"AEAD state is too small");
|
|
281
|
-
#if defined(__GNUC__) || defined(__clang__)
|
|
282
282
|
OPENSSL_STATIC_ASSERT(alignof(union evp_aead_ctx_st_state) >=
|
|
283
283
|
alignof(struct aead_aes_ccm_ctx),
|
|
284
284
|
"AEAD state has insufficient alignment");
|
|
285
|
-
#endif
|
|
286
285
|
|
|
287
286
|
static int aead_aes_ccm_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
|
288
287
|
size_t key_len, size_t tag_len, unsigned M,
|
|
@@ -277,11 +277,6 @@ static void ecp_nistz256_windowed_mul(const EC_GROUP *group, P256_POINT *r,
|
|
|
277
277
|
ecp_nistz256_point_add(r, r, &h);
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
typedef union {
|
|
281
|
-
P256_POINT p;
|
|
282
|
-
P256_POINT_AFFINE a;
|
|
283
|
-
} p256_point_union_t;
|
|
284
|
-
|
|
285
280
|
static crypto_word_t calc_first_wvalue(size_t *index, const uint8_t p_str[33]) {
|
|
286
281
|
static const size_t kWindowSize = 7;
|
|
287
282
|
static const crypto_word_t kMask = (1 << (7 /* kWindowSize */ + 1)) - 1;
|
|
@@ -318,8 +313,6 @@ static void ecp_nistz256_point_mul(const EC_GROUP *group, EC_RAW_POINT *r,
|
|
|
318
313
|
|
|
319
314
|
static void ecp_nistz256_point_mul_base(const EC_GROUP *group, EC_RAW_POINT *r,
|
|
320
315
|
const EC_SCALAR *scalar) {
|
|
321
|
-
alignas(32) p256_point_union_t t, p;
|
|
322
|
-
|
|
323
316
|
uint8_t p_str[33];
|
|
324
317
|
OPENSSL_memcpy(p_str, scalar->words, 32);
|
|
325
318
|
p_str[32] = 0;
|
|
@@ -328,33 +321,38 @@ static void ecp_nistz256_point_mul_base(const EC_GROUP *group, EC_RAW_POINT *r,
|
|
|
328
321
|
size_t index = 0;
|
|
329
322
|
crypto_word_t wvalue = calc_first_wvalue(&index, p_str);
|
|
330
323
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
324
|
+
alignas(32) P256_POINT_AFFINE t;
|
|
325
|
+
alignas(32) P256_POINT p;
|
|
326
|
+
ecp_nistz256_select_w7(&t, ecp_nistz256_precomputed[0], wvalue >> 1);
|
|
327
|
+
ecp_nistz256_neg(p.Z, t.Y);
|
|
328
|
+
copy_conditional(t.Y, p.Z, wvalue & 1);
|
|
334
329
|
|
|
335
|
-
// Convert |
|
|
336
|
-
// is infinity and |ONE| otherwise. |
|
|
330
|
+
// Convert |t| from affine to Jacobian coordinates. We set Z to zero if |t|
|
|
331
|
+
// is infinity and |ONE| otherwise. |t| was computed from the table, so it
|
|
337
332
|
// is infinity iff |wvalue >> 1| is zero.
|
|
338
|
-
|
|
339
|
-
|
|
333
|
+
OPENSSL_memcpy(p.X, t.X, sizeof(p.X));
|
|
334
|
+
OPENSSL_memcpy(p.Y, t.Y, sizeof(p.Y));
|
|
335
|
+
OPENSSL_memset(p.Z, 0, sizeof(p.Z));
|
|
336
|
+
copy_conditional(p.Z, ONE, is_not_zero(wvalue >> 1));
|
|
340
337
|
|
|
341
338
|
for (int i = 1; i < 37; i++) {
|
|
342
339
|
wvalue = calc_wvalue(&index, p_str);
|
|
343
340
|
|
|
344
|
-
ecp_nistz256_select_w7(&t
|
|
341
|
+
ecp_nistz256_select_w7(&t, ecp_nistz256_precomputed[i], wvalue >> 1);
|
|
345
342
|
|
|
346
|
-
|
|
347
|
-
|
|
343
|
+
alignas(32) BN_ULONG neg_Y[P256_LIMBS];
|
|
344
|
+
ecp_nistz256_neg(neg_Y, t.Y);
|
|
345
|
+
copy_conditional(t.Y, neg_Y, wvalue & 1);
|
|
348
346
|
|
|
349
|
-
// Note |ecp_nistz256_point_add_affine| does not work if |p
|
|
350
|
-
//
|
|
351
|
-
ecp_nistz256_point_add_affine(&p
|
|
347
|
+
// Note |ecp_nistz256_point_add_affine| does not work if |p| and |t| are the
|
|
348
|
+
// same non-infinity point.
|
|
349
|
+
ecp_nistz256_point_add_affine(&p, &p, &t);
|
|
352
350
|
}
|
|
353
351
|
|
|
354
352
|
assert(group->field.width == P256_LIMBS);
|
|
355
|
-
OPENSSL_memcpy(r->X.words, p.
|
|
356
|
-
OPENSSL_memcpy(r->Y.words, p.
|
|
357
|
-
OPENSSL_memcpy(r->Z.words, p.
|
|
353
|
+
OPENSSL_memcpy(r->X.words, p.X, P256_LIMBS * sizeof(BN_ULONG));
|
|
354
|
+
OPENSSL_memcpy(r->Y.words, p.Y, P256_LIMBS * sizeof(BN_ULONG));
|
|
355
|
+
OPENSSL_memcpy(r->Z.words, p.Z, P256_LIMBS * sizeof(BN_ULONG));
|
|
358
356
|
}
|
|
359
357
|
|
|
360
358
|
static void ecp_nistz256_points_mul_public(const EC_GROUP *group,
|
|
@@ -364,7 +362,7 @@ static void ecp_nistz256_points_mul_public(const EC_GROUP *group,
|
|
|
364
362
|
const EC_SCALAR *p_scalar) {
|
|
365
363
|
assert(p_ != NULL && p_scalar != NULL && g_scalar != NULL);
|
|
366
364
|
|
|
367
|
-
alignas(32)
|
|
365
|
+
alignas(32) P256_POINT p;
|
|
368
366
|
uint8_t p_str[33];
|
|
369
367
|
OPENSSL_memcpy(p_str, g_scalar->words, 32);
|
|
370
368
|
p_str[32] = 0;
|
|
@@ -377,45 +375,48 @@ static void ecp_nistz256_points_mul_public(const EC_GROUP *group,
|
|
|
377
375
|
// is infinity and |ONE| otherwise. |p| was computed from the table, so it
|
|
378
376
|
// is infinity iff |wvalue >> 1| is zero.
|
|
379
377
|
if ((wvalue >> 1) != 0) {
|
|
380
|
-
OPENSSL_memcpy(
|
|
381
|
-
sizeof(p.
|
|
382
|
-
OPENSSL_memcpy(
|
|
378
|
+
OPENSSL_memcpy(p.X, &ecp_nistz256_precomputed[0][(wvalue >> 1) - 1].X,
|
|
379
|
+
sizeof(p.X));
|
|
380
|
+
OPENSSL_memcpy(p.Y, &ecp_nistz256_precomputed[0][(wvalue >> 1) - 1].Y,
|
|
381
|
+
sizeof(p.Y));
|
|
382
|
+
OPENSSL_memcpy(p.Z, ONE, sizeof(p.Z));
|
|
383
383
|
} else {
|
|
384
|
-
OPENSSL_memset(
|
|
385
|
-
OPENSSL_memset(p.
|
|
384
|
+
OPENSSL_memset(p.X, 0, sizeof(p.X));
|
|
385
|
+
OPENSSL_memset(p.Y, 0, sizeof(p.Y));
|
|
386
|
+
OPENSSL_memset(p.Z, 0, sizeof(p.Z));
|
|
386
387
|
}
|
|
387
388
|
|
|
388
389
|
if ((wvalue & 1) == 1) {
|
|
389
|
-
ecp_nistz256_neg(p.
|
|
390
|
+
ecp_nistz256_neg(p.Y, p.Y);
|
|
390
391
|
}
|
|
391
392
|
|
|
392
393
|
for (int i = 1; i < 37; i++) {
|
|
393
394
|
wvalue = calc_wvalue(&index, p_str);
|
|
394
|
-
|
|
395
395
|
if ((wvalue >> 1) == 0) {
|
|
396
396
|
continue;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
399
|
+
alignas(32) P256_POINT_AFFINE t;
|
|
400
|
+
OPENSSL_memcpy(&t, &ecp_nistz256_precomputed[i][(wvalue >> 1) - 1],
|
|
401
|
+
sizeof(t));
|
|
402
402
|
if ((wvalue & 1) == 1) {
|
|
403
|
-
ecp_nistz256_neg(t.
|
|
403
|
+
ecp_nistz256_neg(t.Y, t.Y);
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
// Note |ecp_nistz256_point_add_affine| does not work if |p
|
|
407
|
-
//
|
|
406
|
+
// Note |ecp_nistz256_point_add_affine| does not work if |p| and |t| are
|
|
407
|
+
// the same non-infinity point, so it is important that we compute the
|
|
408
408
|
// |g_scalar| term before the |p_scalar| term.
|
|
409
|
-
ecp_nistz256_point_add_affine(&p
|
|
409
|
+
ecp_nistz256_point_add_affine(&p, &p, &t);
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
alignas(32) P256_POINT tmp;
|
|
413
|
+
ecp_nistz256_windowed_mul(group, &tmp, p_, p_scalar);
|
|
414
|
+
ecp_nistz256_point_add(&p, &p, &tmp);
|
|
414
415
|
|
|
415
416
|
assert(group->field.width == P256_LIMBS);
|
|
416
|
-
OPENSSL_memcpy(r->X.words, p.
|
|
417
|
-
OPENSSL_memcpy(r->Y.words, p.
|
|
418
|
-
OPENSSL_memcpy(r->Z.words, p.
|
|
417
|
+
OPENSSL_memcpy(r->X.words, p.X, P256_LIMBS * sizeof(BN_ULONG));
|
|
418
|
+
OPENSSL_memcpy(r->Y.words, p.Y, P256_LIMBS * sizeof(BN_ULONG));
|
|
419
|
+
OPENSSL_memcpy(r->Z.words, p.Z, P256_LIMBS * sizeof(BN_ULONG));
|
|
419
420
|
}
|
|
420
421
|
|
|
421
422
|
static int ecp_nistz256_get_affine(const EC_GROUP *group,
|
|
@@ -116,11 +116,7 @@ void CRYPTO_cbc128_decrypt(const uint8_t *in, uint8_t *out, size_t len,
|
|
|
116
116
|
assert(inptr >= outptr || inptr + len <= outptr);
|
|
117
117
|
|
|
118
118
|
size_t n;
|
|
119
|
-
|
|
120
|
-
crypto_word_t t[16 / sizeof(crypto_word_t)];
|
|
121
|
-
uint8_t c[16];
|
|
122
|
-
} tmp;
|
|
123
|
-
|
|
119
|
+
alignas(16) uint8_t tmp[16];
|
|
124
120
|
if ((inptr >= 32 && outptr <= inptr - 32) || inptr < outptr) {
|
|
125
121
|
// If |out| is at least two blocks behind |in| or completely disjoint, there
|
|
126
122
|
// is no need to decrypt to a temporary block.
|
|
@@ -144,10 +140,10 @@ void CRYPTO_cbc128_decrypt(const uint8_t *in, uint8_t *out, size_t len,
|
|
|
144
140
|
"block cannot be evenly divided into words");
|
|
145
141
|
|
|
146
142
|
while (len >= 16) {
|
|
147
|
-
(*block)(in, tmp
|
|
143
|
+
(*block)(in, tmp, key);
|
|
148
144
|
for (n = 0; n < 16; n += sizeof(crypto_word_t)) {
|
|
149
145
|
crypto_word_t c = CRYPTO_load_word_le(in + n);
|
|
150
|
-
CRYPTO_store_word_le(out + n, tmp
|
|
146
|
+
CRYPTO_store_word_le(out + n, CRYPTO_load_word_le(tmp + n) ^
|
|
151
147
|
CRYPTO_load_word_le(ivec + n));
|
|
152
148
|
CRYPTO_store_word_le(ivec + n, c);
|
|
153
149
|
}
|
|
@@ -159,10 +155,10 @@ void CRYPTO_cbc128_decrypt(const uint8_t *in, uint8_t *out, size_t len,
|
|
|
159
155
|
|
|
160
156
|
while (len) {
|
|
161
157
|
uint8_t c;
|
|
162
|
-
(*block)(in, tmp
|
|
158
|
+
(*block)(in, tmp, key);
|
|
163
159
|
for (n = 0; n < 16 && n < len; ++n) {
|
|
164
160
|
c = in[n];
|
|
165
|
-
out[n] = tmp
|
|
161
|
+
out[n] = tmp[n] ^ ivec[n];
|
|
166
162
|
ivec[n] = c;
|
|
167
163
|
}
|
|
168
164
|
if (len <= 16) {
|
|
@@ -137,76 +137,69 @@ void CRYPTO_ghash_init(gmult_func *out_mult, ghash_func *out_hash,
|
|
|
137
137
|
const uint8_t gcm_key[16]) {
|
|
138
138
|
*out_is_avx = 0;
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
OPENSSL_memcpy(H.c, gcm_key, 16);
|
|
146
|
-
|
|
147
|
-
// H is stored in host byte order
|
|
148
|
-
H.u[0] = CRYPTO_bswap8(H.u[0]);
|
|
149
|
-
H.u[1] = CRYPTO_bswap8(H.u[1]);
|
|
150
|
-
|
|
151
|
-
OPENSSL_memcpy(out_key, H.c, 16);
|
|
140
|
+
// H is stored in host byte order.
|
|
141
|
+
uint64_t H[2] = {CRYPTO_load_u64_be(gcm_key),
|
|
142
|
+
CRYPTO_load_u64_be(gcm_key + 8)};
|
|
143
|
+
out_key->hi = H[0];
|
|
144
|
+
out_key->lo = H[1];
|
|
152
145
|
|
|
153
146
|
#if defined(GHASH_ASM_X86_64)
|
|
154
147
|
if (crypto_gcm_clmul_enabled()) {
|
|
155
148
|
if (CRYPTO_is_AVX_capable() && CRYPTO_is_MOVBE_capable()) {
|
|
156
|
-
gcm_init_avx(out_table, H
|
|
149
|
+
gcm_init_avx(out_table, H);
|
|
157
150
|
*out_mult = gcm_gmult_avx;
|
|
158
151
|
*out_hash = gcm_ghash_avx;
|
|
159
152
|
*out_is_avx = 1;
|
|
160
153
|
return;
|
|
161
154
|
}
|
|
162
|
-
gcm_init_clmul(out_table, H
|
|
155
|
+
gcm_init_clmul(out_table, H);
|
|
163
156
|
*out_mult = gcm_gmult_clmul;
|
|
164
157
|
*out_hash = gcm_ghash_clmul;
|
|
165
158
|
return;
|
|
166
159
|
}
|
|
167
160
|
if (CRYPTO_is_SSSE3_capable()) {
|
|
168
|
-
gcm_init_ssse3(out_table, H
|
|
161
|
+
gcm_init_ssse3(out_table, H);
|
|
169
162
|
*out_mult = gcm_gmult_ssse3;
|
|
170
163
|
*out_hash = gcm_ghash_ssse3;
|
|
171
164
|
return;
|
|
172
165
|
}
|
|
173
166
|
#elif defined(GHASH_ASM_X86)
|
|
174
167
|
if (crypto_gcm_clmul_enabled()) {
|
|
175
|
-
gcm_init_clmul(out_table, H
|
|
168
|
+
gcm_init_clmul(out_table, H);
|
|
176
169
|
*out_mult = gcm_gmult_clmul;
|
|
177
170
|
*out_hash = gcm_ghash_clmul;
|
|
178
171
|
return;
|
|
179
172
|
}
|
|
180
173
|
if (CRYPTO_is_SSSE3_capable()) {
|
|
181
|
-
gcm_init_ssse3(out_table, H
|
|
174
|
+
gcm_init_ssse3(out_table, H);
|
|
182
175
|
*out_mult = gcm_gmult_ssse3;
|
|
183
176
|
*out_hash = gcm_ghash_ssse3;
|
|
184
177
|
return;
|
|
185
178
|
}
|
|
186
179
|
#elif defined(GHASH_ASM_ARM)
|
|
187
180
|
if (gcm_pmull_capable()) {
|
|
188
|
-
gcm_init_v8(out_table, H
|
|
181
|
+
gcm_init_v8(out_table, H);
|
|
189
182
|
*out_mult = gcm_gmult_v8;
|
|
190
183
|
*out_hash = gcm_ghash_v8;
|
|
191
184
|
return;
|
|
192
185
|
}
|
|
193
186
|
|
|
194
187
|
if (gcm_neon_capable()) {
|
|
195
|
-
gcm_init_neon(out_table, H
|
|
188
|
+
gcm_init_neon(out_table, H);
|
|
196
189
|
*out_mult = gcm_gmult_neon;
|
|
197
190
|
*out_hash = gcm_ghash_neon;
|
|
198
191
|
return;
|
|
199
192
|
}
|
|
200
193
|
#elif defined(GHASH_ASM_PPC64LE)
|
|
201
194
|
if (CRYPTO_is_PPC64LE_vcrypto_capable()) {
|
|
202
|
-
gcm_init_p8(out_table, H
|
|
195
|
+
gcm_init_p8(out_table, H);
|
|
203
196
|
*out_mult = gcm_gmult_p8;
|
|
204
197
|
*out_hash = gcm_ghash_p8;
|
|
205
198
|
return;
|
|
206
199
|
}
|
|
207
200
|
#endif
|
|
208
201
|
|
|
209
|
-
gcm_init_nohw(out_table, H
|
|
202
|
+
gcm_init_nohw(out_table, H);
|
|
210
203
|
*out_mult = gcm_gmult_nohw;
|
|
211
204
|
*out_hash = gcm_ghash_nohw;
|
|
212
205
|
}
|
|
@@ -59,7 +59,7 @@ int CTR_DRBG_init(CTR_DRBG_STATE *drbg,
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
drbg->ctr = aes_ctr_set_key(&drbg->ks, NULL, &drbg->block, seed_material, 32);
|
|
62
|
-
OPENSSL_memcpy(drbg->counter
|
|
62
|
+
OPENSSL_memcpy(drbg->counter, seed_material + 32, 16);
|
|
63
63
|
drbg->reseed_counter = 1;
|
|
64
64
|
|
|
65
65
|
return 1;
|
|
@@ -71,8 +71,8 @@ OPENSSL_STATIC_ASSERT(CTR_DRBG_ENTROPY_LEN % AES_BLOCK_SIZE == 0,
|
|
|
71
71
|
// ctr_inc adds |n| to the last four bytes of |drbg->counter|, treated as a
|
|
72
72
|
// big-endian number.
|
|
73
73
|
static void ctr32_add(CTR_DRBG_STATE *drbg, uint32_t n) {
|
|
74
|
-
drbg->counter
|
|
75
|
-
|
|
74
|
+
uint32_t ctr = CRYPTO_load_u32_be(drbg->counter + 12);
|
|
75
|
+
CRYPTO_store_u32_be(drbg->counter + 12, ctr + n);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
static int ctr_drbg_update(CTR_DRBG_STATE *drbg, const uint8_t *data,
|
|
@@ -87,7 +87,7 @@ static int ctr_drbg_update(CTR_DRBG_STATE *drbg, const uint8_t *data,
|
|
|
87
87
|
uint8_t temp[CTR_DRBG_ENTROPY_LEN];
|
|
88
88
|
for (size_t i = 0; i < CTR_DRBG_ENTROPY_LEN; i += AES_BLOCK_SIZE) {
|
|
89
89
|
ctr32_add(drbg, 1);
|
|
90
|
-
drbg->block(drbg->counter
|
|
90
|
+
drbg->block(drbg->counter, temp + i, &drbg->ks);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
for (size_t i = 0; i < data_len; i++) {
|
|
@@ -95,7 +95,7 @@ static int ctr_drbg_update(CTR_DRBG_STATE *drbg, const uint8_t *data,
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
drbg->ctr = aes_ctr_set_key(&drbg->ks, NULL, &drbg->block, temp, 32);
|
|
98
|
-
OPENSSL_memcpy(drbg->counter
|
|
98
|
+
OPENSSL_memcpy(drbg->counter, temp + 32, 16);
|
|
99
99
|
|
|
100
100
|
return 1;
|
|
101
101
|
}
|
|
@@ -167,12 +167,12 @@ int CTR_DRBG_generate(CTR_DRBG_STATE *drbg, uint8_t *out, size_t out_len,
|
|
|
167
167
|
if (drbg->ctr) {
|
|
168
168
|
OPENSSL_memset(out, 0, todo);
|
|
169
169
|
ctr32_add(drbg, 1);
|
|
170
|
-
drbg->ctr(out, out, num_blocks, &drbg->ks, drbg->counter
|
|
170
|
+
drbg->ctr(out, out, num_blocks, &drbg->ks, drbg->counter);
|
|
171
171
|
ctr32_add(drbg, num_blocks - 1);
|
|
172
172
|
} else {
|
|
173
173
|
for (size_t i = 0; i < todo; i += AES_BLOCK_SIZE) {
|
|
174
174
|
ctr32_add(drbg, 1);
|
|
175
|
-
drbg->block(drbg->counter
|
|
175
|
+
drbg->block(drbg->counter, out + i, &drbg->ks);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -183,7 +183,7 @@ int CTR_DRBG_generate(CTR_DRBG_STATE *drbg, uint8_t *out, size_t out_len,
|
|
|
183
183
|
if (out_len > 0) {
|
|
184
184
|
uint8_t block[AES_BLOCK_SIZE];
|
|
185
185
|
ctr32_add(drbg, 1);
|
|
186
|
-
drbg->block(drbg->counter
|
|
186
|
+
drbg->block(drbg->counter, block, &drbg->ks);
|
|
187
187
|
|
|
188
188
|
OPENSSL_memcpy(out, block, out_len);
|
|
189
189
|
}
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
#include <openssl/digest.h>
|
|
16
16
|
#include <openssl/err.h>
|
|
17
|
+
#include <openssl/evp.h>
|
|
17
18
|
#include <openssl/hkdf.h>
|
|
19
|
+
#include <openssl/kdf.h>
|
|
18
20
|
|
|
19
21
|
#include <gtest/gtest.h>
|
|
20
22
|
|
|
@@ -266,6 +268,108 @@ TEST(HKDFTest, TestVectors) {
|
|
|
266
268
|
test->ikm_len, test->salt, test->salt_len, test->info,
|
|
267
269
|
test->info_len));
|
|
268
270
|
EXPECT_EQ(Bytes(test->out, test->out_len), Bytes(buf, test->out_len));
|
|
271
|
+
|
|
272
|
+
// Repeat the test with the OpenSSL compatibility |EVP_PKEY_derive| API.
|
|
273
|
+
bssl::UniquePtr<EVP_PKEY_CTX> ctx(
|
|
274
|
+
EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, nullptr));
|
|
275
|
+
ASSERT_TRUE(ctx);
|
|
276
|
+
ASSERT_TRUE(EVP_PKEY_derive_init(ctx.get()));
|
|
277
|
+
ASSERT_TRUE(
|
|
278
|
+
EVP_PKEY_CTX_hkdf_mode(ctx.get(), EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY));
|
|
279
|
+
ASSERT_TRUE(EVP_PKEY_CTX_set_hkdf_md(ctx.get(), test->md_func()));
|
|
280
|
+
ASSERT_TRUE(
|
|
281
|
+
EVP_PKEY_CTX_set1_hkdf_key(ctx.get(), test->ikm, test->ikm_len));
|
|
282
|
+
ASSERT_TRUE(
|
|
283
|
+
EVP_PKEY_CTX_set1_hkdf_salt(ctx.get(), test->salt, test->salt_len));
|
|
284
|
+
for (bool copy_ctx : {false, true}) {
|
|
285
|
+
SCOPED_TRACE(copy_ctx);
|
|
286
|
+
bssl::UniquePtr<EVP_PKEY_CTX> copy;
|
|
287
|
+
EVP_PKEY_CTX *use_ctx = ctx.get();
|
|
288
|
+
if (copy_ctx) {
|
|
289
|
+
copy.reset(EVP_PKEY_CTX_dup(ctx.get()));
|
|
290
|
+
ASSERT_TRUE(copy);
|
|
291
|
+
use_ctx = copy.get();
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// A null output should report the length.
|
|
295
|
+
prk_len = 0;
|
|
296
|
+
ASSERT_TRUE(EVP_PKEY_derive(use_ctx, nullptr, &prk_len));
|
|
297
|
+
EXPECT_EQ(prk_len, test->prk_len);
|
|
298
|
+
|
|
299
|
+
// Too small of a buffer should cleanly fail.
|
|
300
|
+
prk_len = test->prk_len - 1;
|
|
301
|
+
EXPECT_FALSE(EVP_PKEY_derive(use_ctx, prk, &prk_len));
|
|
302
|
+
ERR_clear_error();
|
|
303
|
+
|
|
304
|
+
// Test the correct buffer size.
|
|
305
|
+
OPENSSL_memset(prk, 0, sizeof(prk));
|
|
306
|
+
prk_len = test->prk_len;
|
|
307
|
+
ASSERT_TRUE(EVP_PKEY_derive(use_ctx, prk, &prk_len));
|
|
308
|
+
EXPECT_EQ(Bytes(test->prk, test->prk_len), Bytes(prk, prk_len));
|
|
309
|
+
|
|
310
|
+
// Test a larger buffer than necessary.
|
|
311
|
+
OPENSSL_memset(prk, 0, sizeof(prk));
|
|
312
|
+
prk_len = test->prk_len + 1;
|
|
313
|
+
ASSERT_TRUE(EVP_PKEY_derive(use_ctx, prk, &prk_len));
|
|
314
|
+
EXPECT_EQ(Bytes(test->prk, test->prk_len), Bytes(prk, prk_len));
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
ctx.reset(EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, nullptr));
|
|
318
|
+
ASSERT_TRUE(ctx);
|
|
319
|
+
ASSERT_TRUE(EVP_PKEY_derive_init(ctx.get()));
|
|
320
|
+
ASSERT_TRUE(
|
|
321
|
+
EVP_PKEY_CTX_hkdf_mode(ctx.get(), EVP_PKEY_HKDEF_MODE_EXPAND_ONLY));
|
|
322
|
+
ASSERT_TRUE(EVP_PKEY_CTX_set_hkdf_md(ctx.get(), test->md_func()));
|
|
323
|
+
ASSERT_TRUE(
|
|
324
|
+
EVP_PKEY_CTX_set1_hkdf_key(ctx.get(), test->prk, test->prk_len));
|
|
325
|
+
// |info| can be passed in multiple parts.
|
|
326
|
+
size_t half = test->info_len / 2;
|
|
327
|
+
ASSERT_TRUE(EVP_PKEY_CTX_add1_hkdf_info(ctx.get(), test->info, half));
|
|
328
|
+
ASSERT_TRUE(EVP_PKEY_CTX_add1_hkdf_info(ctx.get(), test->info + half,
|
|
329
|
+
test->info_len - half));
|
|
330
|
+
for (bool copy_ctx : {false, true}) {
|
|
331
|
+
SCOPED_TRACE(copy_ctx);
|
|
332
|
+
bssl::UniquePtr<EVP_PKEY_CTX> copy;
|
|
333
|
+
EVP_PKEY_CTX *use_ctx = ctx.get();
|
|
334
|
+
if (copy_ctx) {
|
|
335
|
+
copy.reset(EVP_PKEY_CTX_dup(ctx.get()));
|
|
336
|
+
ASSERT_TRUE(copy);
|
|
337
|
+
use_ctx = copy.get();
|
|
338
|
+
}
|
|
339
|
+
OPENSSL_memset(buf, 0, sizeof(buf));
|
|
340
|
+
size_t len = test->out_len;
|
|
341
|
+
ASSERT_TRUE(EVP_PKEY_derive(use_ctx, buf, &len));
|
|
342
|
+
EXPECT_EQ(Bytes(test->out, test->out_len), Bytes(buf, len));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
ctx.reset(EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, nullptr));
|
|
346
|
+
ASSERT_TRUE(ctx);
|
|
347
|
+
ASSERT_TRUE(EVP_PKEY_derive_init(ctx.get()));
|
|
348
|
+
ASSERT_TRUE(EVP_PKEY_CTX_hkdf_mode(ctx.get(),
|
|
349
|
+
EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND));
|
|
350
|
+
ASSERT_TRUE(EVP_PKEY_CTX_set_hkdf_md(ctx.get(), test->md_func()));
|
|
351
|
+
ASSERT_TRUE(
|
|
352
|
+
EVP_PKEY_CTX_set1_hkdf_key(ctx.get(), test->ikm, test->ikm_len));
|
|
353
|
+
ASSERT_TRUE(
|
|
354
|
+
EVP_PKEY_CTX_set1_hkdf_salt(ctx.get(), test->salt, test->salt_len));
|
|
355
|
+
// |info| can be passed in multiple parts.
|
|
356
|
+
ASSERT_TRUE(EVP_PKEY_CTX_add1_hkdf_info(ctx.get(), test->info, half));
|
|
357
|
+
ASSERT_TRUE(EVP_PKEY_CTX_add1_hkdf_info(ctx.get(), test->info + half,
|
|
358
|
+
test->info_len - half));
|
|
359
|
+
for (bool copy_ctx : {false, true}) {
|
|
360
|
+
SCOPED_TRACE(copy_ctx);
|
|
361
|
+
bssl::UniquePtr<EVP_PKEY_CTX> copy;
|
|
362
|
+
EVP_PKEY_CTX *use_ctx = ctx.get();
|
|
363
|
+
if (copy_ctx) {
|
|
364
|
+
copy.reset(EVP_PKEY_CTX_dup(ctx.get()));
|
|
365
|
+
ASSERT_TRUE(copy);
|
|
366
|
+
use_ctx = copy.get();
|
|
367
|
+
}
|
|
368
|
+
OPENSSL_memset(buf, 0, sizeof(buf));
|
|
369
|
+
size_t len = test->out_len;
|
|
370
|
+
ASSERT_TRUE(EVP_PKEY_derive(use_ctx, buf, &len));
|
|
371
|
+
EXPECT_EQ(Bytes(test->out, test->out_len), Bytes(buf, len));
|
|
372
|
+
}
|
|
269
373
|
}
|
|
270
374
|
}
|
|
271
375
|
|
|
@@ -126,7 +126,9 @@
|
|
|
126
126
|
#endif
|
|
127
127
|
|
|
128
128
|
#if !defined(__cplusplus)
|
|
129
|
-
#if defined(
|
|
129
|
+
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
|
130
|
+
#include <stdalign.h>
|
|
131
|
+
#elif defined(_MSC_VER) && !defined(__clang__)
|
|
130
132
|
#define alignas(x) __declspec(align(x))
|
|
131
133
|
#define alignof __alignof
|
|
132
134
|
#else
|
|
@@ -135,11 +137,13 @@
|
|
|
135
137
|
// compilers have long implemented C11 and made it default. The most likely
|
|
136
138
|
// cause of pre-C11 modes is stale -std=c99 or -std=gnu99 flags in build
|
|
137
139
|
// configuration. Such flags can be removed.
|
|
138
|
-
|
|
140
|
+
//
|
|
141
|
+
// TODO(davidben): In MSVC 2019 16.8 or higher (_MSC_VER >= 1928),
|
|
142
|
+
// |__STDC_VERSION__| will be 201112 when passed /std:c11 and unset otherwise.
|
|
143
|
+
// C11 alignas and alignof are only implemented in C11 mode. Can we mandate C11
|
|
144
|
+
// mode for those versions?
|
|
139
145
|
#error "BoringSSL must be built in C11 mode or higher."
|
|
140
146
|
#endif
|
|
141
|
-
#include <stdalign.h>
|
|
142
|
-
#endif
|
|
143
147
|
#endif
|
|
144
148
|
|
|
145
149
|
#if defined(OPENSSL_THREADS) && \
|
|
@@ -881,6 +885,16 @@ static inline void CRYPTO_store_u32_be(void *out, uint32_t v) {
|
|
|
881
885
|
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
882
886
|
}
|
|
883
887
|
|
|
888
|
+
static inline uint64_t CRYPTO_load_u64_le(const void *in) {
|
|
889
|
+
uint64_t v;
|
|
890
|
+
OPENSSL_memcpy(&v, in, sizeof(v));
|
|
891
|
+
return v;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
static inline void CRYPTO_store_u64_le(void *out, uint64_t v) {
|
|
895
|
+
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
896
|
+
}
|
|
897
|
+
|
|
884
898
|
static inline uint64_t CRYPTO_load_u64_be(const void *ptr) {
|
|
885
899
|
uint64_t ret;
|
|
886
900
|
OPENSSL_memcpy(&ret, ptr, sizeof(ret));
|