@fails-components/webtransport 0.0.1-rc.2 → 0.0.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 (230) hide show
  1. package/CMakeLists.txt +5 -2
  2. package/package.json +1 -1
  3. package/platform/net/quiche/common/platform/impl/quiche_flags_impl.h +1 -54
  4. package/platform/quiche_platform_impl/quic_flags_impl.h +1 -27
  5. package/platform/quiche_platform_impl/quiche_flag_utils_impl.h +1 -16
  6. package/platform/quiche_platform_impl/quiche_flags_impl.h +6 -1
  7. package/src/http3client.cc +14 -2
  8. package/src/http3client.h +10 -15
  9. package/src/webtransport.js +4 -1
  10. package/third_party/boringssl/src/.clang-format +11 -0
  11. package/third_party/boringssl/src/crypto/CMakeLists.txt +0 -1
  12. package/third_party/boringssl/src/crypto/asn1/a_strex.c +61 -95
  13. package/third_party/boringssl/src/crypto/asn1/asn1_par.c +31 -9
  14. package/third_party/boringssl/src/crypto/asn1/tasn_dec.c +33 -19
  15. package/third_party/boringssl/src/crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl +8 -8
  16. package/third_party/boringssl/src/crypto/cipher_extra/derive_key.c +4 -4
  17. package/third_party/boringssl/src/crypto/cipher_extra/e_des.c +1 -0
  18. package/third_party/boringssl/src/crypto/cipher_extra/e_null.c +1 -0
  19. package/third_party/boringssl/src/crypto/cipher_extra/e_rc2.c +1 -0
  20. package/third_party/boringssl/src/crypto/cipher_extra/e_rc4.c +2 -0
  21. package/third_party/boringssl/src/crypto/fipsmodule/bcm.c +1 -0
  22. package/third_party/boringssl/src/crypto/fipsmodule/bn/asm/x86_64-mont5.pl +0 -197
  23. package/third_party/boringssl/src/crypto/fipsmodule/bn/bn_test.cc +0 -9
  24. package/third_party/boringssl/src/crypto/fipsmodule/bn/bn_tests.txt +68 -0
  25. package/third_party/boringssl/src/crypto/fipsmodule/bn/exponentiation.c +45 -40
  26. package/third_party/boringssl/src/crypto/fipsmodule/bn/internal.h +11 -8
  27. package/third_party/boringssl/src/crypto/fipsmodule/bn/rsaz_exp.c +15 -106
  28. package/third_party/boringssl/src/crypto/fipsmodule/bn/rsaz_exp.h +5 -1
  29. package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aes.c +12 -32
  30. package/third_party/boringssl/src/crypto/fipsmodule/cipher/internal.h +39 -0
  31. package/third_party/boringssl/src/crypto/{evp → fipsmodule/digestsign}/digestsign.c +7 -9
  32. package/third_party/boringssl/src/crypto/fipsmodule/ec/ec_key.c +1 -0
  33. package/third_party/boringssl/src/crypto/fipsmodule/ecdh/ecdh.c +2 -1
  34. package/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -0
  35. package/third_party/boringssl/src/crypto/fipsmodule/hmac/hmac.c +1 -0
  36. package/third_party/boringssl/src/crypto/fipsmodule/service_indicator/service_indicator.c +1 -0
  37. package/third_party/boringssl/src/crypto/pkcs8/pkcs8_x509.c +4 -4
  38. package/third_party/boringssl/src/crypto/x509/algorithm.c +18 -1
  39. package/third_party/boringssl/src/crypto/x509/x_algor.c +1 -1
  40. package/third_party/boringssl/src/crypto/x509/x_crl.c +3 -3
  41. package/third_party/boringssl/src/crypto/x509/x_exten.c +1 -1
  42. package/third_party/boringssl/src/crypto/x509/x_name.c +1 -1
  43. package/third_party/boringssl/src/crypto/x509/x_pubkey.c +1 -1
  44. package/third_party/boringssl/src/crypto/x509/x_req.c +2 -2
  45. package/third_party/boringssl/src/crypto/x509/x_sig.c +1 -1
  46. package/third_party/boringssl/src/crypto/x509/x_spki.c +2 -2
  47. package/third_party/boringssl/src/crypto/x509/x_val.c +1 -1
  48. package/third_party/boringssl/src/crypto/x509/x_x509.c +2 -2
  49. package/third_party/boringssl/src/crypto/x509v3/v3_akey.c +1 -1
  50. package/third_party/boringssl/src/crypto/x509v3/v3_akeya.c +1 -1
  51. package/third_party/boringssl/src/crypto/x509v3/v3_bcons.c +2 -2
  52. package/third_party/boringssl/src/crypto/x509v3/v3_cpols.c +6 -6
  53. package/third_party/boringssl/src/crypto/x509v3/v3_crld.c +6 -6
  54. package/third_party/boringssl/src/crypto/x509v3/v3_enum.c +1 -1
  55. package/third_party/boringssl/src/crypto/x509v3/v3_extku.c +2 -2
  56. package/third_party/boringssl/src/crypto/x509v3/v3_genn.c +3 -3
  57. package/third_party/boringssl/src/crypto/x509v3/v3_info.c +3 -3
  58. package/third_party/boringssl/src/crypto/x509v3/v3_int.c +3 -3
  59. package/third_party/boringssl/src/crypto/x509v3/v3_ncons.c +2 -2
  60. package/third_party/boringssl/src/crypto/x509v3/v3_ocsp.c +2 -2
  61. package/third_party/boringssl/src/crypto/x509v3/v3_pcons.c +1 -1
  62. package/third_party/boringssl/src/crypto/x509v3/v3_pmaps.c +2 -2
  63. package/third_party/boringssl/src/crypto/x509v3/v3_skey.c +1 -1
  64. package/third_party/boringssl/src/decrepit/blowfish/blowfish.c +1 -0
  65. package/third_party/boringssl/src/decrepit/cast/cast.c +1 -0
  66. package/third_party/boringssl/src/decrepit/cfb/cfb.c +1 -0
  67. package/third_party/boringssl/src/decrepit/xts/xts.c +2 -1
  68. package/third_party/boringssl/src/fuzz/CMakeLists.txt +1 -0
  69. package/third_party/boringssl/src/fuzz/der_roundtrip.cc +57 -0
  70. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/0461791e54b4840c109637952eab43d9b938cab8 +0 -0
  71. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/06e57a7b98a403a00822739739924b97ae6c74e9 +0 -0
  72. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/078c3c1199930781466871c8dda69bec379286a4 +0 -0
  73. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/082a991742f652549e4b207100ee521f474e0a99 +1 -0
  74. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/091e3389548686c5038d04e3d76b9c4d30502074 +0 -0
  75. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/13e484c406efe97dc9d91f8b80a27b0e597c34da +1 -0
  76. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/153d254254345b61e20e7b37637dd6f6fd71ba01 +0 -0
  77. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/163605136e22f5b5302fe60d1f17837bee6b6b2b +1 -0
  78. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/1a96ec99b487b93052cd860c447e6d126dcc36d4 +1 -0
  79. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/1cc9ad96fcee279e8589b7071c7a0ccd111098f2 +1 -0
  80. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/229b8e1825512868e0e11a199ed71231dd41bb4f +1 -0
  81. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/236d820eadf7f84d70de7bb8be5f1c57a4005de2 +0 -0
  82. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/24fd9742dbdee3167509db4af245ad6f8c4c1e99 +0 -0
  83. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/2896f8deb3c4e8bdfeab743b22c64c92316880f7 +0 -0
  84. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/29b6252fe9c4d1186394b1664c421cca795b61a5 +0 -0
  85. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/2b4955132275314d1d377f37f93d8c1879a3519a +0 -0
  86. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/2e7112ac524a7a663632397cbb41f7dfd22e92c6 +0 -0
  87. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/396d197005432accf99bf0f483286e459eb24063 +1 -0
  88. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/3c75fe79266cf639f2180722a3f03f8fc3e25685 +1 -0
  89. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/3fbb104fb0eb6cae4af34d8a516998336b3a6778 +1 -0
  90. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/422fa995b3fdfed572b68b292062c330d6d05272 +0 -0
  91. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/428b48fc494cee828f0c27f77aef477cb2e1fd80 +0 -0
  92. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/4bd69e424b6fa38f9e63e58b8d0e95ac2d38d598 +1 -0
  93. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/4be7e1f134e1c55aeadeead515200f6f1e6254ba +0 -0
  94. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/4de268400e174db2dc306f45c833cf968a6c6546 +0 -0
  95. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/52d2c7efcd7da0eb7463829e05a598e36729bfae +1 -0
  96. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/53cf415eb9de49fb5a0cb46e745e413a99aa0779 +0 -0
  97. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/53ea84c48a5792281a46eb5a9c896d54ea3f1838 +1 -0
  98. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/5ba93c9db0cff93f52b521d7420e43f6eda2784f +0 -0
  99. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/5bab61eb53176449e25c2c82f172b82cb13ffb9d +1 -0
  100. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/5e5361730362736fe3e2804d8566e3c91454509b +0 -0
  101. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/6654fedb1fc4b07095695b062b5af4c2f12d59ae +0 -0
  102. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/6cad8b2a41194372ec897bece6512fe8331e274d +1 -0
  103. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/6f40330ec07e8e22f113f982b297ff7f86b8e485 +0 -0
  104. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/738f291e53e97c08dae378c71ef70a60e31ae900 +0 -0
  105. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/7396791821e64fc9340249a4bcbd2198e9f237db +0 -0
  106. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/7653595e28f23e62ea6707c99ca08c780a69335f +0 -0
  107. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/77de68daecd823babbb58edb1c8e14d7106e83bb +1 -0
  108. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/7cb5c71603a787032973d6ddc9c2c34638005784 +0 -0
  109. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/80a1e1ae75c1e5ef7bbde5f5877e3e5b26b3cf58 +0 -0
  110. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/872ba8af52a8c1380c388bab0e20bec2e729db80 +1 -0
  111. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/8855f2d904cf1bbaffc54e68d98890fdc9ec14cc +0 -0
  112. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/8a22f56ee86cc2d67e9610a6b0ed59f21008a341 +0 -0
  113. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/935a69e9f3bfa1dd3bf058fa3e1b953e82195de6 +1 -0
  114. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/951ccb49640c8f9e81fb4e0d82730321f4e15bb3 +0 -0
  115. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/9af1f3ed10c7a54f6b57c344015141cc082db23b +0 -0
  116. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a0b7dd1684089c63a4aac2e4a832544df4d639d6 +0 -0
  117. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a22d0d3565a509a4bfedce078090d8c6a908d950 +0 -0
  118. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a22f1185582f66227118c8e9002a5c29728f0650 +0 -0
  119. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a457945cb86ec812235f407ed70fe72fbaf694a1 +1 -0
  120. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a4ee44c4e8728d4924642ef8765063262e8c4601 +0 -0
  121. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a4fc609a6546fc0061f499f0faed9054fd388c9a +1 -0
  122. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a7c13e6fe60eee08b9aac00a095a9301ea1a9824 +1 -0
  123. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a98e22a5a8c2f5dda365d55e76536931010e1560 +0 -0
  124. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/aca6ed86348b1176bfbe4ebf32b2d48a0aa42f9f +0 -0
  125. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/aeefb82d7f5cc69168aade3b196a84d0f5c14bf2 +0 -0
  126. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/b37e0f6fa42840c773747c4cb608c278ab65021d +1 -0
  127. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/b5d4e67f0ec5b1a90100d8ad424d77aea8e16353 +0 -0
  128. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/b65ea16ba4dae8599ebbad7c4cb9fcd505edf485 +0 -0
  129. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/b95311782071c4d9182c0effe32487fc5cdbd33d +1 -0
  130. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/bbcaf4d15f92bfc6d624eee967fade1a74329f30 +0 -0
  131. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/bc26b8c794ac0adf948cbca02e88b3901824ef17 +1 -0
  132. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/bc7b23c2c68e4ad33ecea493ff6e60d423371cd0 +1 -0
  133. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/bd8daf3e78d8ba3a25838053b6993edc7a21c30e +0 -0
  134. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/c4d94647e646f02da1736b3179804ad6083acde9 +0 -0
  135. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/c869b259f9f81bec8ed24a9bc2cef35a513fb9fc +0 -0
  136. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/ceee46f04a09ef5d3342ef25d9f483e861727575 +1 -0
  137. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/d05c069216b54f35bc7e3ee08371baee243c089a +0 -0
  138. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/d18c30ba21e0d085dd983ad528f2c9001285d3d2 +1 -0
  139. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/d2c00146b2f2bcb4c6cecb731d2062273523d8c8 +1 -0
  140. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/d9bc7157a485958a5fce35ce777f551fe3f7d94c +0 -0
  141. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/defce76f0d3c3e057bb623986bacee7bbd07d1a1 +1 -0
  142. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/df9b696736847e43672b7a99ca05655af8a81135 +0 -0
  143. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/e5b420f71cf412bd9fdebdd46245fabd1f3462e5 +1 -0
  144. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/e7979b0e6e3e9cd64ceab99778c55205d6f92a73 +0 -0
  145. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/ee629f1935abc05fdc32ba314ec1f80f4bff2a17 +0 -0
  146. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/f944dcd635f9801f7ac90a407fbc479964dec024 +0 -0
  147. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/fadcde7d914246ca04bd56e68fd4045b1cf1c5ef +0 -0
  148. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/fd8be6506a9995f626eef831b9c981a80b0e3640 +0 -0
  149. package/third_party/boringssl/src/include/openssl/cipher.h +21 -48
  150. package/third_party/boringssl/src/include/openssl/ssl.h +38 -0
  151. package/third_party/boringssl/src/ssl/handshake_client.cc +8 -2
  152. package/third_party/boringssl/src/ssl/internal.h +16 -3
  153. package/third_party/boringssl/src/ssl/s3_both.cc +23 -1
  154. package/third_party/boringssl/src/ssl/ssl_lib.cc +94 -1
  155. package/third_party/boringssl/src/ssl/test/runner/runner.go +192 -0
  156. package/third_party/boringssl/src/ssl/test/test_config.cc +6 -0
  157. package/third_party/boringssl/src/ssl/test/test_config.h +1 -0
  158. package/third_party/boringssl/src/ssl/tls13_client.cc +7 -3
  159. package/third_party/boringssl/src/ssl/tls13_server.cc +2 -1
  160. package/third_party/boringssl/src/util/convert_comments.go +23 -0
  161. package/third_party/boringssl/src/util/fipstools/acvp/acvptool/acvp/acvp.go +1 -1
  162. package/third_party/boringssl/src/util/fipstools/acvp/modulewrapper/modulewrapper.cc +32 -21
  163. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.cc +1 -1
  164. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.h +1 -1
  165. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_logging_impl.h +3 -2
  166. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_test_impl.cc +2 -2
  167. package/third_party/quiche/quiche/http2/adapter/http2_protocol.h +5 -1
  168. package/third_party/quiche/quiche/http2/adapter/http2_util.cc +2 -0
  169. package/third_party/quiche/quiche/http2/adapter/http2_visitor_interface.h +2 -0
  170. package/third_party/quiche/quiche/http2/adapter/nghttp2_adapter_test.cc +119 -0
  171. package/third_party/quiche/quiche/http2/adapter/oghttp2_adapter_test.cc +130 -0
  172. package/third_party/quiche/quiche/http2/adapter/oghttp2_session.cc +23 -12
  173. package/third_party/quiche/quiche/http2/decoder/decode_buffer_test.cc +6 -11
  174. package/third_party/quiche/quiche/quic/core/congestion_control/bbr2_sender.cc +0 -5
  175. package/third_party/quiche/quiche/quic/core/congestion_control/bbr2_sender.h +0 -2
  176. package/third_party/quiche/quiche/quic/core/congestion_control/bbr_sender.cc +0 -10
  177. package/third_party/quiche/quiche/quic/core/congestion_control/bbr_sender.h +0 -1
  178. package/third_party/quiche/quiche/quic/core/congestion_control/send_algorithm_interface.h +0 -6
  179. package/third_party/quiche/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.cc +0 -2
  180. package/third_party/quiche/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.h +0 -1
  181. package/third_party/quiche/quiche/quic/core/crypto/transport_parameters_test.cc +1 -3
  182. package/third_party/quiche/quiche/quic/core/http/end_to_end_test.cc +19 -9
  183. package/third_party/quiche/quiche/quic/core/http/http_decoder_test.cc +6 -3
  184. package/third_party/quiche/quiche/quic/core/http/quic_server_session_base.cc +4 -16
  185. package/third_party/quiche/quiche/quic/core/http/quic_spdy_session.h +6 -6
  186. package/third_party/quiche/quiche/quic/core/http/quic_spdy_session_test.cc +25 -15
  187. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream_test.cc +6 -5
  188. package/third_party/quiche/quiche/quic/core/http/web_transport_http3.cc +1 -2
  189. package/third_party/quiche/quiche/quic/core/quic_bandwidth_test.cc +12 -12
  190. package/third_party/quiche/quiche/quic/core/quic_connection.cc +5 -95
  191. package/third_party/quiche/quiche/quic/core/quic_connection.h +0 -35
  192. package/third_party/quiche/quiche/quic/core/quic_connection_test.cc +80 -196
  193. package/third_party/quiche/quiche/quic/core/quic_control_frame_manager.cc +1 -1
  194. package/third_party/quiche/quiche/quic/core/quic_crypto_stream.cc +29 -5
  195. package/third_party/quiche/quiche/quic/core/quic_crypto_stream_test.cc +46 -0
  196. package/third_party/quiche/quiche/quic/core/quic_dispatcher_test.cc +17 -14
  197. package/third_party/quiche/quiche/quic/core/quic_flags_list.h +54 -54
  198. package/third_party/quiche/quiche/quic/core/quic_flow_controller_test.cc +8 -5
  199. package/third_party/quiche/quiche/quic/core/quic_framer_test.cc +8 -5
  200. package/third_party/quiche/quiche/quic/core/quic_idle_network_detector.cc +1 -0
  201. package/third_party/quiche/quiche/quic/core/quic_idle_network_detector_test.cc +29 -0
  202. package/third_party/quiche/quiche/quic/core/quic_packet_creator.cc +1 -5
  203. package/third_party/quiche/quiche/quic/core/quic_packet_creator_test.cc +18 -11
  204. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.cc +9 -28
  205. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.h +0 -13
  206. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager_test.cc +1 -49
  207. package/third_party/quiche/quiche/quic/core/quic_session.cc +0 -8
  208. package/third_party/quiche/quiche/quic/core/quic_session.h +0 -1
  209. package/third_party/quiche/quiche/quic/core/quic_stream.cc +1 -1
  210. package/third_party/quiche/quiche/quic/core/quic_stream_sequencer.cc +5 -0
  211. package/third_party/quiche/quiche/quic/core/quic_stream_sequencer.h +4 -0
  212. package/third_party/quiche/quiche/quic/core/quic_stream_sequencer_test.cc +12 -5
  213. package/third_party/quiche/quiche/quic/core/quic_stream_test.cc +27 -12
  214. package/third_party/quiche/quiche/quic/core/quic_types.cc +0 -1
  215. package/third_party/quiche/quiche/quic/core/quic_types.h +0 -3
  216. package/third_party/quiche/quiche/quic/core/quic_utils.cc +0 -3
  217. package/third_party/quiche/quiche/quic/core/quic_utils_test.cc +0 -2
  218. package/third_party/quiche/quiche/quic/core/tls_client_handshaker_test.cc +16 -12
  219. package/third_party/quiche/quiche/quic/core/tls_handshaker.cc +18 -3
  220. package/third_party/quiche/quiche/quic/qbone/platform/internet_checksum.cc +7 -2
  221. package/third_party/quiche/quiche/quic/test_tools/crypto_test_utils.cc +20 -12
  222. package/third_party/quiche/quiche/quic/test_tools/crypto_test_utils.h +10 -5
  223. package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.h +0 -2
  224. package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint.cc +0 -8
  225. package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint.h +0 -1
  226. package/third_party/quiche/quiche/quic/tools/quic_simple_server_stream_test.cc +2 -1
  227. package/platform/net/quiche/common/platform/impl/quic_flags_list_add.h +0 -379
  228. package/platform/net/quiche/common/platform/impl/quiche_flags_impl.cc +0 -21
  229. package/third_party/boringssl/src/crypto/asn1/charmap.h +0 -15
  230. package/third_party/boringssl/src/crypto/asn1/charmap.pl +0 -135
