@fails-components/webtransport 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/package.json +1 -1
  2. package/readme.md +1 -3
  3. package/src/http3eventloop.cc +83 -9
  4. package/src/http3eventloop.h +13 -3
  5. package/src/http3server.cc +22 -22
  6. package/src/http3server.h +7 -20
  7. package/src/http3wtstreamvisitor.cc +31 -10
  8. package/src/http3wtstreamvisitor.h +38 -11
  9. package/src/webtransport.js +91 -23
  10. package/test/echoserver.js +29 -5
  11. package/test/testsuite.js +242 -220
  12. package/third_party/boringssl/src/CMakeLists.txt +2 -0
  13. package/third_party/boringssl/src/crypto/CMakeLists.txt +1 -0
  14. package/third_party/boringssl/src/crypto/asn1/a_bitstr.c +174 -177
  15. package/third_party/boringssl/src/crypto/asn1/a_bool.c +46 -48
  16. package/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c +21 -23
  17. package/third_party/boringssl/src/crypto/asn1/a_dup.c +21 -23
  18. package/third_party/boringssl/src/crypto/asn1/a_gentm.c +84 -187
  19. package/third_party/boringssl/src/crypto/asn1/a_i2d_fp.c +19 -21
  20. package/third_party/boringssl/src/crypto/asn1/a_int.c +305 -329
  21. package/third_party/boringssl/src/crypto/asn1/a_mbstr.c +190 -195
  22. package/third_party/boringssl/src/crypto/asn1/a_object.c +182 -189
  23. package/third_party/boringssl/src/crypto/asn1/a_octet.c +6 -9
  24. package/third_party/boringssl/src/crypto/asn1/a_print.c +15 -16
  25. package/third_party/boringssl/src/crypto/asn1/a_strex.c +386 -399
  26. package/third_party/boringssl/src/crypto/asn1/a_strnid.c +110 -131
  27. package/third_party/boringssl/src/crypto/asn1/a_time.c +118 -111
  28. package/third_party/boringssl/src/crypto/asn1/a_type.c +59 -60
  29. package/third_party/boringssl/src/crypto/asn1/a_utctm.c +114 -186
  30. package/third_party/boringssl/src/crypto/asn1/a_utf8.c +171 -159
  31. package/third_party/boringssl/src/crypto/asn1/asn1_lib.c +245 -260
  32. package/third_party/boringssl/src/crypto/asn1/asn1_par.c +41 -40
  33. package/third_party/boringssl/src/crypto/asn1/asn1_test.cc +31 -0
  34. package/third_party/boringssl/src/crypto/asn1/asn_pack.c +31 -33
  35. package/third_party/boringssl/src/crypto/asn1/f_int.c +36 -33
  36. package/third_party/boringssl/src/crypto/asn1/f_string.c +29 -26
  37. package/third_party/boringssl/src/crypto/asn1/internal.h +62 -61
  38. package/third_party/boringssl/src/crypto/asn1/tasn_dec.c +706 -702
  39. package/third_party/boringssl/src/crypto/asn1/tasn_enc.c +507 -524
  40. package/third_party/boringssl/src/crypto/asn1/tasn_fre.c +141 -133
  41. package/third_party/boringssl/src/crypto/asn1/tasn_new.c +207 -199
  42. package/third_party/boringssl/src/crypto/asn1/tasn_typ.c +19 -22
  43. package/third_party/boringssl/src/crypto/asn1/tasn_utl.c +24 -24
  44. package/third_party/boringssl/src/crypto/asn1/time_support.c +13 -13
  45. package/third_party/boringssl/src/crypto/bio/connect.c +9 -3
  46. package/third_party/boringssl/src/crypto/bytestring/bytestring_test.cc +125 -1
  47. package/third_party/boringssl/src/crypto/bytestring/cbb.c +4 -7
  48. package/third_party/boringssl/src/crypto/bytestring/cbs.c +167 -9
  49. package/third_party/boringssl/src/crypto/cipher_extra/e_aesctrhmac.c +0 -2
  50. package/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c +23 -54
  51. package/third_party/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c +0 -2
  52. package/third_party/boringssl/src/crypto/cipher_extra/e_tls.c +0 -2
  53. package/third_party/boringssl/src/crypto/curve25519/curve25519.c +6 -8
  54. package/third_party/boringssl/src/crypto/evp/evp_ctx.c +25 -22
  55. package/third_party/boringssl/src/crypto/evp/internal.h +15 -9
  56. package/third_party/boringssl/src/crypto/evp/p_dsa_asn1.c +2 -0
  57. package/third_party/boringssl/src/crypto/evp/p_ec_asn1.c +2 -0
  58. package/third_party/boringssl/src/crypto/evp/p_ed25519.c +3 -3
  59. package/third_party/boringssl/src/crypto/evp/p_ed25519_asn1.c +10 -7
  60. package/third_party/boringssl/src/crypto/evp/p_hkdf.c +241 -0
  61. package/third_party/boringssl/src/crypto/evp/p_rsa_asn1.c +2 -0
  62. package/third_party/boringssl/src/crypto/evp/p_x25519_asn1.c +1 -0
  63. package/third_party/boringssl/src/crypto/fipsmodule/aes/aes_nohw.c +9 -10
  64. package/third_party/boringssl/src/crypto/fipsmodule/aes/key_wrap.c +2 -6
  65. package/third_party/boringssl/src/crypto/fipsmodule/bn/exponentiation.c +5 -11
  66. package/third_party/boringssl/src/crypto/fipsmodule/bn/internal.h +1 -1
  67. package/third_party/boringssl/src/crypto/fipsmodule/bn/prime.c +2 -0
  68. package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aes.c +10 -26
  69. package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aesccm.c +2 -3
  70. package/third_party/boringssl/src/crypto/fipsmodule/digestsign/digestsign.c +1 -0
  71. package/third_party/boringssl/src/crypto/fipsmodule/ec/p256-nistz.c +44 -43
  72. package/third_party/boringssl/src/crypto/fipsmodule/modes/cbc.c +5 -9
  73. package/third_party/boringssl/src/crypto/fipsmodule/modes/gcm.c +14 -21
  74. package/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c +8 -8
  75. package/third_party/boringssl/src/crypto/fipsmodule/rand/internal.h +1 -4
  76. package/third_party/boringssl/src/crypto/hkdf/hkdf_test.cc +104 -0
  77. package/third_party/boringssl/src/crypto/internal.h +18 -4
  78. package/third_party/boringssl/src/crypto/lhash/internal.h +13 -1
  79. package/third_party/boringssl/src/crypto/obj/obj_dat.h +4 -1
  80. package/third_party/boringssl/src/crypto/obj/obj_mac.num +1 -0
  81. package/third_party/boringssl/src/crypto/obj/objects.txt +2 -0
  82. package/third_party/boringssl/src/crypto/pem/pem_all.c +77 -86
  83. package/third_party/boringssl/src/crypto/pem/pem_info.c +221 -233
  84. package/third_party/boringssl/src/crypto/pem/pem_lib.c +639 -608
  85. package/third_party/boringssl/src/crypto/pem/pem_oth.c +17 -16
  86. package/third_party/boringssl/src/crypto/pem/pem_pk8.c +133 -142
  87. package/third_party/boringssl/src/crypto/pem/pem_pkey.c +96 -92
  88. package/third_party/boringssl/src/crypto/poly1305/poly1305_vec.c +12 -28
  89. package/third_party/boringssl/src/crypto/siphash/siphash.c +8 -11
  90. package/third_party/boringssl/src/crypto/siphash/siphash_test.cc +5 -7
  91. package/third_party/boringssl/src/crypto/stack/stack.c +33 -16
  92. package/third_party/boringssl/src/crypto/thread_pthread.c +0 -2
  93. package/third_party/boringssl/src/crypto/thread_win.c +0 -2
  94. package/third_party/boringssl/src/crypto/trust_token/internal.h +14 -0
  95. package/third_party/boringssl/src/crypto/trust_token/pmbtoken.c +127 -30
  96. package/third_party/boringssl/src/crypto/trust_token/trust_token.c +40 -0
  97. package/third_party/boringssl/src/crypto/trust_token/trust_token_test.cc +165 -0
  98. package/third_party/boringssl/src/crypto/trust_token/voprf.c +55 -6
  99. package/third_party/boringssl/src/crypto/x509/a_digest.c +23 -24
  100. package/third_party/boringssl/src/crypto/x509/a_sign.c +52 -55
  101. package/third_party/boringssl/src/crypto/x509/a_verify.c +33 -34
  102. package/third_party/boringssl/src/crypto/x509/algorithm.c +17 -18
  103. package/third_party/boringssl/src/crypto/x509/asn1_gen.c +618 -612
  104. package/third_party/boringssl/src/crypto/x509/by_dir.c +320 -337
  105. package/third_party/boringssl/src/crypto/x509/by_file.c +186 -186
  106. package/third_party/boringssl/src/crypto/x509/i2d_pr.c +11 -14
  107. package/third_party/boringssl/src/crypto/x509/internal.h +22 -22
  108. package/third_party/boringssl/src/crypto/x509/name_print.c +155 -150
  109. package/third_party/boringssl/src/crypto/x509/rsa_pss.c +27 -29
  110. package/third_party/boringssl/src/crypto/x509/t_crl.c +67 -70
  111. package/third_party/boringssl/src/crypto/x509/t_req.c +3 -5
  112. package/third_party/boringssl/src/crypto/x509/t_x509.c +280 -251
  113. package/third_party/boringssl/src/crypto/x509/t_x509a.c +52 -47
  114. package/third_party/boringssl/src/crypto/x509/x509.c +3 -4
  115. package/third_party/boringssl/src/crypto/x509/x509_att.c +234 -223
  116. package/third_party/boringssl/src/crypto/x509/x509_cmp.c +286 -296
  117. package/third_party/boringssl/src/crypto/x509/x509_d2.c +37 -32
  118. package/third_party/boringssl/src/crypto/x509/x509_def.c +14 -30
  119. package/third_party/boringssl/src/crypto/x509/x509_ext.c +55 -84
  120. package/third_party/boringssl/src/crypto/x509/x509_lu.c +545 -581
  121. package/third_party/boringssl/src/crypto/x509/x509_obj.c +131 -121
  122. package/third_party/boringssl/src/crypto/x509/x509_req.c +120 -139
  123. package/third_party/boringssl/src/crypto/x509/x509_set.c +128 -142
  124. package/third_party/boringssl/src/crypto/x509/x509_trs.c +185 -193
  125. package/third_party/boringssl/src/crypto/x509/x509_txt.c +70 -72
  126. package/third_party/boringssl/src/crypto/x509/x509_v3.c +172 -161
  127. package/third_party/boringssl/src/crypto/x509/x509_vfy.c +2041 -2053
  128. package/third_party/boringssl/src/crypto/x509/x509_vpm.c +441 -461
  129. package/third_party/boringssl/src/crypto/x509/x509cset.c +152 -170
  130. package/third_party/boringssl/src/crypto/x509/x509name.c +274 -260
  131. package/third_party/boringssl/src/crypto/x509/x509rset.c +43 -20
  132. package/third_party/boringssl/src/crypto/x509/x509spki.c +62 -63
  133. package/third_party/boringssl/src/crypto/x509/x_algor.c +64 -62
  134. package/third_party/boringssl/src/crypto/x509/x_all.c +103 -133
  135. package/third_party/boringssl/src/crypto/x509/x_attrib.c +23 -24
  136. package/third_party/boringssl/src/crypto/x509/x_crl.c +310 -321
  137. package/third_party/boringssl/src/crypto/x509/x_exten.c +6 -5
  138. package/third_party/boringssl/src/crypto/x509/x_info.c +31 -28
  139. package/third_party/boringssl/src/crypto/x509/x_name.c +361 -365
  140. package/third_party/boringssl/src/crypto/x509/x_pkey.c +38 -32
  141. package/third_party/boringssl/src/crypto/x509/x_pubkey.c +114 -117
  142. package/third_party/boringssl/src/crypto/x509/x_req.c +27 -29
  143. package/third_party/boringssl/src/crypto/x509/x_sig.c +2 -2
  144. package/third_party/boringssl/src/crypto/x509/x_spki.c +8 -10
  145. package/third_party/boringssl/src/crypto/x509/x_val.c +2 -2
  146. package/third_party/boringssl/src/crypto/x509/x_x509.c +212 -226
  147. package/third_party/boringssl/src/crypto/x509/x_x509a.c +112 -109
  148. package/third_party/boringssl/src/crypto/x509v3/ext_dat.h +10 -13
  149. package/third_party/boringssl/src/crypto/x509v3/internal.h +72 -87
  150. package/third_party/boringssl/src/crypto/x509v3/pcy_cache.c +184 -176
  151. package/third_party/boringssl/src/crypto/x509v3/pcy_data.c +58 -56
  152. package/third_party/boringssl/src/crypto/x509v3/pcy_lib.c +71 -70
  153. package/third_party/boringssl/src/crypto/x509v3/pcy_map.c +56 -58
  154. package/third_party/boringssl/src/crypto/x509v3/pcy_node.c +89 -91
  155. package/third_party/boringssl/src/crypto/x509v3/pcy_tree.c +585 -590
  156. package/third_party/boringssl/src/crypto/x509v3/v3_akey.c +118 -112
  157. package/third_party/boringssl/src/crypto/x509v3/v3_akeya.c +3 -3
  158. package/third_party/boringssl/src/crypto/x509v3/v3_alt.c +447 -451
  159. package/third_party/boringssl/src/crypto/x509v3/v3_bcons.c +44 -38
  160. package/third_party/boringssl/src/crypto/x509v3/v3_bitst.c +39 -43
  161. package/third_party/boringssl/src/crypto/x509v3/v3_conf.c +321 -320
  162. package/third_party/boringssl/src/crypto/x509v3/v3_cpols.c +352 -327
  163. package/third_party/boringssl/src/crypto/x509v3/v3_crld.c +437 -383
  164. package/third_party/boringssl/src/crypto/x509v3/v3_enum.c +23 -16
  165. package/third_party/boringssl/src/crypto/x509v3/v3_extku.c +62 -53
  166. package/third_party/boringssl/src/crypto/x509v3/v3_genn.c +118 -115
  167. package/third_party/boringssl/src/crypto/x509v3/v3_ia5.c +30 -31
  168. package/third_party/boringssl/src/crypto/x509v3/v3_info.c +112 -98
  169. package/third_party/boringssl/src/crypto/x509v3/v3_int.c +40 -15
  170. package/third_party/boringssl/src/crypto/x509v3/v3_lib.c +248 -252
  171. package/third_party/boringssl/src/crypto/x509v3/v3_ncons.c +390 -386
  172. package/third_party/boringssl/src/crypto/x509v3/v3_ocsp.c +45 -32
  173. package/third_party/boringssl/src/crypto/x509v3/v3_pci.c +206 -209
  174. package/third_party/boringssl/src/crypto/x509v3/v3_pcia.c +6 -8
  175. package/third_party/boringssl/src/crypto/x509v3/v3_pcons.c +54 -50
  176. package/third_party/boringssl/src/crypto/x509v3/v3_pmaps.c +66 -65
  177. package/third_party/boringssl/src/crypto/x509v3/v3_prn.c +144 -133
  178. package/third_party/boringssl/src/crypto/x509v3/v3_purp.c +695 -709
  179. package/third_party/boringssl/src/crypto/x509v3/v3_skey.c +75 -69
  180. package/third_party/boringssl/src/crypto/x509v3/v3_utl.c +1102 -1082
  181. package/third_party/boringssl/src/include/openssl/base.h +3 -1
  182. package/third_party/boringssl/src/include/openssl/bn.h +3 -0
  183. package/third_party/boringssl/src/include/openssl/bytestring.h +20 -0
  184. package/third_party/boringssl/src/include/openssl/evp.h +6 -5
  185. package/third_party/boringssl/src/include/openssl/kdf.h +91 -0
  186. package/third_party/boringssl/src/include/openssl/nid.h +4 -0
  187. package/third_party/boringssl/src/include/openssl/ssl.h +6 -1
  188. package/third_party/boringssl/src/include/openssl/stack.h +47 -32
  189. package/third_party/boringssl/src/include/openssl/trust_token.h +18 -3
  190. package/third_party/boringssl/src/include/openssl/x509.h +18 -0
  191. package/third_party/boringssl/src/ssl/ssl_file.cc +61 -99
  192. package/third_party/boringssl/src/ssl/ssl_test.cc +101 -0
  193. package/third_party/boringssl/src/util/doc.config +2 -1
  194. package/third_party/boringssl/src/util/fipstools/acvp/acvptool/subprocess/subprocess.go +8 -0
  195. package/third_party/googleurl/AUTHORS +16 -2
  196. package/third_party/googleurl/base/BUILD +1 -0
  197. package/third_party/googleurl/base/compiler_specific.h +16 -17
  198. package/third_party/googleurl/base/containers/contiguous_iterator.h +13 -9
  199. package/third_party/googleurl/base/containers/span.h +23 -8
  200. package/third_party/googleurl/base/memory/raw_ptr.h +17 -25
  201. package/third_party/googleurl/base/memory/raw_ptr_exclusion.h +21 -0
  202. package/third_party/googleurl/base/strings/escape.cc +14 -2
  203. package/third_party/googleurl/base/strings/safe_sprintf.h +1 -1
  204. package/third_party/googleurl/base/strings/string_number_conversions.cc +5 -3
  205. package/third_party/googleurl/base/strings/string_number_conversions_internal.h +5 -5
  206. package/third_party/googleurl/base/strings/string_piece.h +3 -3
  207. package/third_party/googleurl/base/strings/string_util.cc +4 -27
  208. package/third_party/googleurl/base/strings/string_util.h +43 -8
  209. package/third_party/googleurl/base/strings/string_util_internal.h +11 -12
  210. package/third_party/googleurl/base/strings/string_util_unittest.cc +33 -0
  211. package/third_party/googleurl/base/strings/string_util_win.cc +0 -5
  212. package/third_party/googleurl/base/strings/string_util_win.h +9 -1
  213. package/third_party/googleurl/base/strings/utf_offset_string_conversions.cc +1 -1
  214. package/third_party/googleurl/base/strings/utf_string_conversion_utils.cc +5 -8
  215. package/third_party/googleurl/base/strings/utf_string_conversion_utils.h +13 -10
  216. package/third_party/googleurl/base/strings/utf_string_conversions.cc +32 -25
  217. package/third_party/googleurl/base/template_util.h +23 -35
  218. package/third_party/googleurl/build/build_config.h +14 -3
  219. package/third_party/googleurl/copy.bara.sky +1 -1
  220. package/third_party/googleurl/url/gurl.cc +8 -4
  221. package/third_party/googleurl/url/gurl.h +1 -0
  222. package/third_party/googleurl/url/gurl_unittest.cc +1 -0
  223. package/third_party/googleurl/url/origin.h +36 -26
  224. package/third_party/googleurl/url/scheme_host_port.h +4 -1
  225. package/third_party/googleurl/url/url_canon.h +2 -1
  226. package/third_party/googleurl/url/url_canon_internal.cc +9 -7
  227. package/third_party/googleurl/url/url_canon_internal.h +16 -16
  228. package/third_party/googleurl/url/url_canon_stdstring.h +2 -1
  229. package/third_party/googleurl/url/url_util.cc +9 -8
  230. package/third_party/quiche/build/source_list.bzl +7 -0
  231. package/third_party/quiche/build/source_list.gni +7 -0
  232. package/third_party/quiche/build/source_list.json +7 -0
  233. package/third_party/quiche/quiche/common/platform/api/quiche_mem_slice.h +7 -3
  234. package/third_party/quiche/quiche/http2/adapter/nghttp2_adapter_test.cc +86 -2
  235. package/third_party/quiche/quiche/http2/adapter/oghttp2_adapter_test.cc +104 -2
  236. package/third_party/quiche/quiche/http2/adapter/oghttp2_session.cc +23 -0
  237. package/third_party/quiche/quiche/http2/adapter/oghttp2_session.h +6 -1
  238. package/third_party/quiche/quiche/quic/core/congestion_control/send_algorithm_test.cc +0 -16
  239. package/third_party/quiche/quiche/quic/core/crypto/crypto_protocol.h +1 -1
  240. package/third_party/quiche/quiche/quic/core/http/end_to_end_test.cc +56 -2
  241. package/third_party/quiche/quiche/quic/core/http/http_constants.cc +1 -0
  242. package/third_party/quiche/quiche/quic/core/http/http_constants.h +1 -0
  243. package/third_party/quiche/quiche/quic/core/http/http_encoder.cc +28 -17
  244. package/third_party/quiche/quiche/quic/core/http/http_encoder.h +5 -0
  245. package/third_party/quiche/quiche/quic/core/http/http_encoder_test.cc +26 -30
  246. package/third_party/quiche/quiche/quic/core/http/http_frames.h +1 -0
  247. package/third_party/quiche/quiche/quic/core/http/quic_server_session_base.cc +4 -4
  248. package/third_party/quiche/quiche/quic/core/http/quic_server_session_base_test.cc +1 -1
  249. package/third_party/quiche/quiche/quic/core/http/quic_spdy_client_session.cc +5 -1
  250. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.cc +6 -33
  251. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.h +0 -17
  252. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream_test.cc +5 -20
  253. package/third_party/quiche/quiche/quic/core/io/quic_event_loop.h +81 -0
  254. package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop.cc +265 -0
  255. package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop.h +152 -0
  256. package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop_test.cc +341 -0
  257. package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store.cc +3 -1
  258. package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store.h +7 -7
  259. package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store_test.cc +4 -3
  260. package/third_party/quiche/quiche/quic/core/quic_connection.cc +69 -19
  261. package/third_party/quiche/quiche/quic/core/quic_connection.h +9 -3
  262. package/third_party/quiche/quiche/quic/core/quic_connection_id_manager.cc +29 -10
  263. package/third_party/quiche/quiche/quic/core/quic_connection_id_manager.h +5 -3
  264. package/third_party/quiche/quiche/quic/core/quic_connection_id_manager_test.cc +85 -22
  265. package/third_party/quiche/quiche/quic/core/quic_connection_test.cc +186 -30
  266. package/third_party/quiche/quiche/quic/core/quic_crypto_stream.cc +2 -1
  267. package/third_party/quiche/quiche/quic/core/quic_default_clock.cc +31 -0
  268. package/third_party/quiche/quiche/quic/core/quic_default_clock.h +34 -0
  269. package/third_party/quiche/quiche/quic/core/quic_default_connection_helper.h +49 -0
  270. package/third_party/quiche/quiche/quic/core/quic_dispatcher.cc +53 -37
  271. package/third_party/quiche/quiche/quic/core/quic_dispatcher.h +19 -11
  272. package/third_party/quiche/quiche/quic/core/quic_dispatcher_test.cc +15 -2
  273. package/third_party/quiche/quiche/quic/core/quic_flags_list.h +10 -4
  274. package/third_party/quiche/quiche/quic/core/quic_idle_network_detector.cc +2 -2
  275. package/third_party/quiche/quiche/quic/core/quic_idle_network_detector_test.cc +4 -4
  276. package/third_party/quiche/quiche/quic/core/quic_packet_creator.cc +14 -3
  277. package/third_party/quiche/quiche/quic/core/quic_packet_creator_test.cc +145 -2
  278. package/third_party/quiche/quiche/quic/core/quic_packets.cc +3 -1
  279. package/third_party/quiche/quiche/quic/core/quic_packets.h +4 -0
  280. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.cc +13 -11
  281. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.h +9 -0
  282. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager_test.cc +6 -0
  283. package/third_party/quiche/quiche/quic/core/quic_session.cc +3 -2
  284. package/third_party/quiche/quiche/quic/core/quic_session.h +8 -3
  285. package/third_party/quiche/quiche/quic/core/quic_types.cc +18 -0
  286. package/third_party/quiche/quiche/quic/core/quic_types.h +3 -0
  287. package/third_party/quiche/quiche/quic/core/tls_chlo_extractor.cc +3 -0
  288. package/third_party/quiche/quiche/quic/core/tls_chlo_extractor.h +10 -0
  289. package/third_party/quiche/quiche/quic/test_tools/mock_quic_session_visitor.h +1 -1
  290. package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.h +1 -1
  291. package/third_party/quiche/quiche/quic/test_tools/server_thread.cc +3 -2
  292. package/third_party/quiche/quiche/quic/test_tools/simple_session_notifier.cc +7 -1
  293. package/third_party/quiche/quiche/quic/test_tools/simple_session_notifier.h +3 -0
  294. package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint.h +4 -2
  295. package/certs/ca.cnf +0 -69
  296. package/certs/generate_certs.sh +0 -53
  297. package/certs/generate_certs_leaf.sh +0 -53
  298. package/certs/leaf.cnf +0 -24
  299. package/certs/readme.txt +0 -2
  300. package/third_party/quiche/build/BUILD.bazel +0 -7
