@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
@@ -60,28 +60,29 @@
60
60
  #include <stdio.h>
61
61
 
62
62
  #include <openssl/err.h>
63
- #include <openssl/mem.h>
64
63
  #include <openssl/evp.h>
64
+ #include <openssl/mem.h>
65
65
  #include <openssl/obj.h>
66
66
  #include <openssl/rand.h>
67
67
  #include <openssl/x509.h>
68
68
 
69
- /* Handle 'other' PEMs: not private keys */
69
+ // Handle 'other' PEMs: not private keys
70
70
 
71
71
  void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x,
72
- pem_password_cb *cb, void *u)
73
- {
74
- const unsigned char *p = NULL;
75
- unsigned char *data = NULL;
76
- long len;
77
- char *ret = NULL;
72
+ pem_password_cb *cb, void *u) {
73
+ const unsigned char *p = NULL;
74
+ unsigned char *data = NULL;
75
+ long len;
76
+ char *ret = NULL;
78
77
 
79
- if (!PEM_bytes_read_bio(&data, &len, NULL, name, bp, cb, u))
80
- return NULL;
81
- p = data;
82
- ret = d2i(x, &p, len);
83
- if (ret == NULL)
84
- OPENSSL_PUT_ERROR(PEM, ERR_R_ASN1_LIB);
85
- OPENSSL_free(data);
86
- return ret;
78
+ if (!PEM_bytes_read_bio(&data, &len, NULL, name, bp, cb, u)) {
79
+ return NULL;
80
+ }
81
+ p = data;
82
+ ret = d2i(x, &p, len);
83
+ if (ret == NULL) {
84
+ OPENSSL_PUT_ERROR(PEM, ERR_R_ASN1_LIB);
85
+ }
86
+ OPENSSL_free(data);
87
+ return ret;
87
88
  }
@@ -64,187 +64,178 @@
64
64
  #include <openssl/rand.h>
65
65
  #include <openssl/x509.h>
66
66
 
67
- static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder,
68
- int nid, const EVP_CIPHER *enc,
69
- char *kstr, int klen, pem_password_cb *cb, void *u);
70
- static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder,
71
- int nid, const EVP_CIPHER *enc,
72
- char *kstr, int klen, pem_password_cb *cb, void *u);
73
-
74
- /*
75
- * These functions write a private key in PKCS#8 format: it is a "drop in"
76
- * replacement for PEM_write_bio_PrivateKey() and friends. As usual if 'enc'
77
- * is NULL then it uses the unencrypted private key form. The 'nid' versions
78
- * uses PKCS#5 v1.5 PBE algorithms whereas the others use PKCS#5 v2.0.
79
- */
80
-
81
- int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
82
- char *kstr, int klen,
83
- pem_password_cb *cb, void *u)
84
- {
85
- return do_pk8pkey(bp, x, 0, nid, NULL, kstr, klen, cb, u);
67
+ static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid,
68
+ const EVP_CIPHER *enc, char *kstr, int klen,
69
+ pem_password_cb *cb, void *u);
70
+ static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder, int nid,
71
+ const EVP_CIPHER *enc, char *kstr, int klen,
72
+ pem_password_cb *cb, void *u);
73
+
74
+ // These functions write a private key in PKCS#8 format: it is a "drop in"
75
+ // replacement for PEM_write_bio_PrivateKey() and friends. As usual if 'enc'
76
+ // is NULL then it uses the unencrypted private key form. The 'nid' versions
77
+ // uses PKCS#5 v1.5 PBE algorithms whereas the others use PKCS#5 v2.0.
78
+
79
+ int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, char *kstr,
80
+ int klen, pem_password_cb *cb, void *u) {
81
+ return do_pk8pkey(bp, x, 0, nid, NULL, kstr, klen, cb, u);
86
82
  }
87
83
 
88
84
  int PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
89
- char *kstr, int klen,
90
- pem_password_cb *cb, void *u)
91
- {
92
- return do_pk8pkey(bp, x, 0, -1, enc, kstr, klen, cb, u);
85
+ char *kstr, int klen, pem_password_cb *cb,
86
+ void *u) {
87
+ return do_pk8pkey(bp, x, 0, -1, enc, kstr, klen, cb, u);
93
88
  }
94
89
 
