@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
package/CMakeLists.txt CHANGED
@@ -63,8 +63,6 @@ platform/quiche_platform_impl/quiche_prefetch_impl.h
63
63
  platform/quiche_platform_impl/quiche_server_stats_impl.h
64
64
  platform/quiche_platform_impl/simple_libuv_epoll_server.cc
65
65
  platform/quiche_platform_impl/simple_libuv_epoll_server.h
66
- platform/net/quiche/common/platform/impl/quiche_flags_impl.h
67
- platform/net/quiche/common/platform/impl/quiche_flags_impl.cc
68
66
  platform/quiche_platform_impl/quiche_mem_slice_impl.h
69
67
  platform/quiche_platform_impl/quiche_flag_utils_impl.h
70
68
  #protofiles
@@ -106,6 +104,11 @@ third_party/quiche/quiche/common/platform/api/quiche_reference_counted.h
106
104
  third_party/quiche/quiche/common/platform/api/quiche_thread_local.h
107
105
  third_party/quiche/quiche/common/platform/api/quiche_time_utils.h
108
106
  third_party/quiche/quiche/common/platform/api/quiche_url_utils.h
107
+ third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quic_flags_impl.cc
108
+ third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quic_flags_impl.h
109
+ third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flag_utils_impl.h
110
+ third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.h
111
+ third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.cc
109
112
  third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_prefetch_impl.h
110
113
  third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_mutex_impl.cc
111
114
  third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_mutex_impl.h
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fails-components/webtransport",
3
- "version": "0.0.1-rc.2",
3
+ "version": "0.0.1",
4
4
  "description": "A component to add webtransport support (server and client) to node.js using libquiche",
5
5
  "main": "src/webtransport.js",
6
6
  "module": "src/webtransport.js",
@@ -7,59 +7,6 @@
7
7
  #ifndef NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAGS_IMPL_H_
8
8
  #define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAGS_IMPL_H_
9
9
 
10
- #include <cstdint>
11
- #include <map>
12
- #include <memory>
13
- #include <string>
14
- #include <vector>
15
- #include <algorithm>
16
-
17
- #include "third_party/quiche/quiche/common/platform/api/quiche_flags.h"
18
- #include "third_party/quiche/quiche/common/platform/api/quiche_export.h"
19
- #define QUIC_FLAG(flag, value) QUICHE_EXPORT_PRIVATE extern bool flag;
20
- #define QUIC_FLAGT(type, flag, value) QUICHE_EXPORT_PRIVATE extern type flag;
21
- #include "third_party/quiche/quiche/quic/core/quic_flags_list.h"
22
- #include "net/quiche/common/platform/impl/quic_flags_list_add.h"
23
- #undef QUIC_FLAG
24
- #undef QUIC_FLAGT
25
-
26
- inline bool GetQuicheFlagImpl(bool flag) {
27
- return flag;
28
- }
29
- inline int32_t GetQuicheFlagImpl(int32_t flag) {
30
- return flag;
31
- }
32
- inline int64_t GetQuicheFlagImpl(int64_t flag) {
33
- return flag;
34
- }
35
- inline uint32_t GetQuicheFlagImpl(uint32_t flag) {
36
- return flag;
37
- }
38
- inline uint64_t GetQuicheFlagImpl(uint64_t flag) {
39
- return flag;
40
- }
41
- inline double GetQuicheFlagImpl(double flag) {
42
- return flag;
43
- }
44
- inline std::string GetQuicheFlagImpl(const std::string& flag) {
45
- return flag;
46
- }
47
-
48
- #define SetQuicheFlagImpl(flag, value) ((flag) = (value))
49
-
50
- // ------------------------------------------------------------------------
51
- // QUIC feature flags implementation.
52
- // ------------------------------------------------------------------------
53
-
54
- #define RELOADABLE_FLAG(flag) FLAGS_quic_reloadable_flag_##flag
55
- #define RESTART_FLAG(flag) FLAGS_quic_restart_flag_##flag
56
-
57
- #define GetQuicheReloadableFlagImpl(module, flag) \
58
- GetQuicheFlag(RELOADABLE_FLAG(flag))
59
- #define SetQuicheReloadableFlagImpl(module, flag, value) \
60
- SetQuicheFlag(RELOADABLE_FLAG(flag), value)
61
- #define GetQuicheRestartFlagImpl(module, flag) GetQuicheFlag(RESTART_FLAG(flag))
62
- #define SetQuicheRestartFlagImpl(module, flag, value) \
63
- SetQuicheFlag(RESTART_FLAG(flag), value)
10
+ #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.h"
64
11
 