@@ -62,590 +62,570 @@
62
62
  #include <openssl/x509.h>
63
63
  #include <openssl/x509v3.h>
64
64
 
65
- #include "internal.h"
66
65
  #include "../internal.h"
67
66
  #include "../x509v3/internal.h"
67
+ #include "internal.h"
68
68
 
69
69
 
70
- /* X509_VERIFY_PARAM functions */
70
+ // X509_VERIFY_PARAM functions
71
71
 
72
72
  #define SET_HOST 0
73
73
  #define ADD_HOST 1
74
74
 
75
- static char *str_copy(char *s)
76
- {
77
- return OPENSSL_strdup(s);
78
- }
75
+ static char *str_copy(char *s) { return OPENSSL_strdup(s); }
79
76
 
80
- static void str_free(char *s)
81
- {
82
- OPENSSL_free(s);
83
- }
77
+ static void str_free(char *s) { OPENSSL_free(s); }
84
78
 
85
79
  #define string_stack_free(sk) sk_OPENSSL_STRING_pop_free(sk, str_free)
86
80
 
87
81
  static int int_x509_param_set_hosts(X509_VERIFY_PARAM *param, int mode,
88
- const char *name, size_t namelen)
89
- {
90
- char *copy;
82
+ const char *name, size_t namelen) {
83
+ char *copy;
91
84
 
92
- if (name == NULL || namelen == 0) {
93
- // Unlike OpenSSL, we reject trying to set or add an empty name.
94
- return 0;
95
- }
85
+ if (name == NULL || namelen == 0) {
86
+ // Unlike OpenSSL, we reject trying to set or add an empty name.
87
+ return 0;
88
+ }
96
89
 
97
- /*
98
- * Refuse names with embedded NUL bytes.
99
- * XXX: Do we need to push an error onto the error stack?
100
- */
101
- if (name && OPENSSL_memchr(name, '\0', namelen))
102
- return 0;
90
+ // Refuse names with embedded NUL bytes.
91
+ // XXX: Do we need to push an error onto the error stack?
92
+ if (name && OPENSSL_memchr(name, '\0', namelen)) {
93
+ return 0;
94
+ }
103
95
 
104
- if (mode == SET_HOST && param->hosts) {
105
- string_stack_free(param->hosts);
106
- param->hosts = NULL;
107
- }
96
+ if (mode == SET_HOST && param->hosts) {
97
+ string_stack_free(param->hosts);
98
+ param->hosts = NULL;
99
+ }
108
100
 
109
- copy = OPENSSL_strndup(name, namelen);
110
- if (copy == NULL)
111
- return 0;
101
+ copy = OPENSSL_strndup(name, namelen);
102
+ if (copy == NULL) {
103
+ return 0;
104
+ }
112
105
 
113
- if (param->hosts == NULL &&
114
- (param->hosts = sk_OPENSSL_STRING_new_null()) == NULL) {
115
- OPENSSL_free(copy);
116
- return 0;
117
- }
106
+ if (param->hosts == NULL &&
107
+ (param->hosts = sk_OPENSSL_STRING_new_null()) == NULL) {
108
+ OPENSSL_free(copy);
109
+ return 0;
110
+ }
118
111
 
119
- if (!sk_OPENSSL_STRING_push(param->hosts, copy)) {
120
- OPENSSL_free(copy);
121
- if (sk_OPENSSL_STRING_num(param->hosts) == 0) {
122
- sk_OPENSSL_STRING_free(param->hosts);
123
- param->hosts = NULL;
124
- }
125
- return 0;
112
+ if (!sk_OPENSSL_STRING_push(param->hosts, copy)) {
113
+ OPENSSL_free(copy);
114
+ if (sk_OPENSSL_STRING_num(param->hosts) == 0) {
115
+ sk_OPENSSL_STRING_free(param->hosts);
116
+ param->hosts = NULL;
126
117
  }
118
+ return 0;
119
+ }
120
+
121
+ return 1;
122
+ }
123
+
124
+ static void x509_verify_param_zero(X509_VERIFY_PARAM *param) {
125
+ if (!param) {
126
+ return;
127
+ }
128
+ param->name = NULL;
129
+ param->purpose = 0;
130
+ param->trust = 0;
131
+ // param->inh_flags = X509_VP_FLAG_DEFAULT;
132
+ param->inh_flags = 0;
133
+ param->flags = 0;
134
+ param->depth = -1;
135
+ if (param->policies) {
136
+ sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
137
+ param->policies = NULL;
138
+ }
139
+ if (param->hosts) {
140
+ string_stack_free(param->hosts);
141
+ param->hosts = NULL;
142
+ }
143
+ if (param->peername) {
144
+ OPENSSL_free(param->peername);
145
+ param->peername = NULL;
146
+ }
147
+ if (param->email) {
148
+ OPENSSL_free(param->email);
149
+ param->email = NULL;
150
+ param->emaillen = 0;
151
+ }
152
+ if (param->ip) {
153
+ OPENSSL_free(param->ip);
154
+ param->ip = NULL;
155
+ param->iplen = 0;
156
+ }
157
+ param->poison = 0;
158
+ }
159
+
160
+ X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) {
161
+ X509_VERIFY_PARAM *param;
162
+ param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM));
163
+ if (!param) {
164
+ return NULL;
165
+ }
166
+ OPENSSL_memset(param, 0, sizeof(X509_VERIFY_PARAM));
167
+ x509_verify_param_zero(param);
168
+ return param;
169
+ }
170
+
171
+ void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param) {
172
+ if (param == NULL) {
173
+ return;
174
+ }
175
+ x509_verify_param_zero(param);
176
+ OPENSSL_free(param);
177
+ }
178
+
179
+ //-
180
+ // This function determines how parameters are "inherited" from one structure
181
+ // to another. There are several different ways this can happen.
182
+ //
183
+ // 1. If a child structure needs to have its values initialized from a parent
184
+ // they are simply copied across. For example SSL_CTX copied to SSL.
185
+ // 2. If the structure should take on values only if they are currently unset.
186
+ // For example the values in an SSL structure will take appropriate value
187
+ // for SSL servers or clients but only if the application has not set new
188
+ // ones.
189
+ //
190
+ // The "inh_flags" field determines how this function behaves.
191
+ //
192
+ // Normally any values which are set in the default are not copied from the
193
+ // destination and verify flags are ORed together.
194
+ //
195
+ // If X509_VP_FLAG_DEFAULT is set then anything set in the source is copied
196
+ // to the destination. Effectively the values in "to" become default values
197
+ // which will be used only if nothing new is set in "from".
198
+ //
199
+ // If X509_VP_FLAG_OVERWRITE is set then all value are copied across whether
200
+ // they are set or not. Flags is still Ored though.
201
+ //
202
+ // If X509_VP_FLAG_RESET_FLAGS is set then the flags value is copied instead
203
+ // of ORed.
204
+ //
205
+ // If X509_VP_FLAG_LOCKED is set then no values are copied.
206
+ //
207
+ // If X509_VP_FLAG_ONCE is set then the current inh_flags setting is zeroed
208
+ // after the next call.
209
+
210
+ // Macro to test if a field should be copied from src to dest
127
211
 