95
90
  int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
96
- char *kstr, int klen,
97
- pem_password_cb *cb, void *u)
98
- {
99
- return do_pk8pkey(bp, x, 1, -1, enc, kstr, klen, cb, u);
91
+ char *kstr, int klen, pem_password_cb *cb,
92
+ void *u) {
93
+ return do_pk8pkey(bp, x, 1, -1, enc, kstr, klen, cb, u);
100
94
  }
101
95
 
102
- int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
103
- char *kstr, int klen,
104
- pem_password_cb *cb, void *u)
105
- {
106
- return do_pk8pkey(bp, x, 1, nid, NULL, kstr, klen, cb, u);
96
+ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, char *kstr,
97
+ int klen, pem_password_cb *cb, void *u) {
98
+ return do_pk8pkey(bp, x, 1, nid, NULL, kstr, klen, cb, u);
107
99
  }
108
100
 
109
101
  static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid,
110
102
  const EVP_CIPHER *enc, char *kstr, int klen,
111
- pem_password_cb *cb, void *u)
112
- {
113
- X509_SIG *p8;
114
- PKCS8_PRIV_KEY_INFO *p8inf;
115
- char buf[PEM_BUFSIZE];
116
- int ret;
117
- if (!(p8inf = EVP_PKEY2PKCS8(x))) {
118
- OPENSSL_PUT_ERROR(PEM, PEM_R_ERROR_CONVERTING_PRIVATE_KEY);
103
+ pem_password_cb *cb, void *u) {
104
+ X509_SIG *p8;
105
+ PKCS8_PRIV_KEY_INFO *p8inf;
106
+ char buf[PEM_BUFSIZE];
107
+ int ret;
108
+ if (!(p8inf = EVP_PKEY2PKCS8(x))) {
109
+ OPENSSL_PUT_ERROR(PEM, PEM_R_ERROR_CONVERTING_PRIVATE_KEY);
110
+ return 0;
111
+ }
112
+ if (enc || (nid != -1)) {
113
+ if (!kstr) {
114
+ klen = 0;
115
+ if (!cb) {
116
+ cb = PEM_def_callback;
117
+ }
118
+ klen = cb(buf, PEM_BUFSIZE, 1, u);
119
+ if (klen <= 0) {
120
+ OPENSSL_PUT_ERROR(PEM, PEM_R_READ_KEY);
121
+ PKCS8_PRIV_KEY_INFO_free(p8inf);
119
122
  return 0;
123
+ }
124
+
125
+ kstr = buf;
120
126
  }
121
- if (enc || (nid != -1)) {
122
- if (!kstr) {
123
- klen = 0;
124
- if (!cb)
125
- cb = PEM_def_callback;
126
- klen = cb(buf, PEM_BUFSIZE, 1, u);
127
- if (klen <= 0) {
128
- OPENSSL_PUT_ERROR(PEM, PEM_R_READ_KEY);
129
- PKCS8_PRIV_KEY_INFO_free(p8inf);
130
- return 0;
131
- }
132
-
133
- kstr = buf;
134
- }
135
- p8 = PKCS8_encrypt(nid, enc, kstr, klen, NULL, 0, 0, p8inf);
136
- if (kstr == buf)
137
- OPENSSL_cleanse(buf, klen);
138
- PKCS8_PRIV_KEY_INFO_free(p8inf);
139
- if (isder)
140
- ret = i2d_PKCS8_bio(bp, p8);
141
- else
142
- ret = PEM_write_bio_PKCS8(bp, p8);
143
- X509_SIG_free(p8);
144
- return ret;
127
+ p8 = PKCS8_encrypt(nid, enc, kstr, klen, NULL, 0, 0, p8inf);
128
+ if (kstr == buf) {
129
+ OPENSSL_cleanse(buf, klen);
130
+ }
131
+ PKCS8_PRIV_KEY_INFO_free(p8inf);
132
+ if (isder) {
133
+ ret = i2d_PKCS8_bio(bp, p8);
145
134
  } else {
146
- if (isder)
147
- ret = i2d_PKCS8_PRIV_KEY_INFO_bio(bp, p8inf);
148
- else
149
- ret = PEM_write_bio_PKCS8_PRIV_KEY_INFO(bp, p8inf);
150
- PKCS8_PRIV_KEY_INFO_free(p8inf);
151
- return ret;
135
+ ret = PEM_write_bio_PKCS8(bp, p8);
136
+ }
137
+ X509_SIG_free(p8);
138
+ return ret;
139
+ } else {
140
+ if (isder) {
141
+ ret = i2d_PKCS8_PRIV_KEY_INFO_bio(bp, p8inf);
142
+ } else {
143
+ ret = PEM_write_bio_PKCS8_PRIV_KEY_INFO(bp, p8inf);
152
144
  }
145
+ PKCS8_PRIV_KEY_INFO_free(p8inf);
146
+ return ret;
147
+ }
153
148
  }
154
149
 
155
150
  EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
156
- void *u)
157
- {
158
- PKCS8_PRIV_KEY_INFO *p8inf = NULL;
159
- X509_SIG *p8 = NULL;
160
- int klen;
161
- EVP_PKEY *ret;
162
- char psbuf[PEM_BUFSIZE];
163
- p8 = d2i_PKCS8_bio(bp, NULL);
164
- if (!p8)
165
- return NULL;
166
-
167
- klen = 0;
168
- if (!cb)
169
- cb = PEM_def_callback;
170
- klen = cb(psbuf, PEM_BUFSIZE, 0, u);
171
- if (klen <= 0) {
172
- OPENSSL_PUT_ERROR(PEM, PEM_R_BAD_PASSWORD_READ);
173
- X509_SIG_free(p8);
174
- return NULL;
175
- }
176
- p8inf = PKCS8_decrypt(p8, psbuf, klen);
151
+ void *u) {
152
+ PKCS8_PRIV_KEY_INFO *p8inf = NULL;
153
+ X509_SIG *p8 = NULL;
154
+ int klen;
155
+ EVP_PKEY *ret;
156
+ char psbuf[PEM_BUFSIZE];
157
+ p8 = d2i_PKCS8_bio(bp, NULL);
158
+ if (!p8) {
159
+ return NULL;
160
+ }
161
+
162
+ klen = 0;
163
+ if (!cb) {
164
+ cb = PEM_def_callback;
165
+ }
166
+ klen = cb(psbuf, PEM_BUFSIZE, 0, u);
167
+ if (klen <= 0) {
168
+ OPENSSL_PUT_ERROR(PEM, PEM_R_BAD_PASSWORD_READ);
177
169
  X509_SIG_free(p8);
178
- OPENSSL_cleanse(psbuf, klen);
179
- if (!p8inf)
180
- return NULL;
181
- ret = EVP_PKCS82PKEY(p8inf);
182
- PKCS8_PRIV_KEY_INFO_free(p8inf);
183
- if (!ret)
184
- return NULL;
185
- if (x) {
186
- if (*x)
187
- EVP_PKEY_free(*x);
188
- *x = ret;
170
+ return NULL;
171
+ }
172
+ p8inf = PKCS8_decrypt(p8, psbuf, klen);
173
+ X509_SIG_free(p8);
174
+ OPENSSL_cleanse(psbuf, klen);
175
+ if (!p8inf) {
176
+ return NULL;
177
+ }
178
+ ret = EVP_PKCS82PKEY(p8inf);
179
+ PKCS8_PRIV_KEY_INFO_free(p8inf);
180
+ if (!ret) {
181
+ return NULL;
182
+ }
183
+ if (x) {
184
+ if (*x) {
185
+ EVP_PKEY_free(*x);
189
186
  }
190
- return ret;
187
+ *x = ret;
188
+ }
189
+ return ret;
191
190
  }
192
191
 
193
192
 
194
193
  int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
195
- char *kstr, int klen, pem_password_cb *cb, void *u)
196
- {
197
- return do_pk8pkey_fp(fp, x, 1, -1, enc, kstr, klen, cb, u);
194
+ char *kstr, int klen, pem_password_cb *cb, void *u) {
195
+ return do_pk8pkey_fp(fp, x, 1, -1, enc, kstr, klen, cb, u);
198
196
  }
199
197
 
200
- int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
201
- char *kstr, int klen,
202
- pem_password_cb *cb, void *u)
203
- {
204
- return do_pk8pkey_fp(fp, x, 1, nid, NULL, kstr, klen, cb, u);
198
+ int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, char *kstr,
199
+ int klen, pem_password_cb *cb, void *u) {
200
+ return do_pk8pkey_fp(fp, x, 1, nid, NULL, kstr, klen, cb, u);
205
201
  }