65
12
  #endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAGS_IMPL_H_
@@ -2,34 +2,8 @@
2
2
  #ifndef QUIC_FLAGS_IMPL
3
3
  #define QUIC_FLAGS_IMPL
4
4
 
5
- // This file is part of the QUICHE platform implementation, and is not to be
6
- // consumed or referenced directly by other Envoy code. It serves purely as a
7
- // porting layer for QUICHE.
8
-
9
-
10
- #include <string>
11
- #include <vector>
12
-
13
- #include "net/quiche/common/platform/impl/quiche_flags_impl.h"
14
-
15
- // Not wired into command-line parsing.
16
- #define DEFINE_QUIC_COMMAND_LINE_FLAG_IMPL(type, flag, value, help) \
17
- QUICHE_DVLOG_IMPL(3) << "Type:" #type "FLAG_" #flag ": value: " << value \
18
- << " help: " << help
19
-
20
- namespace quic {
21
-
22
- // TODO(mpwarres): implement. Lower priority since only used by QUIC command-line tools.
23
- inline std::vector<std::string> QuicParseCommandLineFlagsImpl(const char* /*usage*/, int /*argc*/,
24
- const char* const* /*argv*/) {
25
- return std::vector<std::string>();
26
- }
27
-
28
- // TODO(mpwarres): implement. Lower priority since only used by QUIC command-line tools.
29
- inline void QuicPrintCommandLineFlagHelpImpl(const char* /*usage*/) {}
30
-
31
- } // namespace quic
32
5
 
6
+ #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quic_flags_impl.h"
33
7
 
34
8
 
35
9
  #endif
@@ -5,22 +5,7 @@
5
5
  #ifndef NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_UTILS_IMPL_H_
6
6
  #define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_UTILS_IMPL_H_
7
7
 
8
- #include "quiche_platform_impl/quiche_logging_impl.h"
8
+ #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flag_utils_impl.h"
9
9
 
10
- #define QUICHE_RELOADABLE_FLAG_COUNT_IMPL(flag) \
11
- QUICHE_DVLOG_IMPL(3) << "FLAG_" #flag ": reloadable"
12
- #define QUICHE_RELOADABLE_FLAG_COUNT_N_IMPL(flag, instance, total) \
13
- QUICHE_DVLOG_IMPL(3) << "FLAG_" #flag ": reloadable, instance: " << instance \
14
- << " total: " << total
15
-
16
- #define QUICHE_RESTART_FLAG_COUNT_IMPL(flag) \
17
- QUICHE_DVLOG_IMPL(3) << "FLAG_" #flag ": resart"
18
- #define QUICHE_RESTART_FLAG_COUNT_N_IMPL(flag, instance, total) \
19
- QUICHE_DVLOG_IMPL(3) << "FLAG_" #flag ": restart, instance: " << instance \
20
- << " total: " << total
21
-
22
- #define QUICHE_CODE_COUNT_IMPL(flag) QUICHE_DVLOG_IMPL(3) << "FLAG_" #flag
23
- #define QUICHE_CODE_COUNT_N_IMPL(flag, instance, total) \
24
- QUICHE_DVLOG_IMPL(3) << "FLAG_" #flag
25
10
 
26
11
  #endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_UTILS_IMPL_H_
@@ -1,3 +1,8 @@
1
1
  // only for redirects
2
2
 