@@ -979,13 +979,13 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
979
979
  #if defined(OPENSSL_BN_ASM_MONT5)
980
980
  if (window >= 5) {
981
981
  window = 5; // ~5% improvement for RSA2048 sign, and even for RSA4096
982
- // reserve space for mont->N.d[] copy
982
+ // Reserve space for the |mont->N| copy.
983
983
  powerbufLen += top * sizeof(mont->N.d[0]);
984
984
  }
985
985
  #endif
986
986
 
987
987
  // Allocate a buffer large enough to hold all of the pre-computed
988
- // powers of am, am itself and tmp.
988
+ // powers of |am|, |am| itself, and |tmp|.
989
989
  numPowers = 1 << window;
990
990
  powerbufLen +=
991
991
  sizeof(m->d[0]) *
@@ -1008,7 +1008,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
1008
1008
  }
1009
1009
  OPENSSL_memset(powerbuf, 0, powerbufLen);
1010
1010
 
1011
- // lay down tmp and am right after powers table
1011
+ // Place |tmp| and |am| right after powers table.
1012
1012
  tmp.d = powerbuf + top * numPowers;
1013
1013
  am.d = tmp.d + top;
1014
1014
  tmp.width = am.width = 0;
@@ -1028,18 +1028,26 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
1028
1028
  }
