visaljs 0.0.2 → 0.0.3

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 (1007) hide show
  1. package/cli.js +393 -62
  2. package/node/include/js_node.h +28 -5
  3. package/node/include/js_uv.h +36 -0
  4. package/node/prelude/crypto.js +7 -10
  5. package/node/prelude/dns.js +99 -0
  6. package/node/prelude/dns_promises.js +10 -0
  7. package/node/prelude/http.js +1039 -195
  8. package/node/prelude/internal/crypto/asym.js +39 -12
  9. package/node/prelude/internal/crypto/dh_groups.js +12 -0
  10. package/node/prelude/internal/crypto/diffiehellman.js +354 -0
  11. package/node/prelude/internal/crypto/hash.js +1 -1
  12. package/node/prelude/internal/crypto/key_type.js +3 -0
  13. package/node/prelude/internal/crypto/keys.js +39 -9
  14. package/node/prelude/internal/http_agent.js +249 -0
  15. package/node/prelude/internal/net.js +33 -0
  16. package/node/prelude/internal/socketaddress.js +249 -0
  17. package/node/prelude/internal/tls/common.js +306 -0
  18. package/node/prelude/internal/tls/wrap.js +1217 -0
  19. package/node/prelude/internal/tls/x509.js +394 -0
  20. package/node/prelude/net.js +1083 -50
  21. package/node/prelude/stream.js +6 -0
  22. package/node/prelude/tls.js +141 -0
  23. package/node/prelude/util.js +5 -2
  24. package/node/prelude/util_types.js +85 -0
  25. package/node/src/host_http.c +268 -270
  26. package/node/src/host_loop.c +84 -0
  27. package/node/src/host_net.c +495 -0
  28. package/node/src/host_sys.c +16 -0
  29. package/package.json +1 -1
  30. package/runtime/include/js_builtins.h +16 -0
  31. package/runtime/include/js_console.h +2 -0
  32. package/runtime/include/js_core.def +23 -0
  33. package/runtime/include/js_crypto.h +23 -0
  34. package/runtime/include/js_generator.h +2 -3
  35. package/runtime/include/js_promise.h +0 -2
  36. package/runtime/src/async_iter.c +4 -1
  37. package/runtime/src/boringssl_support.cc +34 -0
  38. package/runtime/src/builtin_table.c +8 -0
  39. package/runtime/src/components.c +10 -0
  40. package/runtime/src/console.c +6 -18
  41. package/runtime/src/core_all.c +1 -0
  42. package/runtime/src/crypto_asym.c +450 -241
  43. package/runtime/src/crypto_bn.c +91 -0
  44. package/runtime/src/crypto_cipher.c +153 -75
  45. package/runtime/src/crypto_hash.c +68 -53
  46. package/runtime/src/crypto_internal.h +55 -26
  47. package/runtime/src/crypto_pkey.c +198 -61
  48. package/runtime/src/crypto_subtle.c +42 -16
  49. package/runtime/src/crypto_tls.c +678 -0
  50. package/runtime/src/generator.c +8 -1
  51. package/runtime/src/global.c +2 -4
  52. package/runtime/src/internal.h +0 -1
  53. package/runtime/src/jobs.c +2 -1
  54. package/runtime/src/promise.c +4 -1
  55. package/runtime/src/tls_roots.gen.h +3215 -0
  56. package/runtime/src/util_types.c +52 -0
  57. package/runtime/src/weak.c +2 -1
  58. package/runtime/third_party/boringssl/LICENSE +238 -0
  59. package/runtime/third_party/boringssl/README.md +46 -0
  60. package/runtime/third_party/boringssl/VERSION +1 -0
  61. package/runtime/third_party/boringssl/crypto/aes/aes.cc +44 -0
  62. package/runtime/third_party/boringssl/crypto/armv8_feature_parsing.h +67 -0
  63. package/runtime/third_party/boringssl/crypto/asn1/a_bitstr.cc +297 -0
  64. package/runtime/third_party/boringssl/crypto/asn1/a_bool.cc +50 -0
  65. package/runtime/third_party/boringssl/crypto/asn1/a_d2i_fp.cc +47 -0
  66. package/runtime/third_party/boringssl/crypto/asn1/a_dup.cc +42 -0
  67. package/runtime/third_party/boringssl/crypto/asn1/a_gentm.cc +130 -0
  68. package/runtime/third_party/boringssl/crypto/asn1/a_i2d_fp.cc +44 -0
  69. package/runtime/third_party/boringssl/crypto/asn1/a_int.cc +467 -0
  70. package/runtime/third_party/boringssl/crypto/asn1/a_mbstr.cc +242 -0
  71. package/runtime/third_party/boringssl/crypto/asn1/a_object.cc +191 -0
  72. package/runtime/third_party/boringssl/crypto/asn1/a_octet.cc +32 -0
  73. package/runtime/third_party/boringssl/crypto/asn1/a_strex.cc +411 -0
  74. package/runtime/third_party/boringssl/crypto/asn1/a_strnid.cc +208 -0
  75. package/runtime/third_party/boringssl/crypto/asn1/a_time.cc +248 -0
  76. package/runtime/third_party/boringssl/crypto/asn1/a_type.cc +467 -0
  77. package/runtime/third_party/boringssl/crypto/asn1/a_utctm.cc +128 -0
  78. package/runtime/third_party/boringssl/crypto/asn1/asn1_lib.cc +453 -0
  79. package/runtime/third_party/boringssl/crypto/asn1/asn1_par.cc +61 -0
  80. package/runtime/third_party/boringssl/crypto/asn1/asn_pack.cc +56 -0
  81. package/runtime/third_party/boringssl/crypto/asn1/f_int.cc +63 -0
  82. package/runtime/third_party/boringssl/crypto/asn1/f_string.cc +52 -0
  83. package/runtime/third_party/boringssl/crypto/asn1/internal.h +430 -0
  84. package/runtime/third_party/boringssl/crypto/asn1/posix_time.cc +244 -0
  85. package/runtime/third_party/boringssl/crypto/asn1/tasn_dec.cc +611 -0
  86. package/runtime/third_party/boringssl/crypto/asn1/tasn_enc.cc +348 -0
  87. package/runtime/third_party/boringssl/crypto/asn1/tasn_fre.cc +163 -0
  88. package/runtime/third_party/boringssl/crypto/asn1/tasn_new.cc +274 -0
  89. package/runtime/third_party/boringssl/crypto/asn1/tasn_typ.cc +92 -0
  90. package/runtime/third_party/boringssl/crypto/asn1/tasn_utl.cc +218 -0
  91. package/runtime/third_party/boringssl/crypto/base64/base64.cc +433 -0
  92. package/runtime/third_party/boringssl/crypto/bcm_support.h +62 -0
  93. package/runtime/third_party/boringssl/crypto/bio/bio.cc +715 -0
  94. package/runtime/third_party/boringssl/crypto/bio/bio_mem.cc +260 -0
  95. package/runtime/third_party/boringssl/crypto/bio/connect.cc +463 -0
  96. package/runtime/third_party/boringssl/crypto/bio/errno.cc +52 -0
  97. package/runtime/third_party/boringssl/crypto/bio/fd.cc +193 -0
  98. package/runtime/third_party/boringssl/crypto/bio/file.cc +283 -0
  99. package/runtime/third_party/boringssl/crypto/bio/hexdump.cc +154 -0
  100. package/runtime/third_party/boringssl/crypto/bio/internal.h +128 -0
  101. package/runtime/third_party/boringssl/crypto/bio/pair.cc +426 -0
  102. package/runtime/third_party/boringssl/crypto/bio/printf.cc +59 -0
  103. package/runtime/third_party/boringssl/crypto/bio/socket.cc +210 -0
  104. package/runtime/third_party/boringssl/crypto/bio/socket_helper.cc +179 -0
  105. package/runtime/third_party/boringssl/crypto/blake2/blake2.cc +173 -0
  106. package/runtime/third_party/boringssl/crypto/bn/bn_asn1.cc +57 -0
  107. package/runtime/third_party/boringssl/crypto/bn/convert.cc +409 -0
  108. package/runtime/third_party/boringssl/crypto/bn/div.cc +102 -0
  109. package/runtime/third_party/boringssl/crypto/bn/exponentiation.cc +168 -0
  110. package/runtime/third_party/boringssl/crypto/bn/sqrt.cc +93 -0
  111. package/runtime/third_party/boringssl/crypto/buf/buf.cc +119 -0
  112. package/runtime/third_party/boringssl/crypto/bytestring/asn1_compat.cc +54 -0
  113. package/runtime/third_party/boringssl/crypto/bytestring/ber.cc +268 -0
  114. package/runtime/third_party/boringssl/crypto/bytestring/cbb.cc +787 -0
  115. package/runtime/third_party/boringssl/crypto/bytestring/cbs.cc +977 -0
  116. package/runtime/third_party/boringssl/crypto/bytestring/internal.h +134 -0
  117. package/runtime/third_party/boringssl/crypto/bytestring/unicode.cc +156 -0
  118. package/runtime/third_party/boringssl/crypto/chacha/chacha.cc +226 -0
  119. package/runtime/third_party/boringssl/crypto/chacha/internal.h +103 -0
  120. package/runtime/third_party/boringssl/crypto/cipher/derive_key.cc +106 -0
  121. package/runtime/third_party/boringssl/crypto/cipher/e_aesctrhmac.cc +294 -0
  122. package/runtime/third_party/boringssl/crypto/cipher/e_aeseax.cc +351 -0
  123. package/runtime/third_party/boringssl/crypto/cipher/e_aesgcmsiv.cc +918 -0
  124. package/runtime/third_party/boringssl/crypto/cipher/e_chacha20poly1305.cc +404 -0
  125. package/runtime/third_party/boringssl/crypto/cipher/e_des.cc +214 -0
  126. package/runtime/third_party/boringssl/crypto/cipher/e_null.cc +55 -0
  127. package/runtime/third_party/boringssl/crypto/cipher/e_rc2.cc +432 -0
  128. package/runtime/third_party/boringssl/crypto/cipher/e_rc4.cc +56 -0
  129. package/runtime/third_party/boringssl/crypto/cipher/e_tls.cc +615 -0
  130. package/runtime/third_party/boringssl/crypto/cipher/get_cipher.cc +85 -0
  131. package/runtime/third_party/boringssl/crypto/cipher/internal.h +399 -0
  132. package/runtime/third_party/boringssl/crypto/cipher/tls_cbc.cc +476 -0
  133. package/runtime/third_party/boringssl/crypto/cms/cms.cc +178 -0
  134. package/runtime/third_party/boringssl/crypto/conf/conf.cc +637 -0
  135. package/runtime/third_party/boringssl/crypto/conf/internal.h +54 -0
  136. package/runtime/third_party/boringssl/crypto/cpu_aarch64_apple.cc +76 -0
  137. package/runtime/third_party/boringssl/crypto/cpu_aarch64_fuchsia.cc +58 -0
  138. package/runtime/third_party/boringssl/crypto/cpu_aarch64_linux.cc +66 -0
  139. package/runtime/third_party/boringssl/crypto/cpu_aarch64_openbsd.cc +45 -0
  140. package/runtime/third_party/boringssl/crypto/cpu_aarch64_sysreg.cc +66 -0
  141. package/runtime/third_party/boringssl/crypto/cpu_aarch64_win.cc +52 -0
  142. package/runtime/third_party/boringssl/crypto/cpu_arm_freebsd.cc +55 -0
  143. package/runtime/third_party/boringssl/crypto/cpu_arm_linux.cc +173 -0
  144. package/runtime/third_party/boringssl/crypto/cpu_arm_linux.h +141 -0
  145. package/runtime/third_party/boringssl/crypto/cpu_intel.cc +287 -0
  146. package/runtime/third_party/boringssl/crypto/crypto.cc +152 -0
  147. package/runtime/third_party/boringssl/crypto/curve25519/asm/x25519-asm-arm.S +2124 -0
  148. package/runtime/third_party/boringssl/crypto/curve25519/cpace.cc +227 -0
  149. package/runtime/third_party/boringssl/crypto/curve25519/curve25519.cc +2436 -0
  150. package/runtime/third_party/boringssl/crypto/curve25519/curve25519_64_adx.cc +18 -0
  151. package/runtime/third_party/boringssl/crypto/curve25519/curve25519_tables.h +3264 -0
  152. package/runtime/third_party/boringssl/crypto/curve25519/internal.h +202 -0
  153. package/runtime/third_party/boringssl/crypto/curve25519/spake25519.cc +532 -0
  154. package/runtime/third_party/boringssl/crypto/des/des.cc +837 -0
  155. package/runtime/third_party/boringssl/crypto/des/internal.h +144 -0
  156. package/runtime/third_party/boringssl/crypto/dh/dh_asn1.cc +109 -0
  157. package/runtime/third_party/boringssl/crypto/dh/params.cc +411 -0
  158. package/runtime/third_party/boringssl/crypto/digest/digest_extra.cc +361 -0
  159. package/runtime/third_party/boringssl/crypto/dsa/dsa.cc +922 -0
  160. package/runtime/third_party/boringssl/crypto/dsa/dsa_asn1.cc +306 -0
  161. package/runtime/third_party/boringssl/crypto/dsa/internal.h +56 -0
  162. package/runtime/third_party/boringssl/crypto/ec/ec_asn1.cc +542 -0
  163. package/runtime/third_party/boringssl/crypto/ec/ec_derive.cc +94 -0
  164. package/runtime/third_party/boringssl/crypto/ec/hash_to_curve.cc +773 -0
  165. package/runtime/third_party/boringssl/crypto/ec/internal.h +114 -0
  166. package/runtime/third_party/boringssl/crypto/ecdh/ecdh.cc +75 -0
  167. package/runtime/third_party/boringssl/crypto/ecdsa/ecdsa_asn1.cc +337 -0
  168. package/runtime/third_party/boringssl/crypto/ecdsa/ecdsa_p1363.cc +54 -0
  169. package/runtime/third_party/boringssl/crypto/engine/engine.cc +95 -0
  170. package/runtime/third_party/boringssl/crypto/err/err.cc +820 -0
  171. package/runtime/third_party/boringssl/crypto/err/internal.h +45 -0
  172. package/runtime/third_party/boringssl/crypto/evp/evp.cc +454 -0
  173. package/runtime/third_party/boringssl/crypto/evp/evp_asn1.cc +439 -0
  174. package/runtime/third_party/boringssl/crypto/evp/evp_ctx.cc +541 -0
  175. package/runtime/third_party/boringssl/crypto/evp/evp_kem.cc +101 -0
  176. package/runtime/third_party/boringssl/crypto/evp/internal.h +427 -0
  177. package/runtime/third_party/boringssl/crypto/evp/p_dh.cc +326 -0
  178. package/runtime/third_party/boringssl/crypto/evp/p_dsa.cc +333 -0
  179. package/runtime/third_party/boringssl/crypto/evp/p_ec.cc +736 -0
  180. package/runtime/third_party/boringssl/crypto/evp/p_ed25519.cc +359 -0
  181. package/runtime/third_party/boringssl/crypto/evp/p_hkdf.cc +204 -0
  182. package/runtime/third_party/boringssl/crypto/evp/p_mldsa.cc +549 -0
  183. package/runtime/third_party/boringssl/crypto/evp/p_mlkem.cc +510 -0
  184. package/runtime/third_party/boringssl/crypto/evp/p_rsa.cc +1185 -0
  185. package/runtime/third_party/boringssl/crypto/evp/p_x25519.cc +371 -0
  186. package/runtime/third_party/boringssl/crypto/evp/p_xwing.cc +300 -0
  187. package/runtime/third_party/boringssl/crypto/evp/pbkdf.cc +105 -0
  188. package/runtime/third_party/boringssl/crypto/evp/print.cc +287 -0
  189. package/runtime/third_party/boringssl/crypto/evp/scrypt.cc +218 -0
  190. package/runtime/third_party/boringssl/crypto/evp/sign.cc +95 -0
  191. package/runtime/third_party/boringssl/crypto/ex_data.cc +140 -0
  192. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/aes.cc.inc +208 -0
  193. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/aes_nohw.cc.inc +1279 -0
  194. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/cbc.cc.inc +132 -0
  195. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/cfb.cc.inc +168 -0
  196. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/ctr.cc.inc +102 -0
  197. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/gcm.cc.inc +614 -0
  198. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/gcm_nohw.cc.inc +304 -0
  199. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/internal.h +590 -0
  200. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/key_wrap.cc.inc +211 -0
  201. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.cc.inc +97 -0
  202. package/runtime/third_party/boringssl/crypto/fipsmodule/aes/ofb.cc.inc +55 -0
  203. package/runtime/third_party/boringssl/crypto/fipsmodule/bcm.cc +288 -0
  204. package/runtime/third_party/boringssl/crypto/fipsmodule/bcm_interface.h +953 -0
  205. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/add.cc.inc +276 -0
  206. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +573 -0
  207. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/bn.cc.inc +377 -0
  208. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/bytes.cc.inc +230 -0
  209. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/cmp.cc.inc +161 -0
  210. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/ctx.cc.inc +127 -0
  211. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/div.cc.inc +738 -0
  212. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/div_extra.cc.inc +90 -0
  213. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.cc.inc +743 -0
  214. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/gcd.cc.inc +281 -0
  215. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/gcd_extra.cc.inc +327 -0
  216. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/generic.cc.inc +579 -0
  217. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/internal.h +810 -0
  218. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/jacobi.cc.inc +101 -0
  219. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/montgomery.cc.inc +408 -0
  220. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.cc.inc +179 -0
  221. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/mul.cc.inc +347 -0
  222. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/prime.cc.inc +931 -0
  223. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/random.cc.inc +261 -0
  224. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.cc.inc +144 -0
  225. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +109 -0
  226. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/shift.cc.inc +317 -0
  227. package/runtime/third_party/boringssl/crypto/fipsmodule/bn/sqrt.cc.inc +370 -0
  228. package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/aead.cc.inc +619 -0
  229. package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/cipher.cc.inc +837 -0
  230. package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.cc.inc +1240 -0
  231. package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/e_aesccm.cc.inc +440 -0
  232. package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/internal.h +461 -0
  233. package/runtime/third_party/boringssl/crypto/fipsmodule/cmac/cmac.cc.inc +293 -0
  234. package/runtime/third_party/boringssl/crypto/fipsmodule/delocate.h +95 -0
  235. package/runtime/third_party/boringssl/crypto/fipsmodule/dh/check.cc.inc +198 -0
  236. package/runtime/third_party/boringssl/crypto/fipsmodule/dh/dh.cc.inc +401 -0
  237. package/runtime/third_party/boringssl/crypto/fipsmodule/dh/internal.h +63 -0
  238. package/runtime/third_party/boringssl/crypto/fipsmodule/digest/digest.cc.inc +221 -0
  239. package/runtime/third_party/boringssl/crypto/fipsmodule/digest/digests.cc.inc +184 -0
  240. package/runtime/third_party/boringssl/crypto/fipsmodule/digest/internal.h +72 -0
  241. package/runtime/third_party/boringssl/crypto/fipsmodule/digest/md32_common.h +166 -0
  242. package/runtime/third_party/boringssl/crypto/fipsmodule/digestsign/digestsign.cc.inc +230 -0
  243. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/builtin_curves.h +277 -0
  244. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec.cc.inc +1024 -0
  245. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec_key.cc.inc +536 -0
  246. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.cc.inc +379 -0
  247. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/felem.cc.inc +250 -0
  248. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/internal.h +752 -0
  249. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/oct.cc.inc +174 -0
  250. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz-table.h +9502 -0
  251. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz.cc.inc +740 -0
  252. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz.h +207 -0
  253. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256.cc.inc +578 -0
  254. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256_table.h +297 -0
  255. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/scalar.cc.inc +184 -0
  256. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/simple.cc.inc +246 -0
  257. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/simple_mul.cc.inc +274 -0
  258. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/util.cc.inc +258 -0
  259. package/runtime/third_party/boringssl/crypto/fipsmodule/ec/wnaf.cc.inc +224 -0
  260. package/runtime/third_party/boringssl/crypto/fipsmodule/ecdh/ecdh.cc.inc +91 -0
  261. package/runtime/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +288 -0
  262. package/runtime/third_party/boringssl/crypto/fipsmodule/ecdsa/internal.h +57 -0
  263. package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/internal.h +38 -0
  264. package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/jitter.cc.inc +487 -0
  265. package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/sha512.cc.inc +329 -0
  266. package/runtime/third_party/boringssl/crypto/fipsmodule/fips_shared_support.cc +28 -0
  267. package/runtime/third_party/boringssl/crypto/fipsmodule/hkdf/hkdf.cc.inc +114 -0
  268. package/runtime/third_party/boringssl/crypto/fipsmodule/hmac/hmac.cc.inc +218 -0
  269. package/runtime/third_party/boringssl/crypto/fipsmodule/keccak/internal.h +165 -0
  270. package/runtime/third_party/boringssl/crypto/fipsmodule/keccak/keccak.cc.inc +647 -0
  271. package/runtime/third_party/boringssl/crypto/fipsmodule/mldsa/fips_known_values.inc +1345 -0
  272. package/runtime/third_party/boringssl/crypto/fipsmodule/mldsa/mldsa.cc.inc +3323 -0
  273. package/runtime/third_party/boringssl/crypto/fipsmodule/mlkem/fips_known_values.inc +411 -0
  274. package/runtime/third_party/boringssl/crypto/fipsmodule/mlkem/mlkem.cc.inc +1856 -0
  275. package/runtime/third_party/boringssl/crypto/fipsmodule/rand/android_entropy_client.cc.inc +82 -0
  276. package/runtime/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.cc.inc +401 -0
  277. package/runtime/third_party/boringssl/crypto/fipsmodule/rand/internal.h +99 -0
  278. package/runtime/third_party/boringssl/crypto/fipsmodule/rand/rand.cc.inc +486 -0
  279. package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +167 -0
  280. package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/padding.cc.inc +371 -0
  281. package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/rsa.cc.inc +996 -0
  282. package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.cc.inc +1000 -0
  283. package/runtime/third_party/boringssl/crypto/fipsmodule/self_check/fips.cc.inc +129 -0
  284. package/runtime/third_party/boringssl/crypto/fipsmodule/self_check/self_check.cc.inc +1093 -0
  285. package/runtime/third_party/boringssl/crypto/fipsmodule/service_indicator/internal.h +112 -0
  286. package/runtime/third_party/boringssl/crypto/fipsmodule/service_indicator/service_indicator.cc.inc +330 -0
  287. package/runtime/third_party/boringssl/crypto/fipsmodule/sha/internal.h +205 -0
  288. package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha1.cc.inc +404 -0
  289. package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha256.cc.inc +315 -0
  290. package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha512.cc.inc +473 -0
  291. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/address.h +144 -0
  292. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fips_known_values.inc +674 -0
  293. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fors.cc.inc +179 -0
  294. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fors.h +48 -0
  295. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/merkle.cc.inc +164 -0
  296. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/merkle.h +58 -0
  297. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/params.h +178 -0
  298. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/slhdsa.cc.inc +690 -0
  299. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/thash.cc.inc +326 -0
  300. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/thash.h +71 -0
  301. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/wots.cc.inc +172 -0
  302. package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/wots.h +40 -0
  303. package/runtime/third_party/boringssl/crypto/fipsmodule/tls/internal.h +33 -0
  304. package/runtime/third_party/boringssl/crypto/fipsmodule/tls/kdf.cc.inc +180 -0
  305. package/runtime/third_party/boringssl/crypto/fuzzer_mode.cc +30 -0
  306. package/runtime/third_party/boringssl/crypto/hpke/hpke.cc +1514 -0
  307. package/runtime/third_party/boringssl/crypto/hrss/asm/poly_rq_mul.S +8489 -0
  308. package/runtime/third_party/boringssl/crypto/hrss/hrss.cc +2189 -0
  309. package/runtime/third_party/boringssl/crypto/hrss/internal.h +64 -0
  310. package/runtime/third_party/boringssl/crypto/internal.h +1767 -0
  311. package/runtime/third_party/boringssl/crypto/lhash/internal.h +222 -0
  312. package/runtime/third_party/boringssl/crypto/lhash/lhash.cc +312 -0
  313. package/runtime/third_party/boringssl/crypto/md4/md4.cc +207 -0
  314. package/runtime/third_party/boringssl/crypto/md5/internal.h +34 -0
  315. package/runtime/third_party/boringssl/crypto/md5/md5.cc +255 -0
  316. package/runtime/third_party/boringssl/crypto/mem.cc +577 -0
  317. package/runtime/third_party/boringssl/crypto/mem_internal.h +706 -0
  318. package/runtime/third_party/boringssl/crypto/mldsa/mldsa.cc +296 -0
  319. package/runtime/third_party/boringssl/crypto/mlkem/mlkem.cc +108 -0
  320. package/runtime/third_party/boringssl/crypto/obj/obj.cc +494 -0
  321. package/runtime/third_party/boringssl/crypto/obj/obj_dat.h +11722 -0
  322. package/runtime/third_party/boringssl/crypto/obj/obj_xref.cc +83 -0
  323. package/runtime/third_party/boringssl/crypto/params_internal.h +30 -0
  324. package/runtime/third_party/boringssl/crypto/pem/internal.h +135 -0
  325. package/runtime/third_party/boringssl/crypto/pem/pem_all.cc +153 -0
  326. package/runtime/third_party/boringssl/crypto/pem/pem_info.cc +250 -0
  327. package/runtime/third_party/boringssl/crypto/pem/pem_lib.cc +707 -0
  328. package/runtime/third_party/boringssl/crypto/pem/pem_oth.cc +45 -0
  329. package/runtime/third_party/boringssl/crypto/pem/pem_pk8.cc +211 -0
  330. package/runtime/third_party/boringssl/crypto/pem/pem_pkey.cc +147 -0
  331. package/runtime/third_party/boringssl/crypto/pem/pem_x509.cc +25 -0
  332. package/runtime/third_party/boringssl/crypto/pem/pem_xaux.cc +25 -0
  333. package/runtime/third_party/boringssl/crypto/pkcs7/internal.h +67 -0
  334. package/runtime/third_party/boringssl/crypto/pkcs7/pkcs7.cc +198 -0
  335. package/runtime/third_party/boringssl/crypto/pkcs7/pkcs7_x509.cc +527 -0
  336. package/runtime/third_party/boringssl/crypto/pkcs8/internal.h +98 -0
  337. package/runtime/third_party/boringssl/crypto/pkcs8/p5_pbev2.cc +286 -0
  338. package/runtime/third_party/boringssl/crypto/pkcs8/pkcs8.cc +473 -0
  339. package/runtime/third_party/boringssl/crypto/pkcs8/pkcs8_x509.cc +1328 -0
  340. package/runtime/third_party/boringssl/crypto/poly1305/internal.h +54 -0
  341. package/runtime/third_party/boringssl/crypto/poly1305/poly1305.cc +315 -0
  342. package/runtime/third_party/boringssl/crypto/poly1305/poly1305_arm.cc +294 -0
  343. package/runtime/third_party/boringssl/crypto/poly1305/poly1305_arm_asm.S +2017 -0
  344. package/runtime/third_party/boringssl/crypto/poly1305/poly1305_vec.cc +853 -0
  345. package/runtime/third_party/boringssl/crypto/pool/internal.h +95 -0
  346. package/runtime/third_party/boringssl/crypto/pool/pool.cc +282 -0
  347. package/runtime/third_party/boringssl/crypto/rand/deterministic.cc +58 -0
  348. package/runtime/third_party/boringssl/crypto/rand/fork_detect.cc +222 -0
  349. package/runtime/third_party/boringssl/crypto/rand/forkunsafe.cc +44 -0
  350. package/runtime/third_party/boringssl/crypto/rand/getentropy.cc +53 -0
  351. package/runtime/third_party/boringssl/crypto/rand/internal.h +67 -0
  352. package/runtime/third_party/boringssl/crypto/rand/ios.cc +35 -0
  353. package/runtime/third_party/boringssl/crypto/rand/rand.cc +79 -0
  354. package/runtime/third_party/boringssl/crypto/rand/trusty.cc +39 -0
  355. package/runtime/third_party/boringssl/crypto/rand/urandom.cc +149 -0
  356. package/runtime/third_party/boringssl/crypto/rand/windows.cc +91 -0
  357. package/runtime/third_party/boringssl/crypto/rc4/rc4.cc +56 -0
  358. package/runtime/third_party/boringssl/crypto/refcount.cc +49 -0
  359. package/runtime/third_party/boringssl/crypto/rsa/internal.h +51 -0
  360. package/runtime/third_party/boringssl/crypto/rsa/rsa_asn1.cc +404 -0
  361. package/runtime/third_party/boringssl/crypto/rsa/rsa_crypt.cc +530 -0
  362. package/runtime/third_party/boringssl/crypto/rsa/rsa_extra.cc +30 -0
  363. package/runtime/third_party/boringssl/crypto/rsa/rsa_print.cc +25 -0
  364. package/runtime/third_party/boringssl/crypto/sha/sha1.cc +55 -0
  365. package/runtime/third_party/boringssl/crypto/sha/sha256.cc +89 -0
  366. package/runtime/third_party/boringssl/crypto/sha/sha512.cc +106 -0
  367. package/runtime/third_party/boringssl/crypto/siphash/siphash.cc +81 -0
  368. package/runtime/third_party/boringssl/crypto/slhdsa/slhdsa.cc +167 -0
  369. package/runtime/third_party/boringssl/crypto/spake2plus/internal.h +204 -0
  370. package/runtime/third_party/boringssl/crypto/spake2plus/spake2plus.cc +501 -0
  371. package/runtime/third_party/boringssl/crypto/stack/stack.cc +462 -0
  372. package/runtime/third_party/boringssl/crypto/thread.cc +68 -0
  373. package/runtime/third_party/boringssl/crypto/thread_none.cc +48 -0
  374. package/runtime/third_party/boringssl/crypto/thread_pthread.cc +138 -0
  375. package/runtime/third_party/boringssl/crypto/thread_win.cc +227 -0
  376. package/runtime/third_party/boringssl/crypto/trust_token/internal.h +405 -0
  377. package/runtime/third_party/boringssl/crypto/trust_token/pmbtoken.cc +1672 -0
  378. package/runtime/third_party/boringssl/crypto/trust_token/trust_token.cc +701 -0
  379. package/runtime/third_party/boringssl/crypto/trust_token/voprf.cc +1266 -0
  380. package/runtime/third_party/boringssl/crypto/x509/a_digest.cc +52 -0
  381. package/runtime/third_party/boringssl/crypto/x509/a_sign.cc +100 -0
  382. package/runtime/third_party/boringssl/crypto/x509/a_verify.cc +77 -0
  383. package/runtime/third_party/boringssl/crypto/x509/algorithm.cc +167 -0
  384. package/runtime/third_party/boringssl/crypto/x509/asn1_gen.cc +540 -0
  385. package/runtime/third_party/boringssl/crypto/x509/by_dir.cc +301 -0
  386. package/runtime/third_party/boringssl/crypto/x509/by_file.cc +226 -0
  387. package/runtime/third_party/boringssl/crypto/x509/i2d_pr.cc +37 -0
  388. package/runtime/third_party/boringssl/crypto/x509/internal.h +697 -0
  389. package/runtime/third_party/boringssl/crypto/x509/name_print.cc +187 -0
  390. package/runtime/third_party/boringssl/crypto/x509/policy.cc +686 -0
  391. package/runtime/third_party/boringssl/crypto/x509/rsa_pss.cc +187 -0
  392. package/runtime/third_party/boringssl/crypto/x509/t_crl.cc +106 -0
  393. package/runtime/third_party/boringssl/crypto/x509/t_req.cc +206 -0
  394. package/runtime/third_party/boringssl/crypto/x509/t_x509.cc +292 -0
  395. package/runtime/third_party/boringssl/crypto/x509/t_x509a.cc +81 -0
  396. package/runtime/third_party/boringssl/crypto/x509/v3_akey.cc +174 -0
  397. package/runtime/third_party/boringssl/crypto/x509/v3_akeya.cc +31 -0
  398. package/runtime/third_party/boringssl/crypto/x509/v3_alt.cc +636 -0
  399. package/runtime/third_party/boringssl/crypto/x509/v3_bcons.cc +96 -0
  400. package/runtime/third_party/boringssl/crypto/x509/v3_bitst.cc +100 -0
  401. package/runtime/third_party/boringssl/crypto/x509/v3_conf.cc +369 -0
  402. package/runtime/third_party/boringssl/crypto/x509/v3_cpols.cc +417 -0
  403. package/runtime/third_party/boringssl/crypto/x509/v3_crld.cc +471 -0
  404. package/runtime/third_party/boringssl/crypto/x509/v3_enum.cc +74 -0
  405. package/runtime/third_party/boringssl/crypto/x509/v3_extku.cc +97 -0
  406. package/runtime/third_party/boringssl/crypto/x509/v3_genn.cc +238 -0
  407. package/runtime/third_party/boringssl/crypto/x509/v3_ia5.cc +83 -0
  408. package/runtime/third_party/boringssl/crypto/x509/v3_info.cc +162 -0
  409. package/runtime/third_party/boringssl/crypto/x509/v3_int.cc +83 -0
  410. package/runtime/third_party/boringssl/crypto/x509/v3_lib.cc +349 -0
  411. package/runtime/third_party/boringssl/crypto/x509/v3_ncons.cc +798 -0
  412. package/runtime/third_party/boringssl/crypto/x509/v3_ocsp.cc +92 -0
  413. package/runtime/third_party/boringssl/crypto/x509/v3_pcons.cc +102 -0
  414. package/runtime/third_party/boringssl/crypto/x509/v3_pmaps.cc +110 -0
  415. package/runtime/third_party/boringssl/crypto/x509/v3_prn.cc +183 -0
  416. package/runtime/third_party/boringssl/crypto/x509/v3_purp.cc +580 -0
  417. package/runtime/third_party/boringssl/crypto/x509/v3_skey.cc +128 -0
  418. package/runtime/third_party/boringssl/crypto/x509/v3_utl.cc +1311 -0
  419. package/runtime/third_party/boringssl/crypto/x509/x509.cc +47 -0
  420. package/runtime/third_party/boringssl/crypto/x509/x509_att.cc +188 -0
  421. package/runtime/third_party/boringssl/crypto/x509/x509_cmp.cc +243 -0
  422. package/runtime/third_party/boringssl/crypto/x509/x509_d2.cc +66 -0
  423. package/runtime/third_party/boringssl/crypto/x509/x509_def.cc +42 -0
  424. package/runtime/third_party/boringssl/crypto/x509/x509_ext.cc +161 -0
  425. package/runtime/third_party/boringssl/crypto/x509/x509_lu.cc +570 -0
  426. package/runtime/third_party/boringssl/crypto/x509/x509_mtc.cc +598 -0
  427. package/runtime/third_party/boringssl/crypto/x509/x509_obj.cc +169 -0
  428. package/runtime/third_party/boringssl/crypto/x509/x509_req.cc +248 -0
  429. package/runtime/third_party/boringssl/crypto/x509/x509_set.cc +166 -0
  430. package/runtime/third_party/boringssl/crypto/x509/x509_trs.cc +123 -0
  431. package/runtime/third_party/boringssl/crypto/x509/x509_txt.cc +147 -0
  432. package/runtime/third_party/boringssl/crypto/x509/x509_v3.cc +249 -0
  433. package/runtime/third_party/boringssl/crypto/x509/x509_vfy.cc +1531 -0
  434. package/runtime/third_party/boringssl/crypto/x509/x509_vpm.cc +449 -0
  435. package/runtime/third_party/boringssl/crypto/x509/x509cset.cc +222 -0
  436. package/runtime/third_party/boringssl/crypto/x509/x509name.cc +377 -0
  437. package/runtime/third_party/boringssl/crypto/x509/x509rset.cc +55 -0
  438. package/runtime/third_party/boringssl/crypto/x509/x509spki.cc +91 -0
  439. package/runtime/third_party/boringssl/crypto/x509/x_algor.cc +223 -0
  440. package/runtime/third_party/boringssl/crypto/x509/x_all.cc +352 -0
  441. package/runtime/third_party/boringssl/crypto/x509/x_attrib.cc +61 -0
  442. package/runtime/third_party/boringssl/crypto/x509/x_crl.cc +325 -0
  443. package/runtime/third_party/boringssl/crypto/x509/x_exten.cc +42 -0
  444. package/runtime/third_party/boringssl/crypto/x509/x_name.cc +407 -0
  445. package/runtime/third_party/boringssl/crypto/x509/x_pubkey.cc +199 -0
  446. package/runtime/third_party/boringssl/crypto/x509/x_req.cc +80 -0
  447. package/runtime/third_party/boringssl/crypto/x509/x_sig.cc +51 -0
  448. package/runtime/third_party/boringssl/crypto/x509/x_spki.cc +44 -0
  449. package/runtime/third_party/boringssl/crypto/x509/x_x509.cc +495 -0
  450. package/runtime/third_party/boringssl/crypto/x509/x_x509a.cc +169 -0
  451. package/runtime/third_party/boringssl/crypto/xwing/xwing.cc +257 -0
  452. package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx2-x86_64-apple.S +1326 -0
  453. package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx2-x86_64-linux.S +1327 -0
  454. package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx512-x86_64-apple.S +1252 -0
  455. package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx512-x86_64-linux.S +1253 -0
  456. package/runtime/third_party/boringssl/gen/bcm/aesni-gcm-x86_64-apple.S +873 -0
  457. package/runtime/third_party/boringssl/gen/bcm/aesni-gcm-x86_64-linux.S +885 -0
  458. package/runtime/third_party/boringssl/gen/bcm/aesni-x86-apple.S +2490 -0
  459. package/runtime/third_party/boringssl/gen/bcm/aesni-x86-linux.S +2530 -0
  460. package/runtime/third_party/boringssl/gen/bcm/aesni-x86_64-apple.S +2413 -0
  461. package/runtime/third_party/boringssl/gen/bcm/aesni-x86_64-linux.S +2397 -0
  462. package/runtime/third_party/boringssl/gen/bcm/aesv8-armv7-linux.S +784 -0
  463. package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-apple.S +792 -0
  464. package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-linux.S +786 -0
  465. package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-win.S +798 -0
  466. package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-apple.S +2912 -0
  467. package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-linux.S +2907 -0
  468. package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-win.S +2915 -0
  469. package/runtime/third_party/boringssl/gen/bcm/armv4-mont-linux.S +932 -0
  470. package/runtime/third_party/boringssl/gen/bcm/armv8-mont-apple.S +1440 -0
  471. package/runtime/third_party/boringssl/gen/bcm/armv8-mont-linux.S +1440 -0
  472. package/runtime/third_party/boringssl/gen/bcm/armv8-mont-win.S +1446 -0
  473. package/runtime/third_party/boringssl/gen/bcm/bn-586-apple.S +530 -0
  474. package/runtime/third_party/boringssl/gen/bcm/bn-586-linux.S +540 -0
  475. package/runtime/third_party/boringssl/gen/bcm/bn-armv8-apple.S +88 -0
  476. package/runtime/third_party/boringssl/gen/bcm/bn-armv8-linux.S +87 -0
  477. package/runtime/third_party/boringssl/gen/bcm/bn-armv8-win.S +87 -0
  478. package/runtime/third_party/boringssl/gen/bcm/bsaes-armv7-linux.S +1520 -0
  479. package/runtime/third_party/boringssl/gen/bcm/co-586-apple.S +1256 -0
  480. package/runtime/third_party/boringssl/gen/bcm/co-586-linux.S +1264 -0
  481. package/runtime/third_party/boringssl/gen/bcm/ghash-armv4-linux.S +242 -0
  482. package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-apple.S +337 -0
  483. package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-linux.S +335 -0
  484. package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-win.S +341 -0
  485. package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86-apple.S +288 -0
  486. package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86-linux.S +292 -0
  487. package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86_64-apple.S +426 -0
  488. package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86_64-linux.S +425 -0
  489. package/runtime/third_party/boringssl/gen/bcm/ghash-x86-apple.S +322 -0
  490. package/runtime/third_party/boringssl/gen/bcm/ghash-x86-linux.S +328 -0
  491. package/runtime/third_party/boringssl/gen/bcm/ghash-x86_64-apple.S +1134 -0
  492. package/runtime/third_party/boringssl/gen/bcm/ghash-x86_64-linux.S +1129 -0
  493. package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv7-linux.S +244 -0
  494. package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-apple.S +567 -0
  495. package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-linux.S +563 -0
  496. package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-win.S +571 -0
  497. package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-apple.S +1744 -0
  498. package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-linux.S +1725 -0
  499. package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-win.S +1765 -0
  500. package/runtime/third_party/boringssl/gen/bcm/p256-x86_64-asm-apple.S +4544 -0
  501. package/runtime/third_party/boringssl/gen/bcm/p256-x86_64-asm-linux.S +4600 -0
  502. package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-apple.S +310 -0
  503. package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-linux.S +310 -0
  504. package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-win.S +310 -0
  505. package/runtime/third_party/boringssl/gen/bcm/p256_beeu-x86_64-asm-apple.S +321 -0
  506. package/runtime/third_party/boringssl/gen/bcm/p256_beeu-x86_64-asm-linux.S +335 -0
  507. package/runtime/third_party/boringssl/gen/bcm/rdrand-x86_64-apple.S +58 -0
  508. package/runtime/third_party/boringssl/gen/bcm/rdrand-x86_64-linux.S +57 -0
  509. package/runtime/third_party/boringssl/gen/bcm/rsaz-avx2-apple.S +1756 -0
  510. package/runtime/third_party/boringssl/gen/bcm/rsaz-avx2-linux.S +1751 -0
  511. package/runtime/third_party/boringssl/gen/bcm/sha1-586-apple.S +3782 -0
  512. package/runtime/third_party/boringssl/gen/bcm/sha1-586-linux.S +3788 -0
  513. package/runtime/third_party/boringssl/gen/bcm/sha1-armv4-large-linux.S +1479 -0
  514. package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-apple.S +1219 -0
  515. package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-linux.S +1218 -0
  516. package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-win.S +1222 -0
  517. package/runtime/third_party/boringssl/gen/bcm/sha1-x86_64-apple.S +5454 -0
  518. package/runtime/third_party/boringssl/gen/bcm/sha1-x86_64-linux.S +5450 -0
  519. package/runtime/third_party/boringssl/gen/bcm/sha256-586-apple.S +5593 -0
  520. package/runtime/third_party/boringssl/gen/bcm/sha256-586-linux.S +5599 -0
  521. package/runtime/third_party/boringssl/gen/bcm/sha256-armv4-linux.S +2840 -0
  522. package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-apple.S +1195 -0
  523. package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-linux.S +1194 -0
  524. package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-win.S +1198 -0
  525. package/runtime/third_party/boringssl/gen/bcm/sha256-x86_64-apple.S +4173 -0
  526. package/runtime/third_party/boringssl/gen/bcm/sha256-x86_64-linux.S +4170 -0
  527. package/runtime/third_party/boringssl/gen/bcm/sha512-586-apple.S +2406 -0
  528. package/runtime/third_party/boringssl/gen/bcm/sha512-586-linux.S +2410 -0
  529. package/runtime/third_party/boringssl/gen/bcm/sha512-armv4-linux.S +1857 -0
  530. package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-apple.S +1598 -0
  531. package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-linux.S +1597 -0
  532. package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-win.S +1601 -0
  533. package/runtime/third_party/boringssl/gen/bcm/sha512-x86_64-apple.S +2979 -0
  534. package/runtime/third_party/boringssl/gen/bcm/sha512-x86_64-linux.S +2978 -0
  535. package/runtime/third_party/boringssl/gen/bcm/vpaes-armv7-linux.S +1225 -0
  536. package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-apple.S +1238 -0
  537. package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-linux.S +1220 -0
  538. package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-win.S +1256 -0
  539. package/runtime/third_party/boringssl/gen/bcm/vpaes-x86-apple.S +680 -0
  540. package/runtime/third_party/boringssl/gen/bcm/vpaes-x86-linux.S +706 -0
  541. package/runtime/third_party/boringssl/gen/bcm/vpaes-x86_64-apple.S +1146 -0
  542. package/runtime/third_party/boringssl/gen/bcm/vpaes-x86_64-linux.S +1133 -0
  543. package/runtime/third_party/boringssl/gen/bcm/x86-mont-apple.S +216 -0
  544. package/runtime/third_party/boringssl/gen/bcm/x86-mont-linux.S +218 -0
  545. package/runtime/third_party/boringssl/gen/bcm/x86_64-mont-apple.S +1238 -0
  546. package/runtime/third_party/boringssl/gen/bcm/x86_64-mont-linux.S +1237 -0
  547. package/runtime/third_party/boringssl/gen/bcm/x86_64-mont5-apple.S +3644 -0
  548. package/runtime/third_party/boringssl/gen/bcm/x86_64-mont5-linux.S +3628 -0
  549. package/runtime/third_party/boringssl/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +325 -0
  550. package/runtime/third_party/boringssl/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +325 -0
  551. package/runtime/third_party/boringssl/gen/crypto/aes128gcmsiv-x86_64-apple.S +3113 -0
  552. package/runtime/third_party/boringssl/gen/crypto/aes128gcmsiv-x86_64-linux.S +3091 -0
  553. package/runtime/third_party/boringssl/gen/crypto/chacha-armv4-linux.S +1450 -0
  554. package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-apple.S +1969 -0
  555. package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-linux.S +1967 -0
  556. package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-win.S +1973 -0
  557. package/runtime/third_party/boringssl/gen/crypto/chacha-x86-apple.S +957 -0
  558. package/runtime/third_party/boringssl/gen/crypto/chacha-x86-linux.S +961 -0
  559. package/runtime/third_party/boringssl/gen/crypto/chacha-x86_64-apple.S +1608 -0
  560. package/runtime/third_party/boringssl/gen/crypto/chacha-x86_64-linux.S +1611 -0
  561. package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-apple.S +3010 -0
  562. package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-linux.S +3008 -0
  563. package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-win.S +3014 -0
  564. package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_x86_64-apple.S +8903 -0
  565. package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_x86_64-linux.S +8940 -0
  566. package/runtime/third_party/boringssl/gen/crypto/err_data.cc +1578 -0
  567. package/runtime/third_party/boringssl/gen/crypto/md5-586-apple.S +684 -0
  568. package/runtime/third_party/boringssl/gen/crypto/md5-586-linux.S +686 -0
  569. package/runtime/third_party/boringssl/gen/crypto/md5-x86_64-apple.S +690 -0
  570. package/runtime/third_party/boringssl/gen/crypto/md5-x86_64-linux.S +695 -0
  571. package/runtime/third_party/boringssl/include/openssl/aead.h +650 -0
  572. package/runtime/third_party/boringssl/include/openssl/aes.h +173 -0
  573. package/runtime/third_party/boringssl/include/openssl/arm_arch.h +24 -0
  574. package/runtime/third_party/boringssl/include/openssl/asm_base.h +219 -0
  575. package/runtime/third_party/boringssl/include/openssl/asn1.h +2002 -0
  576. package/runtime/third_party/boringssl/include/openssl/asn1_mac.h +18 -0
  577. package/runtime/third_party/boringssl/include/openssl/asn1t.h +584 -0
  578. package/runtime/third_party/boringssl/include/openssl/base.h +548 -0
  579. package/runtime/third_party/boringssl/include/openssl/base64.h +156 -0
  580. package/runtime/third_party/boringssl/include/openssl/bio.h +1061 -0
  581. package/runtime/third_party/boringssl/include/openssl/blake2.h +63 -0
  582. package/runtime/third_party/boringssl/include/openssl/blowfish.h +58 -0
  583. package/runtime/third_party/boringssl/include/openssl/bn.h +986 -0
  584. package/runtime/third_party/boringssl/include/openssl/buf.h +95 -0
  585. package/runtime/third_party/boringssl/include/openssl/buffer.h +18 -0
  586. package/runtime/third_party/boringssl/include/openssl/bytestring.h +798 -0
  587. package/runtime/third_party/boringssl/include/openssl/cast.h +91 -0
  588. package/runtime/third_party/boringssl/include/openssl/chacha.h +47 -0
  589. package/runtime/third_party/boringssl/include/openssl/cipher.h +819 -0
  590. package/runtime/third_party/boringssl/include/openssl/cmac.h +91 -0
  591. package/runtime/third_party/boringssl/include/openssl/cms.h +147 -0
  592. package/runtime/third_party/boringssl/include/openssl/conf.h +136 -0
  593. package/runtime/third_party/boringssl/include/openssl/configuration.h +18 -0
  594. package/runtime/third_party/boringssl/include/openssl/cpu.h +18 -0
  595. package/runtime/third_party/boringssl/include/openssl/crypto.h +235 -0
  596. package/runtime/third_party/boringssl/include/openssl/ctrdrbg.h +116 -0
  597. package/runtime/third_party/boringssl/include/openssl/curve25519.h +309 -0
  598. package/runtime/third_party/boringssl/include/openssl/des.h +134 -0
  599. package/runtime/third_party/boringssl/include/openssl/dh.h +336 -0
  600. package/runtime/third_party/boringssl/include/openssl/digest.h +399 -0
  601. package/runtime/third_party/boringssl/include/openssl/dsa.h +392 -0
  602. package/runtime/third_party/boringssl/include/openssl/dtls1.h +16 -0
  603. package/runtime/third_party/boringssl/include/openssl/e_os2.h +18 -0
  604. package/runtime/third_party/boringssl/include/openssl/ec.h +530 -0
  605. package/runtime/third_party/boringssl/include/openssl/ec_key.h +358 -0
  606. package/runtime/third_party/boringssl/include/openssl/ecdh.h +67 -0
  607. package/runtime/third_party/boringssl/include/openssl/ecdsa.h +242 -0
  608. package/runtime/third_party/boringssl/include/openssl/engine.h +109 -0
  609. package/runtime/third_party/boringssl/include/openssl/err.h +416 -0
  610. package/runtime/third_party/boringssl/include/openssl/evp.h +1645 -0
  611. package/runtime/third_party/boringssl/include/openssl/evp_errors.h +66 -0
  612. package/runtime/third_party/boringssl/include/openssl/ex_data.h +117 -0
  613. package/runtime/third_party/boringssl/include/openssl/hkdf.h +68 -0
  614. package/runtime/third_party/boringssl/include/openssl/hmac.h +151 -0
  615. package/runtime/third_party/boringssl/include/openssl/hpke.h +456 -0
  616. package/runtime/third_party/boringssl/include/openssl/hrss.h +108 -0
  617. package/runtime/third_party/boringssl/include/openssl/is_boringssl.h +16 -0
  618. package/runtime/third_party/boringssl/include/openssl/kdf.h +92 -0
  619. package/runtime/third_party/boringssl/include/openssl/lhash.h +18 -0
  620. package/runtime/third_party/boringssl/include/openssl/md4.h +73 -0
  621. package/runtime/third_party/boringssl/include/openssl/md5.h +67 -0
  622. package/runtime/third_party/boringssl/include/openssl/mem.h +215 -0
  623. package/runtime/third_party/boringssl/include/openssl/mldsa.h +486 -0
  624. package/runtime/third_party/boringssl/include/openssl/mlkem.h +222 -0
  625. package/runtime/third_party/boringssl/include/openssl/nid.h +5561 -0
  626. package/runtime/third_party/boringssl/include/openssl/obj.h +225 -0
  627. package/runtime/third_party/boringssl/include/openssl/obj_mac.h +18 -0
  628. package/runtime/third_party/boringssl/include/openssl/objects.h +18 -0
  629. package/runtime/third_party/boringssl/include/openssl/opensslconf.h +108 -0
  630. package/runtime/third_party/boringssl/include/openssl/opensslv.h +18 -0
  631. package/runtime/third_party/boringssl/include/openssl/ossl_typ.h +18 -0
  632. package/runtime/third_party/boringssl/include/openssl/params.h +42 -0
  633. package/runtime/third_party/boringssl/include/openssl/pem.h +769 -0
  634. package/runtime/third_party/boringssl/include/openssl/pkcs12.h +18 -0
  635. package/runtime/third_party/boringssl/include/openssl/pkcs7.h +239 -0
  636. package/runtime/third_party/boringssl/include/openssl/pkcs8.h +267 -0
  637. package/runtime/third_party/boringssl/include/openssl/poly1305.h +52 -0
  638. package/runtime/third_party/boringssl/include/openssl/pool.h +137 -0
  639. package/runtime/third_party/boringssl/include/openssl/posix_time.h +51 -0
  640. package/runtime/third_party/boringssl/include/openssl/prefix_symbols.h +8000 -0
  641. package/runtime/third_party/boringssl/include/openssl/prefix_symbols_internal_S.h +633 -0
  642. package/runtime/third_party/boringssl/include/openssl/prefix_symbols_internal_c.h +329 -0
  643. package/runtime/third_party/boringssl/include/openssl/rand.h +138 -0
  644. package/runtime/third_party/boringssl/include/openssl/rc4.h +54 -0
  645. package/runtime/third_party/boringssl/include/openssl/ripemd.h +71 -0
  646. package/runtime/third_party/boringssl/include/openssl/rsa.h +893 -0
  647. package/runtime/third_party/boringssl/include/openssl/safestack.h +16 -0
  648. package/runtime/third_party/boringssl/include/openssl/service_indicator.h +19 -0
  649. package/runtime/third_party/boringssl/include/openssl/sha.h +108 -0
  650. package/runtime/third_party/boringssl/include/openssl/sha2.h +201 -0
  651. package/runtime/third_party/boringssl/include/openssl/siphash.h +37 -0
  652. package/runtime/third_party/boringssl/include/openssl/slhdsa.h +250 -0
  653. package/runtime/third_party/boringssl/include/openssl/span.h +376 -0
  654. package/runtime/third_party/boringssl/include/openssl/srtp.h +18 -0
  655. package/runtime/third_party/boringssl/include/openssl/ssl.h +7211 -0
  656. package/runtime/third_party/boringssl/include/openssl/ssl3.h +171 -0
  657. package/runtime/third_party/boringssl/include/openssl/stack.h +688 -0
  658. package/runtime/third_party/boringssl/include/openssl/target.h +246 -0
  659. package/runtime/third_party/boringssl/include/openssl/thread.h +114 -0
  660. package/runtime/third_party/boringssl/include/openssl/time.h +22 -0
  661. package/runtime/third_party/boringssl/include/openssl/tls1.h +263 -0
  662. package/runtime/third_party/boringssl/include/openssl/tls_prf.h +47 -0
  663. package/runtime/third_party/boringssl/include/openssl/trust_token.h +349 -0
  664. package/runtime/third_party/boringssl/include/openssl/type_check.h +37 -0
  665. package/runtime/third_party/boringssl/include/openssl/types.h +18 -0
  666. package/runtime/third_party/boringssl/include/openssl/x509.h +5404 -0
  667. package/runtime/third_party/boringssl/include/openssl/x509_vfy.h +18 -0
  668. package/runtime/third_party/boringssl/include/openssl/x509v3.h +63 -0
  669. package/runtime/third_party/boringssl/include/openssl/x509v3_errors.h +84 -0
  670. package/runtime/third_party/boringssl/include/openssl/xwing.h +115 -0
  671. package/runtime/third_party/boringssl/sources.json +696 -0
  672. package/runtime/third_party/boringssl/ssl/bio_ssl.cc +196 -0
  673. package/runtime/third_party/boringssl/ssl/d1_both.cc +1137 -0
  674. package/runtime/third_party/boringssl/ssl/d1_lib.cc +245 -0
  675. package/runtime/third_party/boringssl/ssl/d1_pkt.cc +322 -0
  676. package/runtime/third_party/boringssl/ssl/d1_srtp.cc +128 -0
  677. package/runtime/third_party/boringssl/ssl/dtls_method.cc +216 -0
  678. package/runtime/third_party/boringssl/ssl/dtls_record.cc +586 -0
  679. package/runtime/third_party/boringssl/ssl/encrypted_client_hello.cc +1110 -0
  680. package/runtime/third_party/boringssl/ssl/extensions.cc +5368 -0
  681. package/runtime/third_party/boringssl/ssl/handoff.cc +625 -0
  682. package/runtime/third_party/boringssl/ssl/handshake.cc +694 -0
  683. package/runtime/third_party/boringssl/ssl/handshake_client.cc +1958 -0
  684. package/runtime/third_party/boringssl/ssl/handshake_server.cc +1875 -0
  685. package/runtime/third_party/boringssl/ssl/internal.h +4506 -0
  686. package/runtime/third_party/boringssl/ssl/s3_both.cc +555 -0
  687. package/runtime/third_party/boringssl/ssl/s3_lib.cc +88 -0
  688. package/runtime/third_party/boringssl/ssl/s3_pkt.cc +396 -0
  689. package/runtime/third_party/boringssl/ssl/ssl_aead_ctx.cc +416 -0
  690. package/runtime/third_party/boringssl/ssl/ssl_asn1.cc +851 -0
  691. package/runtime/third_party/boringssl/ssl/ssl_buffer.cc +304 -0
  692. package/runtime/third_party/boringssl/ssl/ssl_cert.cc +723 -0
  693. package/runtime/third_party/boringssl/ssl/ssl_cipher.cc +1762 -0
  694. package/runtime/third_party/boringssl/ssl/ssl_credential.cc +913 -0
  695. package/runtime/third_party/boringssl/ssl/ssl_file.cc +375 -0
  696. package/runtime/third_party/boringssl/ssl/ssl_key_share.cc +445 -0
  697. package/runtime/third_party/boringssl/ssl/ssl_lib.cc +4132 -0
  698. package/runtime/third_party/boringssl/ssl/ssl_privkey.cc +973 -0
  699. package/runtime/third_party/boringssl/ssl/ssl_session.cc +1273 -0
  700. package/runtime/third_party/boringssl/ssl/ssl_stat.cc +162 -0
  701. package/runtime/third_party/boringssl/ssl/ssl_transcript.cc +224 -0
  702. package/runtime/third_party/boringssl/ssl/ssl_versions.cc +436 -0
  703. package/runtime/third_party/boringssl/ssl/ssl_x509.cc +1229 -0
  704. package/runtime/third_party/boringssl/ssl/t1_enc.cc +266 -0
  705. package/runtime/third_party/boringssl/ssl/tls13_both.cc +764 -0
  706. package/runtime/third_party/boringssl/ssl/tls13_client.cc +1325 -0
  707. package/runtime/third_party/boringssl/ssl/tls13_enc.cc +746 -0
  708. package/runtime/third_party/boringssl/ssl/tls13_server.cc +1623 -0
  709. package/runtime/third_party/boringssl/ssl/tls_method.cc +266 -0
  710. package/runtime/third_party/boringssl/ssl/tls_record.cc +524 -0
  711. package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_curve25519_adx_mul.S +178 -0
  712. package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_curve25519_adx_square.S +146 -0
  713. package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_p256_adx_mul.S +177 -0
  714. package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_p256_adx_sqr.S +166 -0
  715. package/runtime/third_party/boringssl/third_party/fiat/bedrock_unverified_bareminimum.c.inc +47 -0
  716. package/runtime/third_party/boringssl/third_party/fiat/bedrock_unverified_platform.c.inc +137 -0
  717. package/runtime/third_party/boringssl/third_party/fiat/curve25519_32.h +1571 -0
  718. package/runtime/third_party/boringssl/third_party/fiat/curve25519_64.h +978 -0
  719. package/runtime/third_party/boringssl/third_party/fiat/curve25519_64_adx.h +700 -0
  720. package/runtime/third_party/boringssl/third_party/fiat/curve25519_64_msvc.h +1281 -0
  721. package/runtime/third_party/boringssl/third_party/fiat/p256_32.h +4760 -0
  722. package/runtime/third_party/boringssl/third_party/fiat/p256_64.h +1984 -0
  723. package/runtime/third_party/boringssl/third_party/fiat/p256_64_msvc.h +1939 -0
  724. package/runtime/third_party/boringssl/third_party/fiat/p256_field.c.inc +26 -0
  725. package/runtime/third_party/boringssl/third_party/fiat/p256_field_32.br.c.inc +71 -0
  726. package/runtime/third_party/boringssl/third_party/fiat/p256_field_64.br.c.inc +84 -0
  727. package/runtime/third_party/boringssl/third_party/fiat/p256_point.br.c.inc +112 -0
  728. package/runtime/third_party/v8-ieee754/README.md +2 -1
  729. package/runtime/third_party/v8-ieee754/convert.py +4 -0
  730. package/runtime/third_party/v8-ieee754/ieee754.c +1 -1
  731. package/runtime/third_party/bearssl/LICENSE.txt +0 -21
  732. package/runtime/third_party/bearssl/README.txt +0 -136
  733. package/runtime/third_party/bearssl/VERSION +0 -1
  734. package/runtime/third_party/bearssl/inc/bearssl.h +0 -183
  735. package/runtime/third_party/bearssl/inc/bearssl_aead.h +0 -1059
  736. package/runtime/third_party/bearssl/inc/bearssl_block.h +0 -2618
  737. package/runtime/third_party/bearssl/inc/bearssl_ec.h +0 -967
  738. package/runtime/third_party/bearssl/inc/bearssl_hash.h +0 -1346
  739. package/runtime/third_party/bearssl/inc/bearssl_hmac.h +0 -241
  740. package/runtime/third_party/bearssl/inc/bearssl_kdf.h +0 -284
  741. package/runtime/third_party/bearssl/inc/bearssl_pem.h +0 -294
  742. package/runtime/third_party/bearssl/inc/bearssl_prf.h +0 -150
  743. package/runtime/third_party/bearssl/inc/bearssl_rand.h +0 -397
  744. package/runtime/third_party/bearssl/inc/bearssl_rsa.h +0 -1655
  745. package/runtime/third_party/bearssl/inc/bearssl_ssl.h +0 -4296
  746. package/runtime/third_party/bearssl/inc/bearssl_x509.h +0 -1474
  747. package/runtime/third_party/bearssl/src/aead/ccm.c +0 -346
  748. package/runtime/third_party/bearssl/src/aead/eax.c +0 -525
  749. package/runtime/third_party/bearssl/src/aead/gcm.c +0 -318
  750. package/runtime/third_party/bearssl/src/codec/ccopy.c +0 -44
  751. package/runtime/third_party/bearssl/src/codec/dec16be.c +0 -38
  752. package/runtime/third_party/bearssl/src/codec/dec16le.c +0 -38
  753. package/runtime/third_party/bearssl/src/codec/dec32be.c +0 -38
  754. package/runtime/third_party/bearssl/src/codec/dec32le.c +0 -38
  755. package/runtime/third_party/bearssl/src/codec/dec64be.c +0 -38
  756. package/runtime/third_party/bearssl/src/codec/dec64le.c +0 -38
  757. package/runtime/third_party/bearssl/src/codec/enc16be.c +0 -38
  758. package/runtime/third_party/bearssl/src/codec/enc16le.c +0 -38
  759. package/runtime/third_party/bearssl/src/codec/enc32be.c +0 -38
  760. package/runtime/third_party/bearssl/src/codec/enc32le.c +0 -38
  761. package/runtime/third_party/bearssl/src/codec/enc64be.c +0 -38
  762. package/runtime/third_party/bearssl/src/codec/enc64le.c +0 -38
  763. package/runtime/third_party/bearssl/src/codec/pemdec.c +0 -526
  764. package/runtime/third_party/bearssl/src/codec/pemdec.t0 +0 -314
  765. package/runtime/third_party/bearssl/src/codec/pemenc.c +0 -173
  766. package/runtime/third_party/bearssl/src/config.h +0 -247
  767. package/runtime/third_party/bearssl/src/ec/ec_all_m15.c +0 -121
  768. package/runtime/third_party/bearssl/src/ec/ec_all_m31.c +0 -171
  769. package/runtime/third_party/bearssl/src/ec/ec_c25519_i15.c +0 -398
  770. package/runtime/third_party/bearssl/src/ec/ec_c25519_i31.c +0 -390
  771. package/runtime/third_party/bearssl/src/ec/ec_c25519_m15.c +0 -1478
  772. package/runtime/third_party/bearssl/src/ec/ec_c25519_m31.c +0 -800
  773. package/runtime/third_party/bearssl/src/ec/ec_c25519_m62.c +0 -605
  774. package/runtime/third_party/bearssl/src/ec/ec_c25519_m64.c +0 -831
  775. package/runtime/third_party/bearssl/src/ec/ec_curve25519.c +0 -46
  776. package/runtime/third_party/bearssl/src/ec/ec_default.c +0 -36
  777. package/runtime/third_party/bearssl/src/ec/ec_keygen.c +0 -86
  778. package/runtime/third_party/bearssl/src/ec/ec_p256_m15.c +0 -2124
  779. package/runtime/third_party/bearssl/src/ec/ec_p256_m31.c +0 -1469
  780. package/runtime/third_party/bearssl/src/ec/ec_p256_m62.c +0 -1765
  781. package/runtime/third_party/bearssl/src/ec/ec_p256_m64.c +0 -1781
  782. package/runtime/third_party/bearssl/src/ec/ec_prime_i15.c +0 -824
  783. package/runtime/third_party/bearssl/src/ec/ec_prime_i31.c +0 -826
  784. package/runtime/third_party/bearssl/src/ec/ec_pubkey.c +0 -85
  785. package/runtime/third_party/bearssl/src/ec/ec_secp256r1.c +0 -51
  786. package/runtime/third_party/bearssl/src/ec/ec_secp384r1.c +0 -57
  787. package/runtime/third_party/bearssl/src/ec/ec_secp521r1.c +0 -64
  788. package/runtime/third_party/bearssl/src/ec/ecdsa_atr.c +0 -134
  789. package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_asn1.c +0 -36
  790. package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_raw.c +0 -36
  791. package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_asn1.c +0 -36
  792. package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_raw.c +0 -36
  793. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_bits.c +0 -47
  794. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_asn1.c +0 -45
  795. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_raw.c +0 -174
  796. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_asn1.c +0 -48
  797. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_raw.c +0 -166
  798. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_bits.c +0 -47
  799. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_asn1.c +0 -45
  800. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_raw.c +0 -173
  801. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_asn1.c +0 -48
  802. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_raw.c +0 -165
  803. package/runtime/third_party/bearssl/src/ec/ecdsa_rta.c +0 -121
  804. package/runtime/third_party/bearssl/src/hash/dig_oid.c +0 -84
  805. package/runtime/third_party/bearssl/src/hash/dig_size.c +0 -50
  806. package/runtime/third_party/bearssl/src/hash/ghash_ctmul.c +0 -345
  807. package/runtime/third_party/bearssl/src/hash/ghash_ctmul32.c +0 -251
  808. package/runtime/third_party/bearssl/src/hash/ghash_ctmul64.c +0 -154
  809. package/runtime/third_party/bearssl/src/hash/ghash_pclmul.c +0 -389
  810. package/runtime/third_party/bearssl/src/hash/ghash_pwr8.c +0 -411
  811. package/runtime/third_party/bearssl/src/hash/md5.c +0 -208
  812. package/runtime/third_party/bearssl/src/hash/md5sha1.c +0 -141
  813. package/runtime/third_party/bearssl/src/hash/mgf1.c +0 -56
  814. package/runtime/third_party/bearssl/src/hash/multihash.c +0 -166
  815. package/runtime/third_party/bearssl/src/hash/sha1.c +0 -191
  816. package/runtime/third_party/bearssl/src/hash/sha2big.c +0 -285
  817. package/runtime/third_party/bearssl/src/hash/sha2small.c +0 -341
  818. package/runtime/third_party/bearssl/src/inner.h +0 -2577
  819. package/runtime/third_party/bearssl/src/int/i15_add.c +0 -46
  820. package/runtime/third_party/bearssl/src/int/i15_bitlen.c +0 -44
  821. package/runtime/third_party/bearssl/src/int/i15_decmod.c +0 -124
  822. package/runtime/third_party/bearssl/src/int/i15_decode.c +0 -56
  823. package/runtime/third_party/bearssl/src/int/i15_decred.c +0 -100
  824. package/runtime/third_party/bearssl/src/int/i15_encode.c +0 -56
  825. package/runtime/third_party/bearssl/src/int/i15_fmont.c +0 -59
  826. package/runtime/third_party/bearssl/src/int/i15_iszero.c +0 -39
  827. package/runtime/third_party/bearssl/src/int/i15_moddiv.c +0 -465
  828. package/runtime/third_party/bearssl/src/int/i15_modpow.c +0 -50
  829. package/runtime/third_party/bearssl/src/int/i15_modpow2.c +0 -160
  830. package/runtime/third_party/bearssl/src/int/i15_montmul.c +0 -184
  831. package/runtime/third_party/bearssl/src/int/i15_mulacc.c +0 -61
  832. package/runtime/third_party/bearssl/src/int/i15_muladd.c +0 -173
  833. package/runtime/third_party/bearssl/src/int/i15_ninv15.c +0 -38
  834. package/runtime/third_party/bearssl/src/int/i15_reduce.c +0 -66
  835. package/runtime/third_party/bearssl/src/int/i15_rshift.c +0 -47
  836. package/runtime/third_party/bearssl/src/int/i15_sub.c +0 -46
  837. package/runtime/third_party/bearssl/src/int/i15_tmont.c +0 -36
  838. package/runtime/third_party/bearssl/src/int/i31_add.c +0 -46
  839. package/runtime/third_party/bearssl/src/int/i31_bitlen.c +0 -44
  840. package/runtime/third_party/bearssl/src/int/i31_decmod.c +0 -124
  841. package/runtime/third_party/bearssl/src/int/i31_decode.c +0 -57
  842. package/runtime/third_party/bearssl/src/int/i31_decred.c +0 -103
  843. package/runtime/third_party/bearssl/src/int/i31_encode.c +0 -79
  844. package/runtime/third_party/bearssl/src/int/i31_fmont.c +0 -60
  845. package/runtime/third_party/bearssl/src/int/i31_iszero.c +0 -39
  846. package/runtime/third_party/bearssl/src/int/i31_moddiv.c +0 -488
  847. package/runtime/third_party/bearssl/src/int/i31_modpow.c +0 -65
  848. package/runtime/third_party/bearssl/src/int/i31_modpow2.c +0 -160
  849. package/runtime/third_party/bearssl/src/int/i31_montmul.c +0 -127
  850. package/runtime/third_party/bearssl/src/int/i31_mulacc.c +0 -74
  851. package/runtime/third_party/bearssl/src/int/i31_muladd.c +0 -157
  852. package/runtime/third_party/bearssl/src/int/i31_ninv31.c +0 -39
  853. package/runtime/third_party/bearssl/src/int/i31_reduce.c +0 -66
  854. package/runtime/third_party/bearssl/src/int/i31_rshift.c +0 -47
  855. package/runtime/third_party/bearssl/src/int/i31_sub.c +0 -46
  856. package/runtime/third_party/bearssl/src/int/i31_tmont.c +0 -36
  857. package/runtime/third_party/bearssl/src/int/i32_add.c +0 -51
  858. package/runtime/third_party/bearssl/src/int/i32_bitlen.c +0 -44
  859. package/runtime/third_party/bearssl/src/int/i32_decmod.c +0 -77
  860. package/runtime/third_party/bearssl/src/int/i32_decode.c +0 -63
  861. package/runtime/third_party/bearssl/src/int/i32_decred.c +0 -107
  862. package/runtime/third_party/bearssl/src/int/i32_div32.c +0 -56
  863. package/runtime/third_party/bearssl/src/int/i32_encode.c +0 -72
  864. package/runtime/third_party/bearssl/src/int/i32_fmont.c +0 -60
  865. package/runtime/third_party/bearssl/src/int/i32_iszero.c +0 -39
  866. package/runtime/third_party/bearssl/src/int/i32_modpow.c +0 -65
  867. package/runtime/third_party/bearssl/src/int/i32_montmul.c +0 -69
  868. package/runtime/third_party/bearssl/src/int/i32_mulacc.c +0 -56
  869. package/runtime/third_party/bearssl/src/int/i32_muladd.c +0 -138
  870. package/runtime/third_party/bearssl/src/int/i32_ninv32.c +0 -39
  871. package/runtime/third_party/bearssl/src/int/i32_reduce.c +0 -66
  872. package/runtime/third_party/bearssl/src/int/i32_sub.c +0 -51
  873. package/runtime/third_party/bearssl/src/int/i32_tmont.c +0 -36
  874. package/runtime/third_party/bearssl/src/int/i62_modpow2.c +0 -493
  875. package/runtime/third_party/bearssl/src/kdf/hkdf.c +0 -107
  876. package/runtime/third_party/bearssl/src/kdf/shake.c +0 -590
  877. package/runtime/third_party/bearssl/src/mac/hmac.c +0 -122
  878. package/runtime/third_party/bearssl/src/mac/hmac_ct.c +0 -193
  879. package/runtime/third_party/bearssl/src/rand/aesctr_drbg.c +0 -206
  880. package/runtime/third_party/bearssl/src/rand/hmac_drbg.c +0 -157
  881. package/runtime/third_party/bearssl/src/rand/sysrng.c +0 -252
  882. package/runtime/third_party/bearssl/src/rsa/rsa_default_keygen.c +0 -38
  883. package/runtime/third_party/bearssl/src/rsa/rsa_default_modulus.c +0 -36
  884. package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_decrypt.c +0 -38
  885. package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_encrypt.c +0 -38
  886. package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_sign.c +0 -38
  887. package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_vrfy.c +0 -38
  888. package/runtime/third_party/bearssl/src/rsa/rsa_default_priv.c +0 -38
  889. package/runtime/third_party/bearssl/src/rsa/rsa_default_privexp.c +0 -36
  890. package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_sign.c +0 -38
  891. package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_vrfy.c +0 -38
  892. package/runtime/third_party/bearssl/src/rsa/rsa_default_pub.c +0 -38
  893. package/runtime/third_party/bearssl/src/rsa/rsa_default_pubexp.c +0 -36
  894. package/runtime/third_party/bearssl/src/rsa/rsa_i15_keygen.c +0 -583
  895. package/runtime/third_party/bearssl/src/rsa/rsa_i15_modulus.c +0 -99
  896. package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_decrypt.c +0 -41
  897. package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_encrypt.c +0 -44
  898. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_sign.c +0 -37
  899. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_vrfy.c +0 -43
  900. package/runtime/third_party/bearssl/src/rsa/rsa_i15_priv.c +0 -209
  901. package/runtime/third_party/bearssl/src/rsa/rsa_i15_privexp.c +0 -320
  902. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_sign.c +0 -40
  903. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_vrfy.c +0 -44
  904. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pub.c +0 -113
  905. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pubexp.c +0 -152
  906. package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen.c +0 -37
  907. package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen_inner.c +0 -608
  908. package/runtime/third_party/bearssl/src/rsa/rsa_i31_modulus.c +0 -99
  909. package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_decrypt.c +0 -41
  910. package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_encrypt.c +0 -44
  911. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_sign.c +0 -37
  912. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_vrfy.c +0 -43
  913. package/runtime/third_party/bearssl/src/rsa/rsa_i31_priv.c +0 -203
  914. package/runtime/third_party/bearssl/src/rsa/rsa_i31_privexp.c +0 -318
  915. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_sign.c +0 -40
  916. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_vrfy.c +0 -44
  917. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pub.c +0 -106
  918. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pubexp.c +0 -152
  919. package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_decrypt.c +0 -41
  920. package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_encrypt.c +0 -44
  921. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_sign.c +0 -37
  922. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_vrfy.c +0 -43
  923. package/runtime/third_party/bearssl/src/rsa/rsa_i32_priv.c +0 -160
  924. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_sign.c +0 -40
  925. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_vrfy.c +0 -44
  926. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pub.c +0 -77
  927. package/runtime/third_party/bearssl/src/rsa/rsa_i62_keygen.c +0 -57
  928. package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_decrypt.c +0 -61
  929. package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_encrypt.c +0 -64
  930. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_sign.c +0 -57
  931. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_vrfy.c +0 -63
  932. package/runtime/third_party/bearssl/src/rsa/rsa_i62_priv.c +0 -223
  933. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_sign.c +0 -60
  934. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_vrfy.c +0 -64
  935. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pub.c +0 -125
  936. package/runtime/third_party/bearssl/src/rsa/rsa_oaep_pad.c +0 -112
  937. package/runtime/third_party/bearssl/src/rsa/rsa_oaep_unpad.c +0 -145
  938. package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_pad.c +0 -100
  939. package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_unpad.c +0 -121
  940. package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_pad.c +0 -106
  941. package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_unpad.c +0 -121
  942. package/runtime/third_party/bearssl/src/rsa/rsa_ssl_decrypt.c +0 -52
  943. package/runtime/third_party/bearssl/src/settings.c +0 -306
  944. package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcdec.c +0 -69
  945. package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcenc.c +0 -67
  946. package/runtime/third_party/bearssl/src/symcipher/aes_big_ctr.c +0 -84
  947. package/runtime/third_party/bearssl/src/symcipher/aes_big_ctrcbc.c +0 -142
  948. package/runtime/third_party/bearssl/src/symcipher/aes_big_dec.c +0 -254
  949. package/runtime/third_party/bearssl/src/symcipher/aes_big_enc.c +0 -157
  950. package/runtime/third_party/bearssl/src/symcipher/aes_common.c +0 -112
  951. package/runtime/third_party/bearssl/src/symcipher/aes_ct.c +0 -328
  952. package/runtime/third_party/bearssl/src/symcipher/aes_ct64.c +0 -398
  953. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcdec.c +0 -104
  954. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcenc.c +0 -81
  955. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctr.c +0 -114
  956. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctrcbc.c +0 -433
  957. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_dec.c +0 -159
  958. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_enc.c +0 -115
  959. package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcdec.c +0 -111
  960. package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcenc.c +0 -91
  961. package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctr.c +0 -116
  962. package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctrcbc.c +0 -422
  963. package/runtime/third_party/bearssl/src/symcipher/aes_ct_dec.c +0 -170
  964. package/runtime/third_party/bearssl/src/symcipher/aes_ct_enc.c +0 -112
  965. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8.c +0 -445
  966. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcdec.c +0 -670
  967. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcenc.c +0 -417
  968. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctr.c +0 -717
  969. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctrcbc.c +0 -946
  970. package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcdec.c +0 -69
  971. package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcenc.c +0 -67
  972. package/runtime/third_party/bearssl/src/symcipher/aes_small_ctr.c +0 -84
  973. package/runtime/third_party/bearssl/src/symcipher/aes_small_ctrcbc.c +0 -142
  974. package/runtime/third_party/bearssl/src/symcipher/aes_small_dec.c +0 -176
  975. package/runtime/third_party/bearssl/src/symcipher/aes_small_enc.c +0 -129
  976. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni.c +0 -240
  977. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcdec.c +0 -223
  978. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcenc.c +0 -122
  979. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctr.c +0 -211
  980. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctrcbc.c +0 -596
  981. package/runtime/third_party/bearssl/src/symcipher/chacha20_ct.c +0 -106
  982. package/runtime/third_party/bearssl/src/symcipher/chacha20_sse2.c +0 -237
  983. package/runtime/third_party/bearssl/src/symcipher/des_ct.c +0 -411
  984. package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcdec.c +0 -87
  985. package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcenc.c +0 -69
  986. package/runtime/third_party/bearssl/src/symcipher/des_support.c +0 -166
  987. package/runtime/third_party/bearssl/src/symcipher/des_tab.c +0 -310
  988. package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcdec.c +0 -85
  989. package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcenc.c +0 -67
  990. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul.c +0 -260
  991. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul32.c +0 -297
  992. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmulq.c +0 -475
  993. package/runtime/third_party/bearssl/src/symcipher/poly1305_i15.c +0 -221
  994. package/runtime/third_party/bearssl/src/x509/asn1.t0 +0 -757
  995. package/runtime/third_party/bearssl/src/x509/asn1enc.c +0 -93
  996. package/runtime/third_party/bearssl/src/x509/encode_ec_pk8der.c +0 -110
  997. package/runtime/third_party/bearssl/src/x509/encode_ec_rawder.c +0 -161
  998. package/runtime/third_party/bearssl/src/x509/encode_rsa_pk8der.c +0 -97
  999. package/runtime/third_party/bearssl/src/x509/encode_rsa_rawder.c +0 -96
  1000. package/runtime/third_party/bearssl/src/x509/skey_decoder.c +0 -653
  1001. package/runtime/third_party/bearssl/src/x509/skey_decoder.t0 +0 -376
  1002. package/runtime/third_party/bearssl/src/x509/x509_decoder.c +0 -776
  1003. package/runtime/third_party/bearssl/src/x509/x509_decoder.t0 +0 -324
  1004. package/runtime/third_party/bearssl/src/x509/x509_knownkey.c +0 -105
  1005. package/runtime/third_party/bearssl/src/x509/x509_minimal.c +0 -1722
  1006. package/runtime/third_party/bearssl/src/x509/x509_minimal.t0 +0 -1526
  1007. package/runtime/third_party/bearssl/src/x509/x509_minimal_full.c +0 -59