3
- #include "net/quiche/common/platform/impl/quiche_flags_impl.h"
3
+ #ifndef NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_IMPL_H_
4
+ #define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_IMPL_H_
5
+
6
+ #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.h"
7
+
8
+ #endif
@@ -81,12 +81,13 @@ namespace quic
81
81
 
82
82
  Http3Client::Http3Client(Http3EventLoop *eventloop,
83
83
  QuicSocketAddress server_address, const std::string &server_hostname,
84
+ int local_port,
84
85
  std::unique_ptr<ProofVerifier> proof_verifier,
85
86
  std::unique_ptr<SessionCache> session_cache,
86
87
  std::unique_ptr<QuicConnectionHelperInterface> helper)
87
88
  : server_id_(QuicServerId(server_hostname, server_address.port(), false)),
88
89
  initialized_(false),
89
- local_port_(0),
90
+ local_port_(local_port),
90
91
  store_response_(false),
91
92
  latest_response_code_(-1),
92
93
  overflow_supported_(false),
@@ -1290,6 +1291,7 @@ namespace quic
1290
1291
  std::vector<WebTransportHash> serverCertificateHashes;
1291
1292
  std::string privkey;
1292
1293
  std::string hostname = "localhost";
1294
+ int local_port = 0;
1293
1295
 
1294
1296
  v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
1295
1297
 
@@ -1303,6 +1305,7 @@ namespace quic
1303
1305
  v8::Local<v8::String> valueProp = Nan::New("value").ToLocalChecked();
1304
1306
  v8::Local<v8::String> portProp = Nan::New("port").ToLocalChecked();
1305
1307
  v8::Local<v8::String> hostnameProp = Nan::New("hostname").ToLocalChecked();
1308
+ v8::Local<v8::String> localPortProp = Nan::New("localPort").ToLocalChecked();
1306
1309
  if (!obj.IsEmpty())
1307
1310
  {
1308
1311
 
@@ -1365,6 +1368,15 @@ namespace quic
1365
1368
  else
1366
1369
  return Nan::ThrowError("serverCertificateHashes is not an array");
1367
1370
  }
1371
+
1372
+ if (Nan::HasOwnProperty(lobj, localPortProp).FromJust() && !Nan::Get(lobj, localPortProp).IsEmpty())
1373
+ {
1374
+ v8::Local<v8::Value> localPortValue = Nan::Get(lobj, localPortProp).ToLocalChecked();
1375
+ if (localPortValue->IsNumber())
1376
+ local_port = Nan::To<int>(localPortValue).FromJust();
1377
+ else
1378
+ return Nan::ThrowError("localPort is not a number");
1379
+ }
1368
1380
  }
1369
1381
  }
1370
1382
 
@@ -1439,7 +1451,7 @@ namespace quic
1439
1451
  freeaddrinfo);
1440
1452
  address = QuicSocketAddress(info_list->ai_addr, info_list->ai_addrlen);
1441
1453
 