128
- return 1;
129
- }
212
+ #define test_x509_verify_param_copy(field, def) \
213
+ (to_overwrite || \
214
+ ((src->field != (def)) && (to_default || (dest->field == (def)))))
130
215
 
131
- static void x509_verify_param_zero(X509_VERIFY_PARAM *param)
132
- {
133
- if (!param)
134
- return;
135
- param->name = NULL;
136
- param->purpose = 0;
137
- param->trust = 0;
138
- /*
139
- * param->inh_flags = X509_VP_FLAG_DEFAULT;
140
- */
141
- param->inh_flags = 0;
142
- param->flags = 0;
143
- param->depth = -1;
144
- if (param->policies) {
145
- sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
146
- param->policies = NULL;
147
- }
148
- if (param->hosts) {
149
- string_stack_free(param->hosts);
150
- param->hosts = NULL;
151
- }
152
- if (param->peername) {
153
- OPENSSL_free(param->peername);
154
- param->peername = NULL;
155
- }
156
- if (param->email) {
157
- OPENSSL_free(param->email);
158
- param->email = NULL;
159
- param->emaillen = 0;
160
- }
161
- if (param->ip) {
162
- OPENSSL_free(param->ip);
163
- param->ip = NULL;
164
- param->iplen = 0;
165
- }
166
- param->poison = 0;
167
- }
216
+ // Macro to test and copy a field if necessary
168
217
 