@@ -0,0 +1,2002 @@
1
+ // Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // https://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #ifndef OPENSSL_HEADER_ASN1_H
16
+ #define OPENSSL_HEADER_ASN1_H
17
+
18
+ #include <openssl/base.h> // IWYU pragma: export
19
+
20
+ #include <time.h>
21
+
22
+ #include <openssl/bio.h>
23
+ #include <openssl/bn.h>
24
+ #include <openssl/stack.h>
25
+
26
+ #if defined(__cplusplus)
27
+ extern "C" {
28
+ #endif
29
+
30
+
31
+ // Legacy ASN.1 library.
32
+ //
33
+ // This header is part of OpenSSL's ASN.1 implementation. It is retained for
34
+ // compatibility but should not be used by new code. The functions are difficult
35
+ // to use correctly, and have buggy or non-standard behaviors. They are thus
36
+ // particularly prone to behavior changes and API removals, as BoringSSL
37
+ // iterates on these issues.
38
+ //
39
+ // Use the new `CBS` and `CBB` library in <openssl/bytestring.h> instead.
40
+
41
+
42
+ // Tag constants.
43
+ //
44
+ // These constants are used in various APIs to specify ASN.1 types and tag
45
+ // components. See the specific API's documentation for details on which values
46
+ // are used and how.
47
+
48
+ // The following constants are tag classes.
49
+ #define V_ASN1_UNIVERSAL 0x00
50
+ #define V_ASN1_APPLICATION 0x40
51
+ #define V_ASN1_CONTEXT_SPECIFIC 0x80
52
+ #define V_ASN1_PRIVATE 0xc0
53
+
54
+ // V_ASN1_CONSTRUCTED indicates an element is constructed, rather than
55
+ // primitive.
56
+ #define V_ASN1_CONSTRUCTED 0x20
57
+
58
+ // V_ASN1_PRIMITIVE_TAG is the highest tag number which can be encoded in a
59
+ // single byte. Note this is unrelated to whether an element is constructed or
60
+ // primitive.
61
+ //
62
+ // TODO(davidben): Make this private.
63
+ #define V_ASN1_PRIMITIVE_TAG 0x1f
64
+
65
+ // V_ASN1_MAX_UNIVERSAL is the highest supported universal tag number. It is
66
+ // necessary to avoid ambiguity with `V_ASN1_NEG` and `MBSTRING_FLAG`.
67
+ //
68
+ // TODO(davidben): Make this private.
69
+ #define V_ASN1_MAX_UNIVERSAL 0xff
70
+
71
+ // V_ASN1_UNDEF is used in some APIs to indicate an ASN.1 element is omitted.
72
+ #define V_ASN1_UNDEF (-1)
73
+
74
+ // V_ASN1_OTHER is used in `ASN1_TYPE` to indicate a non-universal ASN.1 type.
75
+ #define V_ASN1_OTHER (-3)
76
+
77
+ // V_ASN1_ANY is used by the ASN.1 templates to indicate an ANY type.
78
+ #define V_ASN1_ANY (-4)
79
+
80
+ // The following constants are tag numbers for universal types.
81
+ #define V_ASN1_EOC 0
82
+ #define V_ASN1_BOOLEAN 1
83
+ #define V_ASN1_INTEGER 2
84
+ #define V_ASN1_BIT_STRING 3
85
+ #define V_ASN1_OCTET_STRING 4
86
+ #define V_ASN1_NULL 5
87
+ #define V_ASN1_OBJECT 6
88
+ #define V_ASN1_OBJECT_DESCRIPTOR 7
89
+ #define V_ASN1_EXTERNAL 8
90
+ #define V_ASN1_REAL 9
91
+ #define V_ASN1_ENUMERATED 10
92
+ #define V_ASN1_UTF8STRING 12
93
+ #define V_ASN1_SEQUENCE 16
94
+ #define V_ASN1_SET 17
95
+ #define V_ASN1_NUMERICSTRING 18
96
+ #define V_ASN1_PRINTABLESTRING 19
97
+ #define V_ASN1_T61STRING 20
98
+ #define V_ASN1_TELETEXSTRING 20
99
+ #define V_ASN1_VIDEOTEXSTRING 21
100
+ #define V_ASN1_IA5STRING 22
101
+ #define V_ASN1_UTCTIME 23
102
+ #define V_ASN1_GENERALIZEDTIME 24
103
+ #define V_ASN1_GRAPHICSTRING 25
104
+ #define V_ASN1_ISO64STRING 26
105
+ #define V_ASN1_VISIBLESTRING 26
106
+ #define V_ASN1_GENERALSTRING 27
107
+ #define V_ASN1_UNIVERSALSTRING 28
108
+ #define V_ASN1_BMPSTRING 30
109
+
110
+ // The following constants are used for `ASN1_STRING` values that represent
111
+ // negative INTEGER and ENUMERATED values. See `ASN1_STRING` for more details.
112
+ #define V_ASN1_NEG 0x100
113
+ #define V_ASN1_NEG_INTEGER (V_ASN1_INTEGER | V_ASN1_NEG)
114
+ #define V_ASN1_NEG_ENUMERATED (V_ASN1_ENUMERATED | V_ASN1_NEG)
115
+
116
+ // The following constants are bitmask representations of ASN.1 types.
117
+ #define B_ASN1_NUMERICSTRING 0x0001
118
+ #define B_ASN1_PRINTABLESTRING 0x0002
119
+ #define B_ASN1_T61STRING 0x0004
120
+ #define B_ASN1_TELETEXSTRING 0x0004
121
+ #define B_ASN1_VIDEOTEXSTRING 0x0008
122
+ #define B_ASN1_IA5STRING 0x0010
123
+ #define B_ASN1_GRAPHICSTRING 0x0020
124
+ #define B_ASN1_ISO64STRING 0x0040
125
+ #define B_ASN1_VISIBLESTRING 0x0040
126
+ #define B_ASN1_GENERALSTRING 0x0080
127
+ #define B_ASN1_UNIVERSALSTRING 0x0100
128
+ #define B_ASN1_OCTET_STRING 0x0200
129
+ #define B_ASN1_BIT_STRING 0x0400
130
+ #define B_ASN1_BMPSTRING 0x0800
131
+ #define B_ASN1_UTF8STRING 0x2000
132
+ #define B_ASN1_UTCTIME 0x4000
133
+ #define B_ASN1_GENERALIZEDTIME 0x8000
134
+ #define B_ASN1_SEQUENCE 0x10000
135
+
136
+ // ASN1_tag2bit converts `tag` from the tag number of a universal type to a
137
+ // corresponding `B_ASN1_*` constant, or zero if `tag` has no bitmask.
138
+ OPENSSL_EXPORT unsigned long ASN1_tag2bit(int tag);
139
+
140
+ // ASN1_tag2str returns a string representation of `tag`, interpret as a tag
141
+ // number for a universal type, or `V_ASN1_NEG_*`.
142
+ OPENSSL_EXPORT const char *ASN1_tag2str(int tag);
143
+
144
+
145
+ // API conventions.
146
+ //
147
+ // The following sample functions document the calling conventions used by
148
+ // legacy ASN.1 APIs.
149
+
150
+ #if 0 // Sample functions
151
+
152
+ // d2i_SAMPLE parses a structure from up to `len` bytes at `*inp`. On success,
153
+ // it advances `*inp` by the number of bytes read and returns a newly-allocated
154
+ // `SAMPLE` object containing the parsed structure. If `out` is non-NULL, it
155
+ // additionally frees the previous value at `*out` and updates `*out` to the
156
+ // result. If parsing or allocating the result fails, it returns NULL.
157
+ //
158
+ // This function does not reject trailing data in the input. This allows the
159
+ // caller to parse a sequence of concatenated structures. Callers parsing only
160
+ // one structure should check for trailing data by comparing the updated `*inp`
161
+ // with the end of the input.
162
+ //
163
+ // Note: If `out` and `*out` are both non-NULL, the object at `*out` is not
164
+ // updated in-place. Instead, it is freed, and the pointer is updated to the
165
+ // new object. This differs from OpenSSL. Callers are recommended to set `out`
166
+ // to NULL and instead use the return value.
167
+ SAMPLE *d2i_SAMPLE(SAMPLE **out, const uint8_t **inp, long len);
168
+
169
+ // i2d_SAMPLE marshals `in`. On error, it returns a negative value. On success,
170
+ // it returns the length of the result and outputs it via `outp` as follows:
171
+ //
172
+ // If `outp` is NULL, the function writes nothing. This mode can be used to size
173
+ // buffers.
174
+ //
175
+ // If `outp` is non-NULL but `*outp` is NULL, the function sets `*outp` to a
176
+ // newly-allocated buffer containing the result. The caller is responsible for
177
+ // releasing `*outp` with `OPENSSL_free`. This mode is recommended for most
178
+ // callers.
179
+ //
180
+ // If `outp` and `*outp` are non-NULL, the function writes the result to
181
+ // `*outp`, which must have enough space available, and advances `*outp` just
182
+ // past the output.
183
+ //
184
+ // WARNING: In the third mode, the function does not internally check output
185
+ // bounds. Failing to correctly size the buffer will result in a potentially
186
+ // exploitable memory error.
187
+ int i2d_SAMPLE(const SAMPLE *in, uint8_t **outp);
188
+
189
+ #endif // Sample functions
190
+
191
+ // The following typedefs are sometimes used for pointers to functions like
192
+ // `d2i_SAMPLE` and `i2d_SAMPLE`. Note, however, that these act on `void*`.
193
+ // Calling a function with a different pointer type is undefined in C, so this
194
+ // is only valid with a wrapper.
195
+ typedef void *d2i_of_void(void **, const unsigned char **, long);
196
+ typedef int i2d_of_void(const void *, unsigned char **);
197
+
198
+
199
+ // ASN.1 types.
200
+ //
201
+ // An `ASN1_ITEM` represents an ASN.1 type and allows working with ASN.1 types
202
+ // generically.
203
+ //
204
+ // `ASN1_ITEM`s use a different namespace from C types and are accessed via
205
+ // `ASN1_ITEM_*` macros. So, for example, `ASN1_OCTET_STRING` is both a C type
206
+ // and the name of an `ASN1_ITEM`, referenced as
207
+ // `ASN1_ITEM_rptr(ASN1_OCTET_STRING)`.
208
+ //
209
+ // Each `ASN1_ITEM` has a corresponding C type, typically with the same name,
210
+ // which represents values in the ASN.1 type. This type is either a pointer type
211
+ // or `ASN1_BOOLEAN`. When it is a pointer, NULL pointers represent omitted
212
+ // values. For example, an OCTET STRING value is declared with the C type
213
+ // `ASN1_OCTET_STRING*` and uses the `ASN1_ITEM` named `ASN1_OCTET_STRING`. An
214
+ // OPTIONAL OCTET STRING uses the same C type and represents an omitted value
215
+ // with a NULL pointer. `ASN1_BOOLEAN` is described in a later section.
216
+
217
+ // DECLARE_ASN1_ITEM declares an `ASN1_ITEM` with name `name`. The `ASN1_ITEM`
218
+ // may be referenced with `ASN1_ITEM_rptr`. Uses of this macro should document
219
+ // the corresponding ASN.1 and C types.
220
+ #define DECLARE_ASN1_ITEM(name) extern OPENSSL_EXPORT const ASN1_ITEM name##_it;
221
+
222
+ // ASN1_ITEM_rptr returns the `const ASN1_ITEM *` named `name`.
223
+ #define ASN1_ITEM_rptr(name) (&(name##_it))
224
+
225
+ // ASN1_ITEM_EXP is an abstraction for referencing an `ASN1_ITEM` in a
226
+ // constant-initialized structure, such as a method table. It exists because, on
227
+ // some OpenSSL platforms, `ASN1_ITEM` references are indirected through
228
+ // functions. Structures reference the `ASN1_ITEM` by declaring a field like
229
+ // `ASN1_ITEM_EXP *item` and initializing it with `ASN1_ITEM_ref`.
230
+ typedef const ASN1_ITEM ASN1_ITEM_EXP;
231
+
232
+ // ASN1_ITEM_ref returns an `ASN1_ITEM_EXP*` for the `ASN1_ITEM` named `name`.
233
+ #define ASN1_ITEM_ref(name) (&(name##_it))
234
+
235
+ // ASN1_ITEM_ptr converts `iptr`, which must be an `ASN1_ITEM_EXP*` to a
236
+ // `const ASN1_ITEM*`.
237
+ #define ASN1_ITEM_ptr(iptr) (iptr)
238
+
239
+ // ASN1_VALUE_st (aka `ASN1_VALUE`) is an opaque type used as a placeholder for
240
+ // the C type corresponding to an `ASN1_ITEM`.
241
+ typedef struct ASN1_VALUE_st ASN1_VALUE;
242
+
243
+ // ASN1_item_new allocates a new value of the C type corresponding to `it`, or
244
+ // NULL on error. On success, the caller must release the value with
245
+ // `ASN1_item_free`, or the corresponding C type's free function, when done. The
246
+ // new value will initialize fields of the value to some default state, such as
247
+ // an empty string. Note, however, that this default state sometimes omits
248
+ // required values, such as with CHOICE types.
249
+ //
250
+ // This function may not be used with `ASN1_ITEM`s whose C type is
251
+ // `ASN1_BOOLEAN`.
252
+ //
253
+ // WARNING: Casting the result of this function to the wrong type is a
254
+ // potentially exploitable memory error. Callers must ensure the value is used
255
+ // consistently with `it`. Prefer using type-specific functions such as
256
+ // `ASN1_OCTET_STRING_new`.
257
+ OPENSSL_EXPORT ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
258
+
259
+ // ASN1_item_free releases memory associated with `val`, which must be an object
260
+ // of the C type corresponding to `it`.
261
+ //
262
+ // This function may not be used with `ASN1_ITEM`s whose C type is
263
+ // `ASN1_BOOLEAN`.
264
+ //
265
+ // WARNING: Passing a pointer of the wrong type into this function is a
266
+ // potentially exploitable memory error. Callers must ensure `val` is consistent
267
+ // with `it`. Prefer using type-specific functions such as
268
+ // `ASN1_OCTET_STRING_free`.
269
+ OPENSSL_EXPORT void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
270
+
271
+ // ASN1_item_d2i parses the ASN.1 type `it` from up to `len` bytes at `*inp`.
272
+ // It behaves like `d2i_SAMPLE`, except that `out` and the return value are cast
273
+ // to `ASN1_VALUE` pointers.
274
+ //
275
+ // This function may not be used with `ASN1_ITEM`s whose C type is
276
+ // `ASN1_BOOLEAN`.
277
+ //
278
+ // WARNING: Casting the result of this function to the wrong type, or passing a
279
+ // pointer of the wrong type into this function, are potentially exploitable
280
+ // memory errors. Callers must ensure `out` is consistent with `it`. Prefer
281
+ // using type-specific functions such as `d2i_ASN1_OCTET_STRING`.
282
+ OPENSSL_EXPORT ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **out,
283
+ const unsigned char **inp, long len,
284
+ const ASN1_ITEM *it);
285
+
286
+ // ASN1_item_i2d marshals `val` as the ASN.1 type associated with `it`, as
287
+ // described in `i2d_SAMPLE`.
288
+ //
289
+ // This function may not be used with `ASN1_ITEM`s whose C type is
290
+ // `ASN1_BOOLEAN`.
291
+ //
292
+ // WARNING: Passing a pointer of the wrong type into this function is a
293
+ // potentially exploitable memory error. Callers must ensure `val` is consistent
294
+ // with `it`. Prefer using type-specific functions such as
295
+ // `i2d_ASN1_OCTET_STRING`.
296
+ OPENSSL_EXPORT int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **outp,
297
+ const ASN1_ITEM *it);
298
+
299
+ // ASN1_item_dup returns a newly-allocated copy of `x`, or NULL on error. `x`
300
+ // must be an object of `it`'s C type.
301
+ //
302
+ // This function may not be used with `ASN1_ITEM`s whose C type is
303
+ // `ASN1_BOOLEAN`.
304
+ //
305
+ // WARNING: Casting the result of this function to the wrong type, or passing a
306
+ // pointer of the wrong type into this function, are potentially exploitable
307
+ // memory errors. Prefer using type-specific functions such as
308
+ // `ASN1_STRING_dup`.
309
+ OPENSSL_EXPORT void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
310
+
311
+ // The following functions behave like `ASN1_item_d2i` but read from `in`
312
+ // instead. `out` is the same parameter as in `ASN1_item_d2i`, but written with
313
+ // `void*` instead. The return values similarly match.
314
+ //
315
+ // These functions may not be used with `ASN1_ITEM`s whose C type is
316
+ // `ASN1_BOOLEAN`.
317
+ //
318
+ // WARNING: These functions do not bound how much data is read from `in`.
319
+ // Parsing an untrusted input could consume unbounded memory.
320
+ OPENSSL_EXPORT void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *out);
321
+ OPENSSL_EXPORT void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *out);
322
+
323
+ // The following functions behave like `ASN1_item_i2d` but write to `out`
324
+ // instead. `in` is the same parameter as in `ASN1_item_i2d`, but written with
325
+ // `void*` instead.
326
+ //
327
+ // These functions may not be used with `ASN1_ITEM`s whose C type is
328
+ // `ASN1_BOOLEAN`.
329
+ OPENSSL_EXPORT int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out,
330
+ const void *in);
331
+ OPENSSL_EXPORT int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out,
332
+ const void *in);
333
+
334
+ // ASN1_item_unpack parses `oct`'s contents as `it`'s ASN.1 type. It returns a
335
+ // newly-allocated instance of `it`'s C type on success, or NULL on error.
336
+ //
337
+ // This function may not be used with `ASN1_ITEM`s whose C type is
338
+ // `ASN1_BOOLEAN`.
339
+ //
340
+ // WARNING: Casting the result of this function to the wrong type is a
341
+ // potentially exploitable memory error. Callers must ensure the value is used
342
+ // consistently with `it`.
343
+ OPENSSL_EXPORT void *ASN1_item_unpack(const ASN1_STRING *oct,
344
+ const ASN1_ITEM *it);
345
+
346
+ // ASN1_item_pack marshals `obj` as `it`'s ASN.1 type. If `out` is NULL, it
347
+ // returns a newly-allocated `ASN1_STRING` with the result, or NULL on error.
348
+ // If `out` is non-NULL, but `*out` is NULL, it does the same but additionally
349
+ // sets `*out` to the result. If both `out` and `*out` are non-NULL, it writes
350
+ // the result to `*out` and returns `*out` on success or NULL on error.
351
+ //
352
+ // This function may not be used with `ASN1_ITEM`s whose C type is
353
+ // `ASN1_BOOLEAN`.
354
+ //
355
+ // WARNING: Passing a pointer of the wrong type into this function is a
356
+ // potentially exploitable memory error. Callers must ensure `val` is consistent
357
+ // with `it`.
358
+ OPENSSL_EXPORT ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
359
+ ASN1_STRING **out);
360
+
361
+
362
+ // Booleans.
363
+ //
364
+ // This library represents ASN.1 BOOLEAN values with `ASN1_BOOLEAN`, which is an
365
+ // integer type. FALSE is zero, TRUE is 0xff, and an omitted OPTIONAL BOOLEAN is
366
+ // -1.
367
+
368
+ // ASN1_BOOLEAN_FALSE is FALSE as an `ASN1_BOOLEAN`.
369
+ #define ASN1_BOOLEAN_FALSE 0
370
+
371
+ // ASN1_BOOLEAN_TRUE is TRUE as an `ASN1_BOOLEAN`. Some code incorrectly uses
372
+ // 1, so prefer `b != ASN1_BOOLEAN_FALSE` over `b == ASN1_BOOLEAN_TRUE`.
373
+ #define ASN1_BOOLEAN_TRUE 0xff
374
+
375
+ // ASN1_BOOLEAN_NONE, in contexts where the `ASN1_BOOLEAN` represents an
376
+ // OPTIONAL BOOLEAN, is an omitted value. Using this value in other contexts is
377
+ // undefined and may be misinterpreted as TRUE.
378
+ #define ASN1_BOOLEAN_NONE (-1)
379
+
380
+ // d2i_ASN1_BOOLEAN parses a DER-encoded ASN.1 BOOLEAN from up to `len` bytes at
381
+ // `*inp`. On success, it advances `*inp` by the number of bytes read and
382
+ // returns the result. If `out` is non-NULL, it additionally writes the result
383
+ // to `*out`. On error, it returns `ASN1_BOOLEAN_NONE`.
384
+ //
385
+ // This function does not reject trailing data in the input. This allows the
386
+ // caller to parse a sequence of concatenated structures. Callers parsing only
387
+ // one structure should check for trailing data by comparing the updated `*inp`
388
+ // with the end of the input.
389
+ //
390
+ // WARNING: This function's is slightly different from other `d2i_*` functions
391
+ // because `ASN1_BOOLEAN` is not a pointer type.
392
+ OPENSSL_EXPORT ASN1_BOOLEAN d2i_ASN1_BOOLEAN(ASN1_BOOLEAN *out,
393
+ const unsigned char **inp,
394
+ long len);
395
+
396
+ // i2d_ASN1_BOOLEAN marshals `a` as a DER-encoded ASN.1 BOOLEAN, as described in
397
+ // `i2d_SAMPLE`.
398
+ OPENSSL_EXPORT int i2d_ASN1_BOOLEAN(ASN1_BOOLEAN a, unsigned char **outp);
399
+
400
+ // The following `ASN1_ITEM`s have ASN.1 type BOOLEAN and C type `ASN1_BOOLEAN`.
401
+ // `ASN1_TBOOLEAN` and `ASN1_FBOOLEAN` must be marked OPTIONAL. When omitted,
402
+ // they are parsed as TRUE and FALSE, respectively, rather than
403
+ // `ASN1_BOOLEAN_NONE`.
404
+ DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
405
+ DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
406
+ DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
407
+
408
+
409
+ // Strings.
410
+ //
411
+ // ASN.1 contains a myriad of string types, as well as types that contain data
412
+ // that may be encoded into a string. This library uses a single type,
413
+ // `ASN1_STRING`, to represent most values.
414
+
415
+ // An asn1_string_st (aka `ASN1_STRING`) represents a value of a string-like
416
+ // ASN.1 type. It contains a `type` field, and a byte string `data` field with a
417
+ // type-specific representation. This type-specific representation does not
418
+ // always correspond to the DER encoding of the type.
419
+ //
420
+ // If `type` is one of `V_ASN1_OCTET_STRING`, `V_ASN1_UTF8STRING`,
421
+ // `V_ASN1_NUMERICSTRING`, `V_ASN1_PRINTABLESTRING`, `V_ASN1_T61STRING`,
422
+ // `V_ASN1_VIDEOTEXSTRING`, `V_ASN1_IA5STRING`, `V_ASN1_GRAPHICSTRING`,
423
+ // `V_ASN1_ISO64STRING`, `V_ASN1_VISIBLESTRING`, `V_ASN1_GENERALSTRING`,
424
+ // `V_ASN1_UNIVERSALSTRING`, or `V_ASN1_BMPSTRING`, the object represents an
425
+ // ASN.1 string type. The data contains the byte representation of the
426
+ // string.
427
+ //
428
+ // If `type` is `V_ASN1_BIT_STRING`, the object represents a BIT STRING value.
429
+ // See bit string documentation below for the data and flags.
430
+ //
431
+ // If `type` is one of `V_ASN1_INTEGER`, `V_ASN1_NEG_INTEGER`,
432
+ // `V_ASN1_ENUMERATED`, or `V_ASN1_NEG_ENUMERATED`, the object represents an
433
+ // INTEGER or ENUMERATED value. See integer documentation below for details.
434
+ //
435
+ // If `type` is `V_ASN1_GENERALIZEDTIME` or `V_ASN1_UTCTIME`, the object
436
+ // represents a GeneralizedTime or UTCTime value, respectively. The data
437
+ // contains the DER encoding of the value. For example, the UNIX epoch would be
438
+ // "19700101000000Z" for a GeneralizedTime and "700101000000Z" for a UTCTime.
439
+ //
440
+ // If `type` is `V_ASN1_SEQUENCE`, `V_ASN1_SET`, or `V_ASN1_OTHER`, the object
441
+ // represents a SEQUENCE, SET, or arbitrary ASN.1 value, respectively. Unlike
442
+ // the above cases, the data contains the DER encoding of the entire structure,
443
+ // including the header. If the value is explicitly or implicitly tagged, this
444
+ // too will be reflected in the data field. As this case handles unknown types,
445
+ // the contents are not checked when parsing or serializing.
446
+ //
447
+ // Other values of `type` do not represent a valid ASN.1 value, though
448
+ // default-constructed objects may set `type` to -1. Such objects cannot be
449
+ // serialized.
450
+ //
451
+ // `ASN1_STRING` additionally has the following typedefs: `ASN1_BIT_STRING`,
452
+ // `ASN1_BMPSTRING`, `ASN1_ENUMERATED`, `ASN1_GENERALIZEDTIME`,
453
+ // `ASN1_GENERALSTRING`, `ASN1_IA5STRING`, `ASN1_INTEGER`, `ASN1_OCTET_STRING`,
454
+ // `ASN1_PRINTABLESTRING`, `ASN1_T61STRING`, `ASN1_TIME`,
455
+ // `ASN1_UNIVERSALSTRING`, `ASN1_UTCTIME`, `ASN1_UTF8STRING`, and
456
+ // `ASN1_VISIBLESTRING`. Other than `ASN1_TIME`, these correspond to universal
457
+ // ASN.1 types. `ASN1_TIME` represents a CHOICE of UTCTime and GeneralizedTime,
458
+ // with a cutoff of 2049, as used in Section 4.1.2.5 of RFC 5280.
459
+ //
460
+ // For clarity, callers are encouraged to use the appropriate typedef when
461
+ // available. They are the same type as `ASN1_STRING`, so a caller may freely
462
+ // pass them into functions expecting `ASN1_STRING`, such as
463
+ // `ASN1_STRING_length`.
464
+ //
465
+ // If a function returns an `ASN1_STRING` where the typedef or ASN.1 structure
466
+ // implies constraints on `type`, callers may assume that `type` is correct.
467
+ // However, if a function takes an `ASN1_STRING` as input, callers must ensure
468
+ // `type` matches. These invariants are not captured by the C type system and
469
+ // may not be checked at runtime. For example, callers may assume the output of
470
+ // `X509_get0_serialNumber` has type `V_ASN1_INTEGER` or `V_ASN1_NEG_INTEGER`.
471
+ // Callers must not pass a string of type `V_ASN1_OCTET_STRING` to
472
+ // `X509_set_serialNumber`. Doing so may break invariants on the `X509` object
473
+ // and break the `X509_get0_serialNumber` invariant.
474
+ //
475
+ // TODO(https://crbug.com/boringssl/445): This is very unfriendly. Getting the
476
+ // type field wrong should not cause memory errors, but it may do strange
477
+ // things. We should add runtime checks to anything that consumes `ASN1_STRING`s
478
+ // from the caller.
479
+ struct asn1_string_st {
480
+ int length;
481
+ int type;
482
+ unsigned char *data;
483
+ long flags;
484
+ };
485
+
486
+ // ASN1_STRING_type_new returns a newly-allocated empty `ASN1_STRING` object of
487
+ // type `type`, or NULL on error.
488
+ OPENSSL_EXPORT ASN1_STRING *ASN1_STRING_type_new(int type);
489
+
490
+ // ASN1_STRING_new returns a newly-allocated empty `ASN1_STRING` object with an
491
+ // arbitrary type. Prefer one of the type-specific constructors, such as
492
+ // `ASN1_OCTET_STRING_new`, or `ASN1_STRING_type_new`.
493
+ OPENSSL_EXPORT ASN1_STRING *ASN1_STRING_new(void);
494
+
495
+ // ASN1_STRING_free releases memory associated with `str`.
496
+ OPENSSL_EXPORT void ASN1_STRING_free(ASN1_STRING *str);
497
+
498
+ // ASN1_STRING_copy sets `dst` to a copy of `str`. It returns one on success and
499
+ // zero on error.
500
+ OPENSSL_EXPORT int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
501
+
502
+ // ASN1_STRING_dup returns a newly-allocated copy of `str`, or NULL on error.
503
+ OPENSSL_EXPORT ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str);
504
+
505
+ // ASN1_STRING_type returns the type of `str`. This value will be one of the
506
+ // `V_ASN1_*` constants.
507
+ OPENSSL_EXPORT int ASN1_STRING_type(const ASN1_STRING *str);
508
+
509
+ // ASN1_STRING_get0_data returns a pointer to `str`'s contents. Callers should
510
+ // use `ASN1_STRING_length` to determine the length of the string. The string
511
+ // may have embedded NUL bytes and may not be NUL-terminated.
512
+ //
513
+ // The contents of an `ASN1_STRING` encode the value in some type-specific
514
+ // representation that does not always correspond to the DER encoding of the
515
+ // type. See the documentation for `ASN1_STRING` for details.
516
+ OPENSSL_EXPORT const unsigned char *ASN1_STRING_get0_data(
517
+ const ASN1_STRING *str);
518
+
519
+ // ASN1_STRING_data returns a mutable pointer to `str`'s contents. Callers
520
+ // should use `ASN1_STRING_length` to determine the length of the string. The
521
+ // string may have embedded NUL bytes and may not be NUL-terminated.
522
+ //
523
+ // The contents of an `ASN1_STRING` encode the value in some type-specific
524
+ // representation that does not always correspond to the DER encoding of the
525
+ // type. See the documentation for `ASN1_STRING` for details.
526
+ //
527
+ // Prefer `ASN1_STRING_get0_data`.
528
+ OPENSSL_EXPORT unsigned char *ASN1_STRING_data(ASN1_STRING *str);
529
+
530
+ // ASN1_STRING_length returns the length of `str`, in bytes.
531
+ //
532
+ // The contents of an `ASN1_STRING` encode the value in some type-specific
533
+ // representation that does not always correspond to the DER encoding of the
534
+ // type. See the documentation for `ASN1_STRING` for details.
535
+ OPENSSL_EXPORT int ASN1_STRING_length(const ASN1_STRING *str);
536
+
537
+ // ASN1_STRING_cmp compares `a` and `b`'s type and contents. It returns an
538
+ // integer equal to, less than, or greater than zero if `a` is equal to, less
539
+ // than, or greater than `b`, respectively. This function compares by length,
540
+ // then data, then type. Note the data compared is the `ASN1_STRING` internal
541
+ // representation and the type order is arbitrary. While this comparison is
542
+ // suitable for sorting, callers should not rely on the exact order when `a`
543
+ // and `b` are different types.
544
+ //
545
+ // Note that, if `a` and `b` are INTEGERs, this comparison does not order the
546
+ // values numerically. For a numerical comparison, use `ASN1_INTEGER_cmp`.
547
+ OPENSSL_EXPORT int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
548
+
549
+ // ASN1_STRING_set sets the contents of `str` to a copy of `len` bytes from
550
+ // `data`. It returns one on success and zero on error. If `data` is NULL, it
551
+ // updates the length and allocates the buffer as needed, but does not
552
+ // initialize the contents.
553
+ //
554
+ // If `str` is a BIT STRING, this function sets the number of unused bits to
555
+ // zero. `ASN1_BIT_STRING_set1` may be used to set a BIT STRING that is not a
556
+ // whole number of bytes.
557
+ OPENSSL_EXPORT int ASN1_STRING_set(ASN1_STRING *str, const void *data,
558
+ ossl_ssize_t len);
559
+
560
+ // ASN1_STRING_set0 sets the contents of `str` to `len` bytes from `data`. It
561
+ // takes ownership of `data`, which must have been allocated with
562
+ // `OPENSSL_malloc`.
563
+ //
564
+ // If `str` is a BIT STRING, this function sets the number of unused bits to
565
+ // zero. `ASN1_BIT_STRING_set1` may be used to set a BIT STRING that is not a
566
+ // whole number of bytes.
567
+ OPENSSL_EXPORT void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
568
+
569
+ // The following functions call `ASN1_STRING_type_new` with the corresponding
570
+ // `V_ASN1_*` constant.
571
+ OPENSSL_EXPORT ASN1_BMPSTRING *ASN1_BMPSTRING_new(void);
572
+ OPENSSL_EXPORT ASN1_GENERALSTRING *ASN1_GENERALSTRING_new(void);
573
+ OPENSSL_EXPORT ASN1_IA5STRING *ASN1_IA5STRING_new(void);
574
+ OPENSSL_EXPORT ASN1_OCTET_STRING *ASN1_OCTET_STRING_new(void);
575
+ OPENSSL_EXPORT ASN1_PRINTABLESTRING *ASN1_PRINTABLESTRING_new(void);
576
+ OPENSSL_EXPORT ASN1_T61STRING *ASN1_T61STRING_new(void);
577
+ OPENSSL_EXPORT ASN1_UNIVERSALSTRING *ASN1_UNIVERSALSTRING_new(void);
578
+ OPENSSL_EXPORT ASN1_UTF8STRING *ASN1_UTF8STRING_new(void);
579
+ OPENSSL_EXPORT ASN1_VISIBLESTRING *ASN1_VISIBLESTRING_new(void);
580
+
581
+ // The following functions call `ASN1_STRING_free`.
582
+ OPENSSL_EXPORT void ASN1_BMPSTRING_free(ASN1_BMPSTRING *str);
583
+ OPENSSL_EXPORT void ASN1_GENERALSTRING_free(ASN1_GENERALSTRING *str);
584
+ OPENSSL_EXPORT void ASN1_IA5STRING_free(ASN1_IA5STRING *str);
585
+ OPENSSL_EXPORT void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *str);
586
+ OPENSSL_EXPORT void ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *str);
587
+ OPENSSL_EXPORT void ASN1_T61STRING_free(ASN1_T61STRING *str);
588
+ OPENSSL_EXPORT void ASN1_UNIVERSALSTRING_free(ASN1_UNIVERSALSTRING *str);
589
+ OPENSSL_EXPORT void ASN1_UTF8STRING_free(ASN1_UTF8STRING *str);
590
+ OPENSSL_EXPORT void ASN1_VISIBLESTRING_free(ASN1_VISIBLESTRING *str);
591
+
592
+ // The following functions parse up to `len` bytes from `*inp` as a
593
+ // DER-encoded ASN.1 value of the corresponding type, as described in
594
+ // `d2i_SAMPLE`.
595
+ OPENSSL_EXPORT ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **out,
596
+ const uint8_t **inp,
597
+ long len);
598
+ OPENSSL_EXPORT ASN1_GENERALSTRING *d2i_ASN1_GENERALSTRING(
599
+ ASN1_GENERALSTRING **out, const uint8_t **inp, long len);
600
+ OPENSSL_EXPORT ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **out,
601
+ const uint8_t **inp,
602
+ long len);
603
+ OPENSSL_EXPORT ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **out,
604
+ const uint8_t **inp,
605
+ long len);
606
+ OPENSSL_EXPORT ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(
607
+ ASN1_PRINTABLESTRING **out, const uint8_t **inp, long len);
608
+ OPENSSL_EXPORT ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **out,
609
+ const uint8_t **inp,
610
+ long len);
611
+ OPENSSL_EXPORT ASN1_UNIVERSALSTRING *d2i_ASN1_UNIVERSALSTRING(
612
+ ASN1_UNIVERSALSTRING **out, const uint8_t **inp, long len);
613
+ OPENSSL_EXPORT ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **out,
614
+ const uint8_t **inp,
615
+ long len);
616
+ OPENSSL_EXPORT ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(
617
+ ASN1_VISIBLESTRING **out, const uint8_t **inp, long len);
618
+
619
+ // The following functions marshal `in` as a DER-encoded ASN.1 value of the
620
+ // corresponding type, as described in `i2d_SAMPLE`.
621
+ OPENSSL_EXPORT int i2d_ASN1_BMPSTRING(const ASN1_BMPSTRING *in, uint8_t **outp);
622
+ OPENSSL_EXPORT int i2d_ASN1_GENERALSTRING(const ASN1_GENERALSTRING *in,
623
+ uint8_t **outp);
624
+ OPENSSL_EXPORT int i2d_ASN1_IA5STRING(const ASN1_IA5STRING *in, uint8_t **outp);
625
+ OPENSSL_EXPORT int i2d_ASN1_OCTET_STRING(const ASN1_OCTET_STRING *in,
626
+ uint8_t **outp);
627
+ OPENSSL_EXPORT int i2d_ASN1_PRINTABLESTRING(const ASN1_PRINTABLESTRING *in,
628
+ uint8_t **outp);
629
+ OPENSSL_EXPORT int i2d_ASN1_T61STRING(const ASN1_T61STRING *in, uint8_t **outp);
630
+ OPENSSL_EXPORT int i2d_ASN1_UNIVERSALSTRING(const ASN1_UNIVERSALSTRING *in,
631
+ uint8_t **outp);
632
+ OPENSSL_EXPORT int i2d_ASN1_UTF8STRING(const ASN1_UTF8STRING *in,
633
+ uint8_t **outp);
634
+ OPENSSL_EXPORT int i2d_ASN1_VISIBLESTRING(const ASN1_VISIBLESTRING *in,
635
+ uint8_t **outp);
636
+
637
+ // The following `ASN1_ITEM`s have the ASN.1 type referred to in their name and
638
+ // C type `ASN1_STRING*`. The C type may also be written as the corresponding
639
+ // typedef.
640
+ DECLARE_ASN1_ITEM(ASN1_BMPSTRING)
641
+ DECLARE_ASN1_ITEM(ASN1_GENERALSTRING)
642
+ DECLARE_ASN1_ITEM(ASN1_IA5STRING)
643
+ DECLARE_ASN1_ITEM(ASN1_OCTET_STRING)
644
+ DECLARE_ASN1_ITEM(ASN1_PRINTABLESTRING)
645
+ DECLARE_ASN1_ITEM(ASN1_T61STRING)
646
+ DECLARE_ASN1_ITEM(ASN1_UNIVERSALSTRING)
647
+ DECLARE_ASN1_ITEM(ASN1_UTF8STRING)
648
+ DECLARE_ASN1_ITEM(ASN1_VISIBLESTRING)
649
+
650
+ // ASN1_OCTET_STRING_dup calls `ASN1_STRING_dup`.
651
+ OPENSSL_EXPORT ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(
652
+ const ASN1_OCTET_STRING *a);
653
+
654
+ // ASN1_OCTET_STRING_cmp calls `ASN1_STRING_cmp`.
655
+ OPENSSL_EXPORT int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
656
+ const ASN1_OCTET_STRING *b);
657
+
658
+ // ASN1_OCTET_STRING_set calls `ASN1_STRING_set`.
659
+ OPENSSL_EXPORT int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str,
660
+ const unsigned char *data, int len);
661
+
662
+ // ASN1_STRING_to_UTF8 converts `in` to UTF-8. On success, sets `*out` to a
663
+ // newly-allocated buffer containing the resulting string and returns the length
664
+ // of the string. The caller must call `OPENSSL_free` to release `*out` when
665
+ // done. On error, it returns a negative number.
666
+ OPENSSL_EXPORT int ASN1_STRING_to_UTF8(unsigned char **out,
667
+ const ASN1_STRING *in);
668
+
669
+ // The following formats define encodings for use with functions like
670
+ // `ASN1_mbstring_copy`. Note `MBSTRING_ASC` refers to Latin-1, not ASCII.
671
+ #define MBSTRING_FLAG 0x1000
672
+ #define MBSTRING_UTF8 (MBSTRING_FLAG)
673
+ #define MBSTRING_ASC (MBSTRING_FLAG | 1)
674
+ #define MBSTRING_BMP (MBSTRING_FLAG | 2)
675
+ #define MBSTRING_UNIV (MBSTRING_FLAG | 4)
676
+
677
+ // DIRSTRING_TYPE contains the valid string types in an X.509 DirectoryString.
678
+ #define DIRSTRING_TYPE \
679
+ (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | \
680
+ B_ASN1_UTF8STRING)
681
+
682
+ // PKCS9STRING_TYPE contains the valid string types in a PKCS9String.
683
+ #define PKCS9STRING_TYPE (DIRSTRING_TYPE | B_ASN1_IA5STRING)
684
+
685
+ // ASN1_mbstring_copy converts `len` bytes from `in` to an ASN.1 string. If
686
+ // `len` is -1, `in` must be NUL-terminated and the length is determined by
687
+ // `strlen`. `in` is decoded according to `inform`, which must be one of
688
+ // `MBSTRING_*`. `mask` determines the set of valid output types and is a
689
+ // bitmask containing a subset of `B_ASN1_PRINTABLESTRING`, `B_ASN1_IA5STRING`,
690
+ // `B_ASN1_T61STRING`, `B_ASN1_BMPSTRING`, `B_ASN1_UNIVERSALSTRING`, and
691
+ // `B_ASN1_UTF8STRING`, in that preference order. This function chooses the
692
+ // first output type in `mask` which can represent `in`. It interprets T61String
693
+ // as Latin-1, rather than T.61.
694
+ //
695
+ // If `mask` is zero, `DIRSTRING_TYPE` is used by default.
696
+ //
697
+ // On success, this function returns the `V_ASN1_*` constant corresponding to
698
+ // the selected output type and, if `out` and `*out` are both non-NULL, updates
699
+ // the object at `*out` with the result. If `out` is non-NULL and `*out` is
700
+ // NULL, it instead sets `*out` to a newly-allocated `ASN1_STRING` containing
701
+ // the result. If `out` is NULL, it returns the selected output type without
702
+ // constructing an `ASN1_STRING`. On error, this function returns -1.
703
+ OPENSSL_EXPORT int ASN1_mbstring_copy(ASN1_STRING **out, const uint8_t *in,
704
+ ossl_ssize_t len, int inform,
705
+ unsigned long mask);
706
+
707
+ // ASN1_mbstring_ncopy behaves like `ASN1_mbstring_copy` but returns an error if
708
+ // the input is less than `minsize` or greater than `maxsize` codepoints long. A
709
+ // `maxsize` value of zero is ignored. Note the sizes are measured in
710
+ // codepoints, not output bytes.
711
+ OPENSSL_EXPORT int ASN1_mbstring_ncopy(ASN1_STRING **out, const uint8_t *in,
712
+ ossl_ssize_t len, int inform,
713
+ unsigned long mask, ossl_ssize_t minsize,
714
+ ossl_ssize_t maxsize);
715
+
716
+ // ASN1_STRING_set_by_NID behaves like `ASN1_mbstring_ncopy`, but determines
717
+ // `mask`, `minsize`, and `maxsize` based on `nid`. When `nid` is a recognized
718
+ // X.509 attribute type, it will pick a suitable ASN.1 string type and bounds.
719
+ // For most attribute types, it preferentially chooses UTF8String. If `nid` is
720
+ // unrecognized, it uses UTF8String by default. This function will also enforce
721
+ // any known attribute-specific constraints on the sizes of the string and fail
722
+ // if the size is invalid. In RFC 5280, these bounds are specified by
723
+ // constraints like "SIZE (1..ub-common-name)" in ASN.1.
724
+ //
725
+ // Slightly unlike `ASN1_mbstring_ncopy`, this function interprets `out` and
726
+ // returns its result as follows: If `out` is NULL, it returns a newly-allocated
727
+ // `ASN1_STRING` containing the result. If `out` is non-NULL and
728
+ // `*out` is NULL, it additionally sets `*out` to the result. If both `out` and
729
+ // `*out` are non-NULL, it instead updates the object at `*out` and returns
730
+ // `*out`. In all cases, it returns NULL on error.
731
+ //
732
+ // This function supports the following NIDs: `NID_countryName`,
733
+ // `NID_dnQualifier`, `NID_domainComponent`, `NID_friendlyName`,
734
+ // `NID_givenName`, `NID_initials`, `NID_localityName`, `NID_ms_csp_name`,
735
+ // `NID_name`, `NID_organizationalUnitName`, `NID_organizationName`,
736
+ // `NID_pkcs9_challengePassword`, `NID_pkcs9_emailAddress`,
737
+ // `NID_pkcs9_unstructuredAddress`, `NID_pkcs9_unstructuredName`,
738
+ // `NID_serialNumber`, `NID_stateOrProvinceName`, and `NID_surname`. Additional
739
+ // NIDs may be registered with `ASN1_STRING_set_by_NID`, but it is recommended
740
+ // to call `ASN1_mbstring_ncopy` directly instead.
741
+ OPENSSL_EXPORT ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
742
+ const unsigned char *in,
743
+ ossl_ssize_t len, int inform,
744
+ int nid);
745
+
746
+ // STABLE_NO_MASK causes `ASN1_STRING_TABLE_add` to allow types other than
747
+ // UTF8String.
748
+ #define STABLE_NO_MASK 0x02
749
+
750
+ // ASN1_STRING_TABLE_add registers the corresponding parameters with `nid`, for
751
+ // use with `ASN1_STRING_set_by_NID`. It returns one on success and zero on
752
+ // error. It is an error to call this function if `nid` is a built-in NID, or
753
+ // was already registered by a previous call.
754
+ //
755
+ // WARNING: This function affects global state in the library. If two libraries
756
+ // in the same address space register information for the same OID, one call
757
+ // will fail. Prefer directly passing the desired parameters to
758
+ // `ASN1_mbstring_copy` or `ASN1_mbstring_ncopy` instead.
759
+ OPENSSL_EXPORT int ASN1_STRING_TABLE_add(int nid, long minsize, long maxsize,
760
+ unsigned long mask,
761
+ unsigned long flags);
762
+
763
+
764
+ // Multi-strings.
765
+ //
766
+ // A multi-string, or "MSTRING", is an `ASN1_STRING` that represents a CHOICE of
767
+ // several string or string-like types, such as X.509's DirectoryString. The
768
+ // `ASN1_STRING`'s type field determines which type is used.
769
+ //
770
+ // Multi-string types are associated with a bitmask, using the `B_ASN1_*`
771
+ // constants, which defines which types are valid.
772
+
773
+ // B_ASN1_DIRECTORYSTRING is a bitmask of types allowed in an X.509
774
+ // DirectoryString (RFC 5280).
775
+ #define B_ASN1_DIRECTORYSTRING \
776
+ (B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | \
777
+ B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING)
778
+
779
+ // DIRECTORYSTRING_new returns a newly-allocated `ASN1_STRING` with type -1, or
780
+ // NULL on error. The resulting `ASN1_STRING` is not a valid X.509
781
+ // DirectoryString until initialized with a value.
782
+ OPENSSL_EXPORT ASN1_STRING *DIRECTORYSTRING_new(void);
783
+
784
+ // DIRECTORYSTRING_free calls `ASN1_STRING_free`.
785
+ OPENSSL_EXPORT void DIRECTORYSTRING_free(ASN1_STRING *str);
786
+
787
+ // d2i_DIRECTORYSTRING parses up to `len` bytes from `*inp` as a DER-encoded
788
+ // X.509 DirectoryString (RFC 5280), as described in `d2i_SAMPLE`.
789
+ //
790
+ // TODO(https://crbug.com/boringssl/354): This function currently also accepts
791
+ // BER, but this will be removed in the future.
792
+ //
793
+ // TODO(https://crbug.com/boringssl/449): DirectoryString's non-empty string
794
+ // requirement is not currently enforced.
795
+ OPENSSL_EXPORT ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **out,
796
+ const uint8_t **inp, long len);
797
+
798
+ // i2d_DIRECTORYSTRING marshals `in` as a DER-encoded X.509 DirectoryString (RFC
799
+ // 5280), as described in `i2d_SAMPLE`.
800
+ OPENSSL_EXPORT int i2d_DIRECTORYSTRING(const ASN1_STRING *in, uint8_t **outp);
801
+
802
+ // B_ASN1_DISPLAYTEXT is a bitmask of types allowed in an X.509 DisplayText (RFC
803
+ // 5280).
804
+ #define B_ASN1_DISPLAYTEXT \
805
+ (B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | \
806
+ B_ASN1_UTF8STRING)
807
+
808
+ // DISPLAYTEXT_new returns a newly-allocated `ASN1_STRING` with type -1, or NULL
809
+ // on error. The resulting `ASN1_STRING` is not a valid X.509 DisplayText until
810
+ // initialized with a value.
811
+ OPENSSL_EXPORT ASN1_STRING *DISPLAYTEXT_new(void);
812
+
813
+ // DISPLAYTEXT_free calls `ASN1_STRING_free`.
814
+ OPENSSL_EXPORT void DISPLAYTEXT_free(ASN1_STRING *str);
815
+
816
+ // d2i_DISPLAYTEXT parses up to `len` bytes from `*inp` as a DER-encoded X.509
817
+ // DisplayText (RFC 5280), as described in `d2i_SAMPLE`.
818
+ //
819
+ // TODO(https://crbug.com/boringssl/354): This function currently also accepts
820
+ // BER, but this will be removed in the future.
821
+ //
822
+ // TODO(https://crbug.com/boringssl/449): DisplayText's size limits are not
823
+ // currently enforced.
824
+ OPENSSL_EXPORT ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **out,
825
+ const uint8_t **inp, long len);
826
+
827
+ // i2d_DISPLAYTEXT marshals `in` as a DER-encoded X.509 DisplayText (RFC 5280),
828
+ // as described in `i2d_SAMPLE`.
829
+ OPENSSL_EXPORT int i2d_DISPLAYTEXT(const ASN1_STRING *in, uint8_t **outp);
830
+
831
+
832
+ // Bit strings.
833
+ //
834
+ // An ASN.1 BIT STRING type represents a string of bits. The string may not
835
+ // necessarily be a whole number of bytes. BIT STRINGs occur in ASN.1 structures
836
+ // in several forms:
837
+ //
838
+ // Some BIT STRINGs represent a bitmask of named bits, such as the X.509 key
839
+ // usage extension in RFC 5280, section 4.2.1.3. For such bit strings, DER
840
+ // imposes an additional restriction that trailing zero bits are removed. Some
841
+ // functions like `ASN1_BIT_STRING_set_bit` help in maintaining this.
842
+ //
843
+ // Other BIT STRINGs are arbitrary strings of bits used as identifiers and do
844
+ // not have this constraint, such as the X.509 issuerUniqueID field.
845
+ //
846
+ // Finally, some structures use BIT STRINGs as a container for byte strings. For
847
+ // example, the signatureValue field in X.509 and the subjectPublicKey field in
848
+ // SubjectPublicKeyInfo are defined as BIT STRINGs with a value specific to the
849
+ // AlgorithmIdentifier. While some unknown algorithm could choose to store
850
+ // arbitrary bit strings, all supported algorithms use a byte string, with bit
851
+ // order matching the DER encoding. Callers interpreting a BIT STRING as a byte
852
+ // string should reject bit strings that are not a whole number of bytes by
853
+ // requiring that `ASN1_BIT_STRING_unused_bits` returns zero; the byte length is
854
+ // returned by `ASN1_STRING_length`.
855
+ //
856
+ // This library represents BIT STRINGs as `ASN1_STRING`s with type
857
+ // `V_ASN1_BIT_STRING`. The data contains the encoded form of the BIT STRING,
858
+ // including any padding bits added to round to a whole number of bytes, but
859
+ // excluding the leading byte containing the number of padding bits. Instead,
860
+ // the bottom three bits of `flags` contain the number of padding bits. For
861
+ // example, DER encodes the BIT STRING {1, 0} as {0x06, 0x80 = 0b10_000000}. The
862
+ // `ASN1_STRING` representation has data of {0x80} and flags of 6.
863
+
864
+ // ASN1_BIT_STRING_new calls `ASN1_STRING_type_new` with `V_ASN1_BIT_STRING`.
865
+ OPENSSL_EXPORT ASN1_BIT_STRING *ASN1_BIT_STRING_new(void);
866
+
867
+ // ASN1_BIT_STRING_free calls `ASN1_STRING_free`.
868
+ OPENSSL_EXPORT void ASN1_BIT_STRING_free(ASN1_BIT_STRING *str);
869
+
870
+ // d2i_ASN1_BIT_STRING parses up to `len` bytes from `*inp` as a DER-encoded
871
+ // ASN.1 BIT STRING, as described in `d2i_SAMPLE`.
872
+ OPENSSL_EXPORT ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **out,
873
+ const uint8_t **inp,
874
+ long len);
875
+
876
+ // i2d_ASN1_BIT_STRING marshals `in` as a DER-encoded ASN.1 BIT STRING, as
877
+ // described in `i2d_SAMPLE`.
878
+ OPENSSL_EXPORT int i2d_ASN1_BIT_STRING(const ASN1_BIT_STRING *in,
879
+ uint8_t **outp);
880
+
881
+ // c2i_ASN1_BIT_STRING decodes `len` bytes from `*inp` as the contents of a
882
+ // DER-encoded BIT STRING, excluding the tag and length. It behaves like
883
+ // `d2i_SAMPLE` except, on success, it always consumes all `len` bytes.
884
+ OPENSSL_EXPORT ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **out,
885
+ const uint8_t **inp,
886
+ long len);
887
+
888
+ // i2c_ASN1_BIT_STRING encodes `in` as the contents of a DER-encoded BIT STRING,
889
+ // excluding the tag and length. If `outp` is non-NULL, it writes the result to
890
+ // `*outp`, advances `*outp` just past the output, and returns the number of
891
+ // bytes written. `*outp` must have space available for the result. If `outp` is
892
+ // NULL, it returns the number of bytes without writing anything. On error, it
893
+ // returns a value <= 0.
894
+ //
895
+ // Note this function differs slightly from `i2d_SAMPLE`. If `outp` is non-NULL
896
+ // and `*outp` is NULL, it does not allocate a new buffer.
897
+ //
898
+ // TODO(davidben): This function currently returns zero on error instead of -1,
899
+ // but it is also mostly infallible. I've currently documented <= 0 to suggest
900
+ // callers work with both.
901
+ OPENSSL_EXPORT int i2c_ASN1_BIT_STRING(const ASN1_BIT_STRING *in,
902
+ uint8_t **outp);
903
+
904
+ // ASN1_BIT_STRING is an `ASN1_ITEM` with ASN.1 type BIT STRING and C type
905
+ // `ASN1_BIT_STRING*`.
906
+ DECLARE_ASN1_ITEM(ASN1_BIT_STRING)
907
+
908
+ // ASN1_BIT_STRING_unused_bits returns the number of unused bits in the last
909
+ // byte of `str`. If `str` is empty (i.e. `ASN1_STRING_length` is zero), this
910
+ // always returns zero. Otherwise it returns a number between 0 and 7.
911
+ OPENSSL_EXPORT uint8_t ASN1_BIT_STRING_unused_bits(const ASN1_BIT_STRING *str);
912
+
913
+ // ASN1_BIT_STRING_set calls `ASN1_STRING_set`.
914
+ OPENSSL_EXPORT int ASN1_BIT_STRING_set(ASN1_BIT_STRING *str,
915
+ const uint8_t *data,
916
+ ossl_ssize_t length);
917
+
918
+ // ASN1_BIT_STRING_set1 sets `str` to a BIT STRING containing `length` bytes
919
+ // from `data`. It returns one on success and zero on error. The least
920
+ // significant `unused_bits` of the last byte of `data` are removed from the bit
921
+ // string. The removed bits must all be zero. `unused_bits` must be between 0
922
+ // and 7, and must be 0 if `length` is zero.
923
+ OPENSSL_EXPORT int ASN1_BIT_STRING_set1(ASN1_BIT_STRING *str,
924
+ const uint8_t *data, size_t length,
925
+ int unused_bits);
926
+
927
+ // ASN1_BIT_STRING_set_bit sets bit `n` of `str` to one if `value` is non-zero
928
+ // and zero if `value` is zero, resizing `str` as needed. It then truncates
929
+ // trailing zeros in `str` to align with the DER representation for a bit string
930
+ // with named bits. It returns one on success and zero on error. `n` is indexed
931
+ // beginning from zero.
932
+ OPENSSL_EXPORT int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *str, int n,
933
+ int value);
934
+
935
+ // ASN1_BIT_STRING_get_bit returns one if bit `n` of `a` is in bounds and set,
936
+ // and zero otherwise. `n` is indexed beginning from zero.
937
+ OPENSSL_EXPORT int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *str, int n);
938
+
939
+ // ASN1_BIT_STRING_check returns one if `str` only contains bits that are set in
940
+ // the `flags_len` bytes pointed by `flags`. Otherwise it returns zero. Bits in
941
+ // `flags` are arranged according to the DER representation, so bit 0
942
+ // corresponds to the MSB of `flags[0]`.
943
+ OPENSSL_EXPORT int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *str,
944
+ const unsigned char *flags,
945
+ int flags_len);
946
+
947
+
948
+ // Integers and enumerated values.
949
+ //
950
+ // INTEGER and ENUMERATED values are represented as `ASN1_STRING`s where the
951
+ // data contains the big-endian encoding of the absolute value of the integer.
952
+ // The sign bit is encoded in the type: non-negative values have a type of
953
+ // `V_ASN1_INTEGER` or `V_ASN1_ENUMERATED`, while negative values have a type of
954
+ // `V_ASN1_NEG_INTEGER` or `V_ASN1_NEG_ENUMERATED`. Note this differs from DER's
955
+ // two's complement representation.
956
+ //
957
+ // The data in the `ASN1_STRING` may not have leading zeros. Note this means
958
+ // zero is represented as the empty string. Parsing functions will never return
959
+ // invalid representations. If an invalid input is constructed, the marshaling
960
+ // functions will skip leading zeros, however other functions, such as
961
+ // `ASN1_INTEGER_cmp` or `ASN1_INTEGER_get`, may not return the correct result.
962
+
963
+ DEFINE_STACK_OF(ASN1_INTEGER)
964
+
965
+ // ASN1_INTEGER_new calls `ASN1_STRING_type_new` with `V_ASN1_INTEGER`. The
966
+ // resulting object has value zero.
967
+ OPENSSL_EXPORT ASN1_INTEGER *ASN1_INTEGER_new(void);
968
+
969
+ // ASN1_INTEGER_free calls `ASN1_STRING_free`.
970
+ OPENSSL_EXPORT void ASN1_INTEGER_free(ASN1_INTEGER *str);
971
+
972
+ // ASN1_INTEGER_dup calls `ASN1_STRING_dup`.
973
+ OPENSSL_EXPORT ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x);
974
+
975
+ // d2i_ASN1_INTEGER parses up to `len` bytes from `*inp` as a DER-encoded
976
+ // ASN.1 INTEGER, as described in `d2i_SAMPLE`.
977
+ OPENSSL_EXPORT ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **out,
978
+ const uint8_t **inp, long len);
979
+
980
+ // i2d_ASN1_INTEGER marshals `in` as a DER-encoded ASN.1 INTEGER, as
981
+ // described in `i2d_SAMPLE`.
982
+ OPENSSL_EXPORT int i2d_ASN1_INTEGER(const ASN1_INTEGER *in, uint8_t **outp);
983
+
984
+ // c2i_ASN1_INTEGER decodes `len` bytes from `*inp` as the contents of a
985
+ // DER-encoded INTEGER, excluding the tag and length. It behaves like
986
+ // `d2i_SAMPLE` except, on success, it always consumes all `len` bytes.
987
+ OPENSSL_EXPORT ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **in,
988
+ const uint8_t **outp, long len);
989
+
990
+ // i2c_ASN1_INTEGER encodes `in` as the contents of a DER-encoded INTEGER,
991
+ // excluding the tag and length. If `outp` is non-NULL, it writes the result to
992
+ // `*outp`, advances `*outp` just past the output, and returns the number of
993
+ // bytes written. `*outp` must have space available for the result. If `outp` is
994
+ // NULL, it returns the number of bytes without writing anything. On error, it
995
+ // returns a value <= 0.
996
+ //
997
+ // Note this function differs slightly from `i2d_SAMPLE`. If `outp` is non-NULL
998
+ // and `*outp` is NULL, it does not allocate a new buffer.
999
+ //
1000
+ // TODO(davidben): This function currently returns zero on error instead of -1,
1001
+ // but it is also mostly infallible. I've currently documented <= 0 to suggest
1002
+ // callers work with both.
1003
+ OPENSSL_EXPORT int i2c_ASN1_INTEGER(const ASN1_INTEGER *in, uint8_t **outp);
1004
+
1005
+ // ASN1_INTEGER is an `ASN1_ITEM` with ASN.1 type INTEGER and C type
1006
+ // `ASN1_INTEGER*`.
1007
+ DECLARE_ASN1_ITEM(ASN1_INTEGER)
1008
+
1009
+ // ASN1_INTEGER_set_uint64 sets `a` to an INTEGER with value `v`. It returns one
1010
+ // on success and zero on error.
1011
+ OPENSSL_EXPORT int ASN1_INTEGER_set_uint64(ASN1_INTEGER *out, uint64_t v);
1012
+
1013
+ // ASN1_INTEGER_set_int64 sets `a` to an INTEGER with value `v`. It returns one
1014
+ // on success and zero on error.
1015
+ OPENSSL_EXPORT int ASN1_INTEGER_set_int64(ASN1_INTEGER *out, int64_t v);
1016
+
1017
+ // ASN1_INTEGER_get_uint64 converts `a` to a `uint64_t`. On success, it returns
1018
+ // one and sets `*out` to the result. If `a` did not fit or has the wrong type,
1019
+ // it returns zero.
1020
+ OPENSSL_EXPORT int ASN1_INTEGER_get_uint64(uint64_t *out,
1021
+ const ASN1_INTEGER *a);
1022
+
1023
+ // ASN1_INTEGER_get_int64 converts `a` to a `int64_t`. On success, it returns
1024
+ // one and sets `*out` to the result. If `a` did not fit or has the wrong type,
1025
+ // it returns zero.
1026
+ OPENSSL_EXPORT int ASN1_INTEGER_get_int64(int64_t *out, const ASN1_INTEGER *a);
1027
+
1028
+ // BN_to_ASN1_INTEGER sets `ai` to an INTEGER with value `bn` and returns `ai`
1029
+ // on success or NULL or error. If `ai` is NULL, it returns a newly-allocated
1030
+ // `ASN1_INTEGER` on success instead, which the caller must release with
1031
+ // `ASN1_INTEGER_free`.
1032
+ OPENSSL_EXPORT ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn,
1033
+ ASN1_INTEGER *ai);
1034
+
1035
+ // ASN1_INTEGER_to_BN sets `bn` to the value of `ai` and returns `bn` on success
1036
+ // or NULL or error. If `bn` is NULL, it returns a newly-allocated `BIGNUM` on
1037
+ // success instead, which the caller must release with `BN_free`.
1038
+ OPENSSL_EXPORT BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
1039
+
1040
+ // ASN1_INTEGER_cmp compares the values of `x` and `y`. It returns an integer
1041
+ // equal to, less than, or greater than zero if `x` is equal to, less than, or
1042
+ // greater than `y`, respectively.
1043
+ OPENSSL_EXPORT int ASN1_INTEGER_cmp(const ASN1_INTEGER *x,
1044
+ const ASN1_INTEGER *y);
1045
+
1046
+ // ASN1_ENUMERATED_new calls `ASN1_STRING_type_new` with `V_ASN1_ENUMERATED`.
1047
+ // The resulting object has value zero.
1048
+ OPENSSL_EXPORT ASN1_ENUMERATED *ASN1_ENUMERATED_new(void);
1049
+
1050
+ // ASN1_ENUMERATED_free calls `ASN1_STRING_free`.
1051
+ OPENSSL_EXPORT void ASN1_ENUMERATED_free(ASN1_ENUMERATED *str);
1052
+
1053
+ // d2i_ASN1_ENUMERATED parses up to `len` bytes from `*inp` as a DER-encoded
1054
+ // ASN.1 ENUMERATED, as described in `d2i_SAMPLE`.
1055
+ OPENSSL_EXPORT ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **out,
1056
+ const uint8_t **inp,
1057
+ long len);
1058
+
1059
+ // i2d_ASN1_ENUMERATED marshals `in` as a DER-encoded ASN.1 ENUMERATED, as
1060
+ // described in `i2d_SAMPLE`.
1061
+ OPENSSL_EXPORT int i2d_ASN1_ENUMERATED(const ASN1_ENUMERATED *in,
1062
+ uint8_t **outp);
1063
+
1064
+ // ASN1_ENUMERATED is an `ASN1_ITEM` with ASN.1 type ENUMERATED and C type
1065
+ // `ASN1_ENUMERATED*`.
1066
+ DECLARE_ASN1_ITEM(ASN1_ENUMERATED)
1067
+
1068
+ // ASN1_ENUMERATED_set_uint64 sets `a` to an ENUMERATED with value `v`. It
1069
+ // returns one on success and zero on error.
1070
+ OPENSSL_EXPORT int ASN1_ENUMERATED_set_uint64(ASN1_ENUMERATED *out, uint64_t v);
1071
+
1072
+ // ASN1_ENUMERATED_set_int64 sets `a` to an ENUMERATED with value `v`. It
1073
+ // returns one on success and zero on error.
1074
+ OPENSSL_EXPORT int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *out, int64_t v);
1075
+
1076
+ // ASN1_ENUMERATED_get_uint64 converts `a` to a `uint64_t`. On success, it
1077
+ // returns one and sets `*out` to the result. If `a` did not fit or has the
1078
+ // wrong type, it returns zero.
1079
+ OPENSSL_EXPORT int ASN1_ENUMERATED_get_uint64(uint64_t *out,
1080
+ const ASN1_ENUMERATED *a);
1081
+
1082
+ // ASN1_ENUMERATED_get_int64 converts `a` to a `int64_t`. On success, it
1083
+ // returns one and sets `*out` to the result. If `a` did not fit or has the
1084
+ // wrong type, it returns zero.
1085
+ OPENSSL_EXPORT int ASN1_ENUMERATED_get_int64(int64_t *out,
1086
+ const ASN1_ENUMERATED *a);
1087
+
1088
+ // BN_to_ASN1_ENUMERATED sets `ai` to an ENUMERATED with value `bn` and returns
1089
+ // `ai` on success or NULL or error. If `ai` is NULL, it returns a
1090
+ // newly-allocated `ASN1_ENUMERATED` on success instead, which the caller must
1091
+ // release with `ASN1_ENUMERATED_free`.
1092
+ OPENSSL_EXPORT ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn,
1093
+ ASN1_ENUMERATED *ai);
1094
+
1095
+ // ASN1_ENUMERATED_to_BN sets `bn` to the value of `ai` and returns `bn` on
1096
+ // success or NULL or error. If `bn` is NULL, it returns a newly-allocated
1097
+ // `BIGNUM` on success instead, which the caller must release with `BN_free`.
1098
+ OPENSSL_EXPORT BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai,
1099
+ BIGNUM *bn);
1100
+
1101
+
1102
+ // Time.
1103
+ //
1104
+ // GeneralizedTime and UTCTime values are represented as `ASN1_STRING`s. The
1105
+ // type field is `V_ASN1_GENERALIZEDTIME` or `V_ASN1_UTCTIME`, respectively. The
1106
+ // data field contains the DER encoding of the value. For example, the UNIX
1107
+ // epoch would be "19700101000000Z" for a GeneralizedTime and "700101000000Z"
1108
+ // for a UTCTime.
1109
+ //
1110
+ // ASN.1 does not define how to interpret UTCTime's two-digit year. RFC 5280
1111
+ // defines it as a range from 1950 to 2049 for X.509. The library uses the
1112
+ // RFC 5280 interpretation. It does not currently enforce the restrictions from
1113
+ // BER, and the additional restrictions from RFC 5280, but future versions may.
1114
+ // Callers should not rely on fractional seconds and non-UTC time zones.
1115
+ //
1116
+ // The `ASN1_TIME` typedef is a multi-string representing the X.509 Time type,
1117
+ // which is a CHOICE of GeneralizedTime and UTCTime, using UTCTime when the
1118
+ // value is in range.
1119
+
1120
+ // ASN1_UTCTIME_new calls `ASN1_STRING_type_new` with `V_ASN1_UTCTIME`. The
1121
+ // resulting object contains empty contents and must be initialized to be a
1122
+ // valid UTCTime.
1123
+ OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_new(void);
1124
+
1125
+ // ASN1_UTCTIME_free calls `ASN1_STRING_free`.
1126
+ OPENSSL_EXPORT void ASN1_UTCTIME_free(ASN1_UTCTIME *str);
1127
+
1128
+ // d2i_ASN1_UTCTIME parses up to `len` bytes from `*inp` as a DER-encoded
1129
+ // ASN.1 UTCTime, as described in `d2i_SAMPLE`.
1130
+ //
1131
+ // TODO(https://crbug.com/boringssl/354): This function currently also accepts
1132
+ // BER, but this will be removed in the future.
1133
+ OPENSSL_EXPORT ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **out,
1134
+ const uint8_t **inp, long len);
1135
+
1136
+ // i2d_ASN1_UTCTIME marshals `in` as a DER-encoded ASN.1 UTCTime, as
1137
+ // described in `i2d_SAMPLE`.
1138
+ OPENSSL_EXPORT int i2d_ASN1_UTCTIME(const ASN1_UTCTIME *in, uint8_t **outp);
1139
+
1140
+ // ASN1_UTCTIME is an `ASN1_ITEM` with ASN.1 type UTCTime and C type
1141
+ // `ASN1_UTCTIME*`.
1142
+ DECLARE_ASN1_ITEM(ASN1_UTCTIME)
1143
+
1144
+ // ASN1_UTCTIME_check returns one if `a` is a valid UTCTime and zero otherwise.
1145
+ OPENSSL_EXPORT int ASN1_UTCTIME_check(const ASN1_UTCTIME *a);
1146
+
1147
+ // ASN1_UTCTIME_set represents `posix_time` as a UTCTime and writes the result
1148
+ // to `s`. It returns `s` on success and NULL on error. If `s` is NULL, it
1149
+ // returns a newly-allocated `ASN1_UTCTIME` instead.
1150
+ //
1151
+ // Note this function may fail if the time is out of range for UTCTime.
1152
+ OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,
1153
+ int64_t posix_time);
1154
+
1155
+ // ASN1_UTCTIME_adj adds `offset_day` days and `offset_sec` seconds to
1156
+ // `posix_time` and writes the result to `s` as a UTCTime. It returns `s` on
1157
+ // success and NULL on error. If `s` is NULL, it returns a newly-allocated
1158
+ // `ASN1_UTCTIME` instead.
1159
+ //
1160
+ // Note this function may fail if the time overflows or is out of range for
1161
+ // UTCTime.
1162
+ OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s,
1163
+ int64_t posix_time,
1164
+ int offset_day, long offset_sec);
1165
+
1166
+ // ASN1_UTCTIME_set_string sets `s` to a UTCTime whose contents are a copy of
1167
+ // `str`. It returns one on success and zero on error or if `str` is not a valid
1168
+ // UTCTime.
1169
+ //
1170
+ // If `s` is NULL, this function validates `str` without copying it.
1171
+ OPENSSL_EXPORT int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
1172
+
1173
+ // ASN1_GENERALIZEDTIME_new calls `ASN1_STRING_type_new` with
1174
+ // `V_ASN1_GENERALIZEDTIME`. The resulting object contains empty contents and
1175
+ // must be initialized to be a valid GeneralizedTime.
1176
+ OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_new(void);
1177
+
1178
+ // ASN1_GENERALIZEDTIME_free calls `ASN1_STRING_free`.
1179
+ OPENSSL_EXPORT void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *str);
1180
+
1181
+ // d2i_ASN1_GENERALIZEDTIME parses up to `len` bytes from `*inp` as a
1182
+ // DER-encoded ASN.1 GeneralizedTime, as described in `d2i_SAMPLE`.
1183
+ OPENSSL_EXPORT ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(
1184
+ ASN1_GENERALIZEDTIME **out, const uint8_t **inp, long len);
1185
+
1186
+ // i2d_ASN1_GENERALIZEDTIME marshals `in` as a DER-encoded ASN.1
1187
+ // GeneralizedTime, as described in `i2d_SAMPLE`.
1188
+ OPENSSL_EXPORT int i2d_ASN1_GENERALIZEDTIME(const ASN1_GENERALIZEDTIME *in,
1189
+ uint8_t **outp);
1190
+
1191
+ // ASN1_GENERALIZEDTIME is an `ASN1_ITEM` with ASN.1 type GeneralizedTime and C
1192
+ // type `ASN1_GENERALIZEDTIME*`.
1193
+ DECLARE_ASN1_ITEM(ASN1_GENERALIZEDTIME)
1194
+
1195
+ // ASN1_GENERALIZEDTIME_check returns one if `a` is a valid GeneralizedTime and
1196
+ // zero otherwise.
1197
+ OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
1198
+
1199
+ // ASN1_GENERALIZEDTIME_set represents `posix_time` as a GeneralizedTime and
1200
+ // writes the result to `s`. It returns `s` on success and NULL on error. If `s`
1201
+ // is NULL, it returns a newly-allocated `ASN1_GENERALIZEDTIME` instead.
1202
+ //
1203
+ // Note this function may fail if the time is out of range for GeneralizedTime.
1204
+ OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(
1205
+ ASN1_GENERALIZEDTIME *s, int64_t posix_time);
1206
+
1207
+ // ASN1_GENERALIZEDTIME_adj adds `offset_day` days and `offset_sec` seconds to
1208
+ // `posix_time` and writes the result to `s` as a GeneralizedTime. It returns
1209
+ // `s` on success and NULL on error. If `s` is NULL, it returns a
1210
+ // newly-allocated `ASN1_GENERALIZEDTIME` instead.
1211
+ //
1212
+ // Note this function may fail if the time overflows or is out of range for
1213
+ // GeneralizedTime.
1214
+ OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(
1215
+ ASN1_GENERALIZEDTIME *s, int64_t posix_time, int offset_day,
1216
+ long offset_sec);
1217
+
1218
+ // ASN1_GENERALIZEDTIME_set_string sets `s` to a GeneralizedTime whose contents
1219
+ // are a copy of `str`. It returns one on success and zero on error or if `str`
1220
+ // is not a valid GeneralizedTime.
1221
+ //
1222
+ // If `s` is NULL, this function validates `str` without copying it.
1223
+ OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s,
1224
+ const char *str);
1225
+
1226
+ // B_ASN1_TIME is a bitmask of types allowed in an X.509 Time.
1227
+ #define B_ASN1_TIME (B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME)
1228
+
1229
+ // ASN1_TIME_new returns a newly-allocated `ASN1_TIME` with type -1, or NULL on
1230
+ // error. The resulting `ASN1_TIME` is not a valid X.509 Time until initialized
1231
+ // with a value.
1232
+ OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_new(void);
1233
+
1234
+ // ASN1_TIME_free releases memory associated with `str`.
1235
+ OPENSSL_EXPORT void ASN1_TIME_free(ASN1_TIME *str);
1236
+
1237
+ // d2i_ASN1_TIME parses up to `len` bytes from `*inp` as a DER-encoded X.509
1238
+ // Time (RFC 5280), as described in `d2i_SAMPLE`.
1239
+ //
1240
+ // TODO(https://crbug.com/boringssl/354): This function currently also accepts
1241
+ // BER, but this will be removed in the future.
1242
+ OPENSSL_EXPORT ASN1_TIME *d2i_ASN1_TIME(ASN1_TIME **out, const uint8_t **inp,
1243
+ long len);
1244
+
1245
+ // i2d_ASN1_TIME marshals `in` as a DER-encoded X.509 Time (RFC 5280), as
1246
+ // described in `i2d_SAMPLE`.
1247
+ OPENSSL_EXPORT int i2d_ASN1_TIME(const ASN1_TIME *in, uint8_t **outp);
1248
+
1249
+ // ASN1_TIME_diff computes `to` - `from`. On success, it sets `*out_days` to the
1250
+ // difference in days, rounded towards zero, sets `*out_seconds` to the
1251
+ // remainder, and returns one. On error, it returns zero.
1252
+ //
1253
+ // If `from` is before `to`, both outputs will be <= 0, with at least one
1254
+ // negative. If `from` is after `to`, both will be >= 0, with at least one
1255
+ // positive. If they are equal, ignoring fractional seconds, both will be zero.
1256
+ //
1257
+ // Note this function may fail on overflow, or if `from` or `to` cannot be
1258
+ // decoded.
1259
+ OPENSSL_EXPORT int ASN1_TIME_diff(int *out_days, int *out_seconds,
1260
+ const ASN1_TIME *from, const ASN1_TIME *to);
1261
+
1262
+ // ASN1_TIME_set_posix represents `posix_time` as a GeneralizedTime or UTCTime
1263
+ // and writes the result to `s`. As in RFC 5280, section 4.1.2.5, it uses
1264
+ // UTCTime when the time fits and GeneralizedTime otherwise. It returns `s` on
1265
+ // success and NULL on error. If `s` is NULL, it returns a newly-allocated
1266
+ // `ASN1_TIME` instead.
1267
+ //
1268
+ // Note this function may fail if the time is out of range for GeneralizedTime.
1269
+ OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_set_posix(ASN1_TIME *s, int64_t posix_time);
1270
+
1271
+ // ASN1_TIME_set is exactly the same as `ASN1_TIME_set_posix` but with a
1272
+ // time_t as input for compatibility.
1273
+ OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t time);
1274
+
1275
+ // ASN1_TIME_adj adds `offset_day` days and `offset_sec` seconds to
1276
+ // `posix_time` and writes the result to `s`. As in RFC 5280, section 4.1.2.5,
1277
+ // it uses UTCTime when the time fits and GeneralizedTime otherwise. It returns
1278
+ // `s` on success and NULL on error. If `s` is NULL, it returns a
1279
+ // newly-allocated `ASN1_GENERALIZEDTIME` instead.
1280
+ //
1281
+ // Note this function may fail if the time overflows or is out of range for
1282
+ // GeneralizedTime.
1283
+ OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, int64_t posix_time,
1284
+ int offset_day, long offset_sec);
1285
+
1286
+ // ASN1_TIME_check returns one if `t` is a valid UTCTime or GeneralizedTime, and
1287
+ // zero otherwise. `t`'s type determines which check is performed. This
1288
+ // function does not enforce that UTCTime was used when possible.
1289
+ OPENSSL_EXPORT int ASN1_TIME_check(const ASN1_TIME *t);
1290
+
1291
+ // ASN1_TIME_to_generalizedtime converts `t` to a GeneralizedTime. If `out` is
1292
+ // NULL, it returns a newly-allocated `ASN1_GENERALIZEDTIME` on success, or NULL
1293
+ // on error. If `out` is non-NULL and `*out` is NULL, it additionally sets
1294
+ // `*out` to the result. If `out` and `*out` are non-NULL, it instead updates
1295
+ // the object pointed by `*out` and returns `*out` on success or NULL on error.
1296
+ OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(
1297
+ const ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
1298
+
1299
+ // ASN1_TIME_set_string behaves like `ASN1_UTCTIME_set_string` if `str` is a
1300
+ // valid UTCTime, and `ASN1_GENERALIZEDTIME_set_string` if `str` is a valid
1301
+ // GeneralizedTime. If `str` is neither, it returns zero.
1302
+ OPENSSL_EXPORT int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
1303
+
1304
+ // ASN1_TIME_set_string_X509 behaves like `ASN1_TIME_set_string` except it
1305
+ // additionally converts GeneralizedTime to UTCTime if it is in the range where
1306
+ // UTCTime is used. See RFC 5280, section 4.1.2.5.
1307
+ OPENSSL_EXPORT int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str);
1308
+
1309
+ // ASN1_TIME_to_time_t converts `t` to a time_t value in `out`. On
1310
+ // success, one is returned. On failure, zero is returned. This function
1311
+ // will fail if the time can not be represented in a time_t.
1312
+ OPENSSL_EXPORT int ASN1_TIME_to_time_t(const ASN1_TIME *t, time_t *out);
1313
+
1314
+ // ASN1_TIME_to_posix converts `t` to a POSIX time value in `out`. On
1315
+ // success, one is returned. On failure, zero is returned.
1316
+ OPENSSL_EXPORT int ASN1_TIME_to_posix(const ASN1_TIME *t, int64_t *out);
1317
+
1318
+ // ASN1_TIME_to_posix_nonstandard converts `t` to a POSIX time value in
1319
+ // `out`. It is exactly the same as `ASN1_TIME_to_posix` but allows for
1320
+ // non-standard four-digit timezone offsets on UTC times. On success, one is
1321
+ // returned. On failure, zero is returned. `ASN1_TIME_to_posix` should normally
1322
+ // be used instead of this function.
1323
+ OPENSSL_EXPORT int ASN1_TIME_to_posix_nonstandard(const ASN1_TIME *t,
1324
+ int64_t *out);
1325
+
1326
+ // TODO(davidben): Expand and document function prototypes generated in macros.
1327
+
1328
+
1329
+ // NULL values.
1330
+ //
1331
+ // This library represents the ASN.1 NULL value by a non-NULL pointer to the
1332
+ // opaque type `ASN1_NULL`. An omitted OPTIONAL ASN.1 NULL value is a NULL
1333
+ // pointer. Unlike other pointer types, it is not necessary to free `ASN1_NULL`
1334
+ // pointers, but it is safe to do so.
1335
+
1336
+ // ASN1_NULL_new returns an opaque, non-NULL pointer. It is safe to call
1337
+ // `ASN1_NULL_free` on the result, but not necessary.
1338
+ OPENSSL_EXPORT ASN1_NULL *ASN1_NULL_new(void);
1339
+
1340
+ // ASN1_NULL_free does nothing.
1341
+ OPENSSL_EXPORT void ASN1_NULL_free(ASN1_NULL *null);
1342
+
1343
+ // d2i_ASN1_NULL parses a DER-encoded ASN.1 NULL value from up to `len` bytes
1344
+ // at `*inp`, as described in `d2i_SAMPLE`.
1345
+ OPENSSL_EXPORT ASN1_NULL *d2i_ASN1_NULL(ASN1_NULL **out, const uint8_t **inp,
1346
+ long len);
1347
+
1348
+ // i2d_ASN1_NULL marshals `in` as a DER-encoded ASN.1 NULL value, as described
1349
+ // in `i2d_SAMPLE`.
1350
+ OPENSSL_EXPORT int i2d_ASN1_NULL(const ASN1_NULL *in, uint8_t **outp);
1351
+
1352
+ // ASN1_NULL is an `ASN1_ITEM` with ASN.1 type NULL and C type `ASN1_NULL*`.
1353
+ DECLARE_ASN1_ITEM(ASN1_NULL)
1354
+
1355
+
1356
+ // Object identifiers.
1357
+ //
1358
+ // An `ASN1_OBJECT` represents an ASN.1 OBJECT IDENTIFIER. See also obj.h for
1359
+ // additional functions relating to `ASN1_OBJECT`.
1360
+ //
1361
+ // TODO(davidben): What's the relationship between asn1.h and obj.h? Most of
1362
+ // obj.h deals with the large NID table, but then functions like `OBJ_get0_data`
1363
+ // or `OBJ_dup` are general `ASN1_OBJECT` functions.
1364
+
1365
+ DEFINE_STACK_OF(ASN1_OBJECT)
1366
+
1367
+ // ASN1_OBJECT_create returns a newly-allocated `ASN1_OBJECT` with `len` bytes
1368
+ // from `data` as the encoded OID, or NULL on error. `data` should contain the
1369
+ // DER-encoded identifier, excluding the tag and length.
1370
+ //
1371
+ // `nid` should be `NID_undef`. Passing a NID value that does not match `data`
1372
+ // will cause some functions to misbehave. `sn` and `ln` should be NULL. If
1373
+ // non-NULL, they are stored as short and long names, respectively, but these
1374
+ // values have no effect for `ASN1_OBJECT`s created through this function.
1375
+ //
1376
+ // TODO(davidben): Should we just ignore all those parameters? NIDs and names
1377
+ // are only relevant for `ASN1_OBJECT`s in the obj.h table.
1378
+ OPENSSL_EXPORT ASN1_OBJECT *ASN1_OBJECT_create(int nid, const uint8_t *data,
1379
+ size_t len, const char *sn,
1380
+ const char *ln);
1381
+
1382
+ // ASN1_OBJECT_free releases memory associated with `a`. If `a` is a static
1383
+ // `ASN1_OBJECT`, returned from `OBJ_nid2obj`, this function does nothing.
1384
+ OPENSSL_EXPORT void ASN1_OBJECT_free(ASN1_OBJECT *a);
1385
+
1386
+ // d2i_ASN1_OBJECT parses a DER-encoded ASN.1 OBJECT IDENTIFIER from up to `len`
1387
+ // bytes at `*inp`, as described in `d2i_SAMPLE`.
1388
+ OPENSSL_EXPORT ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **out,
1389
+ const uint8_t **inp, long len);
1390
+
1391
+ // i2d_ASN1_OBJECT marshals `in` as a DER-encoded ASN.1 OBJECT IDENTIFIER, as
1392
+ // described in `i2d_SAMPLE`.
1393
+ OPENSSL_EXPORT int i2d_ASN1_OBJECT(const ASN1_OBJECT *in, uint8_t **outp);
1394
+
1395
+ // c2i_ASN1_OBJECT decodes `len` bytes from `*inp` as the contents of a
1396
+ // DER-encoded OBJECT IDENTIFIER, excluding the tag and length. It behaves like
1397
+ // `d2i_SAMPLE` except, on success, it always consumes all `len` bytes.
1398
+ OPENSSL_EXPORT ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **out,
1399
+ const uint8_t **inp, long len);
1400
+
1401
+ // ASN1_OBJECT is an `ASN1_ITEM` with ASN.1 type OBJECT IDENTIFIER and C type
1402
+ // `ASN1_OBJECT*`.
1403
+ DECLARE_ASN1_ITEM(ASN1_OBJECT)
1404
+
1405
+
1406
+ // Arbitrary elements.
1407
+
1408
+ // An asn1_type_st (aka `ASN1_TYPE`) represents an arbitrary ASN.1 element,
1409
+ // typically used for ANY types. It contains a `type` field and a `value` union
1410
+ // dependent on `type`.
1411
+ //
1412
+ // WARNING: This struct has a complex representation. Callers must not construct
1413
+ // `ASN1_TYPE` values manually. Use `ASN1_TYPE_set` and `ASN1_TYPE_set1`
1414
+ // instead. Additionally, callers performing non-trivial operations on this type
1415
+ // are encouraged to use `CBS` and `CBB` from <openssl/bytestring.h>, and
1416
+ // convert to or from `ASN1_TYPE` with `d2i_ASN1_TYPE` or `i2d_ASN1_TYPE`.
1417
+ //
1418
+ // The `type` field corresponds to the tag of the ASN.1 element being
1419
+ // represented:
1420
+ //
1421
+ // If `type` is a `V_ASN1_*` constant for an ASN.1 string-like type, as defined
1422
+ // by `ASN1_STRING`, the tag matches the constant. `value` contains an
1423
+ // `ASN1_STRING` pointer (equivalently, one of the more specific typedefs). See
1424
+ // `ASN1_STRING` for details on the representation. Unlike `ASN1_STRING`,
1425
+ // `ASN1_TYPE` does not use the `V_ASN1_NEG` flag for negative INTEGER and
1426
+ // ENUMERATE values. For a negative value, the `ASN1_TYPE`'s `type` will be
1427
+ // `V_ASN1_INTEGER` or `V_ASN1_ENUMERATED`, but `value` will an `ASN1_STRING`
1428
+ // whose `type` is `V_ASN1_NEG_INTEGER` or `V_ASN1_NEG_ENUMERATED`.
1429
+ //
1430
+ // If `type` is `V_ASN1_OBJECT`, the tag is OBJECT IDENTIFIER and `value`
1431
+ // contains an `ASN1_OBJECT` pointer.
1432
+ //
1433
+ // If `type` is `V_ASN1_NULL`, the tag is NULL. `value` contains a NULL pointer.
1434
+ //
1435
+ // If `type` is `V_ASN1_BOOLEAN`, the tag is BOOLEAN. `value` contains an
1436
+ // `ASN1_BOOLEAN`.
1437
+ //
1438
+ // If `type` is `V_ASN1_SEQUENCE`, `V_ASN1_SET`, or `V_ASN1_OTHER`, the tag is
1439
+ // SEQUENCE, SET, or some arbitrary tag, respectively. `value` uses the
1440
+ // corresponding `ASN1_STRING` representation. Although any type may be
1441
+ // represented in `V_ASN1_OTHER`, the parser will always return the more
1442
+ // specific encoding when available.
1443
+ //
1444
+ // Other values of `type` do not represent a valid ASN.1 value, though
1445
+ // default-constructed objects may set `type` to -1. Such objects cannot be
1446
+ // serialized.
1447
+ struct asn1_type_st {
1448
+ int type;
1449
+ union {
1450
+ char *ptr;
1451
+ ASN1_BOOLEAN boolean;
1452
+ ASN1_STRING *asn1_string;
1453
+ ASN1_OBJECT *object;
1454
+ ASN1_INTEGER *integer;
1455
+ ASN1_ENUMERATED *enumerated;
1456
+ ASN1_BIT_STRING *bit_string;
1457
+ ASN1_OCTET_STRING *octet_string;
1458
+ ASN1_PRINTABLESTRING *printablestring;
1459
+ ASN1_T61STRING *t61string;
1460
+ ASN1_IA5STRING *ia5string;
1461
+ ASN1_GENERALSTRING *generalstring;
1462
+ ASN1_BMPSTRING *bmpstring;
1463
+ ASN1_UNIVERSALSTRING *universalstring;
1464
+ ASN1_UTCTIME *utctime;
1465
+ ASN1_GENERALIZEDTIME *generalizedtime;
1466
+ ASN1_VISIBLESTRING *visiblestring;
1467
+ ASN1_UTF8STRING *utf8string;
1468
+ // set and sequence are left complete and still contain the entire element.
1469
+ ASN1_STRING *set;
1470
+ ASN1_STRING *sequence;
1471
+ ASN1_VALUE *asn1_value;
1472
+ } value;
1473
+ };
1474
+
1475
+ DEFINE_STACK_OF(ASN1_TYPE)
1476
+
1477
+ // ASN1_TYPE_new returns a newly-allocated `ASN1_TYPE`, or NULL on allocation
1478
+ // failure. The resulting object has type -1 and must be initialized to be
1479
+ // a valid ANY value.
1480
+ OPENSSL_EXPORT ASN1_TYPE *ASN1_TYPE_new(void);
1481
+
1482
+ // ASN1_TYPE_free releases memory associated with `a`.
1483
+ OPENSSL_EXPORT void ASN1_TYPE_free(ASN1_TYPE *a);
1484
+
1485
+ // d2i_ASN1_TYPE parses up to `len` bytes from `*inp` as an ASN.1 value of any
1486
+ // type, as described in `d2i_SAMPLE`. Note this function only validates
1487
+ // primitive, universal types supported by this library. Values of type
1488
+ // `V_ASN1_SEQUENCE`, `V_ASN1_SET`, `V_ASN1_OTHER`, or an unsupported primitive
1489
+ // type must be validated by the caller when interpreting.
1490
+ //
1491
+ // TODO(https://crbug.com/boringssl/354): This function currently also accepts
1492
+ // BER, but this will be removed in the future.
1493
+ OPENSSL_EXPORT ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **out, const uint8_t **inp,
1494
+ long len);
1495
+
1496
+ // i2d_ASN1_TYPE marshals `in` as DER, as described in `i2d_SAMPLE`.
1497
+ OPENSSL_EXPORT int i2d_ASN1_TYPE(const ASN1_TYPE *in, uint8_t **outp);
1498
+
1499
+ // ASN1_ANY is an `ASN1_ITEM` with ASN.1 type ANY and C type `ASN1_TYPE*`. Note
1500
+ // the `ASN1_ITEM` name and C type do not match.
1501
+ DECLARE_ASN1_ITEM(ASN1_ANY)
1502
+
1503
+ // ASN1_TYPE_get returns the type of `a`, which will be one of the `V_ASN1_*`
1504
+ // constants, or zero if `a` is not fully initialized.
1505
+ OPENSSL_EXPORT int ASN1_TYPE_get(const ASN1_TYPE *a);
1506
+
1507
+ // ASN1_TYPE_set sets `a` to an `ASN1_TYPE` of type `type` and value `value`,
1508
+ // releasing the previous contents of `a`.
1509
+ //
1510
+ // If `type` is `V_ASN1_BOOLEAN`, `a` is set to FALSE if `value` is NULL and
1511
+ // TRUE otherwise. If setting `a` to TRUE, `value` may be an invalid pointer,
1512
+ // such as (void*)1.
1513
+ //
1514
+ // If `type` is `V_ASN1_NULL`, `value` must be NULL.
1515
+ //
1516
+ // For other values of `type`, this function takes ownership of `value`, which
1517
+ // must point to an object of the corresponding type. See `ASN1_TYPE` for
1518
+ // details.
1519
+ OPENSSL_EXPORT void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
1520
+
1521
+ // ASN1_TYPE_set1 behaves like `ASN1_TYPE_set` except it does not take ownership
1522
+ // of `value`. It returns one on success and zero on error.
1523
+ OPENSSL_EXPORT int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
1524
+
1525
+ // ASN1_TYPE_cmp returns zero if `a` and `b` are equal and some non-zero value
1526
+ // otherwise. Note this function can only be used for equality checks, not an
1527
+ // ordering.
1528
+ OPENSSL_EXPORT int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
1529
+
1530
+ typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
1531
+
1532
+ // d2i_ASN1_SEQUENCE_ANY parses up to `len` bytes from `*inp` as a DER-encoded
1533
+ // ASN.1 SEQUENCE OF ANY structure, as described in `d2i_SAMPLE`. The resulting
1534
+ // `ASN1_SEQUENCE_ANY` owns its contents and thus must be released with
1535
+ // `sk_ASN1_TYPE_pop_free` and `ASN1_TYPE_free`, not `sk_ASN1_TYPE_free`.
1536
+ //
1537
+ // TODO(https://crbug.com/boringssl/354): This function currently also accepts
1538
+ // BER, but this will be removed in the future.
1539
+ OPENSSL_EXPORT ASN1_SEQUENCE_ANY *d2i_ASN1_SEQUENCE_ANY(ASN1_SEQUENCE_ANY **out,
1540
+ const uint8_t **inp,
1541
+ long len);
1542
+
1543
+ // i2d_ASN1_SEQUENCE_ANY marshals `in` as a DER-encoded SEQUENCE OF ANY
1544
+ // structure, as described in `i2d_SAMPLE`.
1545
+ OPENSSL_EXPORT int i2d_ASN1_SEQUENCE_ANY(const ASN1_SEQUENCE_ANY *in,
1546
+ uint8_t **outp);
1547
+
1548
+ // d2i_ASN1_SET_ANY parses up to `len` bytes from `*inp` as a DER-encoded ASN.1
1549
+ // SET OF ANY structure, as described in `d2i_SAMPLE`. The resulting
1550
+ // `ASN1_SEQUENCE_ANY` owns its contents and thus must be released with
1551
+ // `sk_ASN1_TYPE_pop_free` and `ASN1_TYPE_free`, not `sk_ASN1_TYPE_free`.
1552
+ //
1553
+ // TODO(https://crbug.com/boringssl/354): This function currently also accepts
1554
+ // BER, but this will be removed in the future.
1555
+ OPENSSL_EXPORT ASN1_SEQUENCE_ANY *d2i_ASN1_SET_ANY(ASN1_SEQUENCE_ANY **out,
1556
+ const uint8_t **inp,
1557
+ long len);
1558
+
1559
+ // i2d_ASN1_SET_ANY marshals `in` as a DER-encoded SET OF ANY structure, as
1560
+ // described in `i2d_SAMPLE`.
1561
+ OPENSSL_EXPORT int i2d_ASN1_SET_ANY(const ASN1_SEQUENCE_ANY *in,
1562
+ uint8_t **outp);
1563
+
1564
+
1565
+ // Human-readable output.
1566
+ //
1567
+ // The following functions output types in some human-readable format. These
1568
+ // functions may be used for debugging and logging. However, the output should
1569
+ // not be consumed programmatically. They may be ambiguous or lose information.
1570
+
1571
+ // ASN1_UTCTIME_print writes a human-readable representation of `a` to `out`. It
1572
+ // returns one on success and zero on error.
1573
+ OPENSSL_EXPORT int ASN1_UTCTIME_print(BIO *out, const ASN1_UTCTIME *a);
1574
+
1575
+ // ASN1_GENERALIZEDTIME_print writes a human-readable representation of `a` to
1576
+ // `out`. It returns one on success and zero on error.
1577
+ OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_print(BIO *out,
1578
+ const ASN1_GENERALIZEDTIME *a);
1579
+
1580
+ // ASN1_TIME_print writes a human-readable representation of `a` to `out`. It
1581
+ // returns one on success and zero on error.
1582
+ OPENSSL_EXPORT int ASN1_TIME_print(BIO *out, const ASN1_TIME *a);
1583
+
1584
+ // ASN1_STRING_print writes a human-readable representation of `str` to `out`.
1585
+ // It returns one on success and zero on error. Unprintable characters are
1586
+ // replaced with '.'.
1587
+ OPENSSL_EXPORT int ASN1_STRING_print(BIO *out, const ASN1_STRING *str);
1588
+
1589
+ // The following flags must not collide with `XN_FLAG_*`.
1590
+
1591
+ // ASN1_STRFLGS_ESC_2253 causes characters to be escaped as in RFC 2253, section
1592
+ // 2.4.
1593
+ #define ASN1_STRFLGS_ESC_2253 1ul
1594
+
1595
+ // ASN1_STRFLGS_ESC_CTRL causes all control characters to be escaped.
1596
+ #define ASN1_STRFLGS_ESC_CTRL 2ul
1597
+
1598
+ // ASN1_STRFLGS_ESC_MSB causes all characters above 127 to be escaped.
1599
+ #define ASN1_STRFLGS_ESC_MSB 4ul
1600
+
1601
+ // ASN1_STRFLGS_ESC_QUOTE causes the string to be surrounded by quotes, rather
1602
+ // than using backslashes, when characters are escaped. Fewer characters will
1603
+ // require escapes in this case.
1604
+ #define ASN1_STRFLGS_ESC_QUOTE 8ul
1605
+
1606
+ // ASN1_STRFLGS_UTF8_CONVERT causes the string to be encoded as UTF-8, with each
1607
+ // byte in the UTF-8 encoding treated as an individual character for purposes of
1608
+ // escape sequences. If not set, each Unicode codepoint in the string is treated
1609
+ // as a character, with wide characters escaped as "\Uxxxx" or "\Wxxxxxxxx".
1610
+ // Note this can be ambiguous if `ASN1_STRFLGS_ESC_*` are all unset. In that
1611
+ // case, backslashes are not escaped, but wide characters are.
1612
+ #define ASN1_STRFLGS_UTF8_CONVERT 0x10ul
1613
+
1614
+ // ASN1_STRFLGS_IGNORE_TYPE causes the string type to be ignored. The
1615
+ // `ASN1_STRING` in-memory representation will be printed directly.
1616
+ #define ASN1_STRFLGS_IGNORE_TYPE 0x20ul
1617
+
1618
+ // ASN1_STRFLGS_SHOW_TYPE causes the string type to be included in the output.
1619
+ #define ASN1_STRFLGS_SHOW_TYPE 0x40ul
1620
+
1621
+ // ASN1_STRFLGS_DUMP_ALL causes all strings to be printed as a hexdump, using
1622
+ // RFC 2253 hexstring notation, such as "#0123456789ABCDEF".
1623
+ #define ASN1_STRFLGS_DUMP_ALL 0x80ul
1624
+
1625
+ // ASN1_STRFLGS_DUMP_UNKNOWN behaves like `ASN1_STRFLGS_DUMP_ALL` but only
1626
+ // applies to values of unknown type. If unset, unknown values will print
1627
+ // their contents as single-byte characters with escape sequences.
1628
+ #define ASN1_STRFLGS_DUMP_UNKNOWN 0x100ul
1629
+
1630
+ // ASN1_STRFLGS_DUMP_DER causes hexdumped strings (as determined by
1631
+ // `ASN1_STRFLGS_DUMP_ALL` or `ASN1_STRFLGS_DUMP_UNKNOWN`) to print the entire
1632
+ // DER element as in RFC 2253, rather than only the contents of the
1633
+ // `ASN1_STRING`.
1634
+ #define ASN1_STRFLGS_DUMP_DER 0x200ul
1635
+
1636
+ // ASN1_STRFLGS_RFC2253 causes the string to be escaped as in RFC 2253,
1637
+ // additionally escaping control characters.
1638
+ #define ASN1_STRFLGS_RFC2253 \
1639
+ (ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | \
1640
+ ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | \
1641
+ ASN1_STRFLGS_DUMP_DER)
1642
+
1643
+ // ASN1_STRING_print_ex writes a human-readable representation of `str` to
1644
+ // `out`. It returns the number of bytes written on success and -1 on error. If
1645
+ // `out` is NULL, it returns the number of bytes it would have written, without
1646
+ // writing anything.
1647
+ //
1648
+ // The `flags` should be a combination of combination of `ASN1_STRFLGS_*`
1649
+ // constants. See the documentation for each flag for how it controls the
1650
+ // output. If unsure, use `ASN1_STRFLGS_RFC2253`.
1651
+ OPENSSL_EXPORT int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str,
1652
+ unsigned long flags);
1653
+
1654
+ // ASN1_STRING_print_ex_fp behaves like `ASN1_STRING_print_ex` but writes to a
1655
+ // `FILE` rather than a `BIO`.
1656
+ OPENSSL_EXPORT int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str,
1657
+ unsigned long flags);
1658
+
1659
+ // i2a_ASN1_INTEGER writes a human-readable representation of `a` to `bp`. It
1660
+ // returns the number of bytes written on success, or a negative number on
1661
+ // error. On error, this function may have written a partial output to `bp`.
1662
+ OPENSSL_EXPORT int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a);
1663
+
1664
+ // i2a_ASN1_ENUMERATED writes a human-readable representation of `a` to `bp`. It
1665
+ // returns the number of bytes written on success, or a negative number on
1666
+ // error. On error, this function may have written a partial output to `bp`.
1667
+ OPENSSL_EXPORT int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a);
1668
+
1669
+ // i2a_ASN1_OBJECT writes a human-readable representation of `a` to `bp`. It
1670
+ // returns the number of bytes written on success, or a negative number on
1671
+ // error. On error, this function may have written a partial output to `bp`.
1672
+ OPENSSL_EXPORT int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a);
1673
+
1674
+ // i2a_ASN1_STRING writes a text representation of `a`'s contents to `bp`. It
1675
+ // returns the number of bytes written on success, or a negative number on
1676
+ // error. On error, this function may have written a partial output to `bp`.
1677
+ // `type` is ignored.
1678
+ //
1679
+ // This function does not decode `a` into a Unicode string. It only hex-encodes
1680
+ // the internal representation of `a`. This is suitable for printing an OCTET
1681
+ // STRING, but may not be human-readable for any other string type.
1682
+ OPENSSL_EXPORT int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type);
1683
+
1684
+ // i2t_ASN1_OBJECT calls `OBJ_obj2txt` with `always_return_oid` set to zero.
1685
+ OPENSSL_EXPORT int i2t_ASN1_OBJECT(char *buf, int buf_len,
1686
+ const ASN1_OBJECT *a);
1687
+
1688
+
1689
+ // Low-level encoding functions.
1690
+
1691
+ // ASN1_get_object parses a BER element from up to `max_len` bytes at `*inp`. It
1692
+ // returns `V_ASN1_CONSTRUCTED` if it successfully parsed a constructed element,
1693
+ // zero if it successfully parsed a primitive element, and 0x80 on error. On
1694
+ // success, it additionally advances `*inp` to the element body, sets
1695
+ // `*out_length`, `*out_tag`, and `*out_class` to the element's length, tag
1696
+ // number, and tag class, respectively,
1697
+ //
1698
+ // Unlike OpenSSL, this function only supports DER. Indefinite and non-minimal
1699
+ // lengths are rejected.
1700
+ //
1701
+ // This function is difficult to use correctly. Use `CBS_get_asn1` and related
1702
+ // functions from bytestring.h.
1703
+ OPENSSL_EXPORT int ASN1_get_object(const unsigned char **inp, long *out_length,
1704
+ int *out_tag, int *out_class, long max_len);
1705
+
1706
+ // ASN1_put_object writes the header for a DER or BER element to `*outp` and
1707
+ // advances `*outp` by the number of bytes written. The caller is responsible
1708
+ // for ensuring `*outp` has enough space for the output. The header describes an
1709
+ // element with length `length`, tag number `tag`, and class `xclass`. `xclass`
1710
+ // should be one of the `V_ASN1_*` tag class constants. The element is primitive
1711
+ // if `constructed` is zero and constructed if it is one or two. If
1712
+ // `constructed` is two, `length` is ignored and the element uses
1713
+ // indefinite-length encoding.
1714
+ //
1715
+ // Use `CBB_add_asn1` instead.
1716
+ OPENSSL_EXPORT void ASN1_put_object(unsigned char **outp, int constructed,
1717
+ int length, int tag, int xclass);
1718
+
1719
+ // ASN1_put_eoc writes two zero bytes to `*outp`, advances `*outp` to point past
1720
+ // those bytes, and returns two.
1721
+ //
1722
+ // Use definite-length encoding instead.
1723
+ OPENSSL_EXPORT int ASN1_put_eoc(unsigned char **outp);
1724
+
1725
+ // ASN1_object_size returns the number of bytes needed to encode a DER or BER
1726
+ // value with length `length` and tag number `tag`, or -1 on error. `tag` should
1727
+ // not include the constructed bit or tag class. If `constructed` is zero or
1728
+ // one, the result uses a definite-length encoding with minimally-encoded
1729
+ // length, as in DER. If `constructed` is two, the result uses BER
1730
+ // indefinite-length encoding.
1731
+ //
1732
+ // Use `CBB_add_asn1` instead.
1733
+ OPENSSL_EXPORT int ASN1_object_size(int constructed, int length, int tag);
1734
+
1735
+
1736
+ // Function declaration macros.
1737
+ //
1738
+ // The following macros declare functions for ASN.1 types. Prefer writing the
1739
+ // prototypes directly. Particularly when `type`, `itname`, or `name` differ,
1740
+ // the macros can be difficult to understand.
1741
+
1742
+ #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
1743
+
1744
+ #define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
1745
+ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
1746
+
1747
+ #define DECLARE_ASN1_FUNCTIONS_name(type, name) \
1748
+ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
1749
+ DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
1750
+
1751
+ #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
1752
+ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
1753
+ DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
1754
+
1755
+ #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
1756
+ OPENSSL_EXPORT type *d2i_##name(type **a, const unsigned char **in, \
1757
+ long len); \
1758
+ OPENSSL_EXPORT int i2d_##name(type *a, unsigned char **out); \
1759
+ DECLARE_ASN1_ITEM(itname)
1760
+
1761
+ #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
1762
+ OPENSSL_EXPORT type *d2i_##name(type **a, const unsigned char **in, \
1763
+ long len); \
1764
+ OPENSSL_EXPORT int i2d_##name(const type *a, unsigned char **out); \
1765
+ DECLARE_ASN1_ITEM(name)
1766
+
1767
+ #define DECLARE_ASN1_FUNCTIONS_const(name) \
1768
+ DECLARE_ASN1_ALLOC_FUNCTIONS(name) \
1769
+ DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name)
1770
+
1771
+ #define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
1772
+ OPENSSL_EXPORT type *name##_new(void); \
1773
+ OPENSSL_EXPORT void name##_free(type *a);
1774
+
1775
+
1776
+ // Deprecated functions.
1777
+
1778
+ // ASN1_STRING_FLAG_BITS_LEFT does nothing. Historically, when a BIT STRING
1779
+ // lacked this flag, it enabled an implicit truncation behavior. This has since
1780
+ // been removed.
1781
+ //
1782
+ // TODO(crbug.com/443769299): Remove this when `ASN1_STRING` is opaque. For now,
1783
+ // we continue to set it in various codepaths, in case code is querying `flags`
1784
+ // manually, even though it does nothing.
1785
+ #define ASN1_STRING_FLAG_BITS_LEFT 0x08
1786
+
1787
+ // ASN1_BIT_STRING_num_bytes computes the length of `str` in bytes. If `str`'s
1788
+ // bit length is a multiple of 8, it sets `*out` to the byte length and returns
1789
+ // one. Otherwise, it returns zero.
1790
+ //
1791
+ // This function may be used with `ASN1_STRING_get0_data` to interpret `str` as
1792
+ // a byte string.
1793
+ //
1794
+ // This function is no longer necessary. The byte length is always equal to
1795
+ // `ASN1_STRING_length` and callers can check for a whole number of bytes by
1796
+ // checking if `ASN1_BIT_STRING_unused_bits` is zero.
1797
+ OPENSSL_EXPORT int ASN1_BIT_STRING_num_bytes(const ASN1_BIT_STRING *str,
1798
+ size_t *out);
1799
+
1800
+ // ASN1_STRING_set_default_mask does nothing.
1801
+ OPENSSL_EXPORT void ASN1_STRING_set_default_mask(unsigned long mask);
1802
+
1803
+ // ASN1_STRING_set_default_mask_asc returns one.
1804
+ OPENSSL_EXPORT int ASN1_STRING_set_default_mask_asc(const char *p);
1805
+
1806
+ // ASN1_STRING_get_default_mask returns `B_ASN1_UTF8STRING`.
1807
+ OPENSSL_EXPORT unsigned long ASN1_STRING_get_default_mask(void);
1808
+
1809
+ // ASN1_STRING_TABLE_cleanup does nothing.
1810
+ OPENSSL_EXPORT void ASN1_STRING_TABLE_cleanup(void);
1811
+
1812
+ // M_ASN1_* are legacy aliases for various `ASN1_STRING` functions. Use the
1813
+ // functions themselves.
1814
+ #define M_ASN1_STRING_length(x) ASN1_STRING_length(x)
1815
+ #define M_ASN1_STRING_type(x) ASN1_STRING_type(x)
1816
+ #define M_ASN1_STRING_data(x) ASN1_STRING_data(x)
1817
+ #define M_ASN1_BIT_STRING_new() ASN1_BIT_STRING_new()
1818
+ #define M_ASN1_BIT_STRING_free(a) ASN1_BIT_STRING_free(a)
1819
+ #define M_ASN1_BIT_STRING_dup(a) ASN1_STRING_dup(a)
1820
+ #define M_ASN1_BIT_STRING_cmp(a, b) ASN1_STRING_cmp(a, b)
1821
+ #define M_ASN1_BIT_STRING_set(a, b, c) ASN1_BIT_STRING_set(a, b, c)
1822
+ #define M_ASN1_INTEGER_new() ASN1_INTEGER_new()
1823
+ #define M_ASN1_INTEGER_free(a) ASN1_INTEGER_free(a)
1824
+ #define M_ASN1_INTEGER_dup(a) ASN1_INTEGER_dup(a)
1825
+ #define M_ASN1_INTEGER_cmp(a, b) ASN1_INTEGER_cmp(a, b)
1826
+ #define M_ASN1_ENUMERATED_new() ASN1_ENUMERATED_new()
1827
+ #define M_ASN1_ENUMERATED_free(a) ASN1_ENUMERATED_free(a)
1828
+ #define M_ASN1_ENUMERATED_dup(a) ASN1_STRING_dup(a)
1829
+ #define M_ASN1_ENUMERATED_cmp(a, b) ASN1_STRING_cmp(a, b)
1830
+ #define M_ASN1_OCTET_STRING_new() ASN1_OCTET_STRING_new()
1831
+ #define M_ASN1_OCTET_STRING_free(a) ASN1_OCTET_STRING_free()
1832
+ #define M_ASN1_OCTET_STRING_dup(a) ASN1_OCTET_STRING_dup(a)
1833
+ #define M_ASN1_OCTET_STRING_cmp(a, b) ASN1_OCTET_STRING_cmp(a, b)
1834
+ #define M_ASN1_OCTET_STRING_set(a, b, c) ASN1_OCTET_STRING_set(a, b, c)
1835
+ #define M_ASN1_OCTET_STRING_print(a, b) ASN1_STRING_print(a, b)
1836
+ #define M_ASN1_PRINTABLESTRING_new() ASN1_PRINTABLESTRING_new()
1837
+ #define M_ASN1_PRINTABLESTRING_free(a) ASN1_PRINTABLESTRING_free(a)
1838
+ #define M_ASN1_IA5STRING_new() ASN1_IA5STRING_new()
1839
+ #define M_ASN1_IA5STRING_free(a) ASN1_IA5STRING_free(a)
1840
+ #define M_ASN1_IA5STRING_dup(a) ASN1_STRING_dup(a)
1841
+ #define M_ASN1_UTCTIME_new() ASN1_UTCTIME_new()
1842
+ #define M_ASN1_UTCTIME_free(a) ASN1_UTCTIME_free(a)
1843
+ #define M_ASN1_UTCTIME_dup(a) ASN1_STRING_dup(a)
1844
+ #define M_ASN1_T61STRING_new() ASN1_T61STRING_new()
1845
+ #define M_ASN1_T61STRING_free(a) ASN1_T61STRING_free(a)
1846
+ #define M_ASN1_GENERALIZEDTIME_new() ASN1_GENERALIZEDTIME_new()
1847
+ #define M_ASN1_GENERALIZEDTIME_free(a) ASN1_GENERALIZEDTIME_free(a)
1848
+ #define M_ASN1_GENERALIZEDTIME_dup(a) ASN1_STRING_dup(a)
1849
+ #define M_ASN1_GENERALSTRING_new() ASN1_GENERALSTRING_new()
1850
+ #define M_ASN1_GENERALSTRING_free(a) ASN1_GENERALSTRING_free(a)
1851
+ #define M_ASN1_UNIVERSALSTRING_new() ASN1_UNIVERSALSTRING_new()
1852
+ #define M_ASN1_UNIVERSALSTRING_free(a) ASN1_UNIVERSALSTRING_free(a)
1853
+ #define M_ASN1_BMPSTRING_new() ASN1_BMPSTRING_new()
1854
+ #define M_ASN1_BMPSTRING_free(a) ASN1_BMPSTRING_free(a)
1855
+ #define M_ASN1_VISIBLESTRING_new() ASN1_VISIBLESTRING_new()
1856
+ #define M_ASN1_VISIBLESTRING_free(a) ASN1_VISIBLESTRING_free(a)
1857
+ #define M_ASN1_UTF8STRING_new() ASN1_UTF8STRING_new()
1858
+ #define M_ASN1_UTF8STRING_free(a) ASN1_UTF8STRING_free(a)
1859
+
1860
+ // ASN1_INTEGER_set sets `a` to an INTEGER with value `v`. It returns one on
1861
+ // success and zero on error.
1862
+ //
1863
+ // Use `ASN1_INTEGER_set_uint64` and `ASN1_INTEGER_set_int64` instead.
1864
+ OPENSSL_EXPORT int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
1865
+
1866
+ // ASN1_ENUMERATED_set sets `a` to an ENUMERATED with value `v`. It returns one
1867
+ // on success and zero on error.
1868
+ //
1869
+ // Use `ASN1_ENUMERATED_set_uint64` and `ASN1_ENUMERATED_set_int64` instead.
1870
+ OPENSSL_EXPORT int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
1871
+
1872
+ // ASN1_INTEGER_get returns the value of `a` as a `long`, or -1 if `a` is out of
1873
+ // range or the wrong type.
1874
+ //
1875
+ // WARNING: This function's return value cannot distinguish errors from -1.
1876
+ // Use `ASN1_INTEGER_get_uint64` and `ASN1_INTEGER_get_int64` instead.
1877
+ OPENSSL_EXPORT long ASN1_INTEGER_get(const ASN1_INTEGER *a);
1878
+
1879
+ // ASN1_ENUMERATED_get returns the value of `a` as a `long`, or -1 if `a` is out
1880
+ // of range or the wrong type.
1881
+ //
1882
+ // WARNING: This function's return value cannot distinguish errors from -1.
1883
+ // Use `ASN1_ENUMERATED_get_uint64` and `ASN1_ENUMERATED_get_int64` instead.
1884
+ OPENSSL_EXPORT long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);
1885
+
1886
+
1887
+ #if defined(__cplusplus)
1888
+ } // extern C
1889
+
1890
+ extern "C++" {
1891
+
1892
+ BSSL_NAMESPACE_BEGIN
1893
+
1894
+ BORINGSSL_MAKE_DELETER(ASN1_OBJECT, ASN1_OBJECT_free)
1895
+ BORINGSSL_MAKE_DELETER(ASN1_STRING, ASN1_STRING_free)
1896
+ BORINGSSL_MAKE_DELETER(ASN1_TYPE, ASN1_TYPE_free)
1897
+
1898
+ BSSL_NAMESPACE_END
1899
+
1900
+ } // extern C++
1901
+
1902
+ #endif
1903
+
1904
+ #define ASN1_R_ASN1_LENGTH_MISMATCH 100
1905
+ #define ASN1_R_AUX_ERROR 101
1906
+ #define ASN1_R_BAD_GET_ASN1_OBJECT_CALL 102
1907
+ #define ASN1_R_BAD_OBJECT_HEADER 103
1908
+ #define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 104
1909
+ #define ASN1_R_BN_LIB 105
1910
+ #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
1911
+ #define ASN1_R_BUFFER_TOO_SMALL 107
1912
+ #define ASN1_R_CONTEXT_NOT_INITIALISED 108
1913
+ #define ASN1_R_DECODE_ERROR 109
1914
+ #define ASN1_R_DEPTH_EXCEEDED 110
1915
+ #define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 111
1916
+ #define ASN1_R_ENCODE_ERROR 112
1917
+ #define ASN1_R_ERROR_GETTING_TIME 113
1918
+ #define ASN1_R_EXPECTING_AN_ASN1_SEQUENCE 114
1919
+ #define ASN1_R_EXPECTING_AN_INTEGER 115
1920
+ #define ASN1_R_EXPECTING_AN_OBJECT 116
1921
+ #define ASN1_R_EXPECTING_A_BOOLEAN 117
1922
+ #define ASN1_R_EXPECTING_A_TIME 118
1923
+ #define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
1924
+ #define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
1925
+ #define ASN1_R_FIELD_MISSING 121
1926
+ #define ASN1_R_FIRST_NUM_TOO_LARGE 122
1927
+ #define ASN1_R_HEADER_TOO_LONG 123
1928
+ #define ASN1_R_ILLEGAL_BITSTRING_FORMAT 124
1929
+ #define ASN1_R_ILLEGAL_BOOLEAN 125
1930
+ #define ASN1_R_ILLEGAL_CHARACTERS 126
1931
+ #define ASN1_R_ILLEGAL_FORMAT 127
1932
+ #define ASN1_R_ILLEGAL_HEX 128
1933
+ #define ASN1_R_ILLEGAL_IMPLICIT_TAG 129
1934
+ #define ASN1_R_ILLEGAL_INTEGER 130
1935
+ #define ASN1_R_ILLEGAL_NESTED_TAGGING 131
1936
+ #define ASN1_R_ILLEGAL_NULL 132
1937
+ #define ASN1_R_ILLEGAL_NULL_VALUE 133
1938
+ #define ASN1_R_ILLEGAL_OBJECT 134
1939
+ #define ASN1_R_ILLEGAL_OPTIONAL_ANY 135
1940
+ #define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 136
1941
+ #define ASN1_R_ILLEGAL_TAGGED_ANY 137
1942
+ #define ASN1_R_ILLEGAL_TIME_VALUE 138
1943
+ #define ASN1_R_INTEGER_NOT_ASCII_FORMAT 139
1944
+ #define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 140
1945
+ #define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 141
1946
+ #define ASN1_R_INVALID_BMPSTRING 142
1947
+ #define ASN1_R_INVALID_DIGIT 143
1948
+ #define ASN1_R_INVALID_MODIFIER 144
1949
+ #define ASN1_R_INVALID_NUMBER 145
1950
+ #define ASN1_R_INVALID_OBJECT_ENCODING 146
1951
+ #define ASN1_R_INVALID_SEPARATOR 147
1952
+ #define ASN1_R_INVALID_TIME_FORMAT 148
1953
+ #define ASN1_R_INVALID_UNIVERSALSTRING 149
1954
+ #define ASN1_R_INVALID_UTF8STRING 150
1955
+ #define ASN1_R_LIST_ERROR 151
1956
+ #define ASN1_R_MISSING_ASN1_EOS 152
1957
+ #define ASN1_R_MISSING_EOC 153
1958
+ #define ASN1_R_MISSING_SECOND_NUMBER 154
1959
+ #define ASN1_R_MISSING_VALUE 155
1960
+ #define ASN1_R_MSTRING_NOT_UNIVERSAL 156
1961
+ #define ASN1_R_MSTRING_WRONG_TAG 157
1962
+ #define ASN1_R_NESTED_ASN1_ERROR 158
1963
+ #define ASN1_R_NESTED_ASN1_STRING 159
1964
+ #define ASN1_R_NON_HEX_CHARACTERS 160
1965
+ #define ASN1_R_NOT_ASCII_FORMAT 161
1966
+ #define ASN1_R_NOT_ENOUGH_DATA 162
1967
+ #define ASN1_R_NO_MATCHING_CHOICE_TYPE 163
1968
+ #define ASN1_R_NULL_IS_WRONG_LENGTH 164
1969
+ #define ASN1_R_OBJECT_NOT_ASCII_FORMAT 165
1970
+ #define ASN1_R_ODD_NUMBER_OF_CHARS 166
1971
+ #define ASN1_R_SECOND_NUMBER_TOO_LARGE 167
1972
+ #define ASN1_R_SEQUENCE_LENGTH_MISMATCH 168
1973
+ #define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 169
1974
+ #define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 170
1975
+ #define ASN1_R_SHORT_LINE 171
1976
+ #define ASN1_R_STREAMING_NOT_SUPPORTED 172
1977
+ #define ASN1_R_STRING_TOO_LONG 173
1978
+ #define ASN1_R_STRING_TOO_SHORT 174
1979
+ #define ASN1_R_TAG_VALUE_TOO_HIGH 175
1980
+ #define ASN1_R_TIME_NOT_ASCII_FORMAT 176
1981
+ #define ASN1_R_TOO_LONG 177
1982
+ #define ASN1_R_TYPE_NOT_CONSTRUCTED 178
1983
+ #define ASN1_R_TYPE_NOT_PRIMITIVE 179
1984
+ #define ASN1_R_UNEXPECTED_EOC 180
1985
+ #define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 181
1986
+ #define ASN1_R_UNKNOWN_FORMAT 182
1987
+ #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 183
1988
+ #define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 184
1989
+ #define ASN1_R_UNKNOWN_TAG 185
1990
+ #define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 186
1991
+ #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 187
1992
+ #define ASN1_R_UNSUPPORTED_TYPE 188
1993
+ #define ASN1_R_WRONG_PUBLIC_KEY_TYPE 189
1994
+ #define ASN1_R_WRONG_TAG 190
1995
+ #define ASN1_R_WRONG_TYPE 191
1996
+ #define ASN1_R_NESTED_TOO_DEEP 192
1997
+ #define ASN1_R_BAD_TEMPLATE 193
1998
+ #define ASN1_R_INVALID_BIT_STRING_PADDING 194
1999
+ #define ASN1_R_WRONG_INTEGER_TYPE 195
2000
+ #define ASN1_R_INVALID_INTEGER 196
2001
+
2002
+ #endif // OPENSSL_HEADER_ASN1_H