1442
- Http3Client *object = new Http3Client(eventloop, address, hostname,
1454
+ Http3Client *object = new Http3Client(eventloop, address, hostname, local_port,
1443
1455
  std::move(verifier), std::move(cache), std::move(helper));
1444
1456
  object->SetUserAgentID("fails-components/webtransport");
1445
1457
  object->Wrap(info.This());
package/src/http3client.h CHANGED
@@ -48,28 +48,27 @@ namespace quic
48
48
  public QuicClientPushPromiseIndex::Delegate,
49
49
  public ProcessPacketInterface,
50
50
  public Nan::ObjectWrap,
51
- public LifetimeHelper
51
+ public LifetimeHelper
52
52
  {
53
53
  public:
54
54
  Http3Client(Http3EventLoop *eventloop, QuicSocketAddress server_address,
55
55
  const std::string &server_hostname,
56
+ int local_port,
56
57
  std::unique_ptr<ProofVerifier> proof_verifier,
57
58
  std::unique_ptr<SessionCache> session_cache,
58
59
  std::unique_ptr<QuicConnectionHelperInterface> helper);
59
60
 
60
61
  ~Http3Client() override;
61
62
 
62
-
63
63
  // From EpollCallbackInterface
64
64
  std::string Name() const override { return "Http3Client"; }
65
65
 
66
-
67
66
  void OnRegistration(QuicEpollServer * /*eps*/,
68
67
  int /*fd*/,
69
68
  int /*event_mask*/) override;
70
69
  void OnModification(int /*fd*/, int /*event_mask*/) override;
71
70
  void OnEvent(int /*fd*/, QuicEpollEvent * /*event*/) override;
72
- void OnUnregistration(int /*fd*/, bool /*replaced*/) override ;
71
+ void OnUnregistration(int /*fd*/, bool /*replaced*/) override;
73
72
 
74
73
  void OnShutdown(QuicEpollServer * /*eps*/, int /*fd*/) override;
75
74
 
@@ -101,12 +100,12 @@ namespace quic
101
100
  // Sends a request containing |headers| and |body| and returns the number of
102
101
  // bytes sent (the size of the serialized request headers and body).
103
102
  void SendMessageAsync(const spdy::SpdyHeaderBlock &headers,
104
- absl::string_view body);
103
+ absl::string_view body);
105
104
  // Sends a request containing |headers| and |body| with the fin bit set to
106
105
  // |fin| and returns the number of bytes sent (the size of the serialized
107
106
  // request headers and body).
108
107
  void SendMessageAsync(const spdy::SpdyHeaderBlock &headers,
109
- absl::string_view body, bool fin);
108
+ absl::string_view body, bool fin);
110
109
 
111
110
  void SendConnectivityProbing();
112
111
  void Connect();
@@ -152,7 +151,6 @@ namespace quic
152
151
  size_t bytes_read() const;
153
152
  size_t bytes_written() const;
154
153
 
155
-
156
154
  // If the client has at least one UDP socket, return the latest created one.
157
155
  // Otherwise, return -1.
158
156
  int GetLatestFD() const;
@@ -178,7 +176,7 @@ namespace quic
178
176
  const QuicSocketAddress &address() const;
179
177
 
180
178
  // Returns a newly created QuicSpdyClientStream to callback
181
- void CreateClientStream(std::function<void (QuicSpdyClientStream *)> finish);
179
+ void CreateClientStream(std::function<void(QuicSpdyClientStream *)> finish);
182
180
 
183
181
  // From QuicSpdyStream::Visitor
184
182
  void OnClose(QuicSpdyStream *stream) override;
@@ -195,7 +193,7 @@ namespace quic
195
193
  void OnRendezvousResult(QuicSpdyStream *) override;
196
194
 
197
195
  // Returns nullptr if the maximum number of streams have already been created.
198
- //QuicSpdyClientStream *GetOrCreateStream();
196
+ // QuicSpdyClientStream *GetOrCreateStream();
199
197
  // async replacement
200
198
  void RunOnStreamMaybeCreateStream(std::function<void(QuicSpdyClientStream *)> finish);
201
199
 
@@ -208,7 +206,6 @@ namespace quic
208
206
  QuicRstStreamErrorCode stream_error() { return stream_error_; }
209
207
  QuicErrorCode connection_error() const;
210
208
 
211
-
212
209
  // Get the server config map. Server config must exist.
213
210
  const QuicTagValueMap &GetServerConfig();
214
211
 
@@ -252,7 +249,6 @@ namespace quic
252
249
 
253
250
  static NAN_METHOD(New);
254
251
 
255
-
256
252
  static NAN_METHOD(openWTSession);
257
253
  static NAN_METHOD(closeClient);
258
254
 
@@ -262,8 +258,8 @@ namespace quic
262
258
  return my_constructor;
263
259
  }
264
260
 
265
-
266
- void doUnref() override {
261
+ void doUnref() override
262
+ {
267
263
  Unref();
268
264
  }
269
265
 
@@ -326,7 +322,6 @@ namespace quic
326
322
  int64_t response_body_size;
327
323
  };
328
324
 