1029
1029
 
1030
1030
  #if defined(OPENSSL_BN_ASM_MONT5)
1031
- // This optimization uses ideas from http://eprint.iacr.org/2011/239,
1032
- // specifically optimization of cache-timing attack countermeasures
1033
- // and pre-computation optimization.
1034
-
1035
- // Dedicated window==4 case improves 512-bit RSA sign by ~15%, but as
1036
- // 512-bit RSA is hardly relevant, we omit it to spare size...
1031
+ // This optimization uses ideas from https://eprint.iacr.org/2011/239,
1032
+ // specifically optimization of cache-timing attack countermeasures,
1033
+ // pre-computation optimization, and Almost Montgomery Multiplication.
1034
+ //
1035
+ // The paper discusses a 4-bit window to optimize 512-bit modular
1036
+ // exponentiation, used in RSA-1024 with CRT, but RSA-1024 is no longer
1037
+ // important.
1038
+ //
1039
+ // |bn_mul_mont_gather5| and |bn_power5| implement the "almost" reduction
1040
+ // variant, so the values here may not be fully reduced. They are bounded by R
1041
+ // (i.e. they fit in |top| words), not |m|. Additionally, we pass these
1042
+ // "almost" reduced inputs into |bn_mul_mont|, which implements the normal
1043
+ // reduction variant. Given those inputs, |bn_mul_mont| may not give reduced
1044
+ // output, but it will still produce "almost" reduced output.
1045
+ //
1046
+ // TODO(davidben): Using "almost" reduction complicates analysis of this code,
1047
+ // and its interaction with other parts of the project. Determine whether this
1048
+ // is actually necessary for performance.
1037
1049
  if (window == 5 && top > 1) {
1038
- const BN_ULONG *n0 = mont->n0;
1039
- BN_ULONG *np;
1040
-
1041
- // BN_to_montgomery can contaminate words above .top
1042
- // [in BN_DEBUG[_DEBUG] build]...
1050
+ // Ensure |am| and |tmp| are padded to the right width.
1043
1051
  for (i = am.width; i < top; i++) {
1044
1052
  am.d[i] = 0;
1045
1053
  }
@@ -1047,40 +1055,33 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
1047
1055
  tmp.d[i] = 0;
1048
1056
  }
