@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.
Files changed (384) hide show
  1. package/.github/workflows/npm-publish-packages.yml +0 -0
  2. package/CMakeLists.txt +2 -0
  3. package/package.json +1 -1
  4. package/readme.md +0 -0
  5. package/src/http3serversession.h +1 -1
  6. package/src/webtransport.js +4 -2
  7. package/third_party/boringssl/src/CMakeLists.txt +9 -12
  8. package/third_party/boringssl/src/crypto/CMakeLists.txt +2 -3
  9. package/third_party/boringssl/src/crypto/asn1/time_support.c +206 -206
  10. package/third_party/boringssl/src/crypto/bio/socket_helper.c +124 -122
  11. package/third_party/boringssl/src/crypto/evp/digestsign.c +268 -231
  12. package/third_party/boringssl/src/crypto/evp/p_ec.c +286 -286
  13. package/third_party/boringssl/src/crypto/fipsmodule/aes/key_wrap.c +246 -236
  14. package/third_party/boringssl/src/crypto/fipsmodule/aes/mode_wrappers.c +124 -122
  15. package/third_party/boringssl/src/crypto/fipsmodule/bcm.c +3 -0
  16. package/third_party/boringssl/src/crypto/fipsmodule/bn/bytes.c +246 -230
  17. package/third_party/boringssl/src/crypto/fipsmodule/bn/internal.h +734 -715
  18. package/third_party/boringssl/src/crypto/fipsmodule/bn/random.c +349 -341
  19. package/third_party/boringssl/src/crypto/fipsmodule/cipher/cipher.c +670 -648
  20. package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aes.c +1504 -1472
  21. package/third_party/boringssl/src/crypto/{cipher_extra → fipsmodule/cipher}/e_aesccm.c +435 -446
  22. package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cavp_3des_cmac_tests.txt +0 -0
  23. package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cavp_aes128_cmac_tests.txt +0 -0
  24. package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cavp_aes192_cmac_tests.txt +0 -0
  25. package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cavp_aes256_cmac_tests.txt +0 -0
  26. package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cmac.c +318 -278
  27. package/third_party/boringssl/src/crypto/{cmac → fipsmodule/cmac}/cmac_test.cc +268 -267
  28. package/third_party/boringssl/src/crypto/fipsmodule/dh/dh.c +5 -1
  29. package/third_party/boringssl/src/crypto/fipsmodule/ec/ec.c +11 -17
  30. package/third_party/boringssl/src/crypto/fipsmodule/ec/ec_key.c +15 -4
  31. package/third_party/boringssl/src/crypto/fipsmodule/ec/internal.h +2 -6
  32. package/third_party/boringssl/src/crypto/fipsmodule/ec/p224-64.c +1164 -1180
  33. package/third_party/boringssl/src/crypto/fipsmodule/ec/p256-nistz.c +3 -3
  34. package/third_party/boringssl/src/crypto/fipsmodule/ec/p256-nistz_test.cc +2 -2
  35. package/third_party/boringssl/src/crypto/fipsmodule/ec/p256.c +44 -33
  36. package/third_party/boringssl/src/crypto/fipsmodule/ec/scalar.c +169 -175
  37. package/third_party/boringssl/src/crypto/fipsmodule/ec/simple.c +352 -357
  38. package/third_party/boringssl/src/crypto/fipsmodule/ecdh/ecdh.c +4 -0
  39. package/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c +14 -9
  40. package/third_party/boringssl/src/crypto/fipsmodule/hmac/hmac.c +256 -235
  41. package/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c +204 -202
  42. package/third_party/boringssl/src/crypto/fipsmodule/rsa/padding.c +702 -695
  43. package/third_party/boringssl/src/crypto/fipsmodule/rsa/rsa_impl.c +7 -2
  44. package/third_party/boringssl/src/crypto/fipsmodule/self_check/self_check.c +7 -0
  45. package/third_party/boringssl/src/crypto/fipsmodule/service_indicator/internal.h +89 -0
  46. package/third_party/boringssl/src/crypto/fipsmodule/service_indicator/service_indicator.c +333 -0
  47. package/third_party/boringssl/src/crypto/fipsmodule/service_indicator/service_indicator_test.cc +2410 -0
  48. package/third_party/boringssl/src/crypto/fipsmodule/sha/sha1.c +359 -357
  49. package/third_party/boringssl/src/crypto/fipsmodule/sha/sha256.c +325 -321
  50. package/third_party/boringssl/src/crypto/fipsmodule/sha/sha512.c +510 -508
  51. package/third_party/boringssl/src/crypto/fipsmodule/tls/kdf.c +177 -165
  52. package/third_party/boringssl/src/crypto/internal.h +13 -0
  53. package/third_party/boringssl/src/crypto/trust_token/trust_token_test.cc +884 -884
  54. package/third_party/boringssl/src/crypto/x509/internal.h +0 -2
  55. package/third_party/boringssl/src/crypto/x509/t_crl.c +148 -148
  56. package/third_party/boringssl/src/crypto/x509/t_req.c +249 -250
  57. package/third_party/boringssl/src/crypto/x509/t_x509.c +2 -3
  58. package/third_party/boringssl/src/crypto/x509/x509_req.c +262 -304
  59. package/third_party/boringssl/src/crypto/x509/x509_set.c +250 -240
  60. package/third_party/boringssl/src/crypto/x509/x509_test.cc +466 -4
  61. package/third_party/boringssl/src/crypto/x509/x509cset.c +292 -279
  62. package/third_party/boringssl/src/crypto/x509/x509rset.c +89 -86
  63. package/third_party/boringssl/src/crypto/x509/x_crl.c +37 -125
  64. package/third_party/boringssl/src/crypto/x509/x_req.c +114 -109
  65. package/third_party/boringssl/src/crypto/x509/x_x509.c +394 -394
  66. package/third_party/boringssl/src/crypto/x509v3/v3_akey.c +11 -16
  67. package/third_party/boringssl/src/crypto/x509v3/v3_alt.c +644 -642
  68. package/third_party/boringssl/src/crypto/x509v3/v3_bcons.c +130 -133
  69. package/third_party/boringssl/src/crypto/x509v3/v3_bitst.c +149 -144
  70. package/third_party/boringssl/src/crypto/x509v3/v3_cpols.c +496 -500
  71. package/third_party/boringssl/src/crypto/x509v3/v3_enum.c +105 -106
  72. package/third_party/boringssl/src/crypto/x509v3/v3_ia5.c +126 -121
  73. package/third_party/boringssl/src/crypto/x509v3/v3_info.c +206 -218
  74. package/third_party/boringssl/src/crypto/x509v3/v3_int.c +97 -91
  75. package/third_party/boringssl/src/crypto/x509v3/v3_pci.c +290 -289
  76. package/third_party/boringssl/src/crypto/x509v3/v3_skey.c +161 -156
  77. package/third_party/boringssl/src/crypto/x509v3/v3_utl.c +5 -3
  78. package/third_party/boringssl/src/include/openssl/aead.h +480 -480
  79. package/third_party/boringssl/src/include/openssl/asn1.h +2 -0
  80. package/third_party/boringssl/src/include/openssl/base.h +1 -1
  81. package/third_party/boringssl/src/include/openssl/service_indicator.h +96 -0
  82. package/third_party/boringssl/src/include/openssl/ssl.h +7 -0
  83. package/third_party/boringssl/src/include/openssl/x509.h +11 -33
  84. package/third_party/boringssl/src/include/openssl/x509v3.h +990 -1018
  85. package/third_party/boringssl/src/sources.cmake +4 -4
  86. package/third_party/boringssl/src/ssl/internal.h +10 -0
  87. package/third_party/boringssl/src/ssl/ssl_lib.cc +3081 -3072
  88. package/third_party/boringssl/src/ssl/ssl_test.cc +46 -0
  89. package/third_party/boringssl/src/ssl/tls13_server.cc +4 -6
  90. package/third_party/boringssl/src/util/bot/DEPS +14 -27
  91. package/third_party/boringssl/src/util/bot/UPDATING +3 -9
  92. package/third_party/boringssl/src/util/bot/update_clang.py +172 -172
  93. package/third_party/boringssl/src/util/bot/vs_toolchain.py +3 -3
  94. package/third_party/quiche/.bazelrc +8 -0
  95. package/third_party/quiche/BUILD.bazel +7 -0
  96. package/third_party/quiche/WHITESPACE +3 -1
  97. package/third_party/quiche/WORKSPACE.bazel +87 -0
  98. package/third_party/quiche/build/BUILD.bazel +7 -0
  99. package/third_party/quiche/build/source_list.bzl +1511 -0
  100. package/third_party/quiche/build/source_list.gni +1511 -0
  101. package/third_party/quiche/build/source_list.json +1511 -0
  102. package/third_party/quiche/build/test.bzl +26 -0
  103. package/third_party/quiche/build/zlib.BUILD +25 -0
  104. package/third_party/quiche/quiche/BUILD.bazel +270 -0
  105. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_enums.cc +3 -3
  106. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_enums.h +7 -7
  107. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_frame.cc +39 -18
  108. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_frame.h +11 -10
  109. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_frame_test.cc +67 -63
  110. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_headers.cc +13 -12
  111. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_headers.h +16 -8
  112. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_headers_test.cc +9 -9
  113. package/third_party/quiche/quiche/{common/balsa → balsa}/balsa_visitor_interface.h +4 -4
  114. package/third_party/quiche/quiche/{common/balsa → balsa}/framer_interface.h +3 -3
  115. package/third_party/quiche/quiche/{common/balsa → balsa}/header_api.h +3 -3
  116. package/third_party/quiche/quiche/{common/balsa → balsa}/header_properties.cc +1 -1
  117. package/third_party/quiche/quiche/{common/balsa → balsa}/header_properties.h +3 -3
  118. package/third_party/quiche/quiche/{common/balsa → balsa}/header_properties_test.cc +1 -1
  119. package/third_party/quiche/quiche/{common/balsa → balsa}/http_validation_policy.cc +1 -1
  120. package/third_party/quiche/quiche/{common/balsa → balsa}/http_validation_policy.h +3 -3
  121. package/third_party/quiche/quiche/{common/balsa → balsa}/noop_balsa_visitor.h +4 -4
  122. package/third_party/quiche/quiche/{common/balsa → balsa}/simple_buffer.cc +22 -29
  123. package/third_party/quiche/quiche/{common/balsa → balsa}/simple_buffer.h +18 -16
  124. package/third_party/quiche/quiche/{common/balsa → balsa}/simple_buffer_test.cc +79 -32
  125. package/third_party/quiche/quiche/{common/balsa → balsa}/standard_header_map.cc +1 -1
  126. package/third_party/quiche/quiche/{common/balsa → balsa}/standard_header_map.h +3 -3
  127. package/third_party/quiche/quiche/common/platform/api/quiche_command_line_flags.h +6 -1
  128. package/third_party/quiche/quiche/common/platform/api/quiche_flags.h +8 -0
  129. package/third_party/quiche/quiche/common/platform/api/quiche_logging.h +0 -3
  130. package/third_party/quiche/quiche/common/platform/api/quiche_lower_case_string_test.cc +29 -0
  131. package/third_party/quiche/quiche/common/platform/api/quiche_test.h +5 -7
  132. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quic_flags_impl.h +1 -1
  133. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_bug_tracker_impl.h +3 -2
  134. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_command_line_flags_impl.cc +41 -0
  135. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_command_line_flags_impl.h +33 -0
  136. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_expect_bug_impl.h +15 -0
  137. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_logging_impl.h +84 -50
  138. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_lower_case_string_impl.h +25 -0
  139. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_stack_trace_impl.cc +1 -1
  140. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_test_impl.cc +25 -0
  141. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_test_impl.h +56 -0
  142. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_test_output_impl.h +27 -0
  143. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_thread_impl.h +26 -0
  144. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_url_utils_impl.cc +1 -0
  145. package/third_party/quiche/quiche/common/quiche_buffer_allocator_test.cc +1 -1
  146. package/third_party/quiche/quiche/common/quiche_mem_slice_storage.h +2 -3
  147. package/third_party/quiche/quiche/common/structured_headers.cc +14 -12
  148. package/third_party/quiche/quiche/http2/adapter/event_forwarder.cc +7 -5
  149. package/third_party/quiche/quiche/http2/adapter/event_forwarder.h +4 -2
  150. package/third_party/quiche/quiche/http2/adapter/event_forwarder_test.cc +14 -9
  151. package/third_party/quiche/quiche/http2/adapter/header_validator.cc +43 -19
  152. package/third_party/quiche/quiche/http2/adapter/header_validator.h +11 -40
  153. package/third_party/quiche/quiche/http2/adapter/header_validator_base.h +69 -0
  154. package/third_party/quiche/quiche/http2/adapter/header_validator_test.cc +73 -1
  155. package/third_party/quiche/quiche/http2/adapter/nghttp2_adapter_test.cc +66 -0
  156. package/third_party/quiche/quiche/http2/adapter/nghttp2_session_test.cc +8 -5
  157. package/third_party/quiche/quiche/http2/adapter/nghttp2_test.cc +1 -1
  158. package/third_party/quiche/quiche/http2/adapter/noop_header_validator.cc +22 -0
  159. package/third_party/quiche/quiche/http2/adapter/noop_header_validator.h +25 -0
  160. package/third_party/quiche/quiche/http2/adapter/noop_header_validator_test.cc +523 -0
  161. package/third_party/quiche/quiche/http2/adapter/oghttp2_adapter_test.cc +186 -5
  162. package/third_party/quiche/quiche/http2/adapter/oghttp2_session.cc +37 -43
  163. package/third_party/quiche/quiche/http2/adapter/oghttp2_session.h +22 -23
  164. package/third_party/quiche/quiche/http2/adapter/test_utils.cc +1 -1
  165. package/third_party/quiche/quiche/http2/adapter/window_manager_test.cc +11 -5
  166. package/third_party/quiche/quiche/http2/core/http2_trace_logging.cc +13 -11
  167. package/third_party/quiche/quiche/http2/core/http2_trace_logging.h +5 -4
  168. package/third_party/quiche/quiche/http2/core/priority_write_scheduler.h +42 -36
  169. package/third_party/quiche/quiche/http2/core/priority_write_scheduler_test.cc +2 -2
  170. package/third_party/quiche/quiche/http2/decoder/decode_buffer_test.cc +9 -9
  171. package/third_party/quiche/quiche/http2/decoder/decode_http2_structures_test.cc +1 -1
  172. package/third_party/quiche/quiche/http2/decoder/http2_frame_decoder_test.cc +14 -14
  173. package/third_party/quiche/quiche/http2/decoder/http2_structure_decoder_test.cc +17 -17
  174. package/third_party/quiche/quiche/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc +1 -1
  175. package/third_party/quiche/quiche/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc +1 -1
  176. package/third_party/quiche/quiche/http2/decoder/payload_decoders/data_payload_decoder_test.cc +2 -2
  177. package/third_party/quiche/quiche/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc +1 -1
  178. package/third_party/quiche/quiche/http2/decoder/payload_decoders/headers_payload_decoder_test.cc +1 -1
  179. package/third_party/quiche/quiche/http2/decoder/payload_decoders/ping_payload_decoder_test.cc +1 -1
  180. package/third_party/quiche/quiche/http2/decoder/payload_decoders/priority_payload_decoder_test.cc +1 -1
  181. package/third_party/quiche/quiche/http2/decoder/payload_decoders/priority_update_payload_decoder_test.cc +1 -1
  182. package/third_party/quiche/quiche/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc +1 -1
  183. package/third_party/quiche/quiche/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc +1 -1
  184. package/third_party/quiche/quiche/http2/decoder/payload_decoders/settings_payload_decoder_test.cc +1 -1
  185. package/third_party/quiche/quiche/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc +1 -1
  186. package/third_party/quiche/quiche/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc +1 -1
  187. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_block_decoder_test.cc +2 -2
  188. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_decoder_state_test.cc +8 -8
  189. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc +4 -3
  190. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_decoder_tables_test.cc +17 -17
  191. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_decoder_test.cc +25 -25
  192. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_entry_decoder_test.cc +2 -2
  193. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_entry_type_decoder_test.cc +7 -6
  194. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_string_decoder_test.cc +6 -6
  195. package/third_party/quiche/quiche/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc +1 -1
  196. package/third_party/quiche/quiche/http2/hpack/huffman/hpack_huffman_decoder_test.cc +2 -2
  197. package/third_party/quiche/quiche/http2/hpack/huffman/hpack_huffman_encoder_test.cc +1 -1
  198. package/third_party/quiche/quiche/http2/hpack/huffman/hpack_huffman_transcoder_test.cc +5 -5
  199. package/third_party/quiche/quiche/http2/hpack/varint/hpack_varint_decoder_test.cc +4 -4
  200. package/third_party/quiche/quiche/http2/hpack/varint/hpack_varint_round_trip_test.cc +1 -1
  201. package/third_party/quiche/quiche/http2/http2_constants_test.cc +1 -1
  202. package/third_party/quiche/quiche/http2/http2_structures_test.cc +23 -22
  203. package/third_party/quiche/quiche/http2/test_tools/frame_decoder_state_test_util.cc +1 -1
  204. package/third_party/quiche/quiche/http2/test_tools/frame_decoder_state_test_util.h +1 -1
  205. package/third_party/quiche/quiche/http2/test_tools/frame_parts.cc +38 -38
  206. package/third_party/quiche/quiche/http2/test_tools/hpack_block_collector.cc +15 -15
  207. package/third_party/quiche/quiche/http2/test_tools/hpack_entry_collector.cc +24 -22
  208. package/third_party/quiche/quiche/http2/test_tools/hpack_string_collector.cc +5 -5
  209. package/third_party/quiche/quiche/http2/test_tools/http2_frame_builder_test.cc +70 -89
  210. package/third_party/quiche/quiche/http2/test_tools/payload_decoder_base_test_util.cc +1 -1
  211. package/third_party/quiche/quiche/http2/test_tools/payload_decoder_base_test_util.h +29 -26
  212. package/third_party/quiche/quiche/http2/test_tools/{random_decoder_test.cc → random_decoder_test_base.cc} +13 -10
  213. package/third_party/quiche/quiche/http2/test_tools/{random_decoder_test.h → random_decoder_test_base.h} +15 -17
  214. package/third_party/quiche/quiche/http2/test_tools/{random_decoder_test_test.cc → random_decoder_test_base_test.cc} +1 -1
  215. package/third_party/quiche/quiche/http2/test_tools/verify_macros.h +32 -0
  216. package/third_party/quiche/quiche/quic/core/congestion_control/bbr2_sender.cc +2 -1
  217. package/third_party/quiche/quiche/quic/core/congestion_control/bbr2_simulator_test.cc +3 -2
  218. package/third_party/quiche/quiche/quic/core/congestion_control/bbr_sender_test.cc +3 -2
  219. package/third_party/quiche/quiche/quic/core/congestion_control/rtt_stats.cc +3 -2
  220. package/third_party/quiche/quiche/quic/core/congestion_control/rtt_stats.h +2 -1
  221. package/third_party/quiche/quiche/quic/core/congestion_control/rtt_stats_test.cc +2 -13
  222. package/third_party/quiche/quiche/quic/core/crypto/certificate_view.cc +15 -0
  223. package/third_party/quiche/quiche/quic/core/crypto/certificate_view.h +7 -0
  224. package/third_party/quiche/quiche/quic/core/crypto/certificate_view_test.cc +16 -0
  225. package/third_party/quiche/quiche/quic/core/crypto/crypto_protocol.h +1 -0
  226. package/third_party/quiche/quiche/quic/core/crypto/proof_source.h +2 -2
  227. package/third_party/quiche/quiche/quic/core/crypto/proof_source_x509.cc +3 -5
  228. package/third_party/quiche/quiche/quic/core/crypto/proof_source_x509.h +1 -2
  229. package/third_party/quiche/quiche/quic/core/crypto/quic_crypto_server_config.cc +1 -1
  230. package/third_party/quiche/quiche/quic/core/crypto/quic_crypto_server_config.h +3 -3
  231. package/third_party/quiche/quiche/quic/core/frames/quic_blocked_frame.cc +2 -8
  232. package/third_party/quiche/quiche/quic/core/frames/quic_blocked_frame.h +0 -1
  233. package/third_party/quiche/quiche/quic/core/frames/quic_crypto_frame.h +2 -0
  234. package/third_party/quiche/quiche/quic/core/frames/quic_frames_test.cc +2 -1
  235. package/third_party/quiche/quiche/quic/core/http/capsule.cc +2 -22
  236. package/third_party/quiche/quiche/quic/core/http/capsule.h +0 -2
  237. package/third_party/quiche/quiche/quic/core/http/capsule_test.cc +1 -2
  238. package/third_party/quiche/quiche/quic/core/http/end_to_end_test.cc +148 -57
  239. package/third_party/quiche/quiche/quic/core/http/http_constants.cc +1 -1
  240. package/third_party/quiche/quiche/quic/core/http/http_constants.h +2 -2
  241. package/third_party/quiche/quiche/quic/core/http/quic_header_list_test.cc +2 -2
  242. package/third_party/quiche/quiche/quic/core/http/quic_headers_stream_test.cc +18 -14
  243. package/third_party/quiche/quiche/quic/core/http/quic_send_control_stream.h +2 -1
  244. package/third_party/quiche/quiche/quic/core/http/quic_send_control_stream_test.cc +3 -7
  245. package/third_party/quiche/quiche/quic/core/http/quic_server_session_base.h +4 -0
  246. package/third_party/quiche/quiche/quic/core/http/quic_spdy_session.cc +47 -65
  247. package/third_party/quiche/quiche/quic/core/http/quic_spdy_session.h +5 -17
  248. package/third_party/quiche/quiche/quic/core/http/quic_spdy_session_test.cc +63 -54
  249. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.cc +34 -91
  250. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.h +1 -9
  251. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream_test.cc +27 -134
  252. package/third_party/quiche/quiche/quic/core/http/spdy_utils.cc +0 -41
  253. package/third_party/quiche/quiche/quic/core/http/spdy_utils.h +0 -9
  254. package/third_party/quiche/quiche/quic/core/http/spdy_utils_test.cc +0 -32
  255. package/third_party/quiche/quiche/quic/core/http/web_transport_http3.cc +0 -1
  256. package/third_party/quiche/quiche/quic/core/packet_number_indexed_queue_test.cc +2 -2
  257. package/third_party/quiche/quiche/quic/core/qpack/qpack_header_table.cc +2 -1
  258. package/third_party/quiche/quiche/quic/core/qpack/qpack_send_stream.h +2 -1
  259. package/third_party/quiche/quiche/quic/core/quic_arena_scoped_ptr_test.cc +2 -2
  260. package/third_party/quiche/quiche/quic/core/quic_connection.cc +68 -46
  261. package/third_party/quiche/quiche/quic/core/quic_connection.h +7 -6
  262. package/third_party/quiche/quiche/quic/core/quic_connection_context_test.cc +2 -2
  263. package/third_party/quiche/quiche/quic/core/quic_connection_id_manager_test.cc +2 -2
  264. package/third_party/quiche/quiche/quic/core/quic_connection_id_test.cc +2 -2
  265. package/third_party/quiche/quiche/quic/core/quic_connection_test.cc +45 -132
  266. package/third_party/quiche/quiche/quic/core/quic_constants.h +0 -7
  267. package/third_party/quiche/quiche/quic/core/quic_control_frame_manager.cc +11 -3
  268. package/third_party/quiche/quiche/quic/core/quic_control_frame_manager.h +1 -1
  269. package/third_party/quiche/quiche/quic/core/quic_control_frame_manager_test.cc +2 -2
  270. package/third_party/quiche/quiche/quic/core/quic_crypto_client_handshaker.cc +13 -1
  271. package/third_party/quiche/quiche/quic/core/quic_crypto_client_handshaker.h +3 -0
  272. package/third_party/quiche/quiche/quic/core/quic_crypto_client_handshaker_test.cc +2 -2
  273. package/third_party/quiche/quiche/quic/core/quic_crypto_client_stream.cc +6 -0
  274. package/third_party/quiche/quiche/quic/core/quic_crypto_client_stream.h +8 -0
  275. package/third_party/quiche/quiche/quic/core/quic_crypto_server_stream.cc +26 -13
  276. package/third_party/quiche/quiche/quic/core/quic_crypto_server_stream.h +5 -2
  277. package/third_party/quiche/quiche/quic/core/quic_crypto_stream.cc +55 -47
  278. package/third_party/quiche/quiche/quic/core/quic_crypto_stream.h +15 -10
  279. package/third_party/quiche/quiche/quic/core/quic_crypto_stream_test.cc +34 -5
  280. package/third_party/quiche/quiche/quic/core/quic_dispatcher.cc +20 -11
  281. package/third_party/quiche/quiche/quic/core/quic_dispatcher_test.cc +37 -13
  282. package/third_party/quiche/quiche/quic/core/quic_flags_list.h +6 -10
  283. package/third_party/quiche/quiche/quic/core/quic_flow_controller.cc +3 -3
  284. package/third_party/quiche/quiche/quic/core/quic_flow_controller.h +2 -2
  285. package/third_party/quiche/quiche/quic/core/quic_flow_controller_test.cc +15 -10
  286. package/third_party/quiche/quiche/quic/core/quic_framer.cc +1 -1
  287. package/third_party/quiche/quiche/quic/core/quic_one_block_arena.h +3 -2
  288. package/third_party/quiche/quiche/quic/core/quic_one_block_arena_test.cc +2 -2
  289. package/third_party/quiche/quiche/quic/core/quic_packet_creator.cc +3 -11
  290. package/third_party/quiche/quiche/quic/core/quic_packet_creator.h +0 -8
  291. package/third_party/quiche/quiche/quic/core/quic_ping_manager.cc +14 -14
  292. package/third_party/quiche/quiche/quic/core/quic_ping_manager_test.cc +48 -0
  293. package/third_party/quiche/quiche/quic/core/quic_received_packet_manager.cc +3 -18
  294. package/third_party/quiche/quiche/quic/core/quic_received_packet_manager_test.cc +4 -14
  295. package/third_party/quiche/quiche/quic/core/quic_server_id_test.cc +2 -2
  296. package/third_party/quiche/quiche/quic/core/quic_session.cc +4 -4
  297. package/third_party/quiche/quiche/quic/core/quic_session.h +1 -1
  298. package/third_party/quiche/quiche/quic/core/quic_session_test.cc +21 -1
  299. package/third_party/quiche/quiche/quic/core/quic_stream.cc +4 -7
  300. package/third_party/quiche/quiche/quic/core/quic_stream_test.cc +2 -4
  301. package/third_party/quiche/quiche/quic/core/quic_trace_visitor_test.cc +2 -2
  302. package/third_party/quiche/quiche/quic/core/quic_types.h +3 -8
  303. package/third_party/quiche/quiche/quic/core/quic_udp_socket_posix.cc +5 -4
  304. package/third_party/quiche/quiche/quic/core/quic_unacked_packet_map_test.cc +1 -1
  305. package/third_party/quiche/quiche/quic/core/quic_utils.cc +1 -1
  306. package/third_party/quiche/quiche/quic/core/quic_utils.h +2 -2
  307. package/third_party/quiche/quiche/quic/core/quic_versions_test.cc +0 -1
  308. package/third_party/quiche/quiche/quic/core/tls_client_handshaker.cc +13 -0
  309. package/third_party/quiche/quiche/quic/core/tls_client_handshaker.h +2 -0
  310. package/third_party/quiche/quiche/quic/core/tls_server_handshaker.cc +17 -3
  311. package/third_party/quiche/quiche/quic/core/tls_server_handshaker.h +3 -1
  312. package/third_party/quiche/quiche/quic/core/uber_received_packet_manager_test.cc +18 -10
  313. package/third_party/quiche/quiche/quic/masque/masque_client_bin.cc +6 -4
  314. package/third_party/quiche/quiche/quic/masque/masque_client_session.cc +23 -7
  315. package/third_party/quiche/quiche/quic/masque/masque_client_session.h +1 -1
  316. package/third_party/quiche/quiche/quic/masque/masque_server_backend.cc +13 -0
  317. package/third_party/quiche/quiche/quic/masque/masque_server_backend.h +2 -0
  318. package/third_party/quiche/quiche/quic/masque/masque_server_bin.cc +5 -4
  319. package/third_party/quiche/quiche/quic/masque/masque_server_session.cc +30 -40
  320. package/third_party/quiche/quiche/quic/masque/masque_server_session.h +1 -1
  321. package/third_party/quiche/quiche/quic/platform/api/quic_export.h +4 -4
  322. package/third_party/quiche/quiche/quic/platform/api/quic_flags.h +0 -1
  323. package/third_party/quiche/quiche/quic/platform/api/quic_logging.h +0 -6
  324. package/third_party/quiche/quiche/quic/platform/api/quic_test.h +6 -5
  325. package/third_party/quiche/quiche/quic/qbone/bonnet/icmp_reachable_test.cc +2 -2
  326. package/third_party/quiche/quiche/quic/qbone/bonnet/mock_qbone_tunnel.h +2 -0
  327. package/third_party/quiche/quiche/quic/qbone/bonnet/qbone_tunnel_interface.h +2 -0
  328. package/third_party/quiche/quiche/quic/qbone/bonnet/tun_device_controller_test.cc +2 -2
  329. package/third_party/quiche/quiche/quic/qbone/bonnet/tun_device_packet_exchanger_test.cc +2 -2
  330. package/third_party/quiche/quiche/quic/qbone/bonnet/tun_device_test.cc +2 -2
  331. package/third_party/quiche/quiche/quic/qbone/platform/netlink_test.cc +2 -2
  332. package/third_party/quiche/quiche/quic/qbone/platform/tcp_packet.cc +5 -4
  333. package/third_party/quiche/quiche/quic/qbone/qbone_client_session.cc +4 -2
  334. package/third_party/quiche/quiche/quic/qbone/qbone_packet_processor.cc +2 -1
  335. package/third_party/quiche/quiche/quic/qbone/qbone_packet_processor_test.cc +2 -2
  336. package/third_party/quiche/quiche/quic/qbone/qbone_server_session.cc +4 -2
  337. package/third_party/quiche/quiche/quic/qbone/qbone_session_base.cc +3 -2
  338. package/third_party/quiche/quiche/quic/qbone/qbone_stream.cc +4 -4
  339. package/third_party/quiche/quiche/quic/test_tools/quic_connection_peer.cc +1 -1
  340. package/third_party/quiche/quiche/quic/test_tools/quic_http_response_cache_data/test.example.com/index.html +63 -0
  341. package/third_party/quiche/quiche/quic/test_tools/quic_http_response_cache_data/test.example.com/map.html +65 -0
  342. package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.cc +4 -3
  343. package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.h +18 -1
  344. package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint_test.cc +1 -1
  345. package/third_party/quiche/quiche/quic/test_tools/simulator/simulator_test.cc +1 -1
  346. package/third_party/quiche/quiche/quic/test_tools/test_ticket_crypter.cc +1 -1
  347. package/third_party/quiche/quiche/quic/test_tools/test_ticket_crypter.h +2 -2
  348. package/third_party/quiche/quiche/quic/{core/crypto → tools}/crypto_message_printer_bin.cc +0 -0
  349. package/third_party/quiche/quiche/quic/{core/qpack → tools}/qpack_offline_decoder_bin.cc +0 -0
  350. package/third_party/quiche/quiche/quic/tools/quic_client_interop_test_bin.cc +4 -3
  351. package/third_party/quiche/quiche/quic/tools/quic_memory_cache_backend_test.cc +3 -31
  352. package/third_party/quiche/quiche/quic/tools/quic_packet_printer_bin.cc +2 -2
  353. package/third_party/quiche/quiche/quic/tools/quic_simple_server_session.h +1 -1
  354. package/third_party/quiche/quiche/quic/tools/quic_simple_server_session_test.cc +1 -1
  355. package/third_party/quiche/quiche/quic/tools/quic_toy_client.cc +52 -38
  356. package/third_party/quiche/quiche/quic/tools/quic_toy_server.cc +10 -7
  357. package/third_party/quiche/quiche/quic/tools/simple_ticket_crypter.cc +1 -1
  358. package/third_party/quiche/quiche/quic/tools/simple_ticket_crypter.h +1 -1
  359. package/third_party/quiche/quiche/quic/tools/web_transport_test_visitors.h +3 -2
  360. package/third_party/quiche/quiche/spdy/core/array_output_buffer.h +1 -1
  361. package/third_party/quiche/quiche/spdy/core/hpack/hpack_decoder_adapter_test.cc +1 -1
  362. package/third_party/quiche/quiche/spdy/core/hpack/hpack_encoder_test.cc +2 -1
  363. package/third_party/quiche/quiche/spdy/core/hpack/hpack_header_table_test.cc +1 -1
  364. package/third_party/quiche/quiche/spdy/core/hpack/hpack_round_trip_test.cc +2 -1
  365. package/third_party/quiche/quiche/spdy/core/hpack/hpack_static_table_test.cc +1 -1
  366. package/third_party/quiche/quiche/spdy/core/http2_frame_decoder_adapter.cc +8 -6
  367. package/third_party/quiche/quiche/spdy/core/http2_frame_decoder_adapter.h +17 -6
  368. package/third_party/quiche/quiche/spdy/core/metadata_extension.cc +1 -1
  369. package/third_party/quiche/quiche/spdy/core/metadata_extension_test.cc +1 -1
  370. package/third_party/quiche/quiche/spdy/core/spdy_framer_test.cc +21 -17
  371. package/third_party/quiche/quiche/spdy/core/spdy_intrusive_list_test.cc +3 -3
  372. package/third_party/quiche/quiche/spdy/core/spdy_no_op_visitor.h +6 -4
  373. package/third_party/quiche/quiche/spdy/core/spdy_pinnable_buffer_piece_test.cc +1 -1
  374. package/third_party/quiche/quiche/spdy/core/spdy_prefixed_buffer_reader_test.cc +1 -1
  375. package/third_party/quiche/quiche/spdy/core/spdy_protocol_test.cc +1 -1
  376. package/third_party/quiche/quiche/spdy/test_tools/mock_spdy_framer_visitor.h +5 -4
  377. package/third_party/boringssl/src/util/bot/cmake-win32.zip.sha1 +0 -1
  378. package/third_party/quiche/quiche/common/platform/api/quiche_mock_log.h +0 -18
  379. package/third_party/quiche/quiche/common/platform/api/quiche_test_helpers.h +0 -8
  380. package/third_party/quiche/quiche/quic/platform/api/quic_mock_log.h +0 -19
  381. package/third_party/quiche/quiche/quic/tools/quic_transport_simple_server_dispatcher.cc +0 -51
  382. package/third_party/quiche/quiche/quic/tools/quic_transport_simple_server_dispatcher.h +0 -41
  383. package/third_party/quiche/quiche/quic/tools/quic_transport_simple_server_session.cc +0 -168
  384. package/third_party/quiche/quiche/quic/tools/quic_transport_simple_server_session.h +0 -78