206
202
 
207
- int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
208
- char *kstr, int klen,
209
- pem_password_cb *cb, void *u)
210
- {
211
- return do_pk8pkey_fp(fp, x, 0, nid, NULL, kstr, klen, cb, u);
203
+ int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr,
204
+ int klen, pem_password_cb *cb, void *u) {
205
+ return do_pk8pkey_fp(fp, x, 0, nid, NULL, kstr, klen, cb, u);
212
206
  }
213
207
 
214
208
  int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
215
209
  char *kstr, int klen, pem_password_cb *cb,
216
- void *u)
217
- {
218
- return do_pk8pkey_fp(fp, x, 0, -1, enc, kstr, klen, cb, u);
210
+ void *u) {
211
+ return do_pk8pkey_fp(fp, x, 0, -1, enc, kstr, klen, cb, u);
219
212
  }
220
213
 
221
214
  static int do_pk8pkey_fp(FILE *fp, EVP_PKEY *x, int isder, int nid,
222
215
  const EVP_CIPHER *enc, char *kstr, int klen,
223
- pem_password_cb *cb, void *u)
224
- {
225
- BIO *bp;
226
- int ret;
227
- if (!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) {
228
- OPENSSL_PUT_ERROR(PEM, ERR_R_BUF_LIB);
229
- return (0);
230
- }
231
- ret = do_pk8pkey(bp, x, isder, nid, enc, kstr, klen, cb, u);
232
- BIO_free(bp);
233
- return ret;
216
+ pem_password_cb *cb, void *u) {
217
+ BIO *bp;
218
+ int ret;
219
+ if (!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) {
220
+ OPENSSL_PUT_ERROR(PEM, ERR_R_BUF_LIB);
221
+ return 0;
222
+ }
223
+ ret = do_pk8pkey(bp, x, isder, nid, enc, kstr, klen, cb, u);
224
+ BIO_free(bp);
225
+ return ret;
234
226
  }