169
- X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void)
170
- {
171
- X509_VERIFY_PARAM *param;
172
- param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM));
173
- if (!param)
174
- return NULL;
175
- OPENSSL_memset(param, 0, sizeof(X509_VERIFY_PARAM));
176
- x509_verify_param_zero(param);
177
- return param;
178
- }
218
+ #define x509_verify_param_copy(field, def) \
219
+ if (test_x509_verify_param_copy(field, def)) \
220
+ dest->field = src->field
179
221
 
180
- void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param)
181
- {
182
- if (param == NULL)
183
- return;
184
- x509_verify_param_zero(param);
185
- OPENSSL_free(param);
186
- }
222
+ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
223
+ const X509_VERIFY_PARAM *src) {
224
+ unsigned long inh_flags;
225
+ int to_default, to_overwrite;
226
+ if (!src) {
227
+ return 1;
228
+ }
229
+ inh_flags = dest->inh_flags | src->inh_flags;
187
230
 
188
- /*-
189
- * This function determines how parameters are "inherited" from one structure
190
- * to another. There are several different ways this can happen.
191
- *
192
- * 1. If a child structure needs to have its values initialized from a parent
193
- * they are simply copied across. For example SSL_CTX copied to SSL.
194
- * 2. If the structure should take on values only if they are currently unset.
195
- * For example the values in an SSL structure will take appropriate value
196
- * for SSL servers or clients but only if the application has not set new
197
- * ones.
198
- *
199
- * The "inh_flags" field determines how this function behaves.
200
- *
201
- * Normally any values which are set in the default are not copied from the
202
- * destination and verify flags are ORed together.
203
- *
204
- * If X509_VP_FLAG_DEFAULT is set then anything set in the source is copied
205
- * to the destination. Effectively the values in "to" become default values
206
- * which will be used only if nothing new is set in "from".
207
- *
208
- * If X509_VP_FLAG_OVERWRITE is set then all value are copied across whether
209
- * they are set or not. Flags is still Ored though.
210
- *
211
- * If X509_VP_FLAG_RESET_FLAGS is set then the flags value is copied instead
212
- * of ORed.
213
- *
214
- * If X509_VP_FLAG_LOCKED is set then no values are copied.
215
- *
216
- * If X509_VP_FLAG_ONCE is set then the current inh_flags setting is zeroed
217
- * after the next call.
218
- */
231
+ if (inh_flags & X509_VP_FLAG_ONCE) {
232
+ dest->inh_flags = 0;
233
+ }
219
234
 
220
- /* Macro to test if a field should be copied from src to dest */
235
+ if (inh_flags & X509_VP_FLAG_LOCKED) {
236
+ return 1;
237
+ }
221
238
 
222
- #define test_x509_verify_param_copy(field, def) \
223
- (to_overwrite || \
224
- ((src->field != (def)) && (to_default || (dest->field == (def)))))
239
+ if (inh_flags & X509_VP_FLAG_DEFAULT) {
240
+ to_default = 1;
241
+ } else {
242
+ to_default = 0;
243
+ }
225
244
 
226
- /* Macro to test and copy a field if necessary */
245
+ if (inh_flags & X509_VP_FLAG_OVERWRITE) {
246
+ to_overwrite = 1;
247
+ } else {
248
+ to_overwrite = 0;
249
+ }
227
250
 
228
- #define x509_verify_param_copy(field, def) \
229
- if (test_x509_verify_param_copy(field, def)) \
230
- dest->field = src->field
251
+ x509_verify_param_copy(purpose, 0);
252
+ x509_verify_param_copy(trust, 0);
253
+ x509_verify_param_copy(depth, -1);
231
254
 
232
- int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
233
- const X509_VERIFY_PARAM *src)
234
- {
235
- unsigned long inh_flags;
236
- int to_default, to_overwrite;
237
- if (!src)
238
- return 1;
239
- inh_flags = dest->inh_flags | src->inh_flags;
240
-
241
- if (inh_flags & X509_VP_FLAG_ONCE)
242
- dest->inh_flags = 0;
243
-
244
- if (inh_flags & X509_VP_FLAG_LOCKED)
245
- return 1;
246
-
247
- if (inh_flags & X509_VP_FLAG_DEFAULT)
248
- to_default = 1;
249
- else
250
- to_default = 0;
251
-
252
- if (inh_flags & X509_VP_FLAG_OVERWRITE)
253
- to_overwrite = 1;
254
- else
255
- to_overwrite = 0;
256
-
257
- x509_verify_param_copy(purpose, 0);
258
- x509_verify_param_copy(trust, 0);
259
- x509_verify_param_copy(depth, -1);
260
-
261
- /* If overwrite or check time not set, copy across */
262
-
263
- if (to_overwrite || !(dest->flags & X509_V_FLAG_USE_CHECK_TIME)) {
264
- dest->check_time = src->check_time;
265
- dest->flags &= ~X509_V_FLAG_USE_CHECK_TIME;
266
- /* Don't need to copy flag: that is done below */
267
- }
255
+ // If overwrite or check time not set, copy across
256
+
257
+ if (to_overwrite || !(dest->flags & X509_V_FLAG_USE_CHECK_TIME)) {
258
+ dest->check_time = src->check_time;
259
+ dest->flags &= ~X509_V_FLAG_USE_CHECK_TIME;
260
+ // Don't need to copy flag: that is done below
261
+ }
268
262
 
269
- if (inh_flags & X509_VP_FLAG_RESET_FLAGS)
270
- dest->flags = 0;
263
+ if (inh_flags & X509_VP_FLAG_RESET_FLAGS) {
264
+ dest->flags = 0;
265
+ }
271
266
 
272
- dest->flags |= src->flags;
267
+ dest->flags |= src->flags;
273
268
 
274
- if (test_x509_verify_param_copy(policies, NULL)) {
275
- if (!X509_VERIFY_PARAM_set1_policies(dest, src->policies))
276
- return 0;
269
+ if (test_x509_verify_param_copy(policies, NULL)) {
270
+ if (!X509_VERIFY_PARAM_set1_policies(dest, src->policies)) {
271
+ return 0;
277
272
  }
273
+ }
278
274
 
279
- /* Copy the host flags if and only if we're copying the host list */
280
- if (test_x509_verify_param_copy(hosts, NULL)) {
281
- if (dest->hosts) {
282
- string_stack_free(dest->hosts);
283
- dest->hosts = NULL;
284
- }
285
- if (src->hosts) {
286
- dest->hosts =
287
- sk_OPENSSL_STRING_deep_copy(src->hosts, str_copy, str_free);
288
- if (dest->hosts == NULL)
289
- return 0;
290
- dest->hostflags = src->hostflags;
291
- }
275
+ // Copy the host flags if and only if we're copying the host list
276
+ if (test_x509_verify_param_copy(hosts, NULL)) {
277
+ if (dest->hosts) {
278
+ string_stack_free(dest->hosts);
279
+ dest->hosts = NULL;
292
280
  }
281
+ if (src->hosts) {
282
+ dest->hosts = sk_OPENSSL_STRING_deep_copy(src->hosts, str_copy, str_free);
283
+ if (dest->hosts == NULL) {
284
+ return 0;
285
+ }
286
+ dest->hostflags = src->hostflags;
287
+ }
288
+ }
293
289
 
294
- if (test_x509_verify_param_copy(email, NULL)) {
295
- if (!X509_VERIFY_PARAM_set1_email(dest, src->email, src->emaillen))
296
- return 0;
290
+ if (test_x509_verify_param_copy(email, NULL)) {
291
+ if (!X509_VERIFY_PARAM_set1_email(dest, src->email, src->emaillen)) {
292
+ return 0;
297
293
  }
294
+ }
298
295
 
299
- if (test_x509_verify_param_copy(ip, NULL)) {
300
- if (!X509_VERIFY_PARAM_set1_ip(dest, src->ip, src->iplen))
301
- return 0;
296
+ if (test_x509_verify_param_copy(ip, NULL)) {
297
+ if (!X509_VERIFY_PARAM_set1_ip(dest, src->ip, src->iplen)) {
298
+ return 0;
302
299
  }
300
+ }
303
301
 
304
- dest->poison = src->poison;
302
+ dest->poison = src->poison;
305
303
 
306
- return 1;
304
+ return 1;
307
305
  }
308
306
 
309
307
  int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
310
- const X509_VERIFY_PARAM *from)
311
- {
312
- unsigned long save_flags = to->inh_flags;
313
- int ret;
314
- to->inh_flags |= X509_VP_FLAG_DEFAULT;
315
- ret = X509_VERIFY_PARAM_inherit(to, from);
316
- to->inh_flags = save_flags;
317
- return ret;
318
- }
319
-
320
- static int int_x509_param_set1(char **pdest, size_t *pdestlen,
321
- const char *src, size_t srclen)
322
- {
323
- void *tmp;
324
- if (src == NULL || srclen == 0) {
325
- // Unlike OpenSSL, we do not allow an empty string to disable previously
326
- // configured checks.
327
- return 0;
328
- }
329
-
330
- tmp = OPENSSL_memdup(src, srclen);
331
- if (!tmp) {
332
- return 0;
333
- }
334
-
335
- if (*pdest)
336
- OPENSSL_free(*pdest);
337
- *pdest = tmp;
338
- if (pdestlen)
339
- *pdestlen = srclen;
340
- return 1;
341
- }
308
+ const X509_VERIFY_PARAM *from) {
309
+ unsigned long save_flags = to->inh_flags;
310
+ int ret;
311
+ to->inh_flags |= X509_VP_FLAG_DEFAULT;
312
+ ret = X509_VERIFY_PARAM_inherit(to, from);
313
+ to->inh_flags = save_flags;
314
+ return ret;
315
+ }
316
+
317
+ static int int_x509_param_set1(char **pdest, size_t *pdestlen, const char *src,
318
+ size_t srclen) {
319
+ void *tmp;
320
+ if (src == NULL || srclen == 0) {
321
+ // Unlike OpenSSL, we do not allow an empty string to disable previously
322
+ // configured checks.
323
+ return 0;
324
+ }
342
325
 
343
- int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name)
344
- {
345
- if (param->name)
346
- OPENSSL_free(param->name);
347
- param->name = OPENSSL_strdup(name);
348
- if (param->name)
349
- return 1;
326
+ tmp = OPENSSL_memdup(src, srclen);
327
+ if (!tmp) {
350
328
  return 0;
329
+ }
330
+
331
+ if (*pdest) {
332
+ OPENSSL_free(*pdest);
333
+ }
334
+ *pdest = tmp;
335
+ if (pdestlen) {
336
+ *pdestlen = srclen;
337
+ }
338
+ return 1;
339
+ }
340
+
341
+ int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) {
342
+ if (param->name) {
343
+ OPENSSL_free(param->name);
344
+ }
345
+ param->name = OPENSSL_strdup(name);
346
+ if (param->name) {
347
+ return 1;
348
+ }
349
+ return 0;
351
350
  }
352
351
 
353
- int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags)
354
- {
355
- param->flags |= flags;
356
- if (flags & X509_V_FLAG_POLICY_MASK)
357
- param->flags |= X509_V_FLAG_POLICY_CHECK;
358
- return 1;
352
+ int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags) {
353
+ param->flags |= flags;
354
+ if (flags & X509_V_FLAG_POLICY_MASK) {
355
+ param->flags |= X509_V_FLAG_POLICY_CHECK;
356
+ }
357
+ return 1;
359
358
  }
