@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
|
@@ -54,6 +54,73 @@ TEST(TrustTokenTest, KeyGenExp1) {
|
|
|
54
54
|
TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE, 0x0001));
|
|
55
55
|
ASSERT_EQ(292u, priv_key_len);
|
|
56
56
|
ASSERT_EQ(301u, pub_key_len);
|
|
57
|
+
|
|
58
|
+
const uint8_t kKeygenSecret[] = "SEED";
|
|
59
|
+
ASSERT_TRUE(TRUST_TOKEN_derive_key_from_secret(
|
|
60
|
+
TRUST_TOKEN_experiment_v1(), priv_key, &priv_key_len,
|
|
61
|
+
TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE, pub_key, &pub_key_len,
|
|
62
|
+
TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE, 0x0001, kKeygenSecret,
|
|
63
|
+
sizeof(kKeygenSecret) - 1));
|
|
64
|
+
|
|
65
|
+
const uint8_t kExpectedPriv[] = {
|
|
66
|
+
0x00, 0x00, 0x00, 0x01, 0x98, 0xaa, 0x32, 0xfc, 0x5f, 0x83, 0x35, 0xea,
|
|
67
|
+
0x57, 0x4f, 0x9e, 0x61, 0x48, 0x6e, 0x89, 0x9d, 0x3d, 0xaa, 0x38, 0x5d,
|
|
68
|
+
0xd0, 0x06, 0x96, 0x62, 0xe8, 0x0b, 0xd6, 0x5f, 0x12, 0xa4, 0xcc, 0xa9,
|
|
69
|
+
0xb5, 0x20, 0x1b, 0x13, 0x8c, 0x1c, 0xaf, 0x36, 0x1b, 0xab, 0x0c, 0xc6,
|
|
70
|
+
0xac, 0x38, 0xae, 0x96, 0x3d, 0x14, 0x9d, 0xb8, 0x8d, 0xf4, 0x7f, 0xe2,
|
|
71
|
+
0x7d, 0xeb, 0x17, 0xc2, 0xbc, 0x63, 0x42, 0x93, 0x94, 0xe4, 0x97, 0xbf,
|
|
72
|
+
0x97, 0xea, 0x02, 0x40, 0xac, 0xb6, 0xa5, 0x03, 0x4c, 0x6b, 0x4c, 0xb8,
|
|
73
|
+
0x8c, 0xf4, 0x66, 0x1b, 0x4e, 0x02, 0x45, 0xf9, 0xcd, 0xb6, 0x0f, 0x59,
|
|
74
|
+
0x09, 0x21, 0x03, 0x7e, 0x92, 0x1f, 0x3f, 0x40, 0x83, 0x50, 0xe3, 0xdc,
|
|
75
|
+
0x9e, 0x6f, 0x65, 0xc5, 0xbd, 0x2c, 0x7d, 0xab, 0x74, 0x49, 0xc8, 0xa2,
|
|
76
|
+
0x3c, 0xab, 0xcb, 0x4d, 0x63, 0x73, 0x81, 0x2b, 0xb2, 0x1e, 0x00, 0x8f,
|
|
77
|
+
0x00, 0xb8, 0xd8, 0xb4, 0x5d, 0xc4, 0x3f, 0x3d, 0xa8, 0x4f, 0x4c, 0x72,
|
|
78
|
+
0x0e, 0x20, 0x17, 0x4b, 0xac, 0x14, 0x8f, 0xb2, 0xa5, 0x20, 0x41, 0x2b,
|
|
79
|
+
0xf7, 0x62, 0x25, 0x6a, 0xd6, 0x41, 0x26, 0x62, 0x10, 0xc1, 0xbc, 0x42,
|
|
80
|
+
0xac, 0x54, 0x1b, 0x75, 0x05, 0xd6, 0x53, 0xb1, 0x7b, 0x84, 0x6a, 0x7b,
|
|
81
|
+
0x5b, 0x2a, 0x34, 0x6e, 0x43, 0x4b, 0x43, 0xcc, 0x6c, 0xdb, 0x1d, 0x02,
|
|
82
|
+
0x34, 0x7f, 0xd1, 0xe8, 0xfd, 0x42, 0x2c, 0xd9, 0x14, 0xdb, 0xd6, 0xf4,
|
|
83
|
+
0xad, 0xb5, 0xe4, 0xac, 0xdd, 0x7e, 0xb5, 0x4c, 0x3f, 0x59, 0x24, 0xfa,
|
|
84
|
+
0x04, 0xd9, 0xb6, 0xd2, 0xb7, 0x7d, 0xf1, 0xfa, 0x13, 0xc0, 0x4d, 0xd5,
|
|
85
|
+
0xca, 0x3a, 0x4e, 0xa8, 0xdd, 0xa9, 0xfc, 0xcb, 0x06, 0xb2, 0xde, 0x4b,
|
|
86
|
+
0x2a, 0x86, 0xbb, 0x0d, 0x41, 0xb6, 0x3d, 0xfb, 0x49, 0xc8, 0xdf, 0x9a,
|
|
87
|
+
0x48, 0xe5, 0x68, 0x8a, 0xfc, 0x86, 0x9c, 0x79, 0x5a, 0x79, 0xc1, 0x09,
|
|
88
|
+
0x33, 0x53, 0xdc, 0x3d, 0xe9, 0x93, 0x7c, 0x5b, 0x72, 0xf7, 0xa0, 0x8a,
|
|
89
|
+
0x1f, 0x07, 0x6c, 0x38, 0x3c, 0x99, 0x0b, 0xe4, 0x4e, 0xa4, 0xbd, 0x41,
|
|
90
|
+
0x1f, 0x83, 0xa6, 0xd3
|
|
91
|
+
};
|
|
92
|
+
ASSERT_EQ(Bytes(kExpectedPriv, sizeof(kExpectedPriv)),
|
|
93
|
+
Bytes(priv_key, priv_key_len));
|
|
94
|
+
|
|
95
|
+
const uint8_t kExpectedPub[] = {
|
|
96
|
+
0x00, 0x00, 0x00, 0x01, 0x00, 0x61, 0x04, 0x5e, 0x06, 0x6b, 0x7b, 0xfd,
|
|
97
|
+
0x54, 0x01, 0xe0, 0xd2, 0xb5, 0x12, 0xce, 0x48, 0x16, 0x66, 0xb2, 0xdf,
|
|
98
|
+
0xfd, 0xa8, 0x38, 0x7c, 0x1f, 0x45, 0x1a, 0xb8, 0x21, 0x52, 0x17, 0x25,
|
|
99
|
+
0xbb, 0x0b, 0x00, 0xd4, 0xa1, 0xbc, 0x28, 0xd9, 0x08, 0x36, 0x98, 0xb2,
|
|
100
|
+
0x17, 0xd3, 0xb5, 0xad, 0xb6, 0x4e, 0x03, 0x5f, 0xd3, 0x66, 0x2c, 0x58,
|
|
101
|
+
0x1c, 0xcc, 0xc6, 0x23, 0xa4, 0xf9, 0xa2, 0x7e, 0xb0, 0xe4, 0xd3, 0x95,
|
|
102
|
+
0x41, 0x6f, 0xba, 0x23, 0x4a, 0x82, 0x93, 0x29, 0x73, 0x75, 0x38, 0x85,
|
|
103
|
+
0x64, 0x9c, 0xaa, 0x12, 0x6d, 0x7d, 0xcd, 0x52, 0x02, 0x91, 0x9f, 0xa9,
|
|
104
|
+
0xee, 0x4b, 0xfd, 0x68, 0x97, 0x40, 0xdc, 0x00, 0x61, 0x04, 0x14, 0x16,
|
|
105
|
+
0x39, 0xf9, 0x63, 0x66, 0x94, 0x03, 0xfa, 0x0b, 0xbf, 0xca, 0x5a, 0x39,
|
|
106
|
+
0x9f, 0x27, 0x5b, 0x3f, 0x69, 0x7a, 0xc9, 0xf7, 0x25, 0x7c, 0x84, 0x9e,
|
|
107
|
+
0x1d, 0x61, 0x5a, 0x24, 0x53, 0xf2, 0x4a, 0x9d, 0xe9, 0x05, 0x53, 0xfd,
|
|
108
|
+
0x12, 0x01, 0x2d, 0x9a, 0x69, 0x50, 0x74, 0x82, 0xa3, 0x45, 0x73, 0xdc,
|
|
109
|
+
0x34, 0x36, 0x31, 0x44, 0x07, 0x0c, 0xda, 0x13, 0xbe, 0x94, 0x37, 0x65,
|
|
110
|
+
0xa0, 0xab, 0x16, 0x52, 0x90, 0xe5, 0x8a, 0x03, 0xe5, 0x98, 0x79, 0x14,
|
|
111
|
+
0x79, 0xd5, 0x17, 0xee, 0xd4, 0xb8, 0xda, 0x77, 0x76, 0x03, 0x20, 0x2a,
|
|
112
|
+
0x7e, 0x3b, 0x76, 0x0b, 0x23, 0xb7, 0x72, 0x77, 0xb2, 0xeb, 0x00, 0x61,
|
|
113
|
+
0x04, 0x68, 0x18, 0x4d, 0x23, 0x23, 0xf4, 0x45, 0xb8, 0x81, 0x0d, 0xa4,
|
|
114
|
+
0x5d, 0x0b, 0x9e, 0x08, 0xfb, 0x45, 0xfb, 0x96, 0x29, 0x43, 0x2f, 0xab,
|
|
115
|
+
0x93, 0x04, 0x4c, 0x04, 0xb6, 0x5e, 0x27, 0xf5, 0x39, 0x66, 0x94, 0x15,
|
|
116
|
+
0x1d, 0xb1, 0x1c, 0x7c, 0x27, 0x6f, 0xa5, 0x19, 0x0c, 0x30, 0x12, 0xcc,
|
|
117
|
+
0x77, 0x7f, 0x10, 0xa9, 0x7c, 0xe4, 0x08, 0x77, 0x3c, 0xd3, 0x6f, 0xa4,
|
|
118
|
+
0xf4, 0xaf, 0xf1, 0x9d, 0x14, 0x1d, 0xd0, 0x02, 0x33, 0x50, 0x55, 0x00,
|
|
119
|
+
0x6a, 0x47, 0x96, 0xe1, 0x8b, 0x4e, 0x44, 0x41, 0xad, 0xb3, 0xea, 0x0d,
|
|
120
|
+
0x0d, 0xd5, 0x73, 0x8e, 0x62, 0x67, 0x8a, 0xb4, 0xe7, 0x5d, 0x17, 0xa9,
|
|
121
|
+
0x24};
|
|
122
|
+
ASSERT_EQ(Bytes(kExpectedPub, sizeof(kExpectedPub)),
|
|
123
|
+
Bytes(pub_key, pub_key_len));
|
|
57
124
|
}
|
|
58
125
|
|
|
59
126
|
TEST(TrustTokenTest, KeyGenExp2VOPRF) {
|
|
@@ -66,6 +133,37 @@ TEST(TrustTokenTest, KeyGenExp2VOPRF) {
|
|
|
66
133
|
TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE, 0x0001));
|
|
67
134
|
ASSERT_EQ(52u, priv_key_len);
|
|
68
135
|
ASSERT_EQ(101u, pub_key_len);
|
|
136
|
+
|
|
137
|
+
const uint8_t kKeygenSecret[] = "SEED";
|
|
138
|
+
ASSERT_TRUE(TRUST_TOKEN_derive_key_from_secret(
|
|
139
|
+
TRUST_TOKEN_experiment_v2_voprf(), priv_key, &priv_key_len,
|
|
140
|
+
TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE, pub_key, &pub_key_len,
|
|
141
|
+
TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE, 0x0001, kKeygenSecret,
|
|
142
|
+
sizeof(kKeygenSecret) - 1));
|
|
143
|
+
|
|
144
|
+
const uint8_t kExpectedPriv[] = {
|
|
145
|
+
0x00, 0x00, 0x00, 0x01, 0x0b, 0xe2, 0xc4, 0x73, 0x92, 0xe7, 0xf8,
|
|
146
|
+
0x3e, 0xba, 0xab, 0x85, 0xa7, 0x77, 0xd7, 0x0a, 0x02, 0xc5, 0x36,
|
|
147
|
+
0xfe, 0x62, 0xa3, 0xca, 0x01, 0x75, 0xc7, 0x62, 0x19, 0xc7, 0xf0,
|
|
148
|
+
0x30, 0xc5, 0x14, 0x60, 0x13, 0x97, 0x4f, 0x63, 0x05, 0x37, 0x92,
|
|
149
|
+
0x7b, 0x76, 0x8e, 0x9f, 0xd0, 0x1a, 0x74, 0x44
|
|
150
|
+
};
|
|
151
|
+
ASSERT_EQ(Bytes(kExpectedPriv, sizeof(kExpectedPriv)),
|
|
152
|
+
Bytes(priv_key, priv_key_len));
|
|
153
|
+
|
|
154
|
+
const uint8_t kExpectedPub[] = {
|
|
155
|
+
0x00, 0x00, 0x00, 0x01, 0x04, 0x2c, 0x9c, 0x11, 0xc1, 0xe5, 0x52, 0x59,
|
|
156
|
+
0x0b, 0x6d, 0x88, 0x8b, 0x6e, 0x28, 0xe8, 0xc5, 0xa3, 0xbe, 0x48, 0x18,
|
|
157
|
+
0xf7, 0x1d, 0x31, 0xcf, 0xa2, 0x6e, 0x2a, 0xd6, 0xcb, 0x83, 0x26, 0x04,
|
|
158
|
+
0xbd, 0x93, 0x67, 0xe4, 0x53, 0xf6, 0x11, 0x7d, 0x45, 0xe9, 0xfe, 0x27,
|
|
159
|
+
0x33, 0x90, 0xdb, 0x1b, 0xfc, 0x9b, 0x31, 0x4d, 0x39, 0x1f, 0x1f, 0x8c,
|
|
160
|
+
0x43, 0x06, 0x70, 0x2c, 0x84, 0xdc, 0x23, 0x18, 0xc7, 0x6a, 0x58, 0xcf,
|
|
161
|
+
0x9e, 0xc1, 0xfa, 0xf2, 0x30, 0xdd, 0xad, 0x62, 0x24, 0xde, 0x11, 0xc1,
|
|
162
|
+
0xba, 0x8d, 0xc3, 0x4f, 0xfb, 0xe5, 0xa5, 0xd4, 0x37, 0xba, 0x3b, 0x70,
|
|
163
|
+
0xc0, 0xc3, 0xef, 0x20, 0x43
|
|
164
|
+
};
|
|
165
|
+
ASSERT_EQ(Bytes(kExpectedPub, sizeof(kExpectedPub)),
|
|
166
|
+
Bytes(pub_key, pub_key_len));
|
|
69
167
|
}
|
|
70
168
|
|
|
71
169
|
TEST(TrustTokenTest, KeyGenExp2PMB) {
|
|
@@ -78,6 +176,73 @@ TEST(TrustTokenTest, KeyGenExp2PMB) {
|
|
|
78
176
|
TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE, 0x0001));
|
|
79
177
|
ASSERT_EQ(292u, priv_key_len);
|
|
80
178
|
ASSERT_EQ(295u, pub_key_len);
|
|
179
|
+
|
|
180
|
+
const uint8_t kKeygenSecret[] = "SEED";
|
|
181
|
+
ASSERT_TRUE(TRUST_TOKEN_derive_key_from_secret(
|
|
182
|
+
TRUST_TOKEN_experiment_v2_pmb(), priv_key, &priv_key_len,
|
|
183
|
+
TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE, pub_key, &pub_key_len,
|
|
184
|
+
TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE, 0x0001, kKeygenSecret,
|
|
185
|
+
sizeof(kKeygenSecret) - 1));
|
|
186
|
+
|
|
187
|
+
const uint8_t kExpectedPriv[] = {
|
|
188
|
+
0x00, 0x00, 0x00, 0x01, 0x1b, 0x74, 0xdc, 0xf0, 0xa9, 0xa7, 0x6c, 0xfb,
|
|
189
|
+
0x41, 0xef, 0xfa, 0x65, 0x52, 0xc9, 0x86, 0x4e, 0xfb, 0x16, 0x9d, 0xea,
|
|
190
|
+
0x62, 0x3f, 0x47, 0xab, 0x1f, 0x1b, 0x05, 0xf2, 0x4f, 0x05, 0xfe, 0x64,
|
|
191
|
+
0xb7, 0xe8, 0xcd, 0x2a, 0x10, 0xfa, 0xa2, 0x48, 0x3f, 0x0e, 0x8b, 0x94,
|
|
192
|
+
0x39, 0xf1, 0xe7, 0x53, 0xe9, 0x50, 0x29, 0xe2, 0xb7, 0x0e, 0xc0, 0x94,
|
|
193
|
+
0xa9, 0xd3, 0xef, 0x64, 0x10, 0x1d, 0x08, 0xd0, 0x60, 0xcb, 0x6d, 0x97,
|
|
194
|
+
0x68, 0xc7, 0x04, 0x92, 0x07, 0xb2, 0x22, 0x83, 0xf7, 0xd9, 0x9b, 0x2c,
|
|
195
|
+
0xf2, 0x52, 0x34, 0x0c, 0x42, 0x31, 0x47, 0x41, 0x19, 0xb9, 0xee, 0xfc,
|
|
196
|
+
0x46, 0xbd, 0x14, 0xce, 0x42, 0xd7, 0x43, 0xc8, 0x32, 0x3b, 0x24, 0xed,
|
|
197
|
+
0xdc, 0x69, 0xa3, 0x8e, 0x29, 0x01, 0xbe, 0xae, 0x24, 0x39, 0x14, 0xa7,
|
|
198
|
+
0x52, 0xe5, 0xd5, 0xff, 0x9a, 0xc4, 0x15, 0x79, 0x29, 0x4c, 0x9b, 0x4e,
|
|
199
|
+
0xfc, 0x61, 0xf2, 0x12, 0x6f, 0x4f, 0xd3, 0x96, 0x28, 0xb0, 0x79, 0xf0,
|
|
200
|
+
0x4e, 0x6e, 0x7d, 0x56, 0x19, 0x1b, 0xc2, 0xd7, 0xf9, 0x3a, 0x58, 0x06,
|
|
201
|
+
0xe5, 0xec, 0xa4, 0x33, 0x14, 0x1c, 0x78, 0x0c, 0x83, 0x94, 0x34, 0x22,
|
|
202
|
+
0x5a, 0x8e, 0x2e, 0xa1, 0x72, 0x4a, 0x03, 0x35, 0xfe, 0x46, 0x92, 0x41,
|
|
203
|
+
0x6b, 0xe6, 0x4b, 0x3f, 0xf0, 0xe7, 0x0b, 0xb5, 0xf3, 0x66, 0x6c, 0xc6,
|
|
204
|
+
0x14, 0xcf, 0xce, 0x32, 0x0a, 0x2c, 0x28, 0xba, 0x4e, 0xb9, 0x75, 0x4a,
|
|
205
|
+
0xa9, 0x2d, 0xb0, 0x8c, 0xd0, 0x62, 0x52, 0x29, 0x1f, 0x12, 0xfd, 0xfb,
|
|
206
|
+
0xd3, 0x2a, 0x36, 0x0f, 0x89, 0x32, 0x86, 0x25, 0x56, 0xb9, 0xe7, 0x3c,
|
|
207
|
+
0xeb, 0xb4, 0x84, 0x41, 0x2b, 0xa8, 0xf3, 0xa5, 0x3d, 0xfe, 0x56, 0x94,
|
|
208
|
+
0x5b, 0x74, 0xb3, 0x5b, 0x27, 0x3f, 0xe7, 0xcf, 0xe4, 0xf8, 0x15, 0x95,
|
|
209
|
+
0x2a, 0xd2, 0x5f, 0x92, 0xb4, 0x6a, 0x89, 0xa5, 0x54, 0xbd, 0x27, 0x5e,
|
|
210
|
+
0xeb, 0x43, 0x07, 0x9b, 0x2b, 0x8b, 0x22, 0x59, 0x13, 0x4b, 0x9c, 0x56,
|
|
211
|
+
0xd8, 0x63, 0xd9, 0xe6, 0x85, 0x15, 0x2c, 0x82, 0x52, 0x40, 0x8f, 0xb1,
|
|
212
|
+
0xe7, 0x56, 0x07, 0x98
|
|
213
|
+
};
|
|
214
|
+
ASSERT_EQ(Bytes(kExpectedPriv, sizeof(kExpectedPriv)),
|
|
215
|
+
Bytes(priv_key, priv_key_len));
|
|
216
|
+
|
|
217
|
+
const uint8_t kExpectedPub[] = {
|
|
218
|
+
0x00, 0x00, 0x00, 0x01, 0x04, 0x48, 0xb1, 0x2d, 0xdd, 0x03, 0x32, 0xeb,
|
|
219
|
+
0x93, 0x31, 0x3d, 0x59, 0x74, 0xf0, 0xcf, 0xaa, 0xa5, 0x39, 0x5f, 0x53,
|
|
220
|
+
0xc4, 0x94, 0x98, 0xbe, 0x8f, 0x22, 0xd7, 0x30, 0xde, 0x1e, 0xb4, 0xf3,
|
|
221
|
+
0x32, 0x23, 0x90, 0x0b, 0xa6, 0x37, 0x4a, 0x4b, 0x44, 0xb3, 0x26, 0x52,
|
|
222
|
+
0x93, 0x7b, 0x4b, 0xa4, 0x79, 0xe8, 0x77, 0x6a, 0x19, 0x81, 0x2a, 0xdd,
|
|
223
|
+
0x91, 0xfb, 0x90, 0x8b, 0x24, 0xb5, 0xbe, 0x20, 0x2e, 0xe8, 0xbc, 0xd3,
|
|
224
|
+
0x83, 0x6c, 0xa8, 0xc5, 0xa1, 0x9a, 0x5b, 0x5e, 0x60, 0xda, 0x45, 0x2e,
|
|
225
|
+
0x31, 0x7f, 0x54, 0x0e, 0x14, 0x40, 0xd2, 0x4d, 0x40, 0x2e, 0x21, 0x79,
|
|
226
|
+
0xfc, 0x77, 0xdd, 0xc7, 0x2d, 0x04, 0xfe, 0xc6, 0xe3, 0xcf, 0x99, 0xef,
|
|
227
|
+
0x88, 0xab, 0x76, 0x86, 0x16, 0x14, 0xed, 0x72, 0x35, 0xa7, 0x05, 0x13,
|
|
228
|
+
0x9f, 0x2c, 0x53, 0xd5, 0xdf, 0x66, 0x75, 0x2e, 0x68, 0xdc, 0xd4, 0xc4,
|
|
229
|
+
0x00, 0x36, 0x08, 0x6d, 0xb7, 0x15, 0xf7, 0xe5, 0x32, 0x59, 0x81, 0x16,
|
|
230
|
+
0x57, 0xaa, 0x72, 0x06, 0xf0, 0xad, 0xd1, 0x85, 0xa0, 0x04, 0xd4, 0x11,
|
|
231
|
+
0x95, 0x1d, 0xac, 0x0b, 0x25, 0xbe, 0x59, 0xa2, 0xb3, 0x30, 0xee, 0x97,
|
|
232
|
+
0x07, 0x2a, 0x51, 0x15, 0xc1, 0x8d, 0xa8, 0xa6, 0x57, 0x9a, 0x4e, 0xbf,
|
|
233
|
+
0xd7, 0x2d, 0x35, 0x07, 0x6b, 0xd6, 0xc9, 0x3c, 0xe4, 0xcf, 0x0b, 0x14,
|
|
234
|
+
0x3e, 0x10, 0x51, 0x77, 0xd6, 0x84, 0x04, 0xbe, 0xd1, 0xd5, 0xa8, 0xf3,
|
|
235
|
+
0x9d, 0x1d, 0x4f, 0xc1, 0xc9, 0xf1, 0x0c, 0x6d, 0xb6, 0xcb, 0xe2, 0x05,
|
|
236
|
+
0x0b, 0x9c, 0x7a, 0x3a, 0x9a, 0x99, 0xe9, 0xa1, 0x93, 0xdc, 0x72, 0x2e,
|
|
237
|
+
0xef, 0xf3, 0x8d, 0xb9, 0x7b, 0xb0, 0x19, 0x24, 0x95, 0x0d, 0x68, 0xa7,
|
|
238
|
+
0xe0, 0xaa, 0x0b, 0xb1, 0xd1, 0xcc, 0x52, 0x14, 0xf9, 0x6c, 0x91, 0x59,
|
|
239
|
+
0xe4, 0xe1, 0x9b, 0xf9, 0x12, 0x39, 0xb1, 0x79, 0xbb, 0x21, 0x92, 0x00,
|
|
240
|
+
0xa4, 0x89, 0xf5, 0xbd, 0xd7, 0x89, 0x27, 0x40, 0xdc, 0xb1, 0x09, 0x38,
|
|
241
|
+
0x63, 0x91, 0x8c, 0xa5, 0x27, 0x27, 0x97, 0x39, 0x35, 0xfa, 0x1a, 0x8a,
|
|
242
|
+
0xa7, 0xe5, 0xc4, 0xd8, 0xbf, 0xe7, 0xbe
|
|
243
|
+
};
|
|
244
|
+
ASSERT_EQ(Bytes(kExpectedPub, sizeof(kExpectedPub)),
|
|
245
|
+
Bytes(pub_key, pub_key_len));
|
|
81
246
|
}
|
|
82
247
|
|
|
83
248
|
// Test that H in |TRUST_TOKEN_experiment_v1| was computed correctly.
|
|
@@ -110,20 +110,18 @@ static int scalar_from_cbs(CBS *cbs, const EC_GROUP *group, EC_SCALAR *out) {
|
|
|
110
110
|
return 1;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
static int
|
|
114
|
-
|
|
113
|
+
static int voprf_calculate_key(const VOPRF_METHOD *method, CBB *out_private,
|
|
114
|
+
CBB *out_public, const EC_SCALAR *priv) {
|
|
115
115
|
const EC_GROUP *group = method->group;
|
|
116
116
|
EC_RAW_POINT pub;
|
|
117
|
-
EC_SCALAR priv;
|
|
118
117
|
EC_AFFINE pub_affine;
|
|
119
|
-
if (!
|
|
120
|
-
!ec_point_mul_scalar_base(group, &pub, &priv) ||
|
|
118
|
+
if (!ec_point_mul_scalar_base(group, &pub, priv) ||
|
|
121
119
|
!ec_jacobian_to_affine(group, &pub_affine, &pub)) {
|
|
122
120
|
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_KEYGEN_FAILURE);
|
|
123
121
|
return 0;
|
|
124
122
|
}
|
|
125
123
|
|
|
126
|
-
if (!scalar_to_cbb(out_private, group,
|
|
124
|
+
if (!scalar_to_cbb(out_private, group, priv) ||
|
|
127
125
|
!cbb_add_point(out_public, group, &pub_affine)) {
|
|
128
126
|
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_BUFFER_TOO_SMALL);
|
|
129
127
|
return 0;
|
|
@@ -132,6 +130,46 @@ static int voprf_generate_key(const VOPRF_METHOD *method, CBB *out_private,
|
|
|
132
130
|
return 1;
|
|
133
131
|
}
|
|
134
132
|
|
|
133
|
+
|
|
134
|
+
static int voprf_generate_key(const VOPRF_METHOD *method, CBB *out_private,
|
|
135
|
+
CBB *out_public) {
|
|
136
|
+
EC_SCALAR priv;
|
|
137
|
+
if (!ec_random_nonzero_scalar(method->group, &priv, kDefaultAdditionalData)) {
|
|
138
|
+
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_KEYGEN_FAILURE);
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
return voprf_calculate_key(method, out_private, out_public, &priv);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static int voprf_derive_key_from_secret(const VOPRF_METHOD *method,
|
|
145
|
+
CBB *out_private, CBB *out_public,
|
|
146
|
+
const uint8_t *secret,
|
|
147
|
+
size_t secret_len) {
|
|
148
|
+
static const uint8_t kKeygenLabel[] = "TrustTokenVOPRFKeyGen";
|
|
149
|
+
|
|
150
|
+
EC_SCALAR priv;
|
|
151
|
+
int ok = 0;
|
|
152
|
+
CBB cbb;
|
|
153
|
+
CBB_zero(&cbb);
|
|
154
|
+
uint8_t *buf = NULL;
|
|
155
|
+
size_t len;
|
|
156
|
+
if (!CBB_init(&cbb, 0) ||
|
|
157
|
+
!CBB_add_bytes(&cbb, kKeygenLabel, sizeof(kKeygenLabel)) ||
|
|
158
|
+
!CBB_add_bytes(&cbb, secret, secret_len) ||
|
|
159
|
+
!CBB_finish(&cbb, &buf, &len) ||
|
|
160
|
+
!method->hash_to_scalar(method->group, &priv, buf, len)) {
|
|
161
|
+
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_KEYGEN_FAILURE);
|
|
162
|
+
goto err;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
ok = voprf_calculate_key(method, out_private, out_public, &priv);
|
|
166
|
+
|
|
167
|
+
err:
|
|
168
|
+
CBB_cleanup(&cbb);
|
|
169
|
+
OPENSSL_free(buf);
|
|
170
|
+
return ok;
|
|
171
|
+
}
|
|
172
|
+
|
|
135
173
|
static int voprf_client_key_from_bytes(const VOPRF_METHOD *method,
|
|
136
174
|
TRUST_TOKEN_CLIENT_KEY *key,
|
|
137
175
|
const uint8_t *in, size_t len) {
|
|
@@ -711,6 +749,17 @@ int voprf_exp2_generate_key(CBB *out_private, CBB *out_public) {
|
|
|
711
749
|
return voprf_generate_key(&voprf_exp2_method, out_private, out_public);
|
|
712
750
|
}
|
|
713
751
|
|
|
752
|
+
int voprf_exp2_derive_key_from_secret(CBB *out_private, CBB *out_public,
|
|
753
|
+
const uint8_t *secret,
|
|
754
|
+
size_t secret_len) {
|
|
755
|
+
if (!voprf_exp2_init_method()) {
|
|
756
|
+
return 0;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
return voprf_derive_key_from_secret(&voprf_exp2_method, out_private,
|
|
760
|
+
out_public, secret, secret_len);
|
|
761
|
+
}
|
|
762
|
+
|
|
714
763
|
int voprf_exp2_client_key_from_bytes(TRUST_TOKEN_CLIENT_KEY *key,
|
|
715
764
|
const uint8_t *in, size_t len) {
|
|
716
765
|
if (!voprf_exp2_init_method()) {
|
|
@@ -62,35 +62,34 @@
|
|
|
62
62
|
#include <openssl/mem.h>
|
|
63
63
|
|
|
64
64
|
int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
|
|
65
|
-
unsigned char *md, unsigned int *len)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
unsigned char *str, *p;
|
|
65
|
+
unsigned char *md, unsigned int *len) {
|
|
66
|
+
int i, ret;
|
|
67
|
+
unsigned char *str, *p;
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
i = i2d(data, NULL);
|
|
70
|
+
if ((str = (unsigned char *)OPENSSL_malloc(i)) == NULL) {
|
|
71
|
+
OPENSSL_PUT_ERROR(X509, ERR_R_MALLOC_FAILURE);
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
p = str;
|
|
75
|
+
i2d(data, &p);
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
ret = EVP_Digest(str, i, md, len, type, NULL);
|
|
78
|
+
OPENSSL_free(str);
|
|
79
|
+
return ret;
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
|
|
84
|
-
unsigned char *md, unsigned int *len)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
unsigned char *str = NULL;
|
|
83
|
+
unsigned char *md, unsigned int *len) {
|
|
84
|
+
int i, ret;
|
|
85
|
+
unsigned char *str = NULL;
|
|
88
86
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
i = ASN1_item_i2d(asn, &str, it);
|
|
88
|
+
if (!str) {
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
92
91
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
ret = EVP_Digest(str, i, md, len, type, NULL);
|
|
93
|
+
OPENSSL_free(str);
|
|
94
|
+
return ret;
|
|
96
95
|
}
|
|
@@ -64,65 +64,62 @@
|
|
|
64
64
|
|
|
65
65
|
#include "internal.h"
|
|
66
66
|
|
|
67
|
-
int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx);
|
|
67
|
+
int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|
68
|
+
ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey,
|
|
69
|
+
const EVP_MD *type) {
|
|
70
|
+
EVP_MD_CTX ctx;
|
|
71
|
+
EVP_MD_CTX_init(&ctx);
|
|
72
|
+
if (!EVP_DigestSignInit(&ctx, NULL, type, NULL, pkey)) {
|
|
73
|
+
EVP_MD_CTX_cleanup(&ctx);
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx);
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
int ASN1_item_sign_ctx(const ASN1_ITEM *it,
|
|
81
|
-
X509_ALGOR *
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
size_t inl = 0, outl = 0;
|
|
79
|
+
int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,
|
|
80
|
+
X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
|
|
81
|
+
void *asn, EVP_MD_CTX *ctx) {
|
|
82
|
+
EVP_PKEY *pkey;
|
|
83
|
+
unsigned char *buf_in = NULL, *buf_out = NULL;
|
|
84
|
+
size_t inl = 0, outl = 0;
|
|
87
85
|
|
|
88
|
-
|
|
86
|
+
pkey = EVP_PKEY_CTX_get0_pkey(ctx->pctx);
|
|
89
87
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
// Write out the requested copies of the AlgorithmIdentifier.
|
|
89
|
+
if (algor1 && !x509_digest_sign_algorithm(ctx, algor1)) {
|
|
90
|
+
goto err;
|
|
91
|
+
}
|
|
92
|
+
if (algor2 && !x509_digest_sign_algorithm(ctx, algor2)) {
|
|
93
|
+
goto err;
|
|
94
|
+
}
|
|
97
95
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
inl = ASN1_item_i2d(asn, &buf_in, it);
|
|
97
|
+
outl = EVP_PKEY_size(pkey);
|
|
98
|
+
buf_out = OPENSSL_malloc((unsigned int)outl);
|
|
99
|
+
if ((buf_in == NULL) || (buf_out == NULL)) {
|
|
100
|
+
outl = 0;
|
|
101
|
+
OPENSSL_PUT_ERROR(X509, ERR_R_MALLOC_FAILURE);
|
|
102
|
+
goto err;
|
|
103
|
+
}
|
|
106
104
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return (outl);
|
|
105
|
+
if (!EVP_DigestSign(ctx, buf_out, &outl, buf_in, inl)) {
|
|
106
|
+
outl = 0;
|
|
107
|
+
OPENSSL_PUT_ERROR(X509, ERR_R_EVP_LIB);
|
|
108
|
+
goto err;
|
|
109
|
+
}
|
|
110
|
+
if (signature->data != NULL) {
|
|
111
|
+
OPENSSL_free(signature->data);
|
|
112
|
+
}
|
|
113
|
+
signature->data = buf_out;
|
|
114
|
+
buf_out = NULL;
|
|
115
|
+
signature->length = outl;
|
|
116
|
+
// In the interests of compatibility, I'll make sure that the bit string
|
|
117
|
+
// has a 'not-used bits' value of 0
|
|
118
|
+
signature->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
|
|
119
|
+
signature->flags |= ASN1_STRING_FLAG_BITS_LEFT;
|
|
120
|
+
err:
|
|
121
|
+
EVP_MD_CTX_cleanup(ctx);
|
|
122
|
+
OPENSSL_free(buf_in);
|
|
123
|
+
OPENSSL_free(buf_out);
|
|
124
|
+
return outl;
|
|
128
125
|
}
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
#include <openssl/x509.h>
|
|
58
58
|
|
|
59
59
|
#include <stdio.h>
|
|
60
|
-
#include <time.h>
|
|
61
60
|
#include <sys/types.h>
|
|
62
61
|
|
|
63
62
|
#include <openssl/bn.h>
|
|
@@ -72,47 +71,47 @@
|
|
|
72
71
|
int ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *a,
|
|
73
72
|
const ASN1_BIT_STRING *signature, void *asn,
|
|
74
73
|
EVP_PKEY *pkey) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
if (!pkey) {
|
|
75
|
+
OPENSSL_PUT_ERROR(X509, ERR_R_PASSED_NULL_PARAMETER);
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
sig_len = (size_t)ASN1_STRING_length(signature);
|
|
79
|
+
size_t sig_len;
|
|
80
|
+
if (signature->type == V_ASN1_BIT_STRING) {
|
|
81
|
+
if (!ASN1_BIT_STRING_num_bytes(signature, &sig_len)) {
|
|
82
|
+
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_BIT_STRING_BITS_LEFT);
|
|
83
|
+
return 0;
|
|
88
84
|
}
|
|
85
|
+
} else {
|
|
86
|
+
sig_len = (size_t)ASN1_STRING_length(signature);
|
|
87
|
+
}
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
EVP_MD_CTX ctx;
|
|
90
|
+
uint8_t *buf_in = NULL;
|
|
91
|
+
int ret = 0, inl = 0;
|
|
92
|
+
EVP_MD_CTX_init(&ctx);
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
if (!x509_digest_verify_init(&ctx, a, pkey)) {
|
|
95
|
+
goto err;
|
|
96
|
+
}
|
|
98
97
|
|
|
99
|
-
|
|
98
|
+
inl = ASN1_item_i2d(asn, &buf_in, it);
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
if (buf_in == NULL) {
|
|
101
|
+
OPENSSL_PUT_ERROR(X509, ERR_R_MALLOC_FAILURE);
|
|
102
|
+
goto err;
|
|
103
|
+
}
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
if (!EVP_DigestVerify(&ctx, ASN1_STRING_get0_data(signature), sig_len, buf_in,
|
|
106
|
+
inl)) {
|
|
107
|
+
OPENSSL_PUT_ERROR(X509, ERR_R_EVP_LIB);
|
|
108
|
+
goto err;
|
|
109
|
+
}
|
|
111
110
|
|
|
112
|
-
|
|
111
|
+
ret = 1;
|
|
113
112
|
|
|
114
113
|
err:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
OPENSSL_free(buf_in);
|
|
115
|
+
EVP_MD_CTX_cleanup(&ctx);
|
|
116
|
+
return ret;
|
|
118
117
|
}
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
|
|
65
65
|
#include "internal.h"
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
// Restrict the digests that are allowed in X509 certificates
|
|
68
68
|
static int x509_digest_nid_ok(const int digest_nid) {
|
|
69
69
|
switch (digest_nid) {
|
|
70
70
|
case NID_md4:
|
|
@@ -86,7 +86,7 @@ int x509_digest_sign_algorithm(EVP_MD_CTX *ctx, X509_ALGOR *algor) {
|
|
|
86
86
|
if (!EVP_PKEY_CTX_get_rsa_padding(ctx->pctx, &pad_mode)) {
|
|
87
87
|
return 0;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
// RSA-PSS has special signature algorithm logic.
|
|
90
90
|
if (pad_mode == RSA_PKCS1_PSS_PADDING) {
|
|
91
91
|
return x509_rsa_ctx_to_pss(ctx, algor);
|
|
92
92
|
}
|
|
@@ -96,8 +96,8 @@ int x509_digest_sign_algorithm(EVP_MD_CTX *ctx, X509_ALGOR *algor) {
|
|
|
96
96
|
return X509_ALGOR_set0(algor, OBJ_nid2obj(NID_ED25519), V_ASN1_UNDEF, NULL);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
// Default behavior: look up the OID for the algorithm/hash pair and encode
|
|
100
|
+
// that.
|
|
101
101
|
const EVP_MD *digest = EVP_MD_CTX_md(ctx);
|
|
102
102
|
if (digest == NULL) {
|
|
103
103
|
OPENSSL_PUT_ERROR(ASN1, ASN1_R_CONTEXT_NOT_INITIALISED);
|
|
@@ -107,14 +107,13 @@ int x509_digest_sign_algorithm(EVP_MD_CTX *ctx, X509_ALGOR *algor) {
|
|
|
107
107
|
const int digest_nid = EVP_MD_type(digest);
|
|
108
108
|
int sign_nid;
|
|
109
109
|
if (!x509_digest_nid_ok(digest_nid) ||
|
|
110
|
-
!OBJ_find_sigid_by_algs(&sign_nid, digest_nid,
|
|
111
|
-
EVP_PKEY_id(pkey))) {
|
|
110
|
+
!OBJ_find_sigid_by_algs(&sign_nid, digest_nid, EVP_PKEY_id(pkey))) {
|
|
112
111
|
OPENSSL_PUT_ERROR(ASN1, ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
|
|
113
112
|
return 0;
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
// RSA signature algorithms include an explicit NULL parameter. Others omit
|
|
116
|
+
// it.
|
|
118
117
|
int paramtype =
|
|
119
118
|
(EVP_PKEY_id(pkey) == EVP_PKEY_RSA) ? V_ASN1_NULL : V_ASN1_UNDEF;
|
|
120
119
|
X509_ALGOR_set0(algor, OBJ_nid2obj(sign_nid), paramtype, NULL);
|
|
@@ -123,7 +122,7 @@ int x509_digest_sign_algorithm(EVP_MD_CTX *ctx, X509_ALGOR *algor) {
|
|
|
123
122
|
|
|
124
123
|
int x509_digest_verify_init(EVP_MD_CTX *ctx, const X509_ALGOR *sigalg,
|
|
125
124
|
EVP_PKEY *pkey) {
|
|
126
|
-
|
|
125
|
+
// Convert the signature OID into digest and public key OIDs.
|
|
127
126
|
int sigalg_nid = OBJ_obj2nid(sigalg->algorithm);
|
|
128
127
|
int digest_nid, pkey_nid;
|
|
129
128
|
if (!OBJ_find_sigid_algs(sigalg_nid, &digest_nid, &pkey_nid)) {
|
|
@@ -131,19 +130,19 @@ int x509_digest_verify_init(EVP_MD_CTX *ctx, const X509_ALGOR *sigalg,
|
|
|
131
130
|
return 0;
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
|
|
133
|
+
// Check the public key OID matches the public key type.
|
|
135
134
|
if (pkey_nid != EVP_PKEY_id(pkey)) {
|
|
136
135
|
OPENSSL_PUT_ERROR(ASN1, ASN1_R_WRONG_PUBLIC_KEY_TYPE);
|
|
137
136
|
return 0;
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
|
|
139
|
+
// Check for permitted digest algorithms
|
|
141
140
|
if (!x509_digest_nid_ok(digest_nid)) {
|
|
142
141
|
OPENSSL_PUT_ERROR(ASN1, ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
|
|
143
142
|
return 0;
|
|
144
143
|
}
|
|
145
144
|
|
|
146
|
-
|
|
145
|
+
// NID_undef signals that there are custom parameters to set.
|
|
147
146
|
if (digest_nid == NID_undef) {
|
|
148
147
|
if (sigalg_nid == NID_rsassaPss) {
|
|
149
148
|
return x509_rsa_pss_to_ctx(ctx, sigalg, pkey);
|
|
@@ -159,17 +158,17 @@ int x509_digest_verify_init(EVP_MD_CTX *ctx, const X509_ALGOR *sigalg,
|
|
|
159
158
|
return 0;
|
|
160
159
|
}
|
|
161
160
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
// The parameter should be an explicit NULL for RSA and omitted for ECDSA. For
|
|
162
|
+
// compatibility, we allow either for both algorithms. See b/167375496.
|
|
163
|
+
//
|
|
164
|
+
// TODO(davidben): Chromium's verifier allows both forms for RSA, but enforces
|
|
165
|
+
// ECDSA more strictly. Align with Chromium and add a flag for b/167375496.
|
|
167
166
|
if (sigalg->parameter != NULL && sigalg->parameter->type != V_ASN1_NULL) {
|
|
168
167
|
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PARAMETER);
|
|
169
168
|
return 0;
|
|
170
169
|
}
|
|
171
170
|
|
|
172
|
-
|
|
171
|
+
// Otherwise, initialize with the digest from the OID.
|
|
173
172
|
const EVP_MD *digest = EVP_get_digestbynid(digest_nid);
|
|
174
173
|
if (digest == NULL) {
|
|
175
174
|
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
|