235
227
 
236
228
  EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
237
- void *u)
238
- {
239
- BIO *bp;
240
- EVP_PKEY *ret;
241
- if (!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) {
242
- OPENSSL_PUT_ERROR(PEM, ERR_R_BUF_LIB);
243
- return NULL;
244
- }
245
- ret = d2i_PKCS8PrivateKey_bio(bp, x, cb, u);
246
- BIO_free(bp);
247
- return ret;
229
+ void *u) {
230
+ BIO *bp;
231
+ EVP_PKEY *ret;
232
+ if (!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) {
233
+ OPENSSL_PUT_ERROR(PEM, ERR_R_BUF_LIB);
234
+ return NULL;
235
+ }
236
+ ret = d2i_PKCS8PrivateKey_bio(bp, x, cb, u);
237
+ BIO_free(bp);
238
+ return ret;
248
239
  }
249
240
 
250
241
 
@@ -252,4 +243,4 @@ IMPLEMENT_PEM_rw(PKCS8, X509_SIG, PEM_STRING_PKCS8, X509_SIG)
252
243
 
253
244
 
254
245
  IMPLEMENT_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO, PEM_STRING_PKCS8INF,
255
- PKCS8_PRIV_KEY_INFO)
246
+ PKCS8_PRIV_KEY_INFO)
@@ -69,110 +69,114 @@
69
69
  #include <openssl/x509.h>
70
70
 
71
71
  EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
72
- void *u)
73
- {
74
- char *nm = NULL;
75
- const unsigned char *p = NULL;
76
- unsigned char *data = NULL;
77
- long len;
78
- EVP_PKEY *ret = NULL;
72
+ void *u) {
73
+ char *nm = NULL;
74
+ const unsigned char *p = NULL;
75
+ unsigned char *data = NULL;
76
+ long len;
77
+ EVP_PKEY *ret = NULL;
79
78
 
80
- if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, cb, u))
81
- return NULL;
82
- p = data;
79
+ if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, cb, u)) {
80
+ return NULL;
81
+ }
82
+ p = data;
83
83
 