360
359
 
361
360
  int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
362
- unsigned long flags)
363
- {
364
- param->flags &= ~flags;
365
- return 1;
361
+ unsigned long flags) {
362
+ param->flags &= ~flags;
363
+ return 1;
366
364
  }
367
365
 
368
- unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param)
369
- {
370
- return param->flags;
366
+ unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param) {
367
+ return param->flags;
371
368
  }
372
369
 
373
- int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose)
374
- {
375
- return X509_PURPOSE_set(&param->purpose, purpose);
370
+ int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose) {
371
+ return X509_PURPOSE_set(&param->purpose, purpose);
376
372
  }
377
373
 
378
- int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust)
379
- {
380
- return X509_TRUST_set(&param->trust, trust);
374
+ int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust) {
375
+ return X509_TRUST_set(&param->trust, trust);
381
376
  }
382
377
 
383
- void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth)
384
- {
385
- param->depth = depth;
378
+ void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth) {
379
+ param->depth = depth;
386
380
  }
387
381
 
388
- void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t)
389
- {
390
- param->check_time = t;
391
- param->flags |= X509_V_FLAG_USE_CHECK_TIME;
382
+ void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t) {
383
+ param->check_time = t;
384
+ param->flags |= X509_V_FLAG_USE_CHECK_TIME;
392
385
  }