1049
1057
 
1050
- // copy mont->N.d[] to improve cache locality
1051
- for (np = am.d + top, i = 0; i < top; i++) {
1058
+ // Copy |mont->N| to improve cache locality.
1059
+ BN_ULONG *np = am.d + top;
1060
+ for (i = 0; i < top; i++) {
1052
1061
  np[i] = mont->N.d[i];
1053
1062
  }
1054
1063
 
1064
+ // Fill |powerbuf| with the first 32 powers of |am|.
1065
+ const BN_ULONG *n0 = mont->n0;
1055
1066
  bn_scatter5(tmp.d, top, powerbuf, 0);
1056
1067
  bn_scatter5(am.d, am.width, powerbuf, 1);
1057
1068
  bn_mul_mont(tmp.d, am.d, am.d, np, n0, top);
1058
1069
  bn_scatter5(tmp.d, top, powerbuf, 2);
1059
1070
 
1060
- // same as above, but uses squaring for 1/2 of operations
1071
+ // Square to compute powers of two.
1061
1072
  for (i = 4; i < 32; i *= 2) {
1062
1073
  bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
1063
1074
  bn_scatter5(tmp.d, top, powerbuf, i);
1064
1075
  }
1065
- for (i = 3; i < 8; i += 2) {
1066
- int j;
1076
+ // Compute odd powers |i| based on |i - 1|, then all powers |i * 2^j|.
1077
+ for (i = 3; i < 32; i += 2) {
1067
1078
  bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
1068
1079
  bn_scatter5(tmp.d, top, powerbuf, i);
1069
- for (j = 2 * i; j < 32; j *= 2) {
1080
+ for (int j = 2 * i; j < 32; j *= 2) {
1070
1081
  bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
1071
1082
  bn_scatter5(tmp.d, top, powerbuf, j);
1072
1083
  }
1073
1084
  }
1074
- for (; i < 16; i += 2) {
1075
- bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
1076
- bn_scatter5(tmp.d, top, powerbuf, i);
1077
- bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
1078
- bn_scatter5(tmp.d, top, powerbuf, 2 * i);
1079
- }
1080
- for (; i < 32; i += 2) {
1081
- bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
1082
- bn_scatter5(tmp.d, top, powerbuf, i);
1083
- }
1084
1085
 
1085
1086
  bits--;
1086
1087
  for (wvalue = 0, i = bits % 5; i >= 0; i--, bits--) {
@@ -1137,15 +1138,15 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
1137
1138
  bn_power5(tmp.d, tmp.d, powerbuf, np, n0, top, val);
1138
1139
  }
1139
1140
  }
1140
-
1141
- ret = bn_from_montgomery(tmp.d, tmp.d, NULL, np, n0, top);
1142
- tmp.width = top;
1143
- if (ret) {
1144
- if (!BN_copy(rr, &tmp)) {
1145
- ret = 0;
1146
- }
1147
- goto err; // non-zero ret means it's not error
1148
- }
1141
+ // The result is now in |tmp| in Montgomery form, but it may not be fully
1142
+ // reduced. This is within bounds for |BN_from_montgomery| (tmp < R <= m*R)
1143
+ // so it will, when converting from Montgomery form, produce a fully reduced
1144
+ // result.
1145
+ //
1146
+ // This differs from Figure 2 of the paper, which uses AMM(h, 1) to convert
1147
+ // from Montgomery form with unreduced output, followed by an extra
1148
+ // reduction step. In the paper's terminology, we replace steps 9 and 10
1149
+ // with MM(h, 1).
1149
1150
  } else
1150
1151
  #endif
1151
1152
  {
@@ -1206,7 +1207,11 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
1206
1207
  }
1207
1208
  }