84
- if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) {
85
- PKCS8_PRIV_KEY_INFO *p8inf;
86
- p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len);
87
- if (!p8inf)
88
- goto p8err;
89
- ret = EVP_PKCS82PKEY(p8inf);
90
- if (x) {
91
- if (*x)
92
- EVP_PKEY_free((EVP_PKEY *)*x);
93
- *x = ret;
94
- }
95
- PKCS8_PRIV_KEY_INFO_free(p8inf);
96
- } else if (strcmp(nm, PEM_STRING_PKCS8) == 0) {
97
- PKCS8_PRIV_KEY_INFO *p8inf;
98
- X509_SIG *p8;
99
- int klen;
100
- char psbuf[PEM_BUFSIZE];
101
- p8 = d2i_X509_SIG(NULL, &p, len);
102
- if (!p8)
103
- goto p8err;
84
+ if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) {
85
+ PKCS8_PRIV_KEY_INFO *p8inf;
86
+ p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len);
87
+ if (!p8inf) {
88
+ goto p8err;
89
+ }
90
+ ret = EVP_PKCS82PKEY(p8inf);
91
+ if (x) {
92
+ if (*x) {
93
+ EVP_PKEY_free((EVP_PKEY *)*x);
94
+ }
95
+ *x = ret;
96
+ }
97
+ PKCS8_PRIV_KEY_INFO_free(p8inf);
98
+ } else if (strcmp(nm, PEM_STRING_PKCS8) == 0) {
99
+ PKCS8_PRIV_KEY_INFO *p8inf;
100
+ X509_SIG *p8;
101
+ int klen;
102
+ char psbuf[PEM_BUFSIZE];
103
+ p8 = d2i_X509_SIG(NULL, &p, len);
104
+ if (!p8) {
105
+ goto p8err;
106
+ }
104
107
 
105
- klen = 0;
106
- if (!cb)
107
- cb = PEM_def_callback;
108
- klen = cb(psbuf, PEM_BUFSIZE, 0, u);
109
- if (klen <= 0) {
110
- OPENSSL_PUT_ERROR(PEM, PEM_R_BAD_PASSWORD_READ);
111
- X509_SIG_free(p8);
112
- goto err;
113
- }
114
- p8inf = PKCS8_decrypt(p8, psbuf, klen);
115
- X509_SIG_free(p8);
116
- OPENSSL_cleanse(psbuf, klen);
117
- if (!p8inf)
118
- goto p8err;
119
- ret = EVP_PKCS82PKEY(p8inf);
120
- if (x) {
121
- if (*x)
122
- EVP_PKEY_free((EVP_PKEY *)*x);
123
- *x = ret;
124
- }
125
- PKCS8_PRIV_KEY_INFO_free(p8inf);
126
- } else if (strcmp(nm, PEM_STRING_RSA) == 0) {
127
- /* TODO(davidben): d2i_PrivateKey parses PKCS#8 along with the
128
- * standalone format. This and the cases below probably should not
129
- * accept PKCS#8. */
130
- ret = d2i_PrivateKey(EVP_PKEY_RSA, x, &p, len);
131
- } else if (strcmp(nm, PEM_STRING_EC) == 0) {
132
- ret = d2i_PrivateKey(EVP_PKEY_EC, x, &p, len);
133
- } else if (strcmp(nm, PEM_STRING_DSA) == 0) {
134
- ret = d2i_PrivateKey(EVP_PKEY_DSA, x, &p, len);
108
+ klen = 0;
109
+ if (!cb) {
110
+ cb = PEM_def_callback;
111
+ }
112
+ klen = cb(psbuf, PEM_BUFSIZE, 0, u);
113
+ if (klen <= 0) {
114
+ OPENSSL_PUT_ERROR(PEM, PEM_R_BAD_PASSWORD_READ);
115
+ X509_SIG_free(p8);
116
+ goto err;
135
117
  }
136
- p8err:
137
- if (ret == NULL)
138
- OPENSSL_PUT_ERROR(PEM, ERR_R_ASN1_LIB);
118
+ p8inf = PKCS8_decrypt(p8, psbuf, klen);
119
+ X509_SIG_free(p8);
120
+ OPENSSL_cleanse(psbuf, klen);
121
+ if (!p8inf) {
122
+ goto p8err;
123
+ }
124
+ ret = EVP_PKCS82PKEY(p8inf);
125
+ if (x) {
126
+ if (*x) {
127
+ EVP_PKEY_free((EVP_PKEY *)*x);
128
+ }
129
+ *x = ret;
130
+ }
131
+ PKCS8_PRIV_KEY_INFO_free(p8inf);
132
+ } else if (strcmp(nm, PEM_STRING_RSA) == 0) {
133
+ // TODO(davidben): d2i_PrivateKey parses PKCS#8 along with the
134
+ // standalone format. This and the cases below probably should not
135
+ // accept PKCS#8.
136
+ ret = d2i_PrivateKey(EVP_PKEY_RSA, x, &p, len);
137
+ } else if (strcmp(nm, PEM_STRING_EC) == 0) {
138
+ ret = d2i_PrivateKey(EVP_PKEY_EC, x, &p, len);
139
+ } else if (strcmp(nm, PEM_STRING_DSA) == 0) {
140
+ ret = d2i_PrivateKey(EVP_PKEY_DSA, x, &p, len);
141
+ }
142
+ p8err:
143
+ if (ret == NULL) {
144
+ OPENSSL_PUT_ERROR(PEM, ERR_R_ASN1_LIB);
145
+ }
139
146
 