393
386
 
394
387
  int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
395
- ASN1_OBJECT *policy)
396
- {
388
+ ASN1_OBJECT *policy) {
389
+ if (!param->policies) {
390
+ param->policies = sk_ASN1_OBJECT_new_null();
397
391
  if (!param->policies) {
398
- param->policies = sk_ASN1_OBJECT_new_null();
399
- if (!param->policies)
400
- return 0;
392
+ return 0;
401
393
  }
402
- if (!sk_ASN1_OBJECT_push(param->policies, policy))
403
- return 0;
404
- return 1;
394
+ }
395
+ if (!sk_ASN1_OBJECT_push(param->policies, policy)) {
396
+ return 0;
397
+ }
398
+ return 1;
405
399
  }
406
400
 
407
401
  int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
408
- STACK_OF(ASN1_OBJECT) *policies)
409
- {
410
- size_t i;
411
- ASN1_OBJECT *oid, *doid;
412
- if (!param)
413
- return 0;
414
- if (param->policies)
415
- sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
402
+ STACK_OF(ASN1_OBJECT) *policies) {
403
+ size_t i;
404
+ ASN1_OBJECT *oid, *doid;
405
+ if (!param) {
406
+ return 0;
407
+ }
408
+ if (param->policies) {
409
+ sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
410
+ }
416
411
 
417
- if (!policies) {
418
- param->policies = NULL;
419
- return 1;
420
- }
412
+ if (!policies) {
413
+ param->policies = NULL;
414
+ return 1;
415
+ }
421
416
 
422
- param->policies = sk_ASN1_OBJECT_new_null();
423
- if (!param->policies)
424
- return 0;
417
+ param->policies = sk_ASN1_OBJECT_new_null();
418
+ if (!param->policies) {
419
+ return 0;
420
+ }
425
421
 
426
- for (i = 0; i < sk_ASN1_OBJECT_num(policies); i++) {
427
- oid = sk_ASN1_OBJECT_value(policies, i);
428
- doid = OBJ_dup(oid);
429
- if (!doid)
430
- return 0;
431
- if (!sk_ASN1_OBJECT_push(param->policies, doid)) {
432
- ASN1_OBJECT_free(doid);
433
- return 0;
434
- }
422
+ for (i = 0; i < sk_ASN1_OBJECT_num(policies); i++) {
423
+ oid = sk_ASN1_OBJECT_value(policies, i);
424
+ doid = OBJ_dup(oid);
425
+ if (!doid) {
426
+ return 0;
435
427
  }
436
- param->flags |= X509_V_FLAG_POLICY_CHECK;
437
- return 1;
428
+ if (!sk_ASN1_OBJECT_push(param->policies, doid)) {
429
+ ASN1_OBJECT_free(doid);
430
+ return 0;
431
+ }
432
+ }
433
+ param->flags |= X509_V_FLAG_POLICY_CHECK;
434
+ return 1;
438
435
  }
439
436
 
440
- int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
441
- const char *name, size_t namelen)
442
- {
443
- if (!int_x509_param_set_hosts(param, SET_HOST, name, namelen)) {
444
- param->poison = 1;
445
- return 0;
446
- }
447
- return 1;
437
+ int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, const char *name,
438
+ size_t namelen) {
439
+ if (!int_x509_param_set_hosts(param, SET_HOST, name, namelen)) {
440
+ param->poison = 1;
441
+ return 0;
442
+ }
443
+ return 1;
448
444
  }