1208
1209
 
1209
- // Convert the final result from montgomery to standard format
1210
+ // Convert the final result from Montgomery to standard format. If we used the
1211
+ // |OPENSSL_BN_ASM_MONT5| codepath, |tmp| may not be fully reduced. It is only
1212
+ // bounded by R rather than |m|. However, that is still within bounds for
1213
+ // |BN_from_montgomery|, which implements full Montgomery reduction, not
1214
+ // "almost" Montgomery reduction.
1210
1215
  if (!BN_from_montgomery(rr, &tmp, mont, ctx)) {
1211
1216
  goto err;
1212
1217
  }
@@ -353,6 +353,9 @@ int bn_rand_secret_range(BIGNUM *r, int *out_is_uniform, BN_ULONG min_inclusive,
353
353
  // corresponding field in |BN_MONT_CTX|. It returns one if |bn_mul_mont| handles
354
354
  // inputs of this size and zero otherwise.
355
355
  //
356
+ // If at least one of |ap| or |bp| is fully reduced, |rp| will be fully reduced.
357
+ // If neither is fully-reduced, the output may not be either.
358
+ //
356
359
  // TODO(davidben): The x86_64 implementation expects a 32-bit input and masks
357
360
  // off upper bits. The aarch64 implementation expects a 64-bit input and does
358
361
  // not. |size_t| is the safer option but not strictly correct for x86_64. But
@@ -372,6 +375,10 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
372
375
  // by |ap| modulo |np|, and stores the result in |rp|. The values are |num|
373
376
  // words long and represented in Montgomery form. |n0| is a pointer to the
374
377
  // corresponding field in |BN_MONT_CTX|.
378
+ //
379
+ // WARNING: This function implements Almost Montgomery Multiplication from
380
+ // https://eprint.iacr.org/2011/239. The inputs do not need to be fully reduced.
381
+ // However, even if they are fully reduced, the output may not be.
375
382
  void bn_mul_mont_gather5(BN_ULONG *rp, const BN_ULONG *ap,
376
383
  const BN_ULONG *table, const BN_ULONG *np,
377
384
  const BN_ULONG *n0, int num, int power);
@@ -391,16 +398,12 @@ void bn_gather5(BN_ULONG *out, size_t num, BN_ULONG *table, size_t power);
391
398
  // values are |num| words long and represented in Montgomery form. |n0| is a
392
399
  // pointer to the corresponding field in |BN_MONT_CTX|. |num| must be divisible
393
400
  // by 8.
401
+ //
402
+ // WARNING: This function implements Almost Montgomery Multiplication from
403
+ // https://eprint.iacr.org/2011/239. The inputs do not need to be fully reduced.
404
+ // However, even if they are fully reduced, the output may not be.
394
405
  void bn_power5(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *table,
395
406
  const BN_ULONG *np, const BN_ULONG *n0, int num, int power);
396
-
397
- // bn_from_montgomery converts |ap| from Montgomery form modulo |np| and writes
398
- // the result in |rp|, each of which is |num| words long. It returns one on
399
- // success and zero if it cannot handle inputs of length |num|. |n0| is a
400
- // pointer to the corresponding field in |BN_MONT_CTX|.
401
- int bn_from_montgomery(BN_ULONG *rp, const BN_ULONG *ap,
402
- const BN_ULONG *not_used, const BN_ULONG *np,
403
- const BN_ULONG *n0, int num);
404
407
  #endif // !OPENSSL_NO_ASM && OPENSSL_X86_64
405
408
 
406
409
  uint64_t bn_mont_n0(const BIGNUM *n);
@@ -66,23 +66,14 @@ void RSAZ_1024_mod_exp_avx2(BN_ULONG result_norm[16],
66
66
  // R2 = 2^3052 * 2^80 / 2^1044 = 2^2088 = (2^1044)^2
67
67
 
68
68
  // table[0] = 1
69
- rsaz_1024_mul_avx2(result, R2, one, m, k0);
70
69
  // table[1] = a_inv^1
70
+ rsaz_1024_mul_avx2(result, R2, one, m, k0);
71
71
  rsaz_1024_mul_avx2(a_inv, a_inv, R2, m, k0);
72
-
73
72
  rsaz_1024_scatter5_avx2(table_s, result, 0);
74
73
  rsaz_1024_scatter5_avx2(table_s, a_inv, 1);
75
-
76
74
  // table[2] = a_inv^2
77
75
  rsaz_1024_sqr_avx2(result, a_inv, m, k0, 1);
78
76
  rsaz_1024_scatter5_avx2(table_s, result, 2);
79
- #if 0
80
- // This is almost 2x smaller and less than 1% slower.
81
- for (int index = 3; index < 32; index++) {
82
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
83
- rsaz_1024_scatter5_avx2(table_s, result, index);
84
- }
85
- #else
86
77
  // table[4] = a_inv^4
87
78
  rsaz_1024_sqr_avx2(result, result, m, k0, 1);
88
79
  rsaz_1024_scatter5_avx2(table_s, result, 4);
@@ -92,109 +83,25 @@ void RSAZ_1024_mod_exp_avx2(BN_ULONG result_norm[16],
92
83
  // table[16] = a_inv^16
93
84
  rsaz_1024_sqr_avx2(result, result, m, k0, 1);
94
85
  rsaz_1024_scatter5_avx2(table_s, result, 16);
95
- // table[17] = a_inv^17
96
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
97
- rsaz_1024_scatter5_avx2(table_s, result, 17);
98
-
99
- // table[3]
100
- rsaz_1024_gather5_avx2(result, table_s, 2);
101
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
102
- rsaz_1024_scatter5_avx2(table_s, result, 3);
103
- // table[6]
104
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
105
- rsaz_1024_scatter5_avx2(table_s, result, 6);
106
- // table[12]
107
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
108
- rsaz_1024_scatter5_avx2(table_s, result, 12);
109
- // table[24]
110
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
111
- rsaz_1024_scatter5_avx2(table_s, result, 24);
112
- // table[25]
113
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
114
- rsaz_1024_scatter5_avx2(table_s, result, 25);
115
-
116
- // table[5]
117
- rsaz_1024_gather5_avx2(result, table_s, 4);
118
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
119
- rsaz_1024_scatter5_avx2(table_s, result, 5);
120
- // table[10]
121
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
122
- rsaz_1024_scatter5_avx2(table_s, result, 10);
123
- // table[20]
124
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
125
- rsaz_1024_scatter5_avx2(table_s, result, 20);
126
- // table[21]
127
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
128
- rsaz_1024_scatter5_avx2(table_s, result, 21);
129
-
130
- // table[7]
131
- rsaz_1024_gather5_avx2(result, table_s, 6);
132
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
133
- rsaz_1024_scatter5_avx2(table_s, result, 7);
134
- // table[14]
135
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
136
- rsaz_1024_scatter5_avx2(table_s, result, 14);
137
- // table[28]
138
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
139
- rsaz_1024_scatter5_avx2(table_s, result, 28);
140
- // table[29]
141
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
142
- rsaz_1024_scatter5_avx2(table_s, result, 29);
143
-
144
- // table[9]
145
- rsaz_1024_gather5_avx2(result, table_s, 8);
146
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
147
- rsaz_1024_scatter5_avx2(table_s, result, 9);
148
- // table[18]
149
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
150
- rsaz_1024_scatter5_avx2(table_s, result, 18);
151
- // table[19]
152
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
153
- rsaz_1024_scatter5_avx2(table_s, result, 19);
154
-
155
- // table[11]
156
- rsaz_1024_gather5_avx2(result, table_s, 10);
157
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
158
- rsaz_1024_scatter5_avx2(table_s, result, 11);
159
- // table[22]
160
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
161
- rsaz_1024_scatter5_avx2(table_s, result, 22);
162
- // table[23]
163
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
164
- rsaz_1024_scatter5_avx2(table_s, result, 23);
165
-
166
- // table[13]
167
- rsaz_1024_gather5_avx2(result, table_s, 12);
168
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
169
- rsaz_1024_scatter5_avx2(table_s, result, 13);
170
- // table[26]
171
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
172
- rsaz_1024_scatter5_avx2(table_s, result, 26);
173
- // table[27]
174
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
175
- rsaz_1024_scatter5_avx2(table_s, result, 27);
176
-
177
- // table[15]
178
- rsaz_1024_gather5_avx2(result, table_s, 14);
179
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
180
- rsaz_1024_scatter5_avx2(table_s, result, 15);
181
- // table[30]
182
- rsaz_1024_sqr_avx2(result, result, m, k0, 1);
183
- rsaz_1024_scatter5_avx2(table_s, result, 30);
184
- // table[31]
185
- rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
186
- rsaz_1024_scatter5_avx2(table_s, result, 31);
187
- #endif
86
+ for (int i = 3; i < 32; i += 2) {
87
+ // table[i] = table[i-1] * a_inv = a_inv^i
88
+ rsaz_1024_gather5_avx2(result, table_s, i - 1);
89
+ rsaz_1024_mul_avx2(result, result, a_inv, m, k0);
90
+ rsaz_1024_scatter5_avx2(table_s, result, i);
91
+ for (int j = 2 * i; j < 32; j *= 2) {
92
+ // table[j] = table[j/2]^2 = a_inv^j
93
+ rsaz_1024_sqr_avx2(result, result, m, k0, 1);
94
+ rsaz_1024_scatter5_avx2(table_s, result, j);
95
+ }
96
+ }
188
97
 
98
+ // Load the first window.
189
99
  const uint8_t *p_str = (const uint8_t *)exponent;
190
-
191
- // load first window
192
100
  int wvalue = p_str[127] >> 3;
193
101
  rsaz_1024_gather5_avx2(result, table_s, wvalue);
194
102
 
195
103
  int index = 1014;
196
104
  while (index > -1) { // Loop for the remaining 127 windows.
197
-
198
105
  rsaz_1024_sqr_avx2(result, result, m, k0, 5);
199
106
 
200
107
  uint16_t wvalue_16;
@@ -219,6 +126,8 @@ void RSAZ_1024_mod_exp_avx2(BN_ULONG result_norm[16],
219
126
  rsaz_1024_mul_avx2(result, result, one, m, k0);
220
127
 
221
128
  rsaz_1024_red2norm_avx2(result_norm, result);
129
+ BN_ULONG scratch[16];
130
+ bn_reduce_once_in_place(result_norm, /*carry=*/0, m_norm, scratch, 16);
222
131
 
223
132
  OPENSSL_cleanse(storage, MOD_EXP_CTIME_STORAGE_LEN * sizeof(BN_ULONG));
224
133
  }
@@ -90,7 +90,11 @@ void rsaz_1024_gather5_avx2(BN_ULONG val[40], const BN_ULONG tbl[32 * 18],
90
90
  int i);
91
91
 
92
92
  // rsaz_1024_red2norm_avx2 converts |red| from RSAZ to |BIGNUM| representation
93
- // and writes the result to |norm|.
93
+ // and writes the result to |norm|. The result will be <= the modulus.
94
+ //
95
+ // WARNING: The result of this operation may not be fully reduced. |norm| may be
96
+ // the modulus instead of zero. This function should be followed by a call to
97
+ // |bn_reduce_once|.
94
98
  void rsaz_1024_red2norm_avx2(BN_ULONG norm[16], const BN_ULONG red[40]);
95
99
 
96
100
 
@@ -603,7 +603,7 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
603
603
  }
604
604
  }
605
605
 
606
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_cbc_generic) {
606
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_128_cbc) {
607
607
  memset(out, 0, sizeof(EVP_CIPHER));
608
608
 
609
609
  out->nid = NID_aes_128_cbc;
@@ -616,7 +616,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_cbc_generic) {
616
616
  out->cipher = aes_cbc_cipher;
617
617
  }
618
618
 
619
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_ctr_generic) {
619
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_128_ctr) {
620
620
  memset(out, 0, sizeof(EVP_CIPHER));
621
621
 
622
622
  out->nid = NID_aes_128_ctr;
@@ -641,7 +641,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_ecb_generic) {
641
641
  out->cipher = aes_ecb_cipher;
642
642
  }