329
-
330
325
  // Index of pending promised streams. Must outlive |session_|.
331
326
  QuicClientPushPromiseIndex push_promise_index_;
332
327
 
@@ -530,7 +525,7 @@ namespace quic
530
525
  uint32_t num_attempts_connect_;
531
526
  bool webtransport_server_support_inform_;
532
527
 
533
- std::queue<std::function<void (QuicSpdyClientStream *)>> finish_stream_open_;
528
+ std::queue<std::function<void(QuicSpdyClientStream *)>> finish_stream_open_;
534
529
  };
535
530
 
536
531
  } // namespace quic
@@ -5,12 +5,15 @@
5
5
  import { existsSync } from 'fs'
6
6
  import { createRequire } from 'module'
7
7
  import { ReadableStream, WritableStream } from 'node:stream/web'
8
+ import * as path from 'path'
9
+ import * as url from 'url'
8
10
 
9
11
  const require = createRequire(import.meta.url)
12
+ const dirname = url.fileURLToPath(new URL('.', import.meta.url))
10
13
  let wtpath = '../build/Release/webtransport.node'
11
14
  if (
12
15
  process.env.NODE_ENV !== 'production' &&
13
- existsSync('build/Debug/webtransport.node')
16
+ existsSync(path.join(dirname,'../build/Debug/webtransport.node'))
14
17
  ) {
15
18
  wtpath = '../build/Debug/webtransport.node'
16
19
  }
@@ -46,6 +46,7 @@ StatementMacros:
46
46
  - "IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name"
47
47
  - "IMPLEMENT_ASN1_FUNCTIONS_fname"
48
48
  - "IMPLEMENT_ASN1_FUNCTIONS_name"
49
+ - "IMPLEMENT_ASN1_TYPE_ex"
49
50
  - "IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS"
50
51
  - "IMPLEMENT_PEM_read"
51
52
  - "IMPLEMENT_PEM_read_bio"
@@ -65,3 +66,13 @@ StatementMacros:
65
66
  - "IMPLEMENT_PEM_write_const"
66
67
  - "IMPLEMENT_PEM_write_fp"
67
68
  - "IMPLEMENT_PEM_write_fp_const"
69
+ - "ASN1_ADB_END"
70
+ - "ASN1_CHOICE_END"
71
+ - "ASN1_ITEM_TEMPLATE_END"
72
+ - "ASN1_SEQUENCE_END"
73
+ - "ASN1_SEQUENCE_END_cb"
74
+ - "ASN1_SEQUENCE_END_enc"
75
+ - "ASN1_SEQUENCE_END_ref"
76
+ # This isn't quite right, but it causes clang-format to do a slightly better
77
+ # job with this macro.
78
+ - "ASN1_EX_TEMPLATE_TYPE"
@@ -288,7 +288,6 @@ add_library(
288
288
  err/err.c
289
289
  err_data.c
290
290
  engine/engine.c
291
- evp/digestsign.c
292
291
  evp/evp.c
293
292
  evp/evp_asn1.c
294
293
  evp/evp_ctx.c
@@ -64,25 +64,12 @@
64
64
  #include <openssl/bio.h>
65
65
  #include <openssl/mem.h>
66
66
 
67
- #include "charmap.h"
68
67
  #include "internal.h"
69
68
 
70
69
 
71
- // These flags must be distinct from |ESC_FLAGS| and fit in a byte.
72
-
73
- // Character is a valid PrintableString character
74
- #define CHARTYPE_PRINTABLESTRING 0x10
75
- // Character needs escaping if it is the first character
76
- #define CHARTYPE_FIRST_ESC_2253 0x20
77
- // Character needs escaping if it is the last character
78
- #define CHARTYPE_LAST_ESC_2253 0x40
79
-
80
- #define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
81
-
82
- #define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
83
- ASN1_STRFLGS_ESC_QUOTE | \
84
- ASN1_STRFLGS_ESC_CTRL | \
85
- ASN1_STRFLGS_ESC_MSB)
70
+ #define ESC_FLAGS \
71
+ (ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_QUOTE | ASN1_STRFLGS_ESC_CTRL | \
72
+ ASN1_STRFLGS_ESC_MSB)
86
73
 