140
- err:
141
- OPENSSL_free(nm);
142
- OPENSSL_free(data);
143
- return (ret);
147
+ err:
148
+ OPENSSL_free(nm);
149
+ OPENSSL_free(data);
150
+ return ret;
144
151
  }
145
152
 
146
153
  int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
147
- unsigned char *kstr, int klen,
148
- pem_password_cb *cb, void *u)
149
- {
150
- return PEM_write_bio_PKCS8PrivateKey(bp, x, enc, (char *)kstr, klen, cb, u);
154
+ unsigned char *kstr, int klen, pem_password_cb *cb,
155
+ void *u) {
156
+ return PEM_write_bio_PKCS8PrivateKey(bp, x, enc, (char *)kstr, klen, cb, u);
151
157
  }
152
158
 
153
159
  EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
154
- void *u)
155
- {
156
- BIO *b = BIO_new_fp(fp, BIO_NOCLOSE);
157
- if (b == NULL) {
158
- OPENSSL_PUT_ERROR(PEM, ERR_R_BUF_LIB);
159
- return NULL;
160
- }
161
- EVP_PKEY *ret = PEM_read_bio_PrivateKey(b, x, cb, u);
162
- BIO_free(b);
163
- return ret;
160
+ void *u) {
161
+ BIO *b = BIO_new_fp(fp, BIO_NOCLOSE);
162
+ if (b == NULL) {
163
+ OPENSSL_PUT_ERROR(PEM, ERR_R_BUF_LIB);
164
+ return NULL;
165
+ }
166
+ EVP_PKEY *ret = PEM_read_bio_PrivateKey(b, x, cb, u);
167
+ BIO_free(b);
168
+ return ret;
164
169
  }
165
170
 
166
171
  int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
167
- unsigned char *kstr, int klen,
168
- pem_password_cb *cb, void *u)
169
- {
170
- BIO *b = BIO_new_fp(fp, BIO_NOCLOSE);
171
- if (b == NULL) {
172
- OPENSSL_PUT_ERROR(PEM, ERR_R_BUF_LIB);
173
- return 0;
174
- }
175
- int ret = PEM_write_bio_PrivateKey(b, x, enc, kstr, klen, cb, u);
176
- BIO_free(b);
177
- return ret;
172
+ unsigned char *kstr, int klen, pem_password_cb *cb,
173
+ void *u) {
174
+ BIO *b = BIO_new_fp(fp, BIO_NOCLOSE);
175
+ if (b == NULL) {
176
+ OPENSSL_PUT_ERROR(PEM, ERR_R_BUF_LIB);
177
+ return 0;
178
+ }
179
+ int ret = PEM_write_bio_PrivateKey(b, x, enc, kstr, klen, cb, u);
180
+ BIO_free(b);
181
+ return ret;
178
182
  }
@@ -27,22 +27,6 @@
27
27
 
28
28
  #include <emmintrin.h>
29
29
 