643
643
 
644
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_ofb_generic) {
644
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_128_ofb) {
645
645
  memset(out, 0, sizeof(EVP_CIPHER));
646
646
 
647
647
  out->nid = NID_aes_128_ofb128;
@@ -654,7 +654,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_ofb_generic) {
654
654
  out->cipher = aes_ofb_cipher;
655
655
  }
656
656
 
657
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_gcm_generic) {
657
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_128_gcm) {
658
658
  memset(out, 0, sizeof(EVP_CIPHER));
659
659
 
660
660
  out->nid = NID_aes_128_gcm;
@@ -671,7 +671,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_gcm_generic) {
671
671
  out->ctrl = aes_gcm_ctrl;
672
672
  }
673
673
 
674
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_cbc_generic) {
674
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_192_cbc) {
675
675
  memset(out, 0, sizeof(EVP_CIPHER));
676
676
 
677
677
  out->nid = NID_aes_192_cbc;
@@ -684,7 +684,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_cbc_generic) {
684
684
  out->cipher = aes_cbc_cipher;
685
685
  }
686
686
 
687
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_ctr_generic) {
687
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_192_ctr) {
688
688
  memset(out, 0, sizeof(EVP_CIPHER));
689
689
 
690
690
  out->nid = NID_aes_192_ctr;
@@ -709,7 +709,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_ecb_generic) {
709
709
  out->cipher = aes_ecb_cipher;
710
710
  }