449
445
 
450
- int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,
451
- const char *name, size_t namelen)
452
- {
453
- if (!int_x509_param_set_hosts(param, ADD_HOST, name, namelen)) {
454
- param->poison = 1;
455
- return 0;
456
- }
457
- return 1;
446
+ int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, const char *name,
447
+ size_t namelen) {
448
+ if (!int_x509_param_set_hosts(param, ADD_HOST, name, namelen)) {
449
+ param->poison = 1;
450
+ return 0;
451
+ }
452
+ return 1;
458
453
  }
459
454
 
460
455
  void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,
461
- unsigned int flags)
462
- {
463
- param->hostflags = flags;
456
+ unsigned int flags) {
457
+ param->hostflags = flags;
464
458
  }
465
459
 
466
- char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param)
467
- {
468
- return param->peername;
460
+ char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param) {
461
+ return param->peername;
469
462
  }
470
463
 
471
- int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
472
- const char *email, size_t emaillen)
473
- {
474
- if (OPENSSL_memchr(email, '\0', emaillen) != NULL ||
475
- !int_x509_param_set1(&param->email, &param->emaillen,
476
- email, emaillen)) {
477
- param->poison = 1;
478
- return 0;
479
- }
464
+ int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, const char *email,
465
+ size_t emaillen) {
466
+ if (OPENSSL_memchr(email, '\0', emaillen) != NULL ||
467
+ !int_x509_param_set1(&param->email, &param->emaillen, email, emaillen)) {
468
+ param->poison = 1;
469
+ return 0;
470
+ }
480
471
 
481
- return 1;
472
+ return 1;
482
473
  }
483
474
 
484
- int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,
485
- const unsigned char *ip, size_t iplen)
486
- {
487
- if ((iplen != 4 && iplen != 16) ||
488
- !int_x509_param_set1((char **)&param->ip, &param->iplen,
489
- (char *)ip, iplen)) {
490
- param->poison = 1;
491
- return 0;
492
- }
475
+ int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, const unsigned char *ip,
476
+ size_t iplen) {
477
+ if ((iplen != 4 && iplen != 16) ||
478
+ !int_x509_param_set1((char **)&param->ip, &param->iplen, (char *)ip,
479
+ iplen)) {
480
+ param->poison = 1;
481
+ return 0;
482
+ }
493
483
 
494
- return 1;
484
+ return 1;
495
485
  }
496
486
 
497
- int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc)
498
- {
499
- unsigned char ipout[16];
500
- size_t iplen;
487
+ int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc) {
488
+ unsigned char ipout[16];
489
+ size_t iplen;
501
490
 
502
- iplen = (size_t)x509v3_a2i_ipadd(ipout, ipasc);
503
- if (iplen == 0)
504
- return 0;
505
- return X509_VERIFY_PARAM_set1_ip(param, ipout, iplen);
491
+ iplen = (size_t)x509v3_a2i_ipadd(ipout, ipasc);
492
+ if (iplen == 0) {
493
+ return 0;
494
+ }
495
+ return X509_VERIFY_PARAM_set1_ip(param, ipout, iplen);
506
496
  }
507
497
 
508
- int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param)
509
- {
510
- return param->depth;
498
+ int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param) {
499
+ return param->depth;
511
500
  }
512
501
 
513
- const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param)
514
- {
515
- return param->name;
502
+ const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param) {
503
+ return param->name;
516
504
  }
517
505
 
518
506
  #define vpm_empty_id NULL, 0U, NULL, NULL, 0, NULL, 0, 0
519
507
 
520
- /*
521
- * Default verify parameters: these are used for various applications and can
522
- * be overridden by the user specified table. NB: the 'name' field *must* be
523
- * in alphabetical order because it will be searched using OBJ_search.
524
- */
508
+ // Default verify parameters: these are used for various applications and can
509
+ // be overridden by the user specified table. NB: the 'name' field *must* be
510
+ // in alphabetical order because it will be searched using OBJ_search.
525
511
 