87
74
  static int maybe_write(BIO *out, const void *buf, int len)
88
75
  {
@@ -90,70 +77,54 @@ static int maybe_write(BIO *out, const void *buf, int len)
90
77
  return out == NULL || BIO_write(out, buf, len) == len;
91
78
  }
92
79
 
93
- /*
94
- * This function handles display of strings, one character at a time. It is
95
- * passed an unsigned long for each character because it could come from 2 or
96
- * even 4 byte forms.
97
- */
98
-
99
- #define HEX_SIZE(type) (sizeof(type)*2)
100
-
101
- static int do_esc_char(uint32_t c, unsigned char flags, char *do_quotes,
102
- BIO *out)
80
+ static int is_control_character(unsigned char c)
103
81
  {
104
- unsigned char chflgs, chtmp;
105
- char tmphex[HEX_SIZE(uint32_t) + 3];
82
+ return c < 32 || c == 127;
83
+ }
106
84
 
85
+ static int do_esc_char(uint32_t c, unsigned long flags, char *do_quotes,
86
+ BIO *out, int is_first, int is_last)
87
+ {
88
+ /* |c| is a |uint32_t| because, depending on |ASN1_STRFLGS_UTF8_CONVERT|,
89
+ * we may be escaping bytes or Unicode codepoints. */
90
+ char buf[16]; /* Large enough for "\\W01234567". */
91
+ unsigned char u8 = (unsigned char)c;
107
92
  if (c > 0xffff) {
108
- BIO_snprintf(tmphex, sizeof tmphex, "\\W%08" PRIX32, c);
109
- if (!maybe_write(out, tmphex, 10))
110
- return -1;
111
- return 10;
112
- }
113
- if (c > 0xff) {
114
- BIO_snprintf(tmphex, sizeof tmphex, "\\U%04" PRIX32, c);
115
- if (!maybe_write(out, tmphex, 6))
116
- return -1;
117
- return 6;
118
- }
119
- chtmp = (unsigned char)c;
120
- if (chtmp > 0x7f)
121
- chflgs = flags & ASN1_STRFLGS_ESC_MSB;
122
- else
123
- chflgs = char_type[chtmp] & flags;
124
- if (chflgs & CHARTYPE_BS_ESC) {
125
- /* If we don't escape with quotes, signal we need quotes */
126
- if (chflgs & ASN1_STRFLGS_ESC_QUOTE) {
127
- if (do_quotes)
128
- *do_quotes = 1;
129
- if (!maybe_write(out, &chtmp, 1))
130
- return -1;
131
- return 1;
93
+ BIO_snprintf(buf, sizeof(buf), "\\W%08" PRIX32, c);
94
+ } else if (c > 0xff) {
95
+ BIO_snprintf(buf, sizeof(buf), "\\U%04" PRIX32, c);
96
+ } else if ((flags & ASN1_STRFLGS_ESC_MSB) && c > 0x7f) {
97
+ BIO_snprintf(buf, sizeof(buf), "\\%02X", c);
98
+ } else if ((flags & ASN1_STRFLGS_ESC_CTRL) && is_control_character(c)) {
99
+ BIO_snprintf(buf, sizeof(buf), "\\%02X", c);
100
+ } else if (flags & ASN1_STRFLGS_ESC_2253) {
101
+ /* See RFC 2253, sections 2.4 and 4. */
102
+ if (c == '\\' || c == '"') {
103
+ /* Quotes and backslashes are always escaped, quoted or not. */
104
+ BIO_snprintf(buf, sizeof(buf), "\\%c", (int)c);
105
+ } else if (c == ',' || c == '+' || c == '<' || c == '>' || c == ';' ||
106
+ (is_first && (c == ' ' || c == '#')) ||
107
+ (is_last && (c == ' '))) {
108
+ if (flags & ASN1_STRFLGS_ESC_QUOTE) {
109
+ /* No need to escape, just tell the caller to quote. */
110
+ if (do_quotes != NULL) {
111
+ *do_quotes = 1;
112
+ }
113
+ return maybe_write(out, &u8, 1) ? 1 : -1;
114
+ }
115
+ BIO_snprintf(buf, sizeof(buf), "\\%c", (int)c);
116
+ } else {
117
+ return maybe_write(out, &u8, 1) ? 1 : -1;
132
118
  }
133
- if (!maybe_write(out, "\\", 1))
134
- return -1;
135
- if (!maybe_write(out, &chtmp, 1))
136
- return -1;
137
- return 2;
138
- }
139
- if (chflgs & (ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB)) {
140
- BIO_snprintf(tmphex, 11, "\\%02X", chtmp);
141
- if (!maybe_write(out, tmphex, 3))
142
- return -1;
143
- return 3;
144
- }
145
- /*
146
- * If we get this far and do any escaping at all must escape the escape
147
- * character itself: backslash.
148
- */
149
- if (chtmp == '\\' && flags & ESC_FLAGS) {
150
- if (!maybe_write(out, "\\\\", 2))
151
- return -1;
152
- return 2;
119
+ } else if ((flags & ESC_FLAGS) && c == '\\') {
120
+ /* If any escape flags are set, also escape backslashes. */
121
+ BIO_snprintf(buf, sizeof(buf), "\\%c", (int)c);
122
+ } else {
123
+ return maybe_write(out, &u8, 1) ? 1 : -1;
153
124
  }
154
- if (!maybe_write(out, &chtmp, 1))
155
- return -1;
156
- return 1;
125
+
126
+ int len = strlen(buf);
127
+ return maybe_write(out, buf, len) ? len : -1;
157
128
  }
158
129
 
159
130
  /*
@@ -163,7 +134,7 @@ static int do_esc_char(uint32_t c, unsigned char flags, char *do_quotes,
163
134
  */
164
135
 
165
136
  static int do_buf(const unsigned char *buf, int buflen, int encoding,
166
- int utf8_convert, unsigned char flags, char *quotes, BIO *out)
137
+ int utf8_convert, unsigned long flags, char *quotes, BIO *out)
167
138
  {
168
139
  /* Reject invalid UCS-4 and UCS-2 lengths without parsing. */
169
140
  switch (encoding) {
@@ -185,10 +156,7 @@ static int do_buf(const unsigned char *buf, int buflen, int encoding,
185
156
  const unsigned char *q = buf + buflen;
186
157
  int outlen = 0;
187
158
  while (p != q) {
188
- unsigned char orflags = 0;
189
- if (p == buf && flags & ASN1_STRFLGS_ESC_2253) {
190
- orflags = CHARTYPE_FIRST_ESC_2253;
191
- }
159
+ const int is_first = p == buf;
192
160
  /* TODO(davidben): Replace this with |cbs_get_ucs2_be|, etc., to check
193
161
  * for invalid codepoints. Before doing that, enforce it in the parser,
194
162
  * https://crbug.com/boringssl/427, so these error cases are not
@@ -224,8 +192,7 @@ static int do_buf(const unsigned char *buf, int buflen, int encoding,
224
192
  assert(0);
225
193
  return -1;
226
194
  }
227
- if (p == q && flags & ASN1_STRFLGS_ESC_2253)
228
- orflags = CHARTYPE_LAST_ESC_2253;
195
+ const int is_last = p == q;
229
196
  if (utf8_convert) {
230
197
  unsigned char utfbuf[6];
231
198
  int utflen;
@@ -237,14 +204,15 @@ static int do_buf(const unsigned char *buf, int buflen, int encoding,
237
204
  * otherwise each character will be > 0x7f and so the
238
205
  * character will never be escaped on first and last.
239
206
  */
240
- int len = do_esc_char(utfbuf[i], flags | orflags, quotes, out);
207
+ int len = do_esc_char(utfbuf[i], flags, quotes, out, is_first,
208
+ is_last);
241
209
  if (len < 0) {
242
210
  return -1;
243
211
  }
244
212
  outlen += len;
245
213
  }
246
214
  } else {
247
- int len = do_esc_char(c, flags | orflags, quotes, out);
215
+ int len = do_esc_char(c, flags, quotes, out, is_first, is_last);
248
216
  if (len < 0) {
249
217
  return -1;
250
218
  }
@@ -281,14 +249,14 @@ static int do_hex_dump(BIO *out, unsigned char *buf, int buflen)
281
249
  * encoding. This uses the RFC 2253 #01234 format.
282
250
  */
283
251
 
284
- static int do_dump(unsigned long lflags, BIO *out, const ASN1_STRING *str)
252
+ static int do_dump(unsigned long flags, BIO *out, const ASN1_STRING *str)
285
253
  {
286
254
  if (!maybe_write(out, "#", 1)) {
287
255
  return -1;
288
256
  }
289
257
 
290
258
  /* If we don't dump DER encoding just dump content octets */
291
- if (!(lflags & ASN1_STRFLGS_DUMP_DER)) {
259
+ if (!(flags & ASN1_STRFLGS_DUMP_DER)) {
292
260
  int outlen = do_hex_dump(out, str->data, str->length);
293
261
  if (outlen < 0) {
294
262
  return -1;
@@ -362,13 +330,11 @@ static int string_type_to_encoding(int type) {
362
330
  * an error occurred.
363
331
  */
364
332
 
365
- int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long lflags)
333
+ int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags)
366
334
  {
367
- /* Keep a copy of escape flags */
368
- unsigned char flags = (unsigned char)(lflags & ESC_FLAGS);
369
335
  int type = str->type;
370
336
  int outlen = 0;
371
- if (lflags & ASN1_STRFLGS_SHOW_TYPE) {
337
+ if (flags & ASN1_STRFLGS_SHOW_TYPE) {
372
338
  const char *tagname = ASN1_tag2str(type);
373
339
  outlen += strlen(tagname);
374
340
  if (!maybe_write(out, tagname, outlen) || !maybe_write(out, ":", 1))
@@ -378,21 +344,21 @@ int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long lflags)
378
344
 
379
345
  /* Decide what to do with |str|, either dump the contents or display it. */
380
346
  int encoding;
381
- if (lflags & ASN1_STRFLGS_DUMP_ALL) {
347
+ if (flags & ASN1_STRFLGS_DUMP_ALL) {
382
348
  /* Dump everything. */
383
349
  encoding = -1;
384
- } else if (lflags & ASN1_STRFLGS_IGNORE_TYPE) {
350
+ } else if (flags & ASN1_STRFLGS_IGNORE_TYPE) {
385
351
  /* Ignore the string type and interpret the contents as Latin-1. */
386
352
  encoding = MBSTRING_ASC;
387
353
  } else {
388
354
  encoding = string_type_to_encoding(type);
389
- if (encoding == -1 && (lflags & ASN1_STRFLGS_DUMP_UNKNOWN) == 0) {
355
+ if (encoding == -1 && (flags & ASN1_STRFLGS_DUMP_UNKNOWN) == 0) {
390
356
  encoding = MBSTRING_ASC;
391
357
  }
392
358
  }
393
359
 
394
360
  if (encoding == -1) {
395
- int len = do_dump(lflags, out, str);
361
+ int len = do_dump(flags, out, str);
396
362
  if (len < 0)
397
363
  return -1;
398
364
  outlen += len;
@@ -400,7 +366,7 @@ int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long lflags)
400
366
  }
401
367
 
402
368
  int utf8_convert = 0;
403
- if (lflags & ASN1_STRFLGS_UTF8_CONVERT) {
369
+ if (flags & ASN1_STRFLGS_UTF8_CONVERT) {
404
370
  /* If the string is UTF-8, skip decoding and just interpret it as 1 byte
405
371
  * per character to avoid converting twice.
406
372
  *