30
- static uint32_t load_u32_le(const uint8_t in[4]) {
31
- uint32_t ret;
32
- OPENSSL_memcpy(&ret, in, 4);
33
- return ret;
34
- }
35
-
36
- static uint64_t load_u64_le(const uint8_t in[8]) {
37
- uint64_t ret;
38
- OPENSSL_memcpy(&ret, in, 8);
39
- return ret;
40
- }
41
-
42
- static void store_u64_le(uint8_t out[8], uint64_t v) {
43
- OPENSSL_memcpy(out, &v, 8);
44
- }
45
-
46
30
  typedef __m128i xmmi;
47
31
 
48
32
  static const alignas(16) uint32_t poly1305_x64_sse2_message_mask[4] = {
@@ -112,8 +96,8 @@ void CRYPTO_poly1305_init(poly1305_state *state, const uint8_t key[32]) {
112
96
  uint64_t t0, t1;
113
97
 
114
98
  // clamp key
115
- t0 = load_u64_le(key + 0);
116
- t1 = load_u64_le(key + 8);
99
+ t0 = CRYPTO_load_u64_le(key + 0);
100
+ t1 = CRYPTO_load_u64_le(key + 8);
117
101
  r0 = t0 & 0xffc0fffffff;
118
102
  t0 >>= 44;
119
103
  t0 |= t1 << 20;
@@ -131,10 +115,10 @@ void CRYPTO_poly1305_init(poly1305_state *state, const uint8_t key[32]) {
131
115
  p->R22.d[3] = (uint32_t)(r2 >> 32);
132
116
 
133
117
  // store pad
134
- p->R23.d[1] = load_u32_le(key + 16);
135
- p->R23.d[3] = load_u32_le(key + 20);
136
- p->R24.d[1] = load_u32_le(key + 24);
137
- p->R24.d[3] = load_u32_le(key + 28);
118
+ p->R23.d[1] = CRYPTO_load_u32_le(key + 16);
119
+ p->R23.d[3] = CRYPTO_load_u32_le(key + 20);
120
+ p->R24.d[1] = CRYPTO_load_u32_le(key + 24);
121
+ p->R24.d[3] = CRYPTO_load_u32_le(key + 28);
138
122
 
139
123
  // H = 0
140
124
  st->H[0] = _mm_setzero_si128();
@@ -766,8 +750,8 @@ void CRYPTO_poly1305_finish(poly1305_state *state, uint8_t mac[16]) {
766
750
  }
767
751
 
768
752
  poly1305_donna_atleast16bytes:
769
- t0 = load_u64_le(m + 0);
770
- t1 = load_u64_le(m + 8);
753
+ t0 = CRYPTO_load_u64_le(m + 0);
754
+ t1 = CRYPTO_load_u64_le(m + 8);
771
755
  h0 += t0 & 0xfffffffffff;
772
756
  t0 = shr128_pair(t1, t0, 44);
773
757
  h1 += t0 & 0xfffffffffff;
@@ -806,8 +790,8 @@ poly1305_donna_atmost15bytes:
806
790
  OPENSSL_memset(m + leftover, 0, 16 - leftover);
807
791
  leftover = 16;
808
792
 
809
- t0 = load_u64_le(m + 0);
810
- t1 = load_u64_le(m + 8);
793
+ t0 = CRYPTO_load_u64_le(m + 0);
794
+ t1 = CRYPTO_load_u64_le(m + 8);
811
795
  h0 += t0 & 0xfffffffffff;
812
796
  t0 = shr128_pair(t1, t0, 44);
813
797
  h1 += t0 & 0xfffffffffff;
@@ -853,8 +837,8 @@ poly1305_donna_finish:
853
837
  t1 = (t1 >> 24);
854
838
  h2 += (t1)+c;
855
839
 
856
- store_u64_le(mac + 0, ((h0) | (h1 << 44)));
857
- store_u64_le(mac + 8, ((h1 >> 20) | (h2 << 24)));
840
+ CRYPTO_store_u64_le(mac + 0, ((h0) | (h1 << 44)));
841
+ CRYPTO_store_u64_le(mac + 8, ((h1 >> 20) | (h2 << 24)));
858
842
  }
859
843
 
860
844
  #endif // BORINGSSL_HAS_UINT128 && OPENSSL_X86_64