711
711
 
712
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_ofb_generic) {
712
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_192_ofb) {
713
713
  memset(out, 0, sizeof(EVP_CIPHER));
714
714
 
715
715
  out->nid = NID_aes_192_ofb128;
@@ -722,7 +722,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_ofb_generic) {
722
722
  out->cipher = aes_ofb_cipher;
723
723
  }
724
724
 
725
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_gcm_generic) {
725
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_192_gcm) {
726
726
  memset(out, 0, sizeof(EVP_CIPHER));
727
727
 
728
728
  out->nid = NID_aes_192_gcm;
@@ -739,7 +739,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_gcm_generic) {
739
739
  out->ctrl = aes_gcm_ctrl;
740
740
  }
741
741
 
742
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_256_cbc_generic) {
742
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_256_cbc) {
743
743
  memset(out, 0, sizeof(EVP_CIPHER));
744
744
 
745
745
  out->nid = NID_aes_256_cbc;
@@ -752,7 +752,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_256_cbc_generic) {
752
752
  out->cipher = aes_cbc_cipher;
753
753
  }
754
754
 
755
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_256_ctr_generic) {
755
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_256_ctr) {
756
756
  memset(out, 0, sizeof(EVP_CIPHER));
757
757
 
758
758
  out->nid = NID_aes_256_ctr;
@@ -777,7 +777,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_256_ecb_generic) {
777
777
  out->cipher = aes_ecb_cipher;
778
778
  }
779
779
 
780
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_256_ofb_generic) {
780
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_256_ofb) {
781
781
  memset(out, 0, sizeof(EVP_CIPHER));
782
782
 
783
783
  out->nid = NID_aes_256_ofb128;
@@ -790,7 +790,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_256_ofb_generic) {
790
790
  out->cipher = aes_ofb_cipher;
791
791
  }
792
792
 
793
- DEFINE_LOCAL_DATA(EVP_CIPHER, aes_256_gcm_generic) {
793
+ DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_aes_256_gcm) {
794
794
  memset(out, 0, sizeof(EVP_CIPHER));
795
795
 
796
796
  out->nid = NID_aes_256_gcm;
@@ -875,26 +875,6 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_hw_256_ecb) {
875
875
 
876
876
  #endif // HWAES_ECB
877
877
 
878
- #define EVP_CIPHER_FUNCTION(keybits, mode) \
879
- const EVP_CIPHER *EVP_aes_##keybits##_##mode(void) { \
880
- return aes_##keybits##_##mode##_generic(); \
881
- }
882
-
883
- EVP_CIPHER_FUNCTION(128, cbc)
884
- EVP_CIPHER_FUNCTION(128, ctr)
885
- EVP_CIPHER_FUNCTION(128, ofb)
886
- EVP_CIPHER_FUNCTION(128, gcm)
887
-
888
- EVP_CIPHER_FUNCTION(192, cbc)
889
- EVP_CIPHER_FUNCTION(192, ctr)
890
- EVP_CIPHER_FUNCTION(192, ofb)
891
- EVP_CIPHER_FUNCTION(192, gcm)
892
-
893
- EVP_CIPHER_FUNCTION(256, cbc)
894
- EVP_CIPHER_FUNCTION(256, ctr)
895
- EVP_CIPHER_FUNCTION(256, ofb)
896
- EVP_CIPHER_FUNCTION(256, gcm)
897
-
898
878
  EVP_ECB_CIPHER_FUNCTION(128)