526
512
  static const X509_VERIFY_PARAM default_table[] = {
527
- {
528
- (char *)"default", /* X509 default parameters */
529
- 0, /* Check time */
530
- 0, /* internal flags */
531
- X509_V_FLAG_TRUSTED_FIRST, /* flags */
532
- 0, /* purpose */
533
- 0, /* trust */
534
- 100, /* depth */
535
- NULL, /* policies */
513
+ {(char *)"default", // X509 default parameters
514
+ 0, // Check time
515
+ 0, // internal flags
516
+ X509_V_FLAG_TRUSTED_FIRST, // flags
517
+ 0, // purpose
518
+ 0, // trust
519
+ 100, // depth
520
+ NULL, // policies
536
521
  vpm_empty_id},
537
- {
538
- (char *)"pkcs7", /* S/MIME sign parameters */
539
- 0, /* Check time */
540
- 0, /* internal flags */
541
- 0, /* flags */
542
- X509_PURPOSE_SMIME_SIGN, /* purpose */
543
- X509_TRUST_EMAIL, /* trust */
544
- -1, /* depth */
545
- NULL, /* policies */
522
+ {(char *)"pkcs7", // S/MIME sign parameters
523
+ 0, // Check time
524
+ 0, // internal flags
525
+ 0, // flags
526
+ X509_PURPOSE_SMIME_SIGN, // purpose
527
+ X509_TRUST_EMAIL, // trust
528
+ -1, // depth
529
+ NULL, // policies
546
530
  vpm_empty_id},
547
- {
548
- (char *)"smime_sign", /* S/MIME sign parameters */
549
- 0, /* Check time */
550
- 0, /* internal flags */
551
- 0, /* flags */
552
- X509_PURPOSE_SMIME_SIGN, /* purpose */
553
- X509_TRUST_EMAIL, /* trust */
554
- -1, /* depth */
555
- NULL, /* policies */
531
+ {(char *)"smime_sign", // S/MIME sign parameters
532
+ 0, // Check time
533
+ 0, // internal flags
534
+ 0, // flags
535
+ X509_PURPOSE_SMIME_SIGN, // purpose
536
+ X509_TRUST_EMAIL, // trust
537
+ -1, // depth
538
+ NULL, // policies
556
539
  vpm_empty_id},
557
- {
558
- (char *)"ssl_client", /* SSL/TLS client parameters */
559
- 0, /* Check time */
560
- 0, /* internal flags */
561
- 0, /* flags */
562
- X509_PURPOSE_SSL_CLIENT, /* purpose */
563
- X509_TRUST_SSL_CLIENT, /* trust */
564
- -1, /* depth */
565
- NULL, /* policies */
540
+ {(char *)"ssl_client", // SSL/TLS client parameters
541
+ 0, // Check time
542
+ 0, // internal flags
543
+ 0, // flags
544
+ X509_PURPOSE_SSL_CLIENT, // purpose
545
+ X509_TRUST_SSL_CLIENT, // trust
546
+ -1, // depth
547
+ NULL, // policies
566
548
  vpm_empty_id},
567
- {
568
- (char *)"ssl_server", /* SSL/TLS server parameters */
569
- 0, /* Check time */
570
- 0, /* internal flags */
571
- 0, /* flags */
572
- X509_PURPOSE_SSL_SERVER, /* purpose */
573
- X509_TRUST_SSL_SERVER, /* trust */
574
- -1, /* depth */
575
- NULL, /* policies */
576
- vpm_empty_id}
577
- };
549
+ {(char *)"ssl_server", // SSL/TLS server parameters
550
+ 0, // Check time
551
+ 0, // internal flags
552
+ 0, // flags
553
+ X509_PURPOSE_SSL_SERVER, // purpose
554
+ X509_TRUST_SSL_SERVER, // trust
555
+ -1, // depth
556
+ NULL, // policies
557
+ vpm_empty_id}};
578
558
 
579
559
  static STACK_OF(X509_VERIFY_PARAM) *param_table = NULL;
580
560
 
581
- static int param_cmp(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b)
582
- {
583
- return strcmp((*a)->name, (*b)->name);
561
+ static int param_cmp(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b) {
562
+ return strcmp((*a)->name, (*b)->name);
584
563
  }
585
564
 
586
- int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param)
587
- {
588
- X509_VERIFY_PARAM *ptmp;
565
+ int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param) {
566
+ X509_VERIFY_PARAM *ptmp;
567
+ if (!param_table) {
568
+ param_table = sk_X509_VERIFY_PARAM_new(param_cmp);
589
569
  if (!param_table) {
590
- param_table = sk_X509_VERIFY_PARAM_new(param_cmp);
591
- if (!param_table)
592
- return 0;
593
- } else {
594
- size_t idx;
595
-
596
- sk_X509_VERIFY_PARAM_sort(param_table);
597
- if (sk_X509_VERIFY_PARAM_find(param_table, &idx, param)) {
598
- ptmp = sk_X509_VERIFY_PARAM_value(param_table, idx);
599
- X509_VERIFY_PARAM_free(ptmp);
600
- (void)sk_X509_VERIFY_PARAM_delete(param_table, idx);
601
- }
570
+ return 0;
602
571
  }
603
- if (!sk_X509_VERIFY_PARAM_push(param_table, param))
604
- return 0;
605
- return 1;
572
+ } else {
573
+ size_t idx;
574
+
575
+ sk_X509_VERIFY_PARAM_sort(param_table);
576
+ if (sk_X509_VERIFY_PARAM_find(param_table, &idx, param)) {
577
+ ptmp = sk_X509_VERIFY_PARAM_value(param_table, idx);
578
+ X509_VERIFY_PARAM_free(ptmp);
579
+ (void)sk_X509_VERIFY_PARAM_delete(param_table, idx);
580
+ }
581
+ }
582
+ if (!sk_X509_VERIFY_PARAM_push(param_table, param)) {
583
+ return 0;
584
+ }
585
+ return 1;
606
586
  }
607
587
 
608
- int X509_VERIFY_PARAM_get_count(void)
609
- {
610
- int num = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
611
- if (param_table)
612
- num += sk_X509_VERIFY_PARAM_num(param_table);
613
- return num;
588
+ int X509_VERIFY_PARAM_get_count(void) {
589
+ int num = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
590
+ if (param_table) {
591
+ num += sk_X509_VERIFY_PARAM_num(param_table);
592
+ }
593
+ return num;
614
594
  }
615
595
 
616
- const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id)
617
- {
618
- int num = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
619
- if (id < num)
620
- return default_table + id;
621
- return sk_X509_VERIFY_PARAM_value(param_table, id - num);
596
+ const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id) {
597
+ int num = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
598
+ if (id < num) {
599
+ return default_table + id;
600
+ }
601
+ return sk_X509_VERIFY_PARAM_value(param_table, id - num);
622
602
  }
623
603
 
624
- const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name)
625
- {
626
- X509_VERIFY_PARAM pm;
627
- unsigned i, limit;
604
+ const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name) {
605
+ X509_VERIFY_PARAM pm;
606
+ unsigned i, limit;
628
607
 
629
- pm.name = (char *)name;
630
- if (param_table) {
631
- size_t idx;
632
- sk_X509_VERIFY_PARAM_sort(param_table);
633
- if (sk_X509_VERIFY_PARAM_find(param_table, &idx, &pm))
634
- return sk_X509_VERIFY_PARAM_value(param_table, idx);
608
+ pm.name = (char *)name;
609
+ if (param_table) {
610
+ size_t idx;
611
+ sk_X509_VERIFY_PARAM_sort(param_table);
612
+ if (sk_X509_VERIFY_PARAM_find(param_table, &idx, &pm)) {
613
+ return sk_X509_VERIFY_PARAM_value(param_table, idx);
635
614
  }
615
+ }
636
616
 
637
- limit = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
638
- for (i = 0; i < limit; i++) {
639
- if (strcmp(default_table[i].name, name) == 0) {
640
- return &default_table[i];
641
- }
617
+ limit = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
618
+ for (i = 0; i < limit; i++) {
619
+ if (strcmp(default_table[i].name, name) == 0) {
620
+ return &default_table[i];
642
621
  }
643
- return NULL;
622
+ }
623
+ return NULL;
644
624
  }
645
625
 
646
- void X509_VERIFY_PARAM_table_cleanup(void)
647
- {
648
- if (param_table)
649
- sk_X509_VERIFY_PARAM_pop_free(param_table, X509_VERIFY_PARAM_free);
650
- param_table = NULL;
626
+ void X509_VERIFY_PARAM_table_cleanup(void) {
627
+ if (param_table) {
628
+ sk_X509_VERIFY_PARAM_pop_free(param_table, X509_VERIFY_PARAM_free);
629
+ }
630
+ param_table = NULL;
651
631
  }