@fails-components/webtransport 0.0.1-rc.0 → 0.0.1-rc.1
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/.github/workflows/npm-publish-packages.yml +0 -0
- package/CMakeLists.txt +2 -0
- package/package.json +1 -1
- package/readme.md +0 -0
- package/src/http3serversession.h +1 -1
- package/src/webtransport.js +4 -2
- package/third_party/boringssl/src/CMakeLists.txt +9 -12
- package/third_party/boringssl/src/crypto/CMakeLists.txt +2 -3
- package/third_party/boringssl/src/crypto/asn1/time_support.c +206 -206
- package/third_party/boringssl/src/crypto/bio/socket_helper.c +124 -122
- package/third_party/boringssl/src/crypto/evp/digestsign.c +268 -231
- package/third_party/boringssl/src/crypto/evp/p_ec.c +286 -286
- package/third_party/boringssl/src/crypto/fipsmodule/aes/key_wrap.c +246 -236
- package/third_party/boringssl/src/crypto/fipsmodule/aes/mode_wrappers.c +124 -122
- package/third_party/boringssl/src/crypto/fipsmodule/bcm.c +3 -0
- package/third_party/boringssl/src/crypto/fipsmodule/bn/bytes.c +246 -230
- package/third_party/boringssl/src/crypto/fipsmodule/bn/internal.h +734 -715
- package/third_party/boringssl/src/crypto/fipsmodule/bn/random.c +349 -341
- package/third_party/boringssl/src/crypto/fipsmodule/cipher/cipher.c +670 -648
- package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aes.c +1504 -1472
- package/third_party/boringssl/src/crypto/{cipher_extra → fipsmodule/cipher}/e_aesccm.c +435 -446
- package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cavp_3des_cmac_tests.txt +0 -0
- package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cavp_aes128_cmac_tests.txt +0 -0
- package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cavp_aes192_cmac_tests.txt +0 -0
- package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cavp_aes256_cmac_tests.txt +0 -0
- package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cmac.c +318 -278
- package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cmac_test.cc +268 -267
- package/third_party/boringssl/src/crypto/fipsmodule/dh/dh.c +5 -1
- package/third_party/boringssl/src/crypto/fipsmodule/ec/ec.c +11 -17
- package/third_party/boringssl/src/crypto/fipsmodule/ec/ec_key.c +15 -4
- package/third_party/boringssl/src/crypto/fipsmodule/ec/internal.h +2 -6
- package/third_party/boringssl/src/crypto/fipsmodule/ec/p224-64.c +1164 -1180
- package/third_party/boringssl/src/crypto/fipsmodule/ec/p256-nistz.c +3 -3
- package/third_party/boringssl/src/crypto/fipsmodule/ec/p256-nistz_test.cc +2 -2
- package/third_party/boringssl/src/crypto/fipsmodule/ec/p256.c +44 -33
- package/third_party/boringssl/src/crypto/fipsmodule/ec/scalar.c +169 -175
- package/third_party/boringssl/src/crypto/fipsmodule/ec/simple.c +352 -357
- package/third_party/boringssl/src/crypto/fipsmodule/ecdh/ecdh.c +4 -0
- package/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c +14 -9
- package/third_party/boringssl/src/crypto/fipsmodule/hmac/hmac.c +256 -235
- package/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c +204 -202
- package/third_party/boringssl/src/crypto/fipsmodule/rsa/padding.c +702 -695
- package/third_party/boringssl/src/crypto/fipsmodule/rsa/rsa_impl.c +7 -2
- package/third_party/boringssl/src/crypto/fipsmodule/self_check/self_check.c +7 -0
- package/third_party/boringssl/src/crypto/fipsmodule/service_indicator/internal.h +89 -0
- package/third_party/boringssl/src/crypto/fipsmodule/service_indicator/service_indicator.c +333 -0
- package/third_party/boringssl/src/crypto/fipsmodule/service_indicator/service_indicator_test.cc +2410 -0
- package/third_party/boringssl/src/crypto/fipsmodule/sha/sha1.c +359 -357
- package/third_party/boringssl/src/crypto/fipsmodule/sha/sha256.c +325 -321
- package/third_party/boringssl/src/crypto/fipsmodule/sha/sha512.c +510 -508
- package/third_party/boringssl/src/crypto/fipsmodule/tls/kdf.c +177 -165
- package/third_party/boringssl/src/crypto/internal.h +13 -0
- package/third_party/boringssl/src/crypto/trust_token/trust_token_test.cc +884 -884
- package/third_party/boringssl/src/crypto/x509/internal.h +0 -2
- package/third_party/boringssl/src/crypto/x509/t_crl.c +148 -148
- package/third_party/boringssl/src/crypto/x509/t_req.c +249 -250
- package/third_party/boringssl/src/crypto/x509/t_x509.c +2 -3
- package/third_party/boringssl/src/crypto/x509/x509_req.c +262 -304
- package/third_party/boringssl/src/crypto/x509/x509_set.c +250 -240
- package/third_party/boringssl/src/crypto/x509/x509_test.cc +466 -4
- package/third_party/boringssl/src/crypto/x509/x509cset.c +292 -279
- package/third_party/boringssl/src/crypto/x509/x509rset.c +89 -86
- package/third_party/boringssl/src/crypto/x509/x_crl.c +37 -125
- package/third_party/boringssl/src/crypto/x509/x_req.c +114 -109
- package/third_party/boringssl/src/crypto/x509/x_x509.c +394 -394
- package/third_party/boringssl/src/crypto/x509v3/v3_akey.c +11 -16
- package/third_party/boringssl/src/crypto/x509v3/v3_alt.c +644 -642
- package/third_party/boringssl/src/crypto/x509v3/v3_bcons.c +130 -133
- package/third_party/boringssl/src/crypto/x509v3/v3_bitst.c +149 -144
- package/third_party/boringssl/src/crypto/x509v3/v3_cpols.c +496 -500
- package/third_party/boringssl/src/crypto/x509v3/v3_enum.c +105 -106
- package/third_party/boringssl/src/crypto/x509v3/v3_ia5.c +126 -121
- package/third_party/boringssl/src/crypto/x509v3/v3_info.c +206 -218
- package/third_party/boringssl/src/crypto/x509v3/v3_int.c +97 -91
- package/third_party/boringssl/src/crypto/x509v3/v3_pci.c +290 -289
- package/third_party/boringssl/src/crypto/x509v3/v3_skey.c +161 -156
- package/third_party/boringssl/src/crypto/x509v3/v3_utl.c +5 -3
- package/third_party/boringssl/src/include/openssl/aead.h +480 -480
- package/third_party/boringssl/src/include/openssl/asn1.h +2 -0
- package/third_party/boringssl/src/include/openssl/base.h +1 -1
- package/third_party/boringssl/src/include/openssl/service_indicator.h +96 -0
- package/third_party/boringssl/src/include/openssl/ssl.h +7 -0
- package/third_party/boringssl/src/include/openssl/x509.h +11 -33
- package/third_party/boringssl/src/include/openssl/x509v3.h +990 -1018
- package/third_party/boringssl/src/sources.cmake +4 -4
- package/third_party/boringssl/src/ssl/internal.h +10 -0
- package/third_party/boringssl/src/ssl/ssl_lib.cc +3081 -3072
- package/third_party/boringssl/src/ssl/ssl_test.cc +46 -0
- package/third_party/boringssl/src/ssl/tls13_server.cc +4 -6
- package/third_party/boringssl/src/util/bot/DEPS +14 -27
- package/third_party/boringssl/src/util/bot/UPDATING +3 -9
- package/third_party/boringssl/src/util/bot/update_clang.py +172 -172
- package/third_party/boringssl/src/util/bot/vs_toolchain.py +3 -3
- package/third_party/quiche/.bazelrc +8 -0
- package/third_party/quiche/BUILD.bazel +7 -0
- package/third_party/quiche/WHITESPACE +3 -1
- package/third_party/quiche/WORKSPACE.bazel +87 -0
- package/third_party/quiche/build/BUILD.bazel +7 -0
- package/third_party/quiche/build/source_list.bzl +1511 -0
- package/third_party/quiche/build/source_list.gni +1511 -0
- package/third_party/quiche/build/source_list.json +1511 -0
- package/third_party/quiche/build/test.bzl +26 -0
- package/third_party/quiche/build/zlib.BUILD +25 -0
- package/third_party/quiche/quiche/BUILD.bazel +270 -0
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_enums.cc +3 -3
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_enums.h +7 -7
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_frame.cc +39 -18
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_frame.h +11 -10
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_frame_test.cc +67 -63
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_headers.cc +13 -12
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_headers.h +16 -8
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_headers_test.cc +9 -9
- package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_visitor_interface.h +4 -4
- package/third_party/quiche/quiche/{common/balsa → balsa}/framer_interface.h +3 -3
- package/third_party/quiche/quiche/{common/balsa → balsa}/header_api.h +3 -3
- package/third_party/quiche/quiche/{common/balsa → balsa}/header_properties.cc +1 -1
- package/third_party/quiche/quiche/{common/balsa → balsa}/header_properties.h +3 -3
- package/third_party/quiche/quiche/{common/balsa → balsa}/header_properties_test.cc +1 -1
- package/third_party/quiche/quiche/{common/balsa → balsa}/http_validation_policy.cc +1 -1
- package/third_party/quiche/quiche/{common/balsa → balsa}/http_validation_policy.h +3 -3
- package/third_party/quiche/quiche/{common/balsa → balsa}/noop_balsa_visitor.h +4 -4
- package/third_party/quiche/quiche/{common/balsa → balsa}/simple_buffer.cc +22 -29
- package/third_party/quiche/quiche/{common/balsa → balsa}/simple_buffer.h +18 -16
- package/third_party/quiche/quiche/{common/balsa → balsa}/simple_buffer_test.cc +79 -32
- package/third_party/quiche/quiche/{common/balsa → balsa}/standard_header_map.cc +1 -1
- package/third_party/quiche/quiche/{common/balsa → balsa}/standard_header_map.h +3 -3
- package/third_party/quiche/quiche/common/platform/api/quiche_command_line_flags.h +6 -1
- package/third_party/quiche/quiche/common/platform/api/quiche_flags.h +8 -0
- package/third_party/quiche/quiche/common/platform/api/quiche_logging.h +0 -3
- package/third_party/quiche/quiche/common/platform/api/quiche_lower_case_string_test.cc +29 -0
- package/third_party/quiche/quiche/common/platform/api/quiche_test.h +5 -7
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quic_flags_impl.h +1 -1
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_bug_tracker_impl.h +3 -2
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_command_line_flags_impl.cc +41 -0
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_command_line_flags_impl.h +33 -0
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_expect_bug_impl.h +15 -0
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_logging_impl.h +84 -50
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_lower_case_string_impl.h +25 -0
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_stack_trace_impl.cc +1 -1
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_test_impl.cc +25 -0
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_test_impl.h +56 -0
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_test_output_impl.h +27 -0
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_thread_impl.h +26 -0
- package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_url_utils_impl.cc +1 -0
- package/third_party/quiche/quiche/common/quiche_buffer_allocator_test.cc +1 -1
- package/third_party/quiche/quiche/common/quiche_mem_slice_storage.h +2 -3
- package/third_party/quiche/quiche/common/structured_headers.cc +14 -12
- package/third_party/quiche/quiche/http2/adapter/event_forwarder.cc +7 -5
- package/third_party/quiche/quiche/http2/adapter/event_forwarder.h +4 -2
- package/third_party/quiche/quiche/http2/adapter/event_forwarder_test.cc +14 -9
- package/third_party/quiche/quiche/http2/adapter/header_validator.cc +43 -19
- package/third_party/quiche/quiche/http2/adapter/header_validator.h +11 -40
- package/third_party/quiche/quiche/http2/adapter/header_validator_base.h +69 -0
- package/third_party/quiche/quiche/http2/adapter/header_validator_test.cc +73 -1
- package/third_party/quiche/quiche/http2/adapter/nghttp2_adapter_test.cc +66 -0
- package/third_party/quiche/quiche/http2/adapter/nghttp2_session_test.cc +8 -5
- package/third_party/quiche/quiche/http2/adapter/nghttp2_test.cc +1 -1
- package/third_party/quiche/quiche/http2/adapter/noop_header_validator.cc +22 -0
- package/third_party/quiche/quiche/http2/adapter/noop_header_validator.h +25 -0
- package/third_party/quiche/quiche/http2/adapter/noop_header_validator_test.cc +523 -0
- package/third_party/quiche/quiche/http2/adapter/oghttp2_adapter_test.cc +186 -5
- package/third_party/quiche/quiche/http2/adapter/oghttp2_session.cc +37 -43
- package/third_party/quiche/quiche/http2/adapter/oghttp2_session.h +22 -23
- package/third_party/quiche/quiche/http2/adapter/test_utils.cc +1 -1
- package/third_party/quiche/quiche/http2/adapter/window_manager_test.cc +11 -5
- package/third_party/quiche/quiche/http2/core/http2_trace_logging.cc +13 -11
- package/third_party/quiche/quiche/http2/core/http2_trace_logging.h +5 -4
- package/third_party/quiche/quiche/http2/core/priority_write_scheduler.h +42 -36
- package/third_party/quiche/quiche/http2/core/priority_write_scheduler_test.cc +2 -2
- package/third_party/quiche/quiche/http2/decoder/decode_buffer_test.cc +9 -9
- package/third_party/quiche/quiche/http2/decoder/decode_http2_structures_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/http2_frame_decoder_test.cc +14 -14
- package/third_party/quiche/quiche/http2/decoder/http2_structure_decoder_test.cc +17 -17
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/data_payload_decoder_test.cc +2 -2
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/headers_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/ping_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/priority_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/priority_update_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/settings_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_block_decoder_test.cc +2 -2
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_decoder_state_test.cc +8 -8
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc +4 -3
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_decoder_tables_test.cc +17 -17
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_decoder_test.cc +25 -25
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_entry_decoder_test.cc +2 -2
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_entry_type_decoder_test.cc +7 -6
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_string_decoder_test.cc +6 -6
- package/third_party/quiche/quiche/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc +1 -1
- package/third_party/quiche/quiche/http2/hpack/huffman/hpack_huffman_decoder_test.cc +2 -2
- package/third_party/quiche/quiche/http2/hpack/huffman/hpack_huffman_encoder_test.cc +1 -1
- package/third_party/quiche/quiche/http2/hpack/huffman/hpack_huffman_transcoder_test.cc +5 -5
- package/third_party/quiche/quiche/http2/hpack/varint/hpack_varint_decoder_test.cc +4 -4
- package/third_party/quiche/quiche/http2/hpack/varint/hpack_varint_round_trip_test.cc +1 -1
- package/third_party/quiche/quiche/http2/http2_constants_test.cc +1 -1
- package/third_party/quiche/quiche/http2/http2_structures_test.cc +23 -22
- package/third_party/quiche/quiche/http2/test_tools/frame_decoder_state_test_util.cc +1 -1
- package/third_party/quiche/quiche/http2/test_tools/frame_decoder_state_test_util.h +1 -1
- package/third_party/quiche/quiche/http2/test_tools/frame_parts.cc +38 -38
- package/third_party/quiche/quiche/http2/test_tools/hpack_block_collector.cc +15 -15
- package/third_party/quiche/quiche/http2/test_tools/hpack_entry_collector.cc +24 -22
- package/third_party/quiche/quiche/http2/test_tools/hpack_string_collector.cc +5 -5
- package/third_party/quiche/quiche/http2/test_tools/http2_frame_builder_test.cc +70 -89
- package/third_party/quiche/quiche/http2/test_tools/payload_decoder_base_test_util.cc +1 -1
- package/third_party/quiche/quiche/http2/test_tools/payload_decoder_base_test_util.h +29 -26
- package/third_party/quiche/quiche/http2/test_tools/{random_decoder_test.cc → random_decoder_test_base.cc} +13 -10
- package/third_party/quiche/quiche/http2/test_tools/{random_decoder_test.h → random_decoder_test_base.h} +15 -17
- package/third_party/quiche/quiche/http2/test_tools/{random_decoder_test_test.cc → random_decoder_test_base_test.cc} +1 -1
- package/third_party/quiche/quiche/http2/test_tools/verify_macros.h +32 -0
- package/third_party/quiche/quiche/quic/core/congestion_control/bbr2_sender.cc +2 -1
- package/third_party/quiche/quiche/quic/core/congestion_control/bbr2_simulator_test.cc +3 -2
- package/third_party/quiche/quiche/quic/core/congestion_control/bbr_sender_test.cc +3 -2
- package/third_party/quiche/quiche/quic/core/congestion_control/rtt_stats.cc +3 -2
- package/third_party/quiche/quiche/quic/core/congestion_control/rtt_stats.h +2 -1
- package/third_party/quiche/quiche/quic/core/congestion_control/rtt_stats_test.cc +2 -13
- package/third_party/quiche/quiche/quic/core/crypto/certificate_view.cc +15 -0
- package/third_party/quiche/quiche/quic/core/crypto/certificate_view.h +7 -0
- package/third_party/quiche/quiche/quic/core/crypto/certificate_view_test.cc +16 -0
- package/third_party/quiche/quiche/quic/core/crypto/crypto_protocol.h +1 -0
- package/third_party/quiche/quiche/quic/core/crypto/proof_source.h +2 -2
- package/third_party/quiche/quiche/quic/core/crypto/proof_source_x509.cc +3 -5
- package/third_party/quiche/quiche/quic/core/crypto/proof_source_x509.h +1 -2
- package/third_party/quiche/quiche/quic/core/crypto/quic_crypto_server_config.cc +1 -1
- package/third_party/quiche/quiche/quic/core/crypto/quic_crypto_server_config.h +3 -3
- package/third_party/quiche/quiche/quic/core/frames/quic_blocked_frame.cc +2 -8
- package/third_party/quiche/quiche/quic/core/frames/quic_blocked_frame.h +0 -1
- package/third_party/quiche/quiche/quic/core/frames/quic_crypto_frame.h +2 -0
- package/third_party/quiche/quiche/quic/core/frames/quic_frames_test.cc +2 -1
- package/third_party/quiche/quiche/quic/core/http/capsule.cc +2 -22
- package/third_party/quiche/quiche/quic/core/http/capsule.h +0 -2
- package/third_party/quiche/quiche/quic/core/http/capsule_test.cc +1 -2
- package/third_party/quiche/quiche/quic/core/http/end_to_end_test.cc +148 -57
- package/third_party/quiche/quiche/quic/core/http/http_constants.cc +1 -1
- package/third_party/quiche/quiche/quic/core/http/http_constants.h +2 -2
- package/third_party/quiche/quiche/quic/core/http/quic_header_list_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/http/quic_headers_stream_test.cc +18 -14
- package/third_party/quiche/quiche/quic/core/http/quic_send_control_stream.h +2 -1
- package/third_party/quiche/quiche/quic/core/http/quic_send_control_stream_test.cc +3 -7
- package/third_party/quiche/quiche/quic/core/http/quic_server_session_base.h +4 -0
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_session.cc +47 -65
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_session.h +5 -17
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_session_test.cc +63 -54
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.cc +34 -91
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.h +1 -9
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream_test.cc +27 -134
- package/third_party/quiche/quiche/quic/core/http/spdy_utils.cc +0 -41
- package/third_party/quiche/quiche/quic/core/http/spdy_utils.h +0 -9
- package/third_party/quiche/quiche/quic/core/http/spdy_utils_test.cc +0 -32
- package/third_party/quiche/quiche/quic/core/http/web_transport_http3.cc +0 -1
- package/third_party/quiche/quiche/quic/core/packet_number_indexed_queue_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/qpack/qpack_header_table.cc +2 -1
- package/third_party/quiche/quiche/quic/core/qpack/qpack_send_stream.h +2 -1
- package/third_party/quiche/quiche/quic/core/quic_arena_scoped_ptr_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_connection.cc +68 -46
- package/third_party/quiche/quiche/quic/core/quic_connection.h +7 -6
- package/third_party/quiche/quiche/quic/core/quic_connection_context_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_connection_id_manager_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_connection_id_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_connection_test.cc +45 -132
- package/third_party/quiche/quiche/quic/core/quic_constants.h +0 -7
- package/third_party/quiche/quiche/quic/core/quic_control_frame_manager.cc +11 -3
- package/third_party/quiche/quiche/quic/core/quic_control_frame_manager.h +1 -1
- package/third_party/quiche/quiche/quic/core/quic_control_frame_manager_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_crypto_client_handshaker.cc +13 -1
- package/third_party/quiche/quiche/quic/core/quic_crypto_client_handshaker.h +3 -0
- package/third_party/quiche/quiche/quic/core/quic_crypto_client_handshaker_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_crypto_client_stream.cc +6 -0
- package/third_party/quiche/quiche/quic/core/quic_crypto_client_stream.h +8 -0
- package/third_party/quiche/quiche/quic/core/quic_crypto_server_stream.cc +26 -13
- package/third_party/quiche/quiche/quic/core/quic_crypto_server_stream.h +5 -2
- package/third_party/quiche/quiche/quic/core/quic_crypto_stream.cc +55 -47
- package/third_party/quiche/quiche/quic/core/quic_crypto_stream.h +15 -10
- package/third_party/quiche/quiche/quic/core/quic_crypto_stream_test.cc +34 -5
- package/third_party/quiche/quiche/quic/core/quic_dispatcher.cc +20 -11
- package/third_party/quiche/quiche/quic/core/quic_dispatcher_test.cc +37 -13
- package/third_party/quiche/quiche/quic/core/quic_flags_list.h +6 -10
- package/third_party/quiche/quiche/quic/core/quic_flow_controller.cc +3 -3
- package/third_party/quiche/quiche/quic/core/quic_flow_controller.h +2 -2
- package/third_party/quiche/quiche/quic/core/quic_flow_controller_test.cc +15 -10
- package/third_party/quiche/quiche/quic/core/quic_framer.cc +1 -1
- package/third_party/quiche/quiche/quic/core/quic_one_block_arena.h +3 -2
- package/third_party/quiche/quiche/quic/core/quic_one_block_arena_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_packet_creator.cc +3 -11
- package/third_party/quiche/quiche/quic/core/quic_packet_creator.h +0 -8
- package/third_party/quiche/quiche/quic/core/quic_ping_manager.cc +14 -14
- package/third_party/quiche/quiche/quic/core/quic_ping_manager_test.cc +48 -0
- package/third_party/quiche/quiche/quic/core/quic_received_packet_manager.cc +3 -18
- package/third_party/quiche/quiche/quic/core/quic_received_packet_manager_test.cc +4 -14
- package/third_party/quiche/quiche/quic/core/quic_server_id_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_session.cc +4 -4
- package/third_party/quiche/quiche/quic/core/quic_session.h +1 -1
- package/third_party/quiche/quiche/quic/core/quic_session_test.cc +21 -1
- package/third_party/quiche/quiche/quic/core/quic_stream.cc +4 -7
- package/third_party/quiche/quiche/quic/core/quic_stream_test.cc +2 -4
- package/third_party/quiche/quiche/quic/core/quic_trace_visitor_test.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_types.h +3 -8
- package/third_party/quiche/quiche/quic/core/quic_udp_socket_posix.cc +5 -4
- package/third_party/quiche/quiche/quic/core/quic_unacked_packet_map_test.cc +1 -1
- package/third_party/quiche/quiche/quic/core/quic_utils.cc +1 -1
- package/third_party/quiche/quiche/quic/core/quic_utils.h +2 -2
- package/third_party/quiche/quiche/quic/core/quic_versions_test.cc +0 -1
- package/third_party/quiche/quiche/quic/core/tls_client_handshaker.cc +13 -0
- package/third_party/quiche/quiche/quic/core/tls_client_handshaker.h +2 -0
- package/third_party/quiche/quiche/quic/core/tls_server_handshaker.cc +17 -3
- package/third_party/quiche/quiche/quic/core/tls_server_handshaker.h +3 -1
- package/third_party/quiche/quiche/quic/core/uber_received_packet_manager_test.cc +18 -10
- package/third_party/quiche/quiche/quic/masque/masque_client_bin.cc +6 -4
- package/third_party/quiche/quiche/quic/masque/masque_client_session.cc +23 -7
- package/third_party/quiche/quiche/quic/masque/masque_client_session.h +1 -1
- package/third_party/quiche/quiche/quic/masque/masque_server_backend.cc +13 -0
- package/third_party/quiche/quiche/quic/masque/masque_server_backend.h +2 -0
- package/third_party/quiche/quiche/quic/masque/masque_server_bin.cc +5 -4
- package/third_party/quiche/quiche/quic/masque/masque_server_session.cc +30 -40
- package/third_party/quiche/quiche/quic/masque/masque_server_session.h +1 -1
- package/third_party/quiche/quiche/quic/platform/api/quic_export.h +4 -4
- package/third_party/quiche/quiche/quic/platform/api/quic_flags.h +0 -1
- package/third_party/quiche/quiche/quic/platform/api/quic_logging.h +0 -6
- package/third_party/quiche/quiche/quic/platform/api/quic_test.h +6 -5
- package/third_party/quiche/quiche/quic/qbone/bonnet/icmp_reachable_test.cc +2 -2
- package/third_party/quiche/quiche/quic/qbone/bonnet/mock_qbone_tunnel.h +2 -0
- package/third_party/quiche/quiche/quic/qbone/bonnet/qbone_tunnel_interface.h +2 -0
- package/third_party/quiche/quiche/quic/qbone/bonnet/tun_device_controller_test.cc +2 -2
- package/third_party/quiche/quiche/quic/qbone/bonnet/tun_device_packet_exchanger_test.cc +2 -2
- package/third_party/quiche/quiche/quic/qbone/bonnet/tun_device_test.cc +2 -2
- package/third_party/quiche/quiche/quic/qbone/platform/netlink_test.cc +2 -2
- package/third_party/quiche/quiche/quic/qbone/platform/tcp_packet.cc +5 -4
- package/third_party/quiche/quiche/quic/qbone/qbone_client_session.cc +4 -2
- package/third_party/quiche/quiche/quic/qbone/qbone_packet_processor.cc +2 -1
- package/third_party/quiche/quiche/quic/qbone/qbone_packet_processor_test.cc +2 -2
- package/third_party/quiche/quiche/quic/qbone/qbone_server_session.cc +4 -2
- package/third_party/quiche/quiche/quic/qbone/qbone_session_base.cc +3 -2
- package/third_party/quiche/quiche/quic/qbone/qbone_stream.cc +4 -4
- package/third_party/quiche/quiche/quic/test_tools/quic_connection_peer.cc +1 -1
- package/third_party/quiche/quiche/quic/test_tools/quic_http_response_cache_data/test.example.com/index.html +63 -0
- package/third_party/quiche/quiche/quic/test_tools/quic_http_response_cache_data/test.example.com/map.html +65 -0
- package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.cc +4 -3
- package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.h +18 -1
- package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint_test.cc +1 -1
- package/third_party/quiche/quiche/quic/test_tools/simulator/simulator_test.cc +1 -1
- package/third_party/quiche/quiche/quic/test_tools/test_ticket_crypter.cc +1 -1
- package/third_party/quiche/quiche/quic/test_tools/test_ticket_crypter.h +2 -2
- package/third_party/quiche/quiche/quic/{core/crypto → tools}/crypto_message_printer_bin.cc +0 -0
- package/third_party/quiche/quiche/quic/{core/qpack → tools}/qpack_offline_decoder_bin.cc +0 -0
- package/third_party/quiche/quiche/quic/tools/quic_client_interop_test_bin.cc +4 -3
- package/third_party/quiche/quiche/quic/tools/quic_memory_cache_backend_test.cc +3 -31
- package/third_party/quiche/quiche/quic/tools/quic_packet_printer_bin.cc +2 -2
- package/third_party/quiche/quiche/quic/tools/quic_simple_server_session.h +1 -1
- package/third_party/quiche/quiche/quic/tools/quic_simple_server_session_test.cc +1 -1
- package/third_party/quiche/quiche/quic/tools/quic_toy_client.cc +52 -38
- package/third_party/quiche/quiche/quic/tools/quic_toy_server.cc +10 -7
- package/third_party/quiche/quiche/quic/tools/simple_ticket_crypter.cc +1 -1
- package/third_party/quiche/quiche/quic/tools/simple_ticket_crypter.h +1 -1
- package/third_party/quiche/quiche/quic/tools/web_transport_test_visitors.h +3 -2
- package/third_party/quiche/quiche/spdy/core/array_output_buffer.h +1 -1
- package/third_party/quiche/quiche/spdy/core/hpack/hpack_decoder_adapter_test.cc +1 -1
- package/third_party/quiche/quiche/spdy/core/hpack/hpack_encoder_test.cc +2 -1
- package/third_party/quiche/quiche/spdy/core/hpack/hpack_header_table_test.cc +1 -1
- package/third_party/quiche/quiche/spdy/core/hpack/hpack_round_trip_test.cc +2 -1
- package/third_party/quiche/quiche/spdy/core/hpack/hpack_static_table_test.cc +1 -1
- package/third_party/quiche/quiche/spdy/core/http2_frame_decoder_adapter.cc +8 -6
- package/third_party/quiche/quiche/spdy/core/http2_frame_decoder_adapter.h +17 -6
- package/third_party/quiche/quiche/spdy/core/metadata_extension.cc +1 -1
- package/third_party/quiche/quiche/spdy/core/metadata_extension_test.cc +1 -1
- package/third_party/quiche/quiche/spdy/core/spdy_framer_test.cc +21 -17
- package/third_party/quiche/quiche/spdy/core/spdy_intrusive_list_test.cc +3 -3
- package/third_party/quiche/quiche/spdy/core/spdy_no_op_visitor.h +6 -4
- package/third_party/quiche/quiche/spdy/core/spdy_pinnable_buffer_piece_test.cc +1 -1
- package/third_party/quiche/quiche/spdy/core/spdy_prefixed_buffer_reader_test.cc +1 -1
- package/third_party/quiche/quiche/spdy/core/spdy_protocol_test.cc +1 -1
- package/third_party/quiche/quiche/spdy/test_tools/mock_spdy_framer_visitor.h +5 -4
- package/third_party/boringssl/src/util/bot/cmake-win32.zip.sha1 +0 -1
- package/third_party/quiche/quiche/common/platform/api/quiche_mock_log.h +0 -18
- package/third_party/quiche/quiche/common/platform/api/quiche_test_helpers.h +0 -8
- package/third_party/quiche/quiche/quic/platform/api/quic_mock_log.h +0 -19
- package/third_party/quiche/quiche/quic/tools/quic_transport_simple_server_dispatcher.cc +0 -51
- package/third_party/quiche/quiche/quic/tools/quic_transport_simple_server_dispatcher.h +0 -41
- package/third_party/quiche/quiche/quic/tools/quic_transport_simple_server_session.cc +0 -168
- package/third_party/quiche/quiche/quic/tools/quic_transport_simple_server_session.h +0 -78
|
@@ -1,267 +1,268 @@
|
|
|
1
|
-
/* Copyright (c) 2015, Google Inc.
|
|
2
|
-
*
|
|
3
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
5
|
-
* copyright notice and this permission notice appear in all copies.
|
|
6
|
-
*
|
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
10
|
-
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
12
|
-
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
13
|
-
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
|
14
|
-
|
|
15
|
-
#include <stdio.h>
|
|
16
|
-
|
|
17
|
-
#include <algorithm>
|
|
18
|
-
#include <vector>
|
|
19
|
-
|
|
20
|
-
#include <gtest/gtest.h>
|
|
21
|
-
|
|
22
|
-
#include <openssl/cipher.h>
|
|
23
|
-
#include <openssl/cmac.h>
|
|
24
|
-
#include <openssl/mem.h>
|
|
25
|
-
|
|
26
|
-
#include "
|
|
27
|
-
#include "
|
|
28
|
-
#include "
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
static void test(const char *name, const uint8_t *key, size_t key_len,
|
|
32
|
-
const uint8_t *msg, size_t msg_len, const uint8_t *expected) {
|
|
33
|
-
SCOPED_TRACE(name);
|
|
34
|
-
|
|
35
|
-
// Test the single-shot API.
|
|
36
|
-
uint8_t out[16];
|
|
37
|
-
ASSERT_TRUE(AES_CMAC(out, key, key_len, msg, msg_len));
|
|
38
|
-
EXPECT_EQ(Bytes(expected, sizeof(out)), Bytes(out));
|
|
39
|
-
|
|
40
|
-
bssl::UniquePtr<CMAC_CTX> ctx(CMAC_CTX_new());
|
|
41
|
-
ASSERT_TRUE(ctx);
|
|
42
|
-
ASSERT_TRUE(CMAC_Init(ctx.get(), key, key_len, EVP_aes_128_cbc(), NULL));
|
|
43
|
-
|
|
44
|
-
for (unsigned chunk_size = 1; chunk_size <= msg_len; chunk_size++) {
|
|
45
|
-
SCOPED_TRACE(chunk_size);
|
|
46
|
-
|
|
47
|
-
ASSERT_TRUE(CMAC_Reset(ctx.get()));
|
|
48
|
-
|
|
49
|
-
size_t done = 0;
|
|
50
|
-
while (done < msg_len) {
|
|
51
|
-
size_t todo = std::min(msg_len - done, static_cast<size_t>(chunk_size));
|
|
52
|
-
ASSERT_TRUE(CMAC_Update(ctx.get(), msg + done, todo));
|
|
53
|
-
done += todo;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
size_t out_len;
|
|
57
|
-
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
58
|
-
EXPECT_EQ(Bytes(expected, sizeof(out)), Bytes(out, out_len));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Test that |CMAC_CTX_copy| works.
|
|
62
|
-
ASSERT_TRUE(CMAC_Reset(ctx.get()));
|
|
63
|
-
size_t chunk = msg_len / 2;
|
|
64
|
-
ASSERT_TRUE(CMAC_Update(ctx.get(), msg, chunk));
|
|
65
|
-
bssl::UniquePtr<CMAC_CTX> ctx2(CMAC_CTX_new());
|
|
66
|
-
ASSERT_TRUE(ctx2);
|
|
67
|
-
ASSERT_TRUE(CMAC_CTX_copy(ctx2.get(), ctx.get()));
|
|
68
|
-
ASSERT_TRUE(CMAC_Update(ctx2.get(), msg + chunk, msg_len - chunk));
|
|
69
|
-
size_t out_len;
|
|
70
|
-
ASSERT_TRUE(CMAC_Final(ctx2.get(), out, &out_len));
|
|
71
|
-
EXPECT_EQ(Bytes(expected, sizeof(out)), Bytes(out, out_len));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
TEST(CMACTest, RFC4493TestVectors) {
|
|
75
|
-
static const uint8_t kKey[16] = {
|
|
76
|
-
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
|
77
|
-
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
|
|
78
|
-
};
|
|
79
|
-
static const uint8_t kOut1[16] = {
|
|
80
|
-
0xbb, 0x1d, 0x69, 0x29, 0xe9, 0x59, 0x37, 0x28,
|
|
81
|
-
0x7f, 0xa3, 0x7d, 0x12, 0x9b, 0x75, 0x67, 0x46,
|
|
82
|
-
};
|
|
83
|
-
static const uint8_t kMsg2[] = {
|
|
84
|
-
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
|
85
|
-
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
|
86
|
-
};
|
|
87
|
-
static const uint8_t kOut2[16] = {
|
|
88
|
-
0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44,
|
|
89
|
-
0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c,
|
|
90
|
-
};
|
|
91
|
-
static const uint8_t kMsg3[] = {
|
|
92
|
-
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
|
93
|
-
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
|
94
|
-
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
|
95
|
-
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
|
96
|
-
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
|
97
|
-
};
|
|
98
|
-
static const uint8_t kOut3[16] = {
|
|
99
|
-
0xdf, 0xa6, 0x67, 0x47, 0xde, 0x9a, 0xe6, 0x30,
|
|
100
|
-
0x30, 0xca, 0x32, 0x61, 0x14, 0x97, 0xc8, 0x27,
|
|
101
|
-
};
|
|
102
|
-
static const uint8_t kMsg4[] = {
|
|
103
|
-
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
|
104
|
-
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
|
105
|
-
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
|
106
|
-
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
|
107
|
-
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
|
108
|
-
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
|
109
|
-
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
|
110
|
-
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10,
|
|
111
|
-
};
|
|
112
|
-
static const uint8_t kOut4[16] = {
|
|
113
|
-
0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92,
|
|
114
|
-
0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe,
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
test("RFC 4493 #1", kKey, sizeof(kKey), NULL, 0, kOut1);
|
|
118
|
-
test("RFC 4493 #2", kKey, sizeof(kKey), kMsg2, sizeof(kMsg2), kOut2);
|
|
119
|
-
test("RFC 4493 #3", kKey, sizeof(kKey), kMsg3, sizeof(kMsg3), kOut3);
|
|
120
|
-
test("RFC 4493 #4", kKey, sizeof(kKey), kMsg4, sizeof(kMsg4), kOut4);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
TEST(CMACTest, Wycheproof) {
|
|
124
|
-
FileTestGTest("third_party/wycheproof_testvectors/aes_cmac_test.txt",
|
|
125
|
-
[](FileTest *t) {
|
|
126
|
-
std::string key_size, tag_size;
|
|
127
|
-
ASSERT_TRUE(t->GetInstruction(&key_size, "keySize"));
|
|
128
|
-
ASSERT_TRUE(t->GetInstruction(&tag_size, "tagSize"));
|
|
129
|
-
WycheproofResult result;
|
|
130
|
-
ASSERT_TRUE(GetWycheproofResult(t, &result));
|
|
131
|
-
std::vector<uint8_t> key, msg, tag;
|
|
132
|
-
ASSERT_TRUE(t->GetBytes(&key, "key"));
|
|
133
|
-
ASSERT_TRUE(t->GetBytes(&msg, "msg"));
|
|
134
|
-
ASSERT_TRUE(t->GetBytes(&tag, "tag"));
|
|
135
|
-
|
|
136
|
-
const EVP_CIPHER *cipher;
|
|
137
|
-
switch (atoi(key_size.c_str())) {
|
|
138
|
-
case 128:
|
|
139
|
-
cipher = EVP_aes_128_cbc();
|
|
140
|
-
break;
|
|
141
|
-
case 192:
|
|
142
|
-
cipher = EVP_aes_192_cbc();
|
|
143
|
-
break;
|
|
144
|
-
case 256:
|
|
145
|
-
cipher = EVP_aes_256_cbc();
|
|
146
|
-
break;
|
|
147
|
-
default:
|
|
148
|
-
// Some test vectors intentionally give the wrong key size. Our API
|
|
149
|
-
// requires the caller pick the sized CBC primitive, so these tests
|
|
150
|
-
// aren't useful for us.
|
|
151
|
-
EXPECT_FALSE(result.IsValid());
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
size_t tag_len = static_cast<size_t>(atoi(tag_size.c_str())) / 8;
|
|
156
|
-
|
|
157
|
-
uint8_t out[16];
|
|
158
|
-
bssl::UniquePtr<CMAC_CTX> ctx(CMAC_CTX_new());
|
|
159
|
-
ASSERT_TRUE(ctx);
|
|
160
|
-
ASSERT_TRUE(CMAC_Init(ctx.get(), key.data(), key.size(), cipher, NULL));
|
|
161
|
-
ASSERT_TRUE(CMAC_Update(ctx.get(), msg.data(), msg.size()));
|
|
162
|
-
size_t out_len;
|
|
163
|
-
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
164
|
-
// Truncate the tag, if requested.
|
|
165
|
-
out_len = std::min(out_len, tag_len);
|
|
166
|
-
|
|
167
|
-
if (result.IsValid()) {
|
|
168
|
-
EXPECT_EQ(Bytes(tag), Bytes(out, out_len));
|
|
169
|
-
|
|
170
|
-
// Test the streaming API as well.
|
|
171
|
-
ASSERT_TRUE(CMAC_Reset(ctx.get()));
|
|
172
|
-
for (uint8_t b : msg) {
|
|
173
|
-
ASSERT_TRUE(CMAC_Update(ctx.get(), &b, 1));
|
|
174
|
-
}
|
|
175
|
-
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
176
|
-
out_len = std::min(out_len, tag_len);
|
|
177
|
-
EXPECT_EQ(Bytes(tag), Bytes(out, out_len));
|
|
178
|
-
} else {
|
|
179
|
-
// Wycheproof's invalid tests assume the implementation internally does
|
|
180
|
-
// the comparison, whereas our API only computes the tag. Check that
|
|
181
|
-
// they're not equal, but these tests are mostly not useful for us.
|
|
182
|
-
EXPECT_NE(Bytes(tag), Bytes(out, out_len));
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
static void RunCAVPTest(const char *path, const EVP_CIPHER *cipher,
|
|
188
|
-
bool is_3des) {
|
|
189
|
-
FileTestGTest(path, [&](FileTest *t) {
|
|
190
|
-
t->IgnoreAttribute("Count");
|
|
191
|
-
t->IgnoreAttribute("Klen");
|
|
192
|
-
std::string t_len, m_len, result;
|
|
193
|
-
ASSERT_TRUE(t->GetAttribute(&t_len, "Tlen"));
|
|
194
|
-
ASSERT_TRUE(t->GetAttribute(&m_len, "Mlen"));
|
|
195
|
-
ASSERT_TRUE(t->GetAttribute(&result, "Result"));
|
|
196
|
-
std::vector<uint8_t> key, msg, mac;
|
|
197
|
-
if (is_3des) {
|
|
198
|
-
std::vector<uint8_t> key2, key3;
|
|
199
|
-
ASSERT_TRUE(t->GetBytes(&key, "Key1"));
|
|
200
|
-
ASSERT_TRUE(t->GetBytes(&key2, "Key2"));
|
|
201
|
-
ASSERT_TRUE(t->GetBytes(&key3, "Key3"));
|
|
202
|
-
key.insert(key.end(), key2.begin(), key2.end());
|
|
203
|
-
key.insert(key.end(), key3.begin(), key3.end());
|
|
204
|
-
} else {
|
|
205
|
-
ASSERT_TRUE(t->GetBytes(&key, "Key"));
|
|
206
|
-
}
|
|
207
|
-
ASSERT_TRUE(t->GetBytes(&msg, "Msg"));
|
|
208
|
-
ASSERT_TRUE(t->GetBytes(&mac, "Mac"));
|
|
209
|
-
|
|
210
|
-
// CAVP's uses a non-empty Msg attribute and zero Mlen for the empty string.
|
|
211
|
-
if (atoi(m_len.c_str()) == 0) {
|
|
212
|
-
msg.clear();
|
|
213
|
-
} else {
|
|
214
|
-
EXPECT_EQ(static_cast<size_t>(atoi(m_len.c_str())), msg.size());
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
size_t tag_len = static_cast<size_t>(atoi(t_len.c_str()));
|
|
218
|
-
|
|
219
|
-
uint8_t out[16];
|
|
220
|
-
bssl::UniquePtr<CMAC_CTX> ctx(CMAC_CTX_new());
|
|
221
|
-
ASSERT_TRUE(ctx);
|
|
222
|
-
ASSERT_TRUE(CMAC_Init(ctx.get(), key.data(), key.size(), cipher, NULL));
|
|
223
|
-
ASSERT_TRUE(CMAC_Update(ctx.get(), msg.data(), msg.size()));
|
|
224
|
-
size_t out_len;
|
|
225
|
-
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
226
|
-
// Truncate the tag, if requested.
|
|
227
|
-
out_len = std::min(out_len, tag_len);
|
|
228
|
-
|
|
229
|
-
ASSERT_FALSE(result.empty());
|
|
230
|
-
if (result[0] == 'P') {
|
|
231
|
-
EXPECT_EQ(Bytes(mac), Bytes(out, out_len));
|
|
232
|
-
|
|
233
|
-
// Test the streaming API as well.
|
|
234
|
-
ASSERT_TRUE(CMAC_Reset(ctx.get()));
|
|
235
|
-
for (uint8_t b : msg) {
|
|
236
|
-
ASSERT_TRUE(CMAC_Update(ctx.get(), &b, 1));
|
|
237
|
-
}
|
|
238
|
-
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
239
|
-
out_len = std::min(out_len, tag_len);
|
|
240
|
-
EXPECT_EQ(Bytes(mac), Bytes(out, out_len));
|
|
241
|
-
} else {
|
|
242
|
-
// CAVP's invalid tests assume the implementation internally does the
|
|
243
|
-
// comparison, whereas our API only computes the tag. Check that they're
|
|
244
|
-
// not equal, but these tests are mostly not useful for us.
|
|
245
|
-
EXPECT_NE(Bytes(mac), Bytes(out, out_len));
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
TEST(CMACTest, CAVPAES128) {
|
|
251
|
-
RunCAVPTest("crypto/cmac/cavp_aes128_cmac_tests.txt",
|
|
252
|
-
false);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
TEST(CMACTest, CAVPAES192) {
|
|
256
|
-
RunCAVPTest("crypto/cmac/cavp_aes192_cmac_tests.txt",
|
|
257
|
-
false);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
TEST(CMACTest, CAVPAES256) {
|
|
261
|
-
RunCAVPTest("crypto/cmac/cavp_aes256_cmac_tests.txt",
|
|
262
|
-
false);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
TEST(CMACTest, CAVP3DES) {
|
|
266
|
-
RunCAVPTest("crypto/cmac/cavp_3des_cmac_tests.txt",
|
|
267
|
-
|
|
1
|
+
/* Copyright (c) 2015, Google Inc.
|
|
2
|
+
*
|
|
3
|
+
* Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
5
|
+
* copyright notice and this permission notice appear in all copies.
|
|
6
|
+
*
|
|
7
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
10
|
+
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
12
|
+
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
13
|
+
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
|
14
|
+
|
|
15
|
+
#include <stdio.h>
|
|
16
|
+
|
|
17
|
+
#include <algorithm>
|
|
18
|
+
#include <vector>
|
|
19
|
+
|
|
20
|
+
#include <gtest/gtest.h>
|
|
21
|
+
|
|
22
|
+
#include <openssl/cipher.h>
|
|
23
|
+
#include <openssl/cmac.h>
|
|
24
|
+
#include <openssl/mem.h>
|
|
25
|
+
|
|
26
|
+
#include "../../test/file_test.h"
|
|
27
|
+
#include "../../test/test_util.h"
|
|
28
|
+
#include "../../test/wycheproof_util.h"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
static void test(const char *name, const uint8_t *key, size_t key_len,
|
|
32
|
+
const uint8_t *msg, size_t msg_len, const uint8_t *expected) {
|
|
33
|
+
SCOPED_TRACE(name);
|
|
34
|
+
|
|
35
|
+
// Test the single-shot API.
|
|
36
|
+
uint8_t out[16];
|
|
37
|
+
ASSERT_TRUE(AES_CMAC(out, key, key_len, msg, msg_len));
|
|
38
|
+
EXPECT_EQ(Bytes(expected, sizeof(out)), Bytes(out));
|
|
39
|
+
|
|
40
|
+
bssl::UniquePtr<CMAC_CTX> ctx(CMAC_CTX_new());
|
|
41
|
+
ASSERT_TRUE(ctx);
|
|
42
|
+
ASSERT_TRUE(CMAC_Init(ctx.get(), key, key_len, EVP_aes_128_cbc(), NULL));
|
|
43
|
+
|
|
44
|
+
for (unsigned chunk_size = 1; chunk_size <= msg_len; chunk_size++) {
|
|
45
|
+
SCOPED_TRACE(chunk_size);
|
|
46
|
+
|
|
47
|
+
ASSERT_TRUE(CMAC_Reset(ctx.get()));
|
|
48
|
+
|
|
49
|
+
size_t done = 0;
|
|
50
|
+
while (done < msg_len) {
|
|
51
|
+
size_t todo = std::min(msg_len - done, static_cast<size_t>(chunk_size));
|
|
52
|
+
ASSERT_TRUE(CMAC_Update(ctx.get(), msg + done, todo));
|
|
53
|
+
done += todo;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
size_t out_len;
|
|
57
|
+
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
58
|
+
EXPECT_EQ(Bytes(expected, sizeof(out)), Bytes(out, out_len));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Test that |CMAC_CTX_copy| works.
|
|
62
|
+
ASSERT_TRUE(CMAC_Reset(ctx.get()));
|
|
63
|
+
size_t chunk = msg_len / 2;
|
|
64
|
+
ASSERT_TRUE(CMAC_Update(ctx.get(), msg, chunk));
|
|
65
|
+
bssl::UniquePtr<CMAC_CTX> ctx2(CMAC_CTX_new());
|
|
66
|
+
ASSERT_TRUE(ctx2);
|
|
67
|
+
ASSERT_TRUE(CMAC_CTX_copy(ctx2.get(), ctx.get()));
|
|
68
|
+
ASSERT_TRUE(CMAC_Update(ctx2.get(), msg + chunk, msg_len - chunk));
|
|
69
|
+
size_t out_len;
|
|
70
|
+
ASSERT_TRUE(CMAC_Final(ctx2.get(), out, &out_len));
|
|
71
|
+
EXPECT_EQ(Bytes(expected, sizeof(out)), Bytes(out, out_len));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
TEST(CMACTest, RFC4493TestVectors) {
|
|
75
|
+
static const uint8_t kKey[16] = {
|
|
76
|
+
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
|
77
|
+
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
|
|
78
|
+
};
|
|
79
|
+
static const uint8_t kOut1[16] = {
|
|
80
|
+
0xbb, 0x1d, 0x69, 0x29, 0xe9, 0x59, 0x37, 0x28,
|
|
81
|
+
0x7f, 0xa3, 0x7d, 0x12, 0x9b, 0x75, 0x67, 0x46,
|
|
82
|
+
};
|
|
83
|
+
static const uint8_t kMsg2[] = {
|
|
84
|
+
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
|
85
|
+
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
|
86
|
+
};
|
|
87
|
+
static const uint8_t kOut2[16] = {
|
|
88
|
+
0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44,
|
|
89
|
+
0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c,
|
|
90
|
+
};
|
|
91
|
+
static const uint8_t kMsg3[] = {
|
|
92
|
+
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
|
93
|
+
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
|
94
|
+
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
|
95
|
+
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
|
96
|
+
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
|
97
|
+
};
|
|
98
|
+
static const uint8_t kOut3[16] = {
|
|
99
|
+
0xdf, 0xa6, 0x67, 0x47, 0xde, 0x9a, 0xe6, 0x30,
|
|
100
|
+
0x30, 0xca, 0x32, 0x61, 0x14, 0x97, 0xc8, 0x27,
|
|
101
|
+
};
|
|
102
|
+
static const uint8_t kMsg4[] = {
|
|
103
|
+
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
|
104
|
+
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
|
105
|
+
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
|
106
|
+
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
|
107
|
+
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
|
108
|
+
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
|
109
|
+
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
|
110
|
+
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10,
|
|
111
|
+
};
|
|
112
|
+
static const uint8_t kOut4[16] = {
|
|
113
|
+
0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92,
|
|
114
|
+
0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
test("RFC 4493 #1", kKey, sizeof(kKey), NULL, 0, kOut1);
|
|
118
|
+
test("RFC 4493 #2", kKey, sizeof(kKey), kMsg2, sizeof(kMsg2), kOut2);
|
|
119
|
+
test("RFC 4493 #3", kKey, sizeof(kKey), kMsg3, sizeof(kMsg3), kOut3);
|
|
120
|
+
test("RFC 4493 #4", kKey, sizeof(kKey), kMsg4, sizeof(kMsg4), kOut4);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
TEST(CMACTest, Wycheproof) {
|
|
124
|
+
FileTestGTest("third_party/wycheproof_testvectors/aes_cmac_test.txt",
|
|
125
|
+
[](FileTest *t) {
|
|
126
|
+
std::string key_size, tag_size;
|
|
127
|
+
ASSERT_TRUE(t->GetInstruction(&key_size, "keySize"));
|
|
128
|
+
ASSERT_TRUE(t->GetInstruction(&tag_size, "tagSize"));
|
|
129
|
+
WycheproofResult result;
|
|
130
|
+
ASSERT_TRUE(GetWycheproofResult(t, &result));
|
|
131
|
+
std::vector<uint8_t> key, msg, tag;
|
|
132
|
+
ASSERT_TRUE(t->GetBytes(&key, "key"));
|
|
133
|
+
ASSERT_TRUE(t->GetBytes(&msg, "msg"));
|
|
134
|
+
ASSERT_TRUE(t->GetBytes(&tag, "tag"));
|
|
135
|
+
|
|
136
|
+
const EVP_CIPHER *cipher;
|
|
137
|
+
switch (atoi(key_size.c_str())) {
|
|
138
|
+
case 128:
|
|
139
|
+
cipher = EVP_aes_128_cbc();
|
|
140
|
+
break;
|
|
141
|
+
case 192:
|
|
142
|
+
cipher = EVP_aes_192_cbc();
|
|
143
|
+
break;
|
|
144
|
+
case 256:
|
|
145
|
+
cipher = EVP_aes_256_cbc();
|
|
146
|
+
break;
|
|
147
|
+
default:
|
|
148
|
+
// Some test vectors intentionally give the wrong key size. Our API
|
|
149
|
+
// requires the caller pick the sized CBC primitive, so these tests
|
|
150
|
+
// aren't useful for us.
|
|
151
|
+
EXPECT_FALSE(result.IsValid());
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
size_t tag_len = static_cast<size_t>(atoi(tag_size.c_str())) / 8;
|
|
156
|
+
|
|
157
|
+
uint8_t out[16];
|
|
158
|
+
bssl::UniquePtr<CMAC_CTX> ctx(CMAC_CTX_new());
|
|
159
|
+
ASSERT_TRUE(ctx);
|
|
160
|
+
ASSERT_TRUE(CMAC_Init(ctx.get(), key.data(), key.size(), cipher, NULL));
|
|
161
|
+
ASSERT_TRUE(CMAC_Update(ctx.get(), msg.data(), msg.size()));
|
|
162
|
+
size_t out_len;
|
|
163
|
+
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
164
|
+
// Truncate the tag, if requested.
|
|
165
|
+
out_len = std::min(out_len, tag_len);
|
|
166
|
+
|
|
167
|
+
if (result.IsValid()) {
|
|
168
|
+
EXPECT_EQ(Bytes(tag), Bytes(out, out_len));
|
|
169
|
+
|
|
170
|
+
// Test the streaming API as well.
|
|
171
|
+
ASSERT_TRUE(CMAC_Reset(ctx.get()));
|
|
172
|
+
for (uint8_t b : msg) {
|
|
173
|
+
ASSERT_TRUE(CMAC_Update(ctx.get(), &b, 1));
|
|
174
|
+
}
|
|
175
|
+
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
176
|
+
out_len = std::min(out_len, tag_len);
|
|
177
|
+
EXPECT_EQ(Bytes(tag), Bytes(out, out_len));
|
|
178
|
+
} else {
|
|
179
|
+
// Wycheproof's invalid tests assume the implementation internally does
|
|
180
|
+
// the comparison, whereas our API only computes the tag. Check that
|
|
181
|
+
// they're not equal, but these tests are mostly not useful for us.
|
|
182
|
+
EXPECT_NE(Bytes(tag), Bytes(out, out_len));
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
static void RunCAVPTest(const char *path, const EVP_CIPHER *cipher,
|
|
188
|
+
bool is_3des) {
|
|
189
|
+
FileTestGTest(path, [&](FileTest *t) {
|
|
190
|
+
t->IgnoreAttribute("Count");
|
|
191
|
+
t->IgnoreAttribute("Klen");
|
|
192
|
+
std::string t_len, m_len, result;
|
|
193
|
+
ASSERT_TRUE(t->GetAttribute(&t_len, "Tlen"));
|
|
194
|
+
ASSERT_TRUE(t->GetAttribute(&m_len, "Mlen"));
|
|
195
|
+
ASSERT_TRUE(t->GetAttribute(&result, "Result"));
|
|
196
|
+
std::vector<uint8_t> key, msg, mac;
|
|
197
|
+
if (is_3des) {
|
|
198
|
+
std::vector<uint8_t> key2, key3;
|
|
199
|
+
ASSERT_TRUE(t->GetBytes(&key, "Key1"));
|
|
200
|
+
ASSERT_TRUE(t->GetBytes(&key2, "Key2"));
|
|
201
|
+
ASSERT_TRUE(t->GetBytes(&key3, "Key3"));
|
|
202
|
+
key.insert(key.end(), key2.begin(), key2.end());
|
|
203
|
+
key.insert(key.end(), key3.begin(), key3.end());
|
|
204
|
+
} else {
|
|
205
|
+
ASSERT_TRUE(t->GetBytes(&key, "Key"));
|
|
206
|
+
}
|
|
207
|
+
ASSERT_TRUE(t->GetBytes(&msg, "Msg"));
|
|
208
|
+
ASSERT_TRUE(t->GetBytes(&mac, "Mac"));
|
|
209
|
+
|
|
210
|
+
// CAVP's uses a non-empty Msg attribute and zero Mlen for the empty string.
|
|
211
|
+
if (atoi(m_len.c_str()) == 0) {
|
|
212
|
+
msg.clear();
|
|
213
|
+
} else {
|
|
214
|
+
EXPECT_EQ(static_cast<size_t>(atoi(m_len.c_str())), msg.size());
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
size_t tag_len = static_cast<size_t>(atoi(t_len.c_str()));
|
|
218
|
+
|
|
219
|
+
uint8_t out[16];
|
|
220
|
+
bssl::UniquePtr<CMAC_CTX> ctx(CMAC_CTX_new());
|
|
221
|
+
ASSERT_TRUE(ctx);
|
|
222
|
+
ASSERT_TRUE(CMAC_Init(ctx.get(), key.data(), key.size(), cipher, NULL));
|
|
223
|
+
ASSERT_TRUE(CMAC_Update(ctx.get(), msg.data(), msg.size()));
|
|
224
|
+
size_t out_len;
|
|
225
|
+
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
226
|
+
// Truncate the tag, if requested.
|
|
227
|
+
out_len = std::min(out_len, tag_len);
|
|
228
|
+
|
|
229
|
+
ASSERT_FALSE(result.empty());
|
|
230
|
+
if (result[0] == 'P') {
|
|
231
|
+
EXPECT_EQ(Bytes(mac), Bytes(out, out_len));
|
|
232
|
+
|
|
233
|
+
// Test the streaming API as well.
|
|
234
|
+
ASSERT_TRUE(CMAC_Reset(ctx.get()));
|
|
235
|
+
for (uint8_t b : msg) {
|
|
236
|
+
ASSERT_TRUE(CMAC_Update(ctx.get(), &b, 1));
|
|
237
|
+
}
|
|
238
|
+
ASSERT_TRUE(CMAC_Final(ctx.get(), out, &out_len));
|
|
239
|
+
out_len = std::min(out_len, tag_len);
|
|
240
|
+
EXPECT_EQ(Bytes(mac), Bytes(out, out_len));
|
|
241
|
+
} else {
|
|
242
|
+
// CAVP's invalid tests assume the implementation internally does the
|
|
243
|
+
// comparison, whereas our API only computes the tag. Check that they're
|
|
244
|
+
// not equal, but these tests are mostly not useful for us.
|
|
245
|
+
EXPECT_NE(Bytes(mac), Bytes(out, out_len));
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
TEST(CMACTest, CAVPAES128) {
|
|
251
|
+
RunCAVPTest("crypto/fipsmodule/cmac/cavp_aes128_cmac_tests.txt",
|
|
252
|
+
EVP_aes_128_cbc(), false);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
TEST(CMACTest, CAVPAES192) {
|
|
256
|
+
RunCAVPTest("crypto/fipsmodule/cmac/cavp_aes192_cmac_tests.txt",
|
|
257
|
+
EVP_aes_192_cbc(), false);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
TEST(CMACTest, CAVPAES256) {
|
|
261
|
+
RunCAVPTest("crypto/fipsmodule/cmac/cavp_aes256_cmac_tests.txt",
|
|
262
|
+
EVP_aes_256_cbc(), false);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
TEST(CMACTest, CAVP3DES) {
|
|
266
|
+
RunCAVPTest("crypto/fipsmodule/cmac/cavp_3des_cmac_tests.txt",
|
|
267
|
+
EVP_des_ede3_cbc(), true);
|
|
268
|
+
}
|
|
@@ -64,9 +64,10 @@
|
|
|
64
64
|
#include <openssl/mem.h>
|
|
65
65
|
#include <openssl/thread.h>
|
|
66
66
|
|
|
67
|
-
#include "internal.h"
|
|
68
67
|
#include "../../internal.h"
|
|
69
68
|
#include "../bn/internal.h"
|
|
69
|
+
#include "../service_indicator/internal.h"
|
|
70
|
+
#include "internal.h"
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
#define OPENSSL_DH_MAX_MODULUS_BITS 10000
|
|
@@ -383,6 +384,8 @@ int DH_compute_key_hashed(DH *dh, uint8_t *out, size_t *out_len,
|
|
|
383
384
|
return 0;
|
|
384
385
|
}
|
|
385
386
|
|
|
387
|
+
FIPS_service_indicator_lock_state();
|
|
388
|
+
|
|
386
389
|
int ret = 0;
|
|
387
390
|
const size_t dh_len = DH_size(dh);
|
|
388
391
|
uint8_t *shared_bytes = OPENSSL_malloc(dh_len);
|
|
@@ -404,6 +407,7 @@ int DH_compute_key_hashed(DH *dh, uint8_t *out, size_t *out_len,
|
|
|
404
407
|
ret = 1;
|
|
405
408
|
|
|
406
409
|
err:
|
|
410
|
+
FIPS_service_indicator_unlock_state();
|
|
407
411
|
OPENSSL_free(shared_bytes);
|
|
408
412
|
return ret;
|
|
409
413
|
}
|
|
@@ -1175,15 +1175,12 @@ int ec_get_x_coordinate_as_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
|
|
1175
1175
|
return 0;
|
|
1176
1176
|
}
|
|
1177
1177
|
|
|
1178
|
-
//
|
|
1179
|
-
//
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
// We must have p < 2×order, assuming p is not tiny (p >= 17). Thus rather we
|
|
1186
|
-
// can reduce by performing at most one subtraction.
|
|
1178
|
+
// The x-coordinate is bounded by p, but we need a scalar, bounded by the
|
|
1179
|
+
// order. These may not have the same size. However, we must have p < 2×order,
|
|
1180
|
+
// assuming p is not tiny (p >= 17).
|
|
1181
|
+
//
|
|
1182
|
+
// Thus |bytes| will fit in |order.width + 1| words, and we can reduce by
|
|
1183
|
+
// performing at most one subtraction.
|
|
1187
1184
|
//
|
|
1188
1185
|
// Proof: We only work with prime order curves, so the number of points on
|
|
1189
1186
|
// the curve is the order. Thus Hasse's theorem gives:
|
|
@@ -1197,14 +1194,11 @@ int ec_get_x_coordinate_as_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
|
|
1197
1194
|
//
|
|
1198
1195
|
// Additionally, one can manually check this property for built-in curves. It
|
|
1199
1196
|
// is enforced for legacy custom curves in |EC_GROUP_set_generator|.
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
group->order.width < EC_MAX_WORDS ? out->words[group->order.width] : 0;
|
|
1206
|
-
bn_reduce_once_in_place(out->words, carry, group->order.d, tmp,
|
|
1207
|
-
group->order.width);
|
|
1197
|
+
const BIGNUM *order = &group->order;
|
|
1198
|
+
BN_ULONG words[EC_MAX_WORDS + 1];
|
|
1199
|
+
bn_big_endian_to_words(words, order->width + 1, bytes, len);
|
|
1200
|
+
bn_reduce_once(out->words, words, /*carry=*/words[order->width], order->d,
|
|
1201
|
+
order->width);
|
|
1208
1202
|
return 1;
|
|
1209
1203
|
}
|
|
1210
1204
|
|
|
@@ -329,14 +329,17 @@ int EC_KEY_check_key(const EC_KEY *eckey) {
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
int EC_KEY_check_fips(const EC_KEY *key) {
|
|
332
|
+
int ret = 0;
|
|
333
|
+
FIPS_service_indicator_lock_state();
|
|
334
|
+
|
|
332
335
|
if (EC_KEY_is_opaque(key)) {
|
|
333
336
|
// Opaque keys can't be checked.
|
|
334
337
|
OPENSSL_PUT_ERROR(EC, EC_R_PUBLIC_KEY_VALIDATION_FAILED);
|
|
335
|
-
|
|
338
|
+
goto end;
|
|
336
339
|
}
|
|
337
340
|
|
|
338
341
|
if (!EC_KEY_check_key(key)) {
|
|
339
|
-
|
|
342
|
+
goto end;
|
|
340
343
|
}
|
|
341
344
|
|
|
342
345
|
if (key->priv_key) {
|
|
@@ -350,11 +353,19 @@ int EC_KEY_check_fips(const EC_KEY *key) {
|
|
|
350
353
|
ECDSA_SIG_free(sig);
|
|
351
354
|
if (!ok) {
|
|
352
355
|
OPENSSL_PUT_ERROR(EC, EC_R_PUBLIC_KEY_VALIDATION_FAILED);
|
|
353
|
-
|
|
356
|
+
goto end;
|
|
354
357
|
}
|
|
355
358
|
}
|
|
356
359
|
|
|
357
|
-
|
|
360
|
+
ret = 1;
|
|
361
|
+
|
|
362
|
+
end:
|
|
363
|
+
FIPS_service_indicator_unlock_state();
|
|
364
|
+
if (ret) {
|
|
365
|
+
EC_KEY_keygen_verify_service_indicator(key);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return ret;
|
|
358
369
|
}
|
|
359
370
|
|
|
360
371
|
int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, const BIGNUM *x,
|