@@ -1,480 +1,480 @@
1
- /* Copyright (c) 2014, 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
- #ifndef OPENSSL_HEADER_AEAD_H
16
- #define OPENSSL_HEADER_AEAD_H
17
-
18
- #include <openssl/base.h>
19
-
20
- #if defined(__cplusplus)
21
- extern "C" {
22
- #endif
23
-
24
-
25
- // Authenticated Encryption with Additional Data.
26
- //
27
- // AEAD couples confidentiality and integrity in a single primitive. AEAD
28
- // algorithms take a key and then can seal and open individual messages. Each
29
- // message has a unique, per-message nonce and, optionally, additional data
30
- // which is authenticated but not included in the ciphertext.
31
- //
32
- // The |EVP_AEAD_CTX_init| function initialises an |EVP_AEAD_CTX| structure and
33
- // performs any precomputation needed to use |aead| with |key|. The length of
34
- // the key, |key_len|, is given in bytes.
35
- //
36
- // The |tag_len| argument contains the length of the tags, in bytes, and allows
37
- // for the processing of truncated authenticators. A zero value indicates that
38
- // the default tag length should be used and this is defined as
39
- // |EVP_AEAD_DEFAULT_TAG_LENGTH| in order to make the code clear. Using
40
- // truncated tags increases an attacker's chance of creating a valid forgery.
41
- // Be aware that the attacker's chance may increase more than exponentially as
42
- // would naively be expected.
43
- //
44
- // When no longer needed, the initialised |EVP_AEAD_CTX| structure must be
45
- // passed to |EVP_AEAD_CTX_cleanup|, which will deallocate any memory used.
46
- //
47
- // With an |EVP_AEAD_CTX| in hand, one can seal and open messages. These
48
- // operations are intended to meet the standard notions of privacy and
49
- // authenticity for authenticated encryption. For formal definitions see
50
- // Bellare and Namprempre, "Authenticated encryption: relations among notions
51
- // and analysis of the generic composition paradigm," Lecture Notes in Computer
52
- // Science B<1976> (2000), 531–545,
53
- // http://www-cse.ucsd.edu/~mihir/papers/oem.html.
54
- //
55
- // When sealing messages, a nonce must be given. The length of the nonce is
56
- // fixed by the AEAD in use and is returned by |EVP_AEAD_nonce_length|. *The
57
- // nonce must be unique for all messages with the same key*. This is critically
58
- // important - nonce reuse may completely undermine the security of the AEAD.
59
- // Nonces may be predictable and public, so long as they are unique. Uniqueness
60
- // may be achieved with a simple counter or, if large enough, may be generated
61
- // randomly. The nonce must be passed into the "open" operation by the receiver
62
- // so must either be implicit (e.g. a counter), or must be transmitted along
63
- // with the sealed message.
64
- //
65
- // The "seal" and "open" operations are atomic - an entire message must be
66
- // encrypted or decrypted in a single call. Large messages may have to be split
67
- // up in order to accommodate this. When doing so, be mindful of the need not to
68
- // repeat nonces and the possibility that an attacker could duplicate, reorder
69
- // or drop message chunks. For example, using a single key for a given (large)
70
- // message and sealing chunks with nonces counting from zero would be secure as
71
- // long as the number of chunks was securely transmitted. (Otherwise an
72
- // attacker could truncate the message by dropping chunks from the end.)
73
- //
74
- // The number of chunks could be transmitted by prefixing it to the plaintext,
75
- // for example. This also assumes that no other message would ever use the same
76
- // key otherwise the rule that nonces must be unique for a given key would be
77
- // violated.
78
- //
79
- // The "seal" and "open" operations also permit additional data to be
80
- // authenticated via the |ad| parameter. This data is not included in the
81
- // ciphertext and must be identical for both the "seal" and "open" call. This
82
- // permits implicit context to be authenticated but may be empty if not needed.
83
- //
84
- // The "seal" and "open" operations may work in-place if the |out| and |in|
85
- // arguments are equal. Otherwise, if |out| and |in| alias, input data may be
86
- // overwritten before it is read. This situation will cause an error.
87
- //
88
- // The "seal" and "open" operations return one on success and zero on error.
89
-
90
-
91
- // AEAD algorithms.
92
-
93
- // EVP_aead_aes_128_gcm is AES-128 in Galois Counter Mode.
94
- //
95
- // Note: AES-GCM should only be used with 12-byte (96-bit) nonces. Although it
96
- // is specified to take a variable-length nonce, nonces with other lengths are
97
- // effectively randomized, which means one must consider collisions. Unless
98
- // implementing an existing protocol which has already specified incorrect
99
- // parameters, only use 12-byte nonces.
100
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm(void);
101
-
102
- // EVP_aead_aes_192_gcm is AES-192 in Galois Counter Mode.
103
- //
104
- // WARNING: AES-192 is superfluous and shouldn't exist. NIST should never have
105
- // defined it. Use only when interop with another system requires it, never
106
- // de novo.
107
- //
108
- // Note: AES-GCM should only be used with 12-byte (96-bit) nonces. Although it
109
- // is specified to take a variable-length nonce, nonces with other lengths are
110
- // effectively randomized, which means one must consider collisions. Unless
111
- // implementing an existing protocol which has already specified incorrect
112
- // parameters, only use 12-byte nonces.
113
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_192_gcm(void);
114
-
115
- // EVP_aead_aes_256_gcm is AES-256 in Galois Counter Mode.
116
- //
117
- // Note: AES-GCM should only be used with 12-byte (96-bit) nonces. Although it
118
- // is specified to take a variable-length nonce, nonces with other lengths are
119
- // effectively randomized, which means one must consider collisions. Unless
120
- // implementing an existing protocol which has already specified incorrect
121
- // parameters, only use 12-byte nonces.
122
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm(void);
123
-
124
- // EVP_aead_chacha20_poly1305 is the AEAD built from ChaCha20 and
125
- // Poly1305 as described in RFC 8439.
126
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_chacha20_poly1305(void);
127
-
128
- // EVP_aead_xchacha20_poly1305 is ChaCha20-Poly1305 with an extended nonce that
129
- // makes random generation of nonces safe.
130
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_xchacha20_poly1305(void);
131
-
132
- // EVP_aead_aes_128_ctr_hmac_sha256 is AES-128 in CTR mode with HMAC-SHA256 for
133
- // authentication. The nonce is 12 bytes; the bottom 32-bits are used as the
134
- // block counter, thus the maximum plaintext size is 64GB.
135
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ctr_hmac_sha256(void);
136
-
137
- // EVP_aead_aes_256_ctr_hmac_sha256 is AES-256 in CTR mode with HMAC-SHA256 for
138
- // authentication. See |EVP_aead_aes_128_ctr_hmac_sha256| for details.
139
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_ctr_hmac_sha256(void);
140
-
141
- // EVP_aead_aes_128_gcm_siv is AES-128 in GCM-SIV mode. See
142
- // https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02
143
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_siv(void);
144
-
145
- // EVP_aead_aes_256_gcm_siv is AES-256 in GCM-SIV mode. See
146
- // https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02
147
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_siv(void);
148
-
149
- // EVP_aead_aes_128_gcm_randnonce is AES-128 in Galois Counter Mode with
150
- // internal nonce generation. The 12-byte nonce is appended to the tag
151
- // and is generated internally. The "tag", for the purpurses of the API, is thus
152
- // 12 bytes larger. The nonce parameter when using this AEAD must be
153
- // zero-length. Since the nonce is random, a single key should not be used for
154
- // more than 2^32 seal operations.
155
- //
156
- // Warning: this is for use for FIPS compliance only. It is probably not
157
- // suitable for other uses. Using standard AES-GCM AEADs allows one to achieve
158
- // the same effect, but gives more control over nonce storage.
159
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_randnonce(void);
160
-
161
- // EVP_aead_aes_256_gcm_randnonce is AES-256 in Galois Counter Mode with
162
- // internal nonce generation. The 12-byte nonce is appended to the tag
163
- // and is generated internally. The "tag", for the purpurses of the API, is thus
164
- // 12 bytes larger. The nonce parameter when using this AEAD must be
165
- // zero-length. Since the nonce is random, a single key should not be used for
166
- // more than 2^32 seal operations.
167
- //
168
- // Warning: this is for use for FIPS compliance only. It is probably not
169
- // suitable for other uses. Using standard AES-GCM AEADs allows one to achieve
170
- // the same effect, but gives more control over nonce storage.
171
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_randnonce(void);
172
-
173
- // EVP_aead_aes_128_ccm_bluetooth is AES-128-CCM with M=4 and L=2 (4-byte tags
174
- // and 13-byte nonces), as decribed in the Bluetooth Core Specification v5.0,
175
- // Volume 6, Part E, Section 1.
176
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ccm_bluetooth(void);
177
-
178
- // EVP_aead_aes_128_ccm_bluetooth_8 is AES-128-CCM with M=8 and L=2 (8-byte tags
179
- // and 13-byte nonces), as used in the Bluetooth Mesh Networking Specification
180
- // v1.0.
181
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ccm_bluetooth_8(void);
182
-
183
- // EVP_has_aes_hardware returns one if we enable hardware support for fast and
184
- // constant-time AES-GCM.
185
- OPENSSL_EXPORT int EVP_has_aes_hardware(void);
186
-
187
-
188
- // Utility functions.
189
-
190
- // EVP_AEAD_key_length returns the length, in bytes, of the keys used by
191
- // |aead|.
192
- OPENSSL_EXPORT size_t EVP_AEAD_key_length(const EVP_AEAD *aead);
193
-
194
- // EVP_AEAD_nonce_length returns the length, in bytes, of the per-message nonce
195
- // for |aead|.
196
- OPENSSL_EXPORT size_t EVP_AEAD_nonce_length(const EVP_AEAD *aead);
197
-
198
- // EVP_AEAD_max_overhead returns the maximum number of additional bytes added
199
- // by the act of sealing data with |aead|.
200
- OPENSSL_EXPORT size_t EVP_AEAD_max_overhead(const EVP_AEAD *aead);
201
-
202
- // EVP_AEAD_max_tag_len returns the maximum tag length when using |aead|. This
203
- // is the largest value that can be passed as |tag_len| to
204
- // |EVP_AEAD_CTX_init|.
205
- OPENSSL_EXPORT size_t EVP_AEAD_max_tag_len(const EVP_AEAD *aead);
206
-
207
-
208
- // AEAD operations.
209
-
210
- union evp_aead_ctx_st_state {
211
- uint8_t opaque[580];
212
- uint64_t alignment;
213
- };
214
-
215
- // An EVP_AEAD_CTX represents an AEAD algorithm configured with a specific key
216
- // and message-independent IV.
217
- typedef struct evp_aead_ctx_st {
218
- const EVP_AEAD *aead;
219
- union evp_aead_ctx_st_state state;
220
- // tag_len may contain the actual length of the authentication tag if it is
221
- // known at initialization time.
222
- uint8_t tag_len;
223
- } EVP_AEAD_CTX;
224
-
225
- // EVP_AEAD_MAX_KEY_LENGTH contains the maximum key length used by
226
- // any AEAD defined in this header.
227
- #define EVP_AEAD_MAX_KEY_LENGTH 80
228
-
229
- // EVP_AEAD_MAX_NONCE_LENGTH contains the maximum nonce length used by
230
- // any AEAD defined in this header.
231
- #define EVP_AEAD_MAX_NONCE_LENGTH 24
232
-
233
- // EVP_AEAD_MAX_OVERHEAD contains the maximum overhead used by any AEAD
234
- // defined in this header.
235
- #define EVP_AEAD_MAX_OVERHEAD 64
236
-
237
- // EVP_AEAD_DEFAULT_TAG_LENGTH is a magic value that can be passed to
238
- // EVP_AEAD_CTX_init to indicate that the default tag length for an AEAD should
239
- // be used.
240
- #define EVP_AEAD_DEFAULT_TAG_LENGTH 0
241
-
242
- // EVP_AEAD_CTX_zero sets an uninitialized |ctx| to the zero state. It must be
243
- // initialized with |EVP_AEAD_CTX_init| before use. It is safe, but not
244
- // necessary, to call |EVP_AEAD_CTX_cleanup| in this state. This may be used for
245
- // more uniform cleanup of |EVP_AEAD_CTX|.
246
- OPENSSL_EXPORT void EVP_AEAD_CTX_zero(EVP_AEAD_CTX *ctx);
247
-
248
- // EVP_AEAD_CTX_new allocates an |EVP_AEAD_CTX|, calls |EVP_AEAD_CTX_init| and
249
- // returns the |EVP_AEAD_CTX|, or NULL on error.
250
- OPENSSL_EXPORT EVP_AEAD_CTX *EVP_AEAD_CTX_new(const EVP_AEAD *aead,
251
- const uint8_t *key,
252
- size_t key_len, size_t tag_len);
253
-
254
- // EVP_AEAD_CTX_free calls |EVP_AEAD_CTX_cleanup| and |OPENSSL_free| on
255
- // |ctx|.
256
- OPENSSL_EXPORT void EVP_AEAD_CTX_free(EVP_AEAD_CTX *ctx);
257
-
258
- // EVP_AEAD_CTX_init initializes |ctx| for the given AEAD algorithm. The |impl|
259
- // argument is ignored and should be NULL. Authentication tags may be truncated
260
- // by passing a size as |tag_len|. A |tag_len| of zero indicates the default
261
- // tag length and this is defined as EVP_AEAD_DEFAULT_TAG_LENGTH for
262
- // readability.
263
- //
264
- // Returns 1 on success. Otherwise returns 0 and pushes to the error stack. In
265
- // the error case, you do not need to call |EVP_AEAD_CTX_cleanup|, but it's
266
- // harmless to do so.
267
- OPENSSL_EXPORT int EVP_AEAD_CTX_init(EVP_AEAD_CTX *ctx, const EVP_AEAD *aead,
268
- const uint8_t *key, size_t key_len,
269
- size_t tag_len, ENGINE *impl);
270
-
271
- // EVP_AEAD_CTX_cleanup frees any data allocated by |ctx|. It is a no-op to
272
- // call |EVP_AEAD_CTX_cleanup| on a |EVP_AEAD_CTX| that has been |memset| to
273
- // all zeros.
274
- OPENSSL_EXPORT void EVP_AEAD_CTX_cleanup(EVP_AEAD_CTX *ctx);
275
-
276
- // EVP_AEAD_CTX_seal encrypts and authenticates |in_len| bytes from |in| and
277
- // authenticates |ad_len| bytes from |ad| and writes the result to |out|. It
278
- // returns one on success and zero otherwise.
279
- //
280
- // This function may be called concurrently with itself or any other seal/open
281
- // function on the same |EVP_AEAD_CTX|.
282
- //
283
- // At most |max_out_len| bytes are written to |out| and, in order to ensure
284
- // success, |max_out_len| should be |in_len| plus the result of
285
- // |EVP_AEAD_max_overhead|. On successful return, |*out_len| is set to the
286
- // actual number of bytes written.
287
- //
288
- // The length of |nonce|, |nonce_len|, must be equal to the result of
289
- // |EVP_AEAD_nonce_length| for this AEAD.
290
- //
291
- // |EVP_AEAD_CTX_seal| never results in a partial output. If |max_out_len| is
292
- // insufficient, zero will be returned. If any error occurs, |out| will be
293
- // filled with zero bytes and |*out_len| set to zero.
294
- //
295
- // If |in| and |out| alias then |out| must be == |in|.
296
- OPENSSL_EXPORT int EVP_AEAD_CTX_seal(const EVP_AEAD_CTX *ctx, uint8_t *out,
297
- size_t *out_len, size_t max_out_len,
298
- const uint8_t *nonce, size_t nonce_len,
299
- const uint8_t *in, size_t in_len,
300
- const uint8_t *ad, size_t ad_len);
301
-
302
- // EVP_AEAD_CTX_open authenticates |in_len| bytes from |in| and |ad_len| bytes
303
- // from |ad| and decrypts at most |in_len| bytes into |out|. It returns one on
304
- // success and zero otherwise.
305
- //
306
- // This function may be called concurrently with itself or any other seal/open
307
- // function on the same |EVP_AEAD_CTX|.
308
- //
309
- // At most |in_len| bytes are written to |out|. In order to ensure success,
310
- // |max_out_len| should be at least |in_len|. On successful return, |*out_len|
311
- // is set to the the actual number of bytes written.
312
- //
313
- // The length of |nonce|, |nonce_len|, must be equal to the result of
314
- // |EVP_AEAD_nonce_length| for this AEAD.
315
- //
316
- // |EVP_AEAD_CTX_open| never results in a partial output. If |max_out_len| is
317
- // insufficient, zero will be returned. If any error occurs, |out| will be
318
- // filled with zero bytes and |*out_len| set to zero.
319
- //
320
- // If |in| and |out| alias then |out| must be == |in|.
321
- OPENSSL_EXPORT int EVP_AEAD_CTX_open(const EVP_AEAD_CTX *ctx, uint8_t *out,
322
- size_t *out_len, size_t max_out_len,
323
- const uint8_t *nonce, size_t nonce_len,
324
- const uint8_t *in, size_t in_len,
325
- const uint8_t *ad, size_t ad_len);
326
-
327
- // EVP_AEAD_CTX_seal_scatter encrypts and authenticates |in_len| bytes from |in|
328
- // and authenticates |ad_len| bytes from |ad|. It writes |in_len| bytes of
329
- // ciphertext to |out| and the authentication tag to |out_tag|. It returns one
330
- // on success and zero otherwise.
331
- //
332
- // This function may be called concurrently with itself or any other seal/open
333
- // function on the same |EVP_AEAD_CTX|.
334
- //
335
- // Exactly |in_len| bytes are written to |out|, and up to
336
- // |EVP_AEAD_max_overhead+extra_in_len| bytes to |out_tag|. On successful
337
- // return, |*out_tag_len| is set to the actual number of bytes written to
338
- // |out_tag|.
339
- //
340
- // |extra_in| may point to an additional plaintext input buffer if the cipher
341
- // supports it. If present, |extra_in_len| additional bytes of plaintext are
342
- // encrypted and authenticated, and the ciphertext is written (before the tag)
343
- // to |out_tag|. |max_out_tag_len| must be sized to allow for the additional
344
- // |extra_in_len| bytes.
345
- //
346
- // The length of |nonce|, |nonce_len|, must be equal to the result of
347
- // |EVP_AEAD_nonce_length| for this AEAD.
348
- //
349
- // |EVP_AEAD_CTX_seal_scatter| never results in a partial output. If
350
- // |max_out_tag_len| is insufficient, zero will be returned. If any error
351
- // occurs, |out| and |out_tag| will be filled with zero bytes and |*out_tag_len|
352
- // set to zero.
353
- //
354
- // If |in| and |out| alias then |out| must be == |in|. |out_tag| may not alias
355
- // any other argument.
356
- OPENSSL_EXPORT int EVP_AEAD_CTX_seal_scatter(
357
- const EVP_AEAD_CTX *ctx, uint8_t *out,
358
- uint8_t *out_tag, size_t *out_tag_len, size_t max_out_tag_len,
359
- const uint8_t *nonce, size_t nonce_len,
360
- const uint8_t *in, size_t in_len,
361
- const uint8_t *extra_in, size_t extra_in_len,
362
- const uint8_t *ad, size_t ad_len);
363
-
364
- // EVP_AEAD_CTX_open_gather decrypts and authenticates |in_len| bytes from |in|
365
- // and authenticates |ad_len| bytes from |ad| using |in_tag_len| bytes of
366
- // authentication tag from |in_tag|. If successful, it writes |in_len| bytes of
367
- // plaintext to |out|. It returns one on success and zero otherwise.
368
- //
369
- // This function may be called concurrently with itself or any other seal/open
370
- // function on the same |EVP_AEAD_CTX|.
371
- //
372
- // The length of |nonce|, |nonce_len|, must be equal to the result of
373
- // |EVP_AEAD_nonce_length| for this AEAD.
374
- //
375
- // |EVP_AEAD_CTX_open_gather| never results in a partial output. If any error
376
- // occurs, |out| will be filled with zero bytes.
377
- //
378
- // If |in| and |out| alias then |out| must be == |in|.
379
- OPENSSL_EXPORT int EVP_AEAD_CTX_open_gather(
380
- const EVP_AEAD_CTX *ctx, uint8_t *out, const uint8_t *nonce,
381
- size_t nonce_len, const uint8_t *in, size_t in_len, const uint8_t *in_tag,
382
- size_t in_tag_len, const uint8_t *ad, size_t ad_len);
383
-
384
- // EVP_AEAD_CTX_aead returns the underlying AEAD for |ctx|, or NULL if one has
385
- // not been set.
386
- OPENSSL_EXPORT const EVP_AEAD *EVP_AEAD_CTX_aead(const EVP_AEAD_CTX *ctx);
387
-
388
-
389
- // TLS-specific AEAD algorithms.
390
- //
391
- // These AEAD primitives do not meet the definition of generic AEADs. They are
392
- // all specific to TLS and should not be used outside of that context. They must
393
- // be initialized with |EVP_AEAD_CTX_init_with_direction|, are stateful, and may
394
- // not be used concurrently. Any nonces are used as IVs, so they must be
395
- // unpredictable. They only accept an |ad| parameter of length 11 (the standard
396
- // TLS one with length omitted).
397
-
398
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_cbc_sha1_tls(void);
399
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_cbc_sha1_tls_implicit_iv(void);
400
-
401
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha1_tls(void);
402
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha1_tls_implicit_iv(void);
403
-
404
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_des_ede3_cbc_sha1_tls(void);
405
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_des_ede3_cbc_sha1_tls_implicit_iv(void);
406
-
407
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_null_sha1_tls(void);
408
-
409
- // EVP_aead_aes_128_gcm_tls12 is AES-128 in Galois Counter Mode using the TLS
410
- // 1.2 nonce construction.
411
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_tls12(void);
412
-
413
- // EVP_aead_aes_256_gcm_tls12 is AES-256 in Galois Counter Mode using the TLS
414
- // 1.2 nonce construction.
415
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_tls12(void);
416
-
417
- // EVP_aead_aes_128_gcm_tls13 is AES-128 in Galois Counter Mode using the TLS
418
- // 1.3 nonce construction.
419
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_tls13(void);
420
-
421
- // EVP_aead_aes_256_gcm_tls13 is AES-256 in Galois Counter Mode using the TLS
422
- // 1.3 nonce construction.
423
- OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_tls13(void);
424
-
425
-
426
- // Obscure functions.
427
-
428
- // evp_aead_direction_t denotes the direction of an AEAD operation.
429
- enum evp_aead_direction_t {
430
- evp_aead_open,
431
- evp_aead_seal,
432
- };
433
-
434
- // EVP_AEAD_CTX_init_with_direction calls |EVP_AEAD_CTX_init| for normal
435
- // AEADs. For TLS-specific and SSL3-specific AEADs, it initializes |ctx| for a
436
- // given direction.
437
- OPENSSL_EXPORT int EVP_AEAD_CTX_init_with_direction(
438
- EVP_AEAD_CTX *ctx, const EVP_AEAD *aead, const uint8_t *key, size_t key_len,
439
- size_t tag_len, enum evp_aead_direction_t dir);
440
-
441
- // EVP_AEAD_CTX_get_iv sets |*out_len| to the length of the IV for |ctx| and
442
- // sets |*out_iv| to point to that many bytes of the current IV. This is only
443
- // meaningful for AEADs with implicit IVs (i.e. CBC mode in TLS 1.0).
444
- //
445
- // It returns one on success or zero on error.
446
- OPENSSL_EXPORT int EVP_AEAD_CTX_get_iv(const EVP_AEAD_CTX *ctx,
447
- const uint8_t **out_iv, size_t *out_len);
448
-
449
- // EVP_AEAD_CTX_tag_len computes the exact byte length of the tag written by
450
- // |EVP_AEAD_CTX_seal_scatter| and writes it to |*out_tag_len|. It returns one
451
- // on success or zero on error. |in_len| and |extra_in_len| must equal the
452
- // arguments of the same names passed to |EVP_AEAD_CTX_seal_scatter|.
453
- OPENSSL_EXPORT int EVP_AEAD_CTX_tag_len(const EVP_AEAD_CTX *ctx,
454
- size_t *out_tag_len,
455
- const size_t in_len,
456
- const size_t extra_in_len);
457
-
458
-
459
- #if defined(__cplusplus)
460
- } // extern C
461
-
462
- #if !defined(BORINGSSL_NO_CXX)
463
- extern "C++" {
464
-
465
- BSSL_NAMESPACE_BEGIN
466
-
467
- using ScopedEVP_AEAD_CTX =
468
- internal::StackAllocated<EVP_AEAD_CTX, void, EVP_AEAD_CTX_zero,
469
- EVP_AEAD_CTX_cleanup>;
470
-
471
- BORINGSSL_MAKE_DELETER(EVP_AEAD_CTX, EVP_AEAD_CTX_free)
472
-
473
- BSSL_NAMESPACE_END
474
-
475
- } // extern C++
476
- #endif
477
-
478
- #endif
479
-
480
- #endif // OPENSSL_HEADER_AEAD_H
1
+ /* Copyright (c) 2014, 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
+ #ifndef OPENSSL_HEADER_AEAD_H
16
+ #define OPENSSL_HEADER_AEAD_H
17
+
18
+ #include <openssl/base.h>
19
+
20
+ #if defined(__cplusplus)
21
+ extern "C" {
22
+ #endif
23
+
24
+
25
+ // Authenticated Encryption with Additional Data.
26
+ //
27
+ // AEAD couples confidentiality and integrity in a single primitive. AEAD
28
+ // algorithms take a key and then can seal and open individual messages. Each
29
+ // message has a unique, per-message nonce and, optionally, additional data
30
+ // which is authenticated but not included in the ciphertext.
31
+ //
32
+ // The |EVP_AEAD_CTX_init| function initialises an |EVP_AEAD_CTX| structure and
33
+ // performs any precomputation needed to use |aead| with |key|. The length of
34
+ // the key, |key_len|, is given in bytes.
35
+ //
36
+ // The |tag_len| argument contains the length of the tags, in bytes, and allows
37
+ // for the processing of truncated authenticators. A zero value indicates that
38
+ // the default tag length should be used and this is defined as
39
+ // |EVP_AEAD_DEFAULT_TAG_LENGTH| in order to make the code clear. Using
40
+ // truncated tags increases an attacker's chance of creating a valid forgery.
41
+ // Be aware that the attacker's chance may increase more than exponentially as
42
+ // would naively be expected.
43
+ //
44
+ // When no longer needed, the initialised |EVP_AEAD_CTX| structure must be
45
+ // passed to |EVP_AEAD_CTX_cleanup|, which will deallocate any memory used.
46
+ //
47
+ // With an |EVP_AEAD_CTX| in hand, one can seal and open messages. These
48
+ // operations are intended to meet the standard notions of privacy and
49
+ // authenticity for authenticated encryption. For formal definitions see
50
+ // Bellare and Namprempre, "Authenticated encryption: relations among notions
51
+ // and analysis of the generic composition paradigm," Lecture Notes in Computer
52
+ // Science B<1976> (2000), 531–545,
53
+ // http://www-cse.ucsd.edu/~mihir/papers/oem.html.
54
+ //
55
+ // When sealing messages, a nonce must be given. The length of the nonce is
56
+ // fixed by the AEAD in use and is returned by |EVP_AEAD_nonce_length|. *The
57
+ // nonce must be unique for all messages with the same key*. This is critically
58
+ // important - nonce reuse may completely undermine the security of the AEAD.
59
+ // Nonces may be predictable and public, so long as they are unique. Uniqueness
60
+ // may be achieved with a simple counter or, if large enough, may be generated
61
+ // randomly. The nonce must be passed into the "open" operation by the receiver
62
+ // so must either be implicit (e.g. a counter), or must be transmitted along
63
+ // with the sealed message.
64
+ //
65
+ // The "seal" and "open" operations are atomic - an entire message must be
66
+ // encrypted or decrypted in a single call. Large messages may have to be split
67
+ // up in order to accommodate this. When doing so, be mindful of the need not to
68
+ // repeat nonces and the possibility that an attacker could duplicate, reorder
69
+ // or drop message chunks. For example, using a single key for a given (large)
70
+ // message and sealing chunks with nonces counting from zero would be secure as
71
+ // long as the number of chunks was securely transmitted. (Otherwise an
72
+ // attacker could truncate the message by dropping chunks from the end.)
73
+ //
74
+ // The number of chunks could be transmitted by prefixing it to the plaintext,
75
+ // for example. This also assumes that no other message would ever use the same
76
+ // key otherwise the rule that nonces must be unique for a given key would be
77
+ // violated.
78
+ //
79
+ // The "seal" and "open" operations also permit additional data to be
80
+ // authenticated via the |ad| parameter. This data is not included in the
81
+ // ciphertext and must be identical for both the "seal" and "open" call. This
82
+ // permits implicit context to be authenticated but may be empty if not needed.
83
+ //
84
+ // The "seal" and "open" operations may work in-place if the |out| and |in|
85
+ // arguments are equal. Otherwise, if |out| and |in| alias, input data may be
86
+ // overwritten before it is read. This situation will cause an error.
87
+ //
88
+ // The "seal" and "open" operations return one on success and zero on error.
89
+
90
+
91
+ // AEAD algorithms.
92
+
93
+ // EVP_aead_aes_128_gcm is AES-128 in Galois Counter Mode.
94
+ //
95
+ // Note: AES-GCM should only be used with 12-byte (96-bit) nonces. Although it
96
+ // is specified to take a variable-length nonce, nonces with other lengths are
97
+ // effectively randomized, which means one must consider collisions. Unless
98
+ // implementing an existing protocol which has already specified incorrect
99
+ // parameters, only use 12-byte nonces.
100
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm(void);
101
+
102
+ // EVP_aead_aes_192_gcm is AES-192 in Galois Counter Mode.
103
+ //
104
+ // WARNING: AES-192 is superfluous and shouldn't exist. NIST should never have
105
+ // defined it. Use only when interop with another system requires it, never
106
+ // de novo.
107
+ //
108
+ // Note: AES-GCM should only be used with 12-byte (96-bit) nonces. Although it
109
+ // is specified to take a variable-length nonce, nonces with other lengths are
110
+ // effectively randomized, which means one must consider collisions. Unless
111
+ // implementing an existing protocol which has already specified incorrect
112
+ // parameters, only use 12-byte nonces.
113
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_192_gcm(void);
114
+
115
+ // EVP_aead_aes_256_gcm is AES-256 in Galois Counter Mode.
116
+ //
117
+ // Note: AES-GCM should only be used with 12-byte (96-bit) nonces. Although it
118
+ // is specified to take a variable-length nonce, nonces with other lengths are
119
+ // effectively randomized, which means one must consider collisions. Unless
120
+ // implementing an existing protocol which has already specified incorrect
121
+ // parameters, only use 12-byte nonces.
122
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm(void);
123
+
124
+ // EVP_aead_chacha20_poly1305 is the AEAD built from ChaCha20 and
125
+ // Poly1305 as described in RFC 8439.
126
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_chacha20_poly1305(void);
127
+
128
+ // EVP_aead_xchacha20_poly1305 is ChaCha20-Poly1305 with an extended nonce that
129
+ // makes random generation of nonces safe.
130
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_xchacha20_poly1305(void);
131
+
132
+ // EVP_aead_aes_128_ctr_hmac_sha256 is AES-128 in CTR mode with HMAC-SHA256 for
133
+ // authentication. The nonce is 12 bytes; the bottom 32-bits are used as the
134
+ // block counter, thus the maximum plaintext size is 64GB.
135
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ctr_hmac_sha256(void);
136
+
137
+ // EVP_aead_aes_256_ctr_hmac_sha256 is AES-256 in CTR mode with HMAC-SHA256 for
138
+ // authentication. See |EVP_aead_aes_128_ctr_hmac_sha256| for details.
139
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_ctr_hmac_sha256(void);
140
+
141
+ // EVP_aead_aes_128_gcm_siv is AES-128 in GCM-SIV mode. See
142
+ // https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02
143
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_siv(void);
144
+
145
+ // EVP_aead_aes_256_gcm_siv is AES-256 in GCM-SIV mode. See
146
+ // https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02
147
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_siv(void);
148
+
149
+ // EVP_aead_aes_128_gcm_randnonce is AES-128 in Galois Counter Mode with
150
+ // internal nonce generation. The 12-byte nonce is appended to the tag
151
+ // and is generated internally. The "tag", for the purpurses of the API, is thus
152
+ // 12 bytes larger. The nonce parameter when using this AEAD must be
153
+ // zero-length. Since the nonce is random, a single key should not be used for
154
+ // more than 2^32 seal operations.
155
+ //
156
+ // Warning: this is for use for FIPS compliance only. It is probably not
157
+ // suitable for other uses. Using standard AES-GCM AEADs allows one to achieve
158
+ // the same effect, but gives more control over nonce storage.
159
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_randnonce(void);
160
+
161
+ // EVP_aead_aes_256_gcm_randnonce is AES-256 in Galois Counter Mode with
162
+ // internal nonce generation. The 12-byte nonce is appended to the tag
163
+ // and is generated internally. The "tag", for the purpurses of the API, is thus
164
+ // 12 bytes larger. The nonce parameter when using this AEAD must be
165
+ // zero-length. Since the nonce is random, a single key should not be used for
166
+ // more than 2^32 seal operations.
167
+ //
168
+ // Warning: this is for use for FIPS compliance only. It is probably not
169
+ // suitable for other uses. Using standard AES-GCM AEADs allows one to achieve
170
+ // the same effect, but gives more control over nonce storage.
171
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_randnonce(void);
172
+
173
+ // EVP_aead_aes_128_ccm_bluetooth is AES-128-CCM with M=4 and L=2 (4-byte tags
174
+ // and 13-byte nonces), as decribed in the Bluetooth Core Specification v5.0,
175
+ // Volume 6, Part E, Section 1.
176
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ccm_bluetooth(void);
177
+
178
+ // EVP_aead_aes_128_ccm_bluetooth_8 is AES-128-CCM with M=8 and L=2 (8-byte tags
179
+ // and 13-byte nonces), as used in the Bluetooth Mesh Networking Specification
180
+ // v1.0.
181
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ccm_bluetooth_8(void);
182
+
183
+ // EVP_has_aes_hardware returns one if we enable hardware support for fast and
184
+ // constant-time AES-GCM.
185
+ OPENSSL_EXPORT int EVP_has_aes_hardware(void);
186
+
187
+
188
+ // Utility functions.
189
+
190
+ // EVP_AEAD_key_length returns the length, in bytes, of the keys used by
191
+ // |aead|.
192
+ OPENSSL_EXPORT size_t EVP_AEAD_key_length(const EVP_AEAD *aead);
193
+
194
+ // EVP_AEAD_nonce_length returns the length, in bytes, of the per-message nonce
195
+ // for |aead|.
196
+ OPENSSL_EXPORT size_t EVP_AEAD_nonce_length(const EVP_AEAD *aead);
197
+
198
+ // EVP_AEAD_max_overhead returns the maximum number of additional bytes added
199
+ // by the act of sealing data with |aead|.
200
+ OPENSSL_EXPORT size_t EVP_AEAD_max_overhead(const EVP_AEAD *aead);
201
+
202
+ // EVP_AEAD_max_tag_len returns the maximum tag length when using |aead|. This
203
+ // is the largest value that can be passed as |tag_len| to
204
+ // |EVP_AEAD_CTX_init|.
205
+ OPENSSL_EXPORT size_t EVP_AEAD_max_tag_len(const EVP_AEAD *aead);
206
+
207
+
208
+ // AEAD operations.
209
+
210
+ union evp_aead_ctx_st_state {
211
+ uint8_t opaque[580];
212
+ uint64_t alignment;
213
+ };
214
+
215
+ // An evp_aead_ctx_st (typedefed as |EVP_AEAD_CTX| in base.h) represents an AEAD
216
+ // algorithm configured with a specific key and message-independent IV.
217
+ struct evp_aead_ctx_st {
218
+ const EVP_AEAD *aead;
219
+ union evp_aead_ctx_st_state state;
220
+ // tag_len may contain the actual length of the authentication tag if it is
221
+ // known at initialization time.
222
+ uint8_t tag_len;
223
+ };
224
+
225
+ // EVP_AEAD_MAX_KEY_LENGTH contains the maximum key length used by
226
+ // any AEAD defined in this header.
227
+ #define EVP_AEAD_MAX_KEY_LENGTH 80
228
+
229
+ // EVP_AEAD_MAX_NONCE_LENGTH contains the maximum nonce length used by
230
+ // any AEAD defined in this header.
231
+ #define EVP_AEAD_MAX_NONCE_LENGTH 24
232
+
233
+ // EVP_AEAD_MAX_OVERHEAD contains the maximum overhead used by any AEAD
234
+ // defined in this header.
235
+ #define EVP_AEAD_MAX_OVERHEAD 64
236
+
237
+ // EVP_AEAD_DEFAULT_TAG_LENGTH is a magic value that can be passed to
238
+ // EVP_AEAD_CTX_init to indicate that the default tag length for an AEAD should
239
+ // be used.
240
+ #define EVP_AEAD_DEFAULT_TAG_LENGTH 0
241
+
242
+ // EVP_AEAD_CTX_zero sets an uninitialized |ctx| to the zero state. It must be
243
+ // initialized with |EVP_AEAD_CTX_init| before use. It is safe, but not
244
+ // necessary, to call |EVP_AEAD_CTX_cleanup| in this state. This may be used for
245
+ // more uniform cleanup of |EVP_AEAD_CTX|.
246
+ OPENSSL_EXPORT void EVP_AEAD_CTX_zero(EVP_AEAD_CTX *ctx);
247
+
248
+ // EVP_AEAD_CTX_new allocates an |EVP_AEAD_CTX|, calls |EVP_AEAD_CTX_init| and
249
+ // returns the |EVP_AEAD_CTX|, or NULL on error.
250
+ OPENSSL_EXPORT EVP_AEAD_CTX *EVP_AEAD_CTX_new(const EVP_AEAD *aead,
251
+ const uint8_t *key,
252
+ size_t key_len, size_t tag_len);
253
+
254
+ // EVP_AEAD_CTX_free calls |EVP_AEAD_CTX_cleanup| and |OPENSSL_free| on
255
+ // |ctx|.
256
+ OPENSSL_EXPORT void EVP_AEAD_CTX_free(EVP_AEAD_CTX *ctx);
257
+
258
+ // EVP_AEAD_CTX_init initializes |ctx| for the given AEAD algorithm. The |impl|
259
+ // argument is ignored and should be NULL. Authentication tags may be truncated
260
+ // by passing a size as |tag_len|. A |tag_len| of zero indicates the default
261
+ // tag length and this is defined as EVP_AEAD_DEFAULT_TAG_LENGTH for
262
+ // readability.
263
+ //
264
+ // Returns 1 on success. Otherwise returns 0 and pushes to the error stack. In
265
+ // the error case, you do not need to call |EVP_AEAD_CTX_cleanup|, but it's
266
+ // harmless to do so.
267
+ OPENSSL_EXPORT int EVP_AEAD_CTX_init(EVP_AEAD_CTX *ctx, const EVP_AEAD *aead,
268
+ const uint8_t *key, size_t key_len,
269
+ size_t tag_len, ENGINE *impl);
270
+
271
+ // EVP_AEAD_CTX_cleanup frees any data allocated by |ctx|. It is a no-op to
272
+ // call |EVP_AEAD_CTX_cleanup| on a |EVP_AEAD_CTX| that has been |memset| to
273
+ // all zeros.
274
+ OPENSSL_EXPORT void EVP_AEAD_CTX_cleanup(EVP_AEAD_CTX *ctx);
275
+
276
+ // EVP_AEAD_CTX_seal encrypts and authenticates |in_len| bytes from |in| and
277
+ // authenticates |ad_len| bytes from |ad| and writes the result to |out|. It
278
+ // returns one on success and zero otherwise.
279
+ //
280
+ // This function may be called concurrently with itself or any other seal/open
281
+ // function on the same |EVP_AEAD_CTX|.
282
+ //
283
+ // At most |max_out_len| bytes are written to |out| and, in order to ensure
284
+ // success, |max_out_len| should be |in_len| plus the result of
285
+ // |EVP_AEAD_max_overhead|. On successful return, |*out_len| is set to the
286
+ // actual number of bytes written.
287
+ //
288
+ // The length of |nonce|, |nonce_len|, must be equal to the result of
289
+ // |EVP_AEAD_nonce_length| for this AEAD.
290
+ //
291
+ // |EVP_AEAD_CTX_seal| never results in a partial output. If |max_out_len| is
292
+ // insufficient, zero will be returned. If any error occurs, |out| will be
293
+ // filled with zero bytes and |*out_len| set to zero.
294
+ //
295
+ // If |in| and |out| alias then |out| must be == |in|.
296
+ OPENSSL_EXPORT int EVP_AEAD_CTX_seal(const EVP_AEAD_CTX *ctx, uint8_t *out,
297
+ size_t *out_len, size_t max_out_len,
298
+ const uint8_t *nonce, size_t nonce_len,
299
+ const uint8_t *in, size_t in_len,
300
+ const uint8_t *ad, size_t ad_len);
301
+
302
+ // EVP_AEAD_CTX_open authenticates |in_len| bytes from |in| and |ad_len| bytes
303
+ // from |ad| and decrypts at most |in_len| bytes into |out|. It returns one on
304
+ // success and zero otherwise.
305
+ //
306
+ // This function may be called concurrently with itself or any other seal/open
307
+ // function on the same |EVP_AEAD_CTX|.
308
+ //
309
+ // At most |in_len| bytes are written to |out|. In order to ensure success,
310
+ // |max_out_len| should be at least |in_len|. On successful return, |*out_len|
311
+ // is set to the the actual number of bytes written.
312
+ //
313
+ // The length of |nonce|, |nonce_len|, must be equal to the result of
314
+ // |EVP_AEAD_nonce_length| for this AEAD.
315
+ //
316
+ // |EVP_AEAD_CTX_open| never results in a partial output. If |max_out_len| is
317
+ // insufficient, zero will be returned. If any error occurs, |out| will be
318
+ // filled with zero bytes and |*out_len| set to zero.
319
+ //
320
+ // If |in| and |out| alias then |out| must be == |in|.
321
+ OPENSSL_EXPORT int EVP_AEAD_CTX_open(const EVP_AEAD_CTX *ctx, uint8_t *out,
322
+ size_t *out_len, size_t max_out_len,
323
+ const uint8_t *nonce, size_t nonce_len,
324
+ const uint8_t *in, size_t in_len,
325
+ const uint8_t *ad, size_t ad_len);
326
+
327
+ // EVP_AEAD_CTX_seal_scatter encrypts and authenticates |in_len| bytes from |in|
328
+ // and authenticates |ad_len| bytes from |ad|. It writes |in_len| bytes of
329
+ // ciphertext to |out| and the authentication tag to |out_tag|. It returns one
330
+ // on success and zero otherwise.
331
+ //
332
+ // This function may be called concurrently with itself or any other seal/open
333
+ // function on the same |EVP_AEAD_CTX|.
334
+ //
335
+ // Exactly |in_len| bytes are written to |out|, and up to
336
+ // |EVP_AEAD_max_overhead+extra_in_len| bytes to |out_tag|. On successful
337
+ // return, |*out_tag_len| is set to the actual number of bytes written to
338
+ // |out_tag|.
339
+ //
340
+ // |extra_in| may point to an additional plaintext input buffer if the cipher
341
+ // supports it. If present, |extra_in_len| additional bytes of plaintext are
342
+ // encrypted and authenticated, and the ciphertext is written (before the tag)
343
+ // to |out_tag|. |max_out_tag_len| must be sized to allow for the additional
344
+ // |extra_in_len| bytes.
345
+ //
346
+ // The length of |nonce|, |nonce_len|, must be equal to the result of
347
+ // |EVP_AEAD_nonce_length| for this AEAD.
348
+ //
349
+ // |EVP_AEAD_CTX_seal_scatter| never results in a partial output. If
350
+ // |max_out_tag_len| is insufficient, zero will be returned. If any error
351
+ // occurs, |out| and |out_tag| will be filled with zero bytes and |*out_tag_len|
352
+ // set to zero.
353
+ //
354
+ // If |in| and |out| alias then |out| must be == |in|. |out_tag| may not alias
355
+ // any other argument.
356
+ OPENSSL_EXPORT int EVP_AEAD_CTX_seal_scatter(
357
+ const EVP_AEAD_CTX *ctx, uint8_t *out,
358
+ uint8_t *out_tag, size_t *out_tag_len, size_t max_out_tag_len,
359
+ const uint8_t *nonce, size_t nonce_len,
360
+ const uint8_t *in, size_t in_len,
361
+ const uint8_t *extra_in, size_t extra_in_len,
362
+ const uint8_t *ad, size_t ad_len);
363
+
364
+ // EVP_AEAD_CTX_open_gather decrypts and authenticates |in_len| bytes from |in|
365
+ // and authenticates |ad_len| bytes from |ad| using |in_tag_len| bytes of
366
+ // authentication tag from |in_tag|. If successful, it writes |in_len| bytes of
367
+ // plaintext to |out|. It returns one on success and zero otherwise.
368
+ //
369
+ // This function may be called concurrently with itself or any other seal/open
370
+ // function on the same |EVP_AEAD_CTX|.
371
+ //
372
+ // The length of |nonce|, |nonce_len|, must be equal to the result of
373
+ // |EVP_AEAD_nonce_length| for this AEAD.
374
+ //
375
+ // |EVP_AEAD_CTX_open_gather| never results in a partial output. If any error
376
+ // occurs, |out| will be filled with zero bytes.
377
+ //
378
+ // If |in| and |out| alias then |out| must be == |in|.
379
+ OPENSSL_EXPORT int EVP_AEAD_CTX_open_gather(
380
+ const EVP_AEAD_CTX *ctx, uint8_t *out, const uint8_t *nonce,
381
+ size_t nonce_len, const uint8_t *in, size_t in_len, const uint8_t *in_tag,
382
+ size_t in_tag_len, const uint8_t *ad, size_t ad_len);
383
+
384
+ // EVP_AEAD_CTX_aead returns the underlying AEAD for |ctx|, or NULL if one has
385
+ // not been set.
386
+ OPENSSL_EXPORT const EVP_AEAD *EVP_AEAD_CTX_aead(const EVP_AEAD_CTX *ctx);
387
+
388
+
389
+ // TLS-specific AEAD algorithms.
390
+ //
391
+ // These AEAD primitives do not meet the definition of generic AEADs. They are
392
+ // all specific to TLS and should not be used outside of that context. They must
393
+ // be initialized with |EVP_AEAD_CTX_init_with_direction|, are stateful, and may
394
+ // not be used concurrently. Any nonces are used as IVs, so they must be
395
+ // unpredictable. They only accept an |ad| parameter of length 11 (the standard
396
+ // TLS one with length omitted).
397
+
398
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_cbc_sha1_tls(void);
399
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_cbc_sha1_tls_implicit_iv(void);
400
+
401
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha1_tls(void);
402
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha1_tls_implicit_iv(void);
403
+
404
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_des_ede3_cbc_sha1_tls(void);
405
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_des_ede3_cbc_sha1_tls_implicit_iv(void);
406
+
407
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_null_sha1_tls(void);
408
+
409
+ // EVP_aead_aes_128_gcm_tls12 is AES-128 in Galois Counter Mode using the TLS
410
+ // 1.2 nonce construction.
411
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_tls12(void);
412
+
413
+ // EVP_aead_aes_256_gcm_tls12 is AES-256 in Galois Counter Mode using the TLS
414
+ // 1.2 nonce construction.
415
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_tls12(void);
416
+
417
+ // EVP_aead_aes_128_gcm_tls13 is AES-128 in Galois Counter Mode using the TLS
418
+ // 1.3 nonce construction.
419
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_tls13(void);
420
+
421
+ // EVP_aead_aes_256_gcm_tls13 is AES-256 in Galois Counter Mode using the TLS
422
+ // 1.3 nonce construction.
423
+ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_tls13(void);
424
+
425
+
426
+ // Obscure functions.
427
+
428
+ // evp_aead_direction_t denotes the direction of an AEAD operation.
429
+ enum evp_aead_direction_t {
430
+ evp_aead_open,
431
+ evp_aead_seal,
432
+ };
433
+
434
+ // EVP_AEAD_CTX_init_with_direction calls |EVP_AEAD_CTX_init| for normal
435
+ // AEADs. For TLS-specific and SSL3-specific AEADs, it initializes |ctx| for a
436
+ // given direction.
437
+ OPENSSL_EXPORT int EVP_AEAD_CTX_init_with_direction(
438
+ EVP_AEAD_CTX *ctx, const EVP_AEAD *aead, const uint8_t *key, size_t key_len,
439
+ size_t tag_len, enum evp_aead_direction_t dir);
440
+
441
+ // EVP_AEAD_CTX_get_iv sets |*out_len| to the length of the IV for |ctx| and
442
+ // sets |*out_iv| to point to that many bytes of the current IV. This is only
443
+ // meaningful for AEADs with implicit IVs (i.e. CBC mode in TLS 1.0).
444
+ //
445
+ // It returns one on success or zero on error.
446
+ OPENSSL_EXPORT int EVP_AEAD_CTX_get_iv(const EVP_AEAD_CTX *ctx,
447
+ const uint8_t **out_iv, size_t *out_len);
448
+
449
+ // EVP_AEAD_CTX_tag_len computes the exact byte length of the tag written by
450
+ // |EVP_AEAD_CTX_seal_scatter| and writes it to |*out_tag_len|. It returns one
451
+ // on success or zero on error. |in_len| and |extra_in_len| must equal the
452
+ // arguments of the same names passed to |EVP_AEAD_CTX_seal_scatter|.
453
+ OPENSSL_EXPORT int EVP_AEAD_CTX_tag_len(const EVP_AEAD_CTX *ctx,
454
+ size_t *out_tag_len,
455
+ const size_t in_len,
456
+ const size_t extra_in_len);
457
+
458
+
459
+ #if defined(__cplusplus)
460
+ } // extern C
461
+
462
+ #if !defined(BORINGSSL_NO_CXX)
463
+ extern "C++" {
464
+
465
+ BSSL_NAMESPACE_BEGIN
466
+
467
+ using ScopedEVP_AEAD_CTX =
468
+ internal::StackAllocated<EVP_AEAD_CTX, void, EVP_AEAD_CTX_zero,
469
+ EVP_AEAD_CTX_cleanup>;
470
+
471
+ BORINGSSL_MAKE_DELETER(EVP_AEAD_CTX, EVP_AEAD_CTX_free)
472
+
473
+ BSSL_NAMESPACE_END
474
+
475
+ } // extern C++
476
+ #endif
477
+
478
+ #endif
479
+
480
+ #endif // OPENSSL_HEADER_AEAD_H