899
879
  EVP_ECB_CIPHER_FUNCTION(192)
900
880
  EVP_ECB_CIPHER_FUNCTION(256)
@@ -112,6 +112,45 @@ struct evp_aead_st {
112
112
  size_t extra_in_len);
113
113
  };
114
114
 
115
+ struct evp_cipher_st {
116
+ // type contains a NID identifying the cipher. (e.g. NID_aes_128_gcm.)
117
+ int nid;
118
+
119
+ // block_size contains the block size, in bytes, of the cipher, or 1 for a
120
+ // stream cipher.
121
+ unsigned block_size;
122
+
123
+ // key_len contains the key size, in bytes, for the cipher. If the cipher
124
+ // takes a variable key size then this contains the default size.
125
+ unsigned key_len;
126
+
127
+ // iv_len contains the IV size, in bytes, or zero if inapplicable.
128
+ unsigned iv_len;
129
+
130
+ // ctx_size contains the size, in bytes, of the per-key context for this
131
+ // cipher.
132
+ unsigned ctx_size;
133
+
134
+ // flags contains the OR of a number of flags. See |EVP_CIPH_*|.
135
+ uint32_t flags;
136
+
137
+ // app_data is a pointer to opaque, user data.
138
+ void *app_data;
139
+
140
+ int (*init)(EVP_CIPHER_CTX *ctx, const uint8_t *key, const uint8_t *iv,
141
+ int enc);
142
+
143
+ int (*cipher)(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
144
+ size_t inl);
145
+
146
+ // cleanup, if non-NULL, releases memory associated with the context. It is
147
+ // called if |EVP_CTRL_INIT| succeeds. Note that |init| may not have been
148
+ // called at this point.
149
+ void (*cleanup)(EVP_CIPHER_CTX *);
150
+
151
+ int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr);
152
+ };
153
+
115
154
  // aes_ctr_set_key initialises |*aes_key| using |key_bytes| bytes from |key|,
116
155
  // where |key_bytes| must either be 16, 24 or 32. If not NULL, |*out_block| is
117
156
  // set to a function that encrypts single blocks. If not NULL, |*gcm_key| is
@@ -57,11 +57,9 @@
57
57
 
58
58
  #include <openssl/err.h>
59
59
 
60
- #include "internal.h"
61
- #include "../fipsmodule/digest/internal.h"
62
- #include "../fipsmodule/service_indicator/internal.h"
63
-
64
- // TODO(agl): this will have to be moved into the FIPS module.
60
+ #include "../../evp/internal.h"
61
+ #include "../digest/internal.h"
62
+ #include "../service_indicator/internal.h"
65
63
 
66
64
 
67
65
  enum evp_sign_verify_t {
@@ -69,9 +67,9 @@ enum evp_sign_verify_t {
69
67
  evp_verify,
70
68
  };
71
69
 
72
- static const struct evp_md_pctx_ops md_pctx_ops = {
73
- EVP_PKEY_CTX_free,
74
- EVP_PKEY_CTX_dup,
70
+ DEFINE_LOCAL_DATA(struct evp_md_pctx_ops, md_pctx_ops) {
71
+ out->free = EVP_PKEY_CTX_free;
72
+ out->dup = EVP_PKEY_CTX_dup;
75
73
  };
76
74
 
77
75
  static int uses_prehash(EVP_MD_CTX *ctx, enum evp_sign_verify_t op) {
@@ -88,7 +86,7 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
88
86
  if (ctx->pctx == NULL) {
89
87
  return 0;
90
88
  }
91
- ctx->pctx_ops = &md_pctx_ops;
89
+ ctx->pctx_ops = md_pctx_ops();
92
90
 
93
91
  if (op == evp_verify) {
94
92
  if (!EVP_PKEY_verify_init(ctx->pctx)) {
@@ -79,6 +79,7 @@
79
79
 
80
80
  #include "internal.h"
81
81
  #include "../delocate.h"
82
+ #include "../service_indicator/internal.h"
82
83
  #include "../../internal.h"
83
84
 
84
85
 
@@ -74,8 +74,9 @@
74
74
  #include <openssl/mem.h>
75
75
  #include <openssl/sha.h>
76
76
 
77
- #include "../ec/internal.h"
78
77
  #include "../../internal.h"
78
+ #include "../ec/internal.h"
79
+ #include "../service_indicator/internal.h"
79
80
 
80
81
 
81
82
  int ECDH_compute_key_fips(uint8_t *out, size_t out_len, const EC_POINT *pub_key,
@@ -64,6 +64,7 @@
64
64
  #include "../../internal.h"
65
65
  #include "../bn/internal.h"
66
66
  #include "../ec/internal.h"
67
+ #include "../service_indicator/internal.h"
67
68
  #include "internal.h"
68
69
 
69
70
 
@@ -63,6 +63,7 @@
63
63
  #include <openssl/mem.h>
64
64
 
65
65
  #include "../../internal.h"
66
+ #include "../service_indicator/internal.h"
66
67
 
67
68
 
68
69
  uint8_t *HMAC(const EVP_MD *evp_md, const void *key, size_t key_len,
@@ -15,6 +15,7 @@
15
15
  #include <openssl/crypto.h>
16
16
  #include <openssl/ec.h>
17
17
  #include <openssl/ec_key.h>
18
+ #include <openssl/err.h>
18
19
  #include <openssl/evp.h>
19
20
  #include <openssl/service_indicator.h>
20
21
 
@@ -104,10 +104,10 @@ static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
104
104
  }
105
105
 
106
106
  ASN1_SEQUENCE_cb(PKCS8_PRIV_KEY_INFO, pkey_cb) = {
107
- ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, version, ASN1_INTEGER),
108
- ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, pkeyalg, X509_ALGOR),
109
- ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, pkey, ASN1_OCTET_STRING),
110
- ASN1_IMP_SET_OF_OPT(PKCS8_PRIV_KEY_INFO, attributes, X509_ATTRIBUTE, 0)
107
+ ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, version, ASN1_INTEGER),
108
+ ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, pkeyalg, X509_ALGOR),
109
+ ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, pkey, ASN1_OCTET_STRING),
110
+ ASN1_IMP_SET_OF_OPT(PKCS8_PRIV_KEY_INFO, attributes, X509_ATTRIBUTE, 0),
111
111
  } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
112
112
 
113
113
  IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)