visaljs 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (520) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/cli.js +8084 -0
  4. package/node/include/js_node.h +46 -0
  5. package/node/prelude/async_hooks.js +88 -0
  6. package/node/prelude/buffer.js +31 -0
  7. package/node/prelude/crypto.js +114 -0
  8. package/node/prelude/events.js +227 -0
  9. package/node/prelude/fs.js +79 -0
  10. package/node/prelude/http.js +536 -0
  11. package/node/prelude/http2.js +30 -0
  12. package/node/prelude/internal/crypto/asym.js +333 -0
  13. package/node/prelude/internal/crypto/cipher.js +205 -0
  14. package/node/prelude/internal/crypto/hash.js +137 -0
  15. package/node/prelude/internal/crypto/kdf.js +182 -0
  16. package/node/prelude/internal/crypto/keys.js +603 -0
  17. package/node/prelude/internal/crypto/random.js +118 -0
  18. package/node/prelude/internal/crypto/util.js +76 -0
  19. package/node/prelude/internal/errors.js +88 -0
  20. package/node/prelude/internal/querystring.js +105 -0
  21. package/node/prelude/module.js +53 -0
  22. package/node/prelude/net.js +51 -0
  23. package/node/prelude/os.js +129 -0
  24. package/node/prelude/path.js +257 -0
  25. package/node/prelude/process.js +21 -0
  26. package/node/prelude/querystring.js +469 -0
  27. package/node/prelude/stream.js +1327 -0
  28. package/node/prelude/stream_promises.js +7 -0
  29. package/node/prelude/stream_web.js +6 -0
  30. package/node/prelude/string_decoder.js +236 -0
  31. package/node/prelude/tty.js +18 -0
  32. package/node/prelude/url.js +1156 -0
  33. package/node/prelude/util.js +64 -0
  34. package/node/prelude/zlib.js +81 -0
  35. package/node/src/host_fs.c +126 -0
  36. package/node/src/host_http.c +486 -0
  37. package/node/src/host_os.c +505 -0
  38. package/node/src/host_sys.c +78 -0
  39. package/node/third_party/libuv/LICENSE +19 -0
  40. package/node/third_party/libuv/include/uv/aix.h +32 -0
  41. package/node/third_party/libuv/include/uv/bsd.h +34 -0
  42. package/node/third_party/libuv/include/uv/darwin.h +61 -0
  43. package/node/third_party/libuv/include/uv/errno.h +483 -0
  44. package/node/third_party/libuv/include/uv/linux.h +34 -0
  45. package/node/third_party/libuv/include/uv/os390.h +33 -0
  46. package/node/third_party/libuv/include/uv/posix.h +31 -0
  47. package/node/third_party/libuv/include/uv/sunos.h +44 -0
  48. package/node/third_party/libuv/include/uv/threadpool.h +37 -0
  49. package/node/third_party/libuv/include/uv/tree.h +521 -0
  50. package/node/third_party/libuv/include/uv/unix.h +512 -0
  51. package/node/third_party/libuv/include/uv/version.h +43 -0
  52. package/node/third_party/libuv/include/uv/win.h +698 -0
  53. package/node/third_party/libuv/include/uv.h +1990 -0
  54. package/node/third_party/libuv/src/fs-poll.c +290 -0
  55. package/node/third_party/libuv/src/heap-inl.h +245 -0
  56. package/node/third_party/libuv/src/idna.c +560 -0
  57. package/node/third_party/libuv/src/idna.h +31 -0
  58. package/node/third_party/libuv/src/inet.c +298 -0
  59. package/node/third_party/libuv/src/queue.h +90 -0
  60. package/node/third_party/libuv/src/random.c +123 -0
  61. package/node/third_party/libuv/src/strscpy.c +38 -0
  62. package/node/third_party/libuv/src/strscpy.h +39 -0
  63. package/node/third_party/libuv/src/strtok.c +52 -0
  64. package/node/third_party/libuv/src/strtok.h +27 -0
  65. package/node/third_party/libuv/src/thread-common.c +175 -0
  66. package/node/third_party/libuv/src/threadpool.c +419 -0
  67. package/node/third_party/libuv/src/timer.c +200 -0
  68. package/node/third_party/libuv/src/unix/async.c +418 -0
  69. package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +164 -0
  70. package/node/third_party/libuv/src/unix/core.c +2104 -0
  71. package/node/third_party/libuv/src/unix/darwin-proctitle.c +176 -0
  72. package/node/third_party/libuv/src/unix/darwin-stub.h +97 -0
  73. package/node/third_party/libuv/src/unix/darwin-syscalls.h +17 -0
  74. package/node/third_party/libuv/src/unix/darwin.c +237 -0
  75. package/node/third_party/libuv/src/unix/dl.c +80 -0
  76. package/node/third_party/libuv/src/unix/fs.c +2303 -0
  77. package/node/third_party/libuv/src/unix/fsevents.c +906 -0
  78. package/node/third_party/libuv/src/unix/getaddrinfo.c +252 -0
  79. package/node/third_party/libuv/src/unix/getnameinfo.c +121 -0
  80. package/node/third_party/libuv/src/unix/internal.h +530 -0
  81. package/node/third_party/libuv/src/unix/kqueue.c +667 -0
  82. package/node/third_party/libuv/src/unix/linux.c +2761 -0
  83. package/node/third_party/libuv/src/unix/loop-watcher.c +68 -0
  84. package/node/third_party/libuv/src/unix/loop.c +240 -0
  85. package/node/third_party/libuv/src/unix/pipe.c +555 -0
  86. package/node/third_party/libuv/src/unix/poll.c +159 -0
  87. package/node/third_party/libuv/src/unix/process.c +1123 -0
  88. package/node/third_party/libuv/src/unix/procfs-exepath.c +45 -0
  89. package/node/third_party/libuv/src/unix/proctitle.c +157 -0
  90. package/node/third_party/libuv/src/unix/random-devurandom.c +93 -0
  91. package/node/third_party/libuv/src/unix/random-getentropy.c +57 -0
  92. package/node/third_party/libuv/src/unix/random-getrandom.c +86 -0
  93. package/node/third_party/libuv/src/unix/random-sysctl-linux.c +99 -0
  94. package/node/third_party/libuv/src/unix/signal.c +581 -0
  95. package/node/third_party/libuv/src/unix/stream.c +1567 -0
  96. package/node/third_party/libuv/src/unix/tcp.c +673 -0
  97. package/node/third_party/libuv/src/unix/thread.c +975 -0
  98. package/node/third_party/libuv/src/unix/tty.c +510 -0
  99. package/node/third_party/libuv/src/unix/udp.c +1434 -0
  100. package/node/third_party/libuv/src/uv-common.c +1051 -0
  101. package/node/third_party/libuv/src/uv-common.h +474 -0
  102. package/node/third_party/libuv/src/uv-data-getter-setters.c +119 -0
  103. package/node/third_party/libuv/src/version.c +45 -0
  104. package/node/third_party/llhttp/LICENSE +22 -0
  105. package/node/third_party/llhttp/api.c +509 -0
  106. package/node/third_party/llhttp/http.c +170 -0
  107. package/node/third_party/llhttp/llhttp.c +10099 -0
  108. package/node/third_party/llhttp/llhttp.h +907 -0
  109. package/package.json +25 -4
  110. package/runtime/include/js_atoms.gen.h +68 -0
  111. package/runtime/include/js_atoms.h +54 -0
  112. package/runtime/include/js_bigint.h +93 -0
  113. package/runtime/include/js_buffer.h +79 -0
  114. package/runtime/include/js_builtins.h +168 -0
  115. package/runtime/include/js_console.h +58 -0
  116. package/runtime/include/js_convert.h +22 -0
  117. package/runtime/include/js_core.def +188 -0
  118. package/runtime/include/js_crypto.h +58 -0
  119. package/runtime/include/js_error.h +37 -0
  120. package/runtime/include/js_exception.h +65 -0
  121. package/runtime/include/js_function.h +167 -0
  122. package/runtime/include/js_gc.h +195 -0
  123. package/runtime/include/js_generator.h +96 -0
  124. package/runtime/include/js_host.h +19 -0
  125. package/runtime/include/js_jobs.h +84 -0
  126. package/runtime/include/js_module.h +16 -0
  127. package/runtime/include/js_object.h +384 -0
  128. package/runtime/include/js_ops.h +111 -0
  129. package/runtime/include/js_promise.h +45 -0
  130. package/runtime/include/js_regexp.h +25 -0
  131. package/runtime/include/js_runtime.h +30 -0
  132. package/runtime/include/js_symbol.h +62 -0
  133. package/runtime/include/js_web.h +110 -0
  134. package/runtime/include/jscell.h +48 -0
  135. package/runtime/include/jscontext.h +240 -0
  136. package/runtime/include/jsnum.h +42 -0
  137. package/runtime/include/jsstring.h +161 -0
  138. package/runtime/include/jsvalue.h +142 -0
  139. package/runtime/src/arguments.c +115 -0
  140. package/runtime/src/array.c +1145 -0
  141. package/runtime/src/arraybuffer.c +608 -0
  142. package/runtime/src/async_iter.c +479 -0
  143. package/runtime/src/atoms.c +157 -0
  144. package/runtime/src/base64.c +107 -0
  145. package/runtime/src/bigint.c +1189 -0
  146. package/runtime/src/blob.c +371 -0
  147. package/runtime/src/buffer.c +1357 -0
  148. package/runtime/src/builtin_table.c +100 -0
  149. package/runtime/src/builtins.c +987 -0
  150. package/runtime/src/builtins_util.h +53 -0
  151. package/runtime/src/collections.c +912 -0
  152. package/runtime/src/components.c +28 -0
  153. package/runtime/src/console.c +637 -0
  154. package/runtime/src/convert.c +82 -0
  155. package/runtime/src/core_all.c +21 -0
  156. package/runtime/src/crypto.c +116 -0
  157. package/runtime/src/crypto_asym.c +644 -0
  158. package/runtime/src/crypto_cipher.c +671 -0
  159. package/runtime/src/crypto_hash.c +260 -0
  160. package/runtime/src/crypto_host.c +414 -0
  161. package/runtime/src/crypto_internal.h +304 -0
  162. package/runtime/src/crypto_kdf.c +143 -0
  163. package/runtime/src/crypto_key.c +171 -0
  164. package/runtime/src/crypto_pkey.c +794 -0
  165. package/runtime/src/crypto_subtle.c +1675 -0
  166. package/runtime/src/date.c +940 -0
  167. package/runtime/src/domexception.c +169 -0
  168. package/runtime/src/elements.c +312 -0
  169. package/runtime/src/elements.h +45 -0
  170. package/runtime/src/encoding.c +485 -0
  171. package/runtime/src/error.c +297 -0
  172. package/runtime/src/events.c +793 -0
  173. package/runtime/src/exception.c +56 -0
  174. package/runtime/src/fetch.c +772 -0
  175. package/runtime/src/function.c +530 -0
  176. package/runtime/src/gc.c +803 -0
  177. package/runtime/src/generator.c +218 -0
  178. package/runtime/src/global.c +119 -0
  179. package/runtime/src/headers.c +557 -0
  180. package/runtime/src/inspect.c +1792 -0
  181. package/runtime/src/internal.h +80 -0
  182. package/runtime/src/iterate.c +94 -0
  183. package/runtime/src/iterator.c +409 -0
  184. package/runtime/src/jobs.c +337 -0
  185. package/runtime/src/jsnum.c +353 -0
  186. package/runtime/src/json.c +1028 -0
  187. package/runtime/src/math.c +243 -0
  188. package/runtime/src/module.c +336 -0
  189. package/runtime/src/number.c +176 -0
  190. package/runtime/src/object.c +1265 -0
  191. package/runtime/src/ops.c +322 -0
  192. package/runtime/src/os.c +196 -0
  193. package/runtime/src/os.h +29 -0
  194. package/runtime/src/process.c +432 -0
  195. package/runtime/src/promise.c +721 -0
  196. package/runtime/src/proxy.c +570 -0
  197. package/runtime/src/reflect.c +194 -0
  198. package/runtime/src/regexp.c +1141 -0
  199. package/runtime/src/regexp_anchor.h +34 -0
  200. package/runtime/src/regexp_message.h +32 -0
  201. package/runtime/src/shape.c +294 -0
  202. package/runtime/src/shape.h +46 -0
  203. package/runtime/src/streams.c +1046 -0
  204. package/runtime/src/streams.h +47 -0
  205. package/runtime/src/string.c +364 -0
  206. package/runtime/src/string_builtins.c +837 -0
  207. package/runtime/src/symbol.c +143 -0
  208. package/runtime/src/test_host.c +59 -0
  209. package/runtime/src/typedarray.c +1330 -0
  210. package/runtime/src/tznames.gen.h +712 -0
  211. package/runtime/src/uri.c +169 -0
  212. package/runtime/src/url.c +2116 -0
  213. package/runtime/src/weak.c +486 -0
  214. package/runtime/src/web.c +214 -0
  215. package/runtime/src/wrapper.c +59 -0
  216. package/runtime/src/writable.c +1486 -0
  217. package/runtime/third_party/ada-idna/LICENSE-MIT +18 -0
  218. package/runtime/third_party/ada-idna/README.md +27 -0
  219. package/runtime/third_party/ada-idna/convert.mjs +83 -0
  220. package/runtime/third_party/ada-idna/idna.c +416 -0
  221. package/runtime/third_party/ada-idna/idna.h +15 -0
  222. package/runtime/third_party/ada-idna/idna_tables.h +2657 -0
  223. package/runtime/third_party/bearssl/LICENSE.txt +21 -0
  224. package/runtime/third_party/bearssl/README.txt +136 -0
  225. package/runtime/third_party/bearssl/VERSION +1 -0
  226. package/runtime/third_party/bearssl/inc/bearssl.h +183 -0
  227. package/runtime/third_party/bearssl/inc/bearssl_aead.h +1059 -0
  228. package/runtime/third_party/bearssl/inc/bearssl_block.h +2618 -0
  229. package/runtime/third_party/bearssl/inc/bearssl_ec.h +967 -0
  230. package/runtime/third_party/bearssl/inc/bearssl_hash.h +1346 -0
  231. package/runtime/third_party/bearssl/inc/bearssl_hmac.h +241 -0
  232. package/runtime/third_party/bearssl/inc/bearssl_kdf.h +284 -0
  233. package/runtime/third_party/bearssl/inc/bearssl_pem.h +294 -0
  234. package/runtime/third_party/bearssl/inc/bearssl_prf.h +150 -0
  235. package/runtime/third_party/bearssl/inc/bearssl_rand.h +397 -0
  236. package/runtime/third_party/bearssl/inc/bearssl_rsa.h +1655 -0
  237. package/runtime/third_party/bearssl/inc/bearssl_ssl.h +4296 -0
  238. package/runtime/third_party/bearssl/inc/bearssl_x509.h +1474 -0
  239. package/runtime/third_party/bearssl/src/aead/ccm.c +346 -0
  240. package/runtime/third_party/bearssl/src/aead/eax.c +525 -0
  241. package/runtime/third_party/bearssl/src/aead/gcm.c +318 -0
  242. package/runtime/third_party/bearssl/src/codec/ccopy.c +44 -0
  243. package/runtime/third_party/bearssl/src/codec/dec16be.c +38 -0
  244. package/runtime/third_party/bearssl/src/codec/dec16le.c +38 -0
  245. package/runtime/third_party/bearssl/src/codec/dec32be.c +38 -0
  246. package/runtime/third_party/bearssl/src/codec/dec32le.c +38 -0
  247. package/runtime/third_party/bearssl/src/codec/dec64be.c +38 -0
  248. package/runtime/third_party/bearssl/src/codec/dec64le.c +38 -0
  249. package/runtime/third_party/bearssl/src/codec/enc16be.c +38 -0
  250. package/runtime/third_party/bearssl/src/codec/enc16le.c +38 -0
  251. package/runtime/third_party/bearssl/src/codec/enc32be.c +38 -0
  252. package/runtime/third_party/bearssl/src/codec/enc32le.c +38 -0
  253. package/runtime/third_party/bearssl/src/codec/enc64be.c +38 -0
  254. package/runtime/third_party/bearssl/src/codec/enc64le.c +38 -0
  255. package/runtime/third_party/bearssl/src/codec/pemdec.c +526 -0
  256. package/runtime/third_party/bearssl/src/codec/pemdec.t0 +314 -0
  257. package/runtime/third_party/bearssl/src/codec/pemenc.c +173 -0
  258. package/runtime/third_party/bearssl/src/config.h +247 -0
  259. package/runtime/third_party/bearssl/src/ec/ec_all_m15.c +121 -0
  260. package/runtime/third_party/bearssl/src/ec/ec_all_m31.c +171 -0
  261. package/runtime/third_party/bearssl/src/ec/ec_c25519_i15.c +398 -0
  262. package/runtime/third_party/bearssl/src/ec/ec_c25519_i31.c +390 -0
  263. package/runtime/third_party/bearssl/src/ec/ec_c25519_m15.c +1478 -0
  264. package/runtime/third_party/bearssl/src/ec/ec_c25519_m31.c +800 -0
  265. package/runtime/third_party/bearssl/src/ec/ec_c25519_m62.c +605 -0
  266. package/runtime/third_party/bearssl/src/ec/ec_c25519_m64.c +831 -0
  267. package/runtime/third_party/bearssl/src/ec/ec_curve25519.c +46 -0
  268. package/runtime/third_party/bearssl/src/ec/ec_default.c +36 -0
  269. package/runtime/third_party/bearssl/src/ec/ec_keygen.c +86 -0
  270. package/runtime/third_party/bearssl/src/ec/ec_p256_m15.c +2124 -0
  271. package/runtime/third_party/bearssl/src/ec/ec_p256_m31.c +1469 -0
  272. package/runtime/third_party/bearssl/src/ec/ec_p256_m62.c +1765 -0
  273. package/runtime/third_party/bearssl/src/ec/ec_p256_m64.c +1781 -0
  274. package/runtime/third_party/bearssl/src/ec/ec_prime_i15.c +824 -0
  275. package/runtime/third_party/bearssl/src/ec/ec_prime_i31.c +826 -0
  276. package/runtime/third_party/bearssl/src/ec/ec_pubkey.c +85 -0
  277. package/runtime/third_party/bearssl/src/ec/ec_secp256r1.c +51 -0
  278. package/runtime/third_party/bearssl/src/ec/ec_secp384r1.c +57 -0
  279. package/runtime/third_party/bearssl/src/ec/ec_secp521r1.c +64 -0
  280. package/runtime/third_party/bearssl/src/ec/ecdsa_atr.c +134 -0
  281. package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_asn1.c +36 -0
  282. package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_raw.c +36 -0
  283. package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_asn1.c +36 -0
  284. package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_raw.c +36 -0
  285. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_bits.c +47 -0
  286. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_asn1.c +45 -0
  287. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_raw.c +174 -0
  288. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_asn1.c +48 -0
  289. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_raw.c +166 -0
  290. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_bits.c +47 -0
  291. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_asn1.c +45 -0
  292. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_raw.c +173 -0
  293. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_asn1.c +48 -0
  294. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_raw.c +165 -0
  295. package/runtime/third_party/bearssl/src/ec/ecdsa_rta.c +121 -0
  296. package/runtime/third_party/bearssl/src/hash/dig_oid.c +84 -0
  297. package/runtime/third_party/bearssl/src/hash/dig_size.c +50 -0
  298. package/runtime/third_party/bearssl/src/hash/ghash_ctmul.c +345 -0
  299. package/runtime/third_party/bearssl/src/hash/ghash_ctmul32.c +251 -0
  300. package/runtime/third_party/bearssl/src/hash/ghash_ctmul64.c +154 -0
  301. package/runtime/third_party/bearssl/src/hash/ghash_pclmul.c +389 -0
  302. package/runtime/third_party/bearssl/src/hash/ghash_pwr8.c +411 -0
  303. package/runtime/third_party/bearssl/src/hash/md5.c +208 -0
  304. package/runtime/third_party/bearssl/src/hash/md5sha1.c +141 -0
  305. package/runtime/third_party/bearssl/src/hash/mgf1.c +56 -0
  306. package/runtime/third_party/bearssl/src/hash/multihash.c +166 -0
  307. package/runtime/third_party/bearssl/src/hash/sha1.c +191 -0
  308. package/runtime/third_party/bearssl/src/hash/sha2big.c +285 -0
  309. package/runtime/third_party/bearssl/src/hash/sha2small.c +341 -0
  310. package/runtime/third_party/bearssl/src/inner.h +2577 -0
  311. package/runtime/third_party/bearssl/src/int/i15_add.c +46 -0
  312. package/runtime/third_party/bearssl/src/int/i15_bitlen.c +44 -0
  313. package/runtime/third_party/bearssl/src/int/i15_decmod.c +124 -0
  314. package/runtime/third_party/bearssl/src/int/i15_decode.c +56 -0
  315. package/runtime/third_party/bearssl/src/int/i15_decred.c +100 -0
  316. package/runtime/third_party/bearssl/src/int/i15_encode.c +56 -0
  317. package/runtime/third_party/bearssl/src/int/i15_fmont.c +59 -0
  318. package/runtime/third_party/bearssl/src/int/i15_iszero.c +39 -0
  319. package/runtime/third_party/bearssl/src/int/i15_moddiv.c +465 -0
  320. package/runtime/third_party/bearssl/src/int/i15_modpow.c +50 -0
  321. package/runtime/third_party/bearssl/src/int/i15_modpow2.c +160 -0
  322. package/runtime/third_party/bearssl/src/int/i15_montmul.c +184 -0
  323. package/runtime/third_party/bearssl/src/int/i15_mulacc.c +61 -0
  324. package/runtime/third_party/bearssl/src/int/i15_muladd.c +173 -0
  325. package/runtime/third_party/bearssl/src/int/i15_ninv15.c +38 -0
  326. package/runtime/third_party/bearssl/src/int/i15_reduce.c +66 -0
  327. package/runtime/third_party/bearssl/src/int/i15_rshift.c +47 -0
  328. package/runtime/third_party/bearssl/src/int/i15_sub.c +46 -0
  329. package/runtime/third_party/bearssl/src/int/i15_tmont.c +36 -0
  330. package/runtime/third_party/bearssl/src/int/i31_add.c +46 -0
  331. package/runtime/third_party/bearssl/src/int/i31_bitlen.c +44 -0
  332. package/runtime/third_party/bearssl/src/int/i31_decmod.c +124 -0
  333. package/runtime/third_party/bearssl/src/int/i31_decode.c +57 -0
  334. package/runtime/third_party/bearssl/src/int/i31_decred.c +103 -0
  335. package/runtime/third_party/bearssl/src/int/i31_encode.c +79 -0
  336. package/runtime/third_party/bearssl/src/int/i31_fmont.c +60 -0
  337. package/runtime/third_party/bearssl/src/int/i31_iszero.c +39 -0
  338. package/runtime/third_party/bearssl/src/int/i31_moddiv.c +488 -0
  339. package/runtime/third_party/bearssl/src/int/i31_modpow.c +65 -0
  340. package/runtime/third_party/bearssl/src/int/i31_modpow2.c +160 -0
  341. package/runtime/third_party/bearssl/src/int/i31_montmul.c +127 -0
  342. package/runtime/third_party/bearssl/src/int/i31_mulacc.c +74 -0
  343. package/runtime/third_party/bearssl/src/int/i31_muladd.c +157 -0
  344. package/runtime/third_party/bearssl/src/int/i31_ninv31.c +39 -0
  345. package/runtime/third_party/bearssl/src/int/i31_reduce.c +66 -0
  346. package/runtime/third_party/bearssl/src/int/i31_rshift.c +47 -0
  347. package/runtime/third_party/bearssl/src/int/i31_sub.c +46 -0
  348. package/runtime/third_party/bearssl/src/int/i31_tmont.c +36 -0
  349. package/runtime/third_party/bearssl/src/int/i32_add.c +51 -0
  350. package/runtime/third_party/bearssl/src/int/i32_bitlen.c +44 -0
  351. package/runtime/third_party/bearssl/src/int/i32_decmod.c +77 -0
  352. package/runtime/third_party/bearssl/src/int/i32_decode.c +63 -0
  353. package/runtime/third_party/bearssl/src/int/i32_decred.c +107 -0
  354. package/runtime/third_party/bearssl/src/int/i32_div32.c +56 -0
  355. package/runtime/third_party/bearssl/src/int/i32_encode.c +72 -0
  356. package/runtime/third_party/bearssl/src/int/i32_fmont.c +60 -0
  357. package/runtime/third_party/bearssl/src/int/i32_iszero.c +39 -0
  358. package/runtime/third_party/bearssl/src/int/i32_modpow.c +65 -0
  359. package/runtime/third_party/bearssl/src/int/i32_montmul.c +69 -0
  360. package/runtime/third_party/bearssl/src/int/i32_mulacc.c +56 -0
  361. package/runtime/third_party/bearssl/src/int/i32_muladd.c +138 -0
  362. package/runtime/third_party/bearssl/src/int/i32_ninv32.c +39 -0
  363. package/runtime/third_party/bearssl/src/int/i32_reduce.c +66 -0
  364. package/runtime/third_party/bearssl/src/int/i32_sub.c +51 -0
  365. package/runtime/third_party/bearssl/src/int/i32_tmont.c +36 -0
  366. package/runtime/third_party/bearssl/src/int/i62_modpow2.c +493 -0
  367. package/runtime/third_party/bearssl/src/kdf/hkdf.c +107 -0
  368. package/runtime/third_party/bearssl/src/kdf/shake.c +590 -0
  369. package/runtime/third_party/bearssl/src/mac/hmac.c +122 -0
  370. package/runtime/third_party/bearssl/src/mac/hmac_ct.c +193 -0
  371. package/runtime/third_party/bearssl/src/rand/aesctr_drbg.c +206 -0
  372. package/runtime/third_party/bearssl/src/rand/hmac_drbg.c +157 -0
  373. package/runtime/third_party/bearssl/src/rand/sysrng.c +252 -0
  374. package/runtime/third_party/bearssl/src/rsa/rsa_default_keygen.c +38 -0
  375. package/runtime/third_party/bearssl/src/rsa/rsa_default_modulus.c +36 -0
  376. package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_decrypt.c +38 -0
  377. package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_encrypt.c +38 -0
  378. package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_sign.c +38 -0
  379. package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_vrfy.c +38 -0
  380. package/runtime/third_party/bearssl/src/rsa/rsa_default_priv.c +38 -0
  381. package/runtime/third_party/bearssl/src/rsa/rsa_default_privexp.c +36 -0
  382. package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_sign.c +38 -0
  383. package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_vrfy.c +38 -0
  384. package/runtime/third_party/bearssl/src/rsa/rsa_default_pub.c +38 -0
  385. package/runtime/third_party/bearssl/src/rsa/rsa_default_pubexp.c +36 -0
  386. package/runtime/third_party/bearssl/src/rsa/rsa_i15_keygen.c +583 -0
  387. package/runtime/third_party/bearssl/src/rsa/rsa_i15_modulus.c +99 -0
  388. package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_decrypt.c +41 -0
  389. package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_encrypt.c +44 -0
  390. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_sign.c +37 -0
  391. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_vrfy.c +43 -0
  392. package/runtime/third_party/bearssl/src/rsa/rsa_i15_priv.c +209 -0
  393. package/runtime/third_party/bearssl/src/rsa/rsa_i15_privexp.c +320 -0
  394. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_sign.c +40 -0
  395. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_vrfy.c +44 -0
  396. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pub.c +113 -0
  397. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pubexp.c +152 -0
  398. package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen.c +37 -0
  399. package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen_inner.c +608 -0
  400. package/runtime/third_party/bearssl/src/rsa/rsa_i31_modulus.c +99 -0
  401. package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_decrypt.c +41 -0
  402. package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_encrypt.c +44 -0
  403. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_sign.c +37 -0
  404. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_vrfy.c +43 -0
  405. package/runtime/third_party/bearssl/src/rsa/rsa_i31_priv.c +203 -0
  406. package/runtime/third_party/bearssl/src/rsa/rsa_i31_privexp.c +318 -0
  407. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_sign.c +40 -0
  408. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_vrfy.c +44 -0
  409. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pub.c +106 -0
  410. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pubexp.c +152 -0
  411. package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_decrypt.c +41 -0
  412. package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_encrypt.c +44 -0
  413. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_sign.c +37 -0
  414. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_vrfy.c +43 -0
  415. package/runtime/third_party/bearssl/src/rsa/rsa_i32_priv.c +160 -0
  416. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_sign.c +40 -0
  417. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_vrfy.c +44 -0
  418. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pub.c +77 -0
  419. package/runtime/third_party/bearssl/src/rsa/rsa_i62_keygen.c +57 -0
  420. package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_decrypt.c +61 -0
  421. package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_encrypt.c +64 -0
  422. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_sign.c +57 -0
  423. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_vrfy.c +63 -0
  424. package/runtime/third_party/bearssl/src/rsa/rsa_i62_priv.c +223 -0
  425. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_sign.c +60 -0
  426. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_vrfy.c +64 -0
  427. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pub.c +125 -0
  428. package/runtime/third_party/bearssl/src/rsa/rsa_oaep_pad.c +112 -0
  429. package/runtime/third_party/bearssl/src/rsa/rsa_oaep_unpad.c +145 -0
  430. package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_pad.c +100 -0
  431. package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_unpad.c +121 -0
  432. package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_pad.c +106 -0
  433. package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_unpad.c +121 -0
  434. package/runtime/third_party/bearssl/src/rsa/rsa_ssl_decrypt.c +52 -0
  435. package/runtime/third_party/bearssl/src/settings.c +306 -0
  436. package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcdec.c +69 -0
  437. package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcenc.c +67 -0
  438. package/runtime/third_party/bearssl/src/symcipher/aes_big_ctr.c +84 -0
  439. package/runtime/third_party/bearssl/src/symcipher/aes_big_ctrcbc.c +142 -0
  440. package/runtime/third_party/bearssl/src/symcipher/aes_big_dec.c +254 -0
  441. package/runtime/third_party/bearssl/src/symcipher/aes_big_enc.c +157 -0
  442. package/runtime/third_party/bearssl/src/symcipher/aes_common.c +112 -0
  443. package/runtime/third_party/bearssl/src/symcipher/aes_ct.c +328 -0
  444. package/runtime/third_party/bearssl/src/symcipher/aes_ct64.c +398 -0
  445. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcdec.c +104 -0
  446. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcenc.c +81 -0
  447. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctr.c +114 -0
  448. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctrcbc.c +433 -0
  449. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_dec.c +159 -0
  450. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_enc.c +115 -0
  451. package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcdec.c +111 -0
  452. package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcenc.c +91 -0
  453. package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctr.c +116 -0
  454. package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctrcbc.c +422 -0
  455. package/runtime/third_party/bearssl/src/symcipher/aes_ct_dec.c +170 -0
  456. package/runtime/third_party/bearssl/src/symcipher/aes_ct_enc.c +112 -0
  457. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8.c +445 -0
  458. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcdec.c +670 -0
  459. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcenc.c +417 -0
  460. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctr.c +717 -0
  461. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctrcbc.c +946 -0
  462. package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcdec.c +69 -0
  463. package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcenc.c +67 -0
  464. package/runtime/third_party/bearssl/src/symcipher/aes_small_ctr.c +84 -0
  465. package/runtime/third_party/bearssl/src/symcipher/aes_small_ctrcbc.c +142 -0
  466. package/runtime/third_party/bearssl/src/symcipher/aes_small_dec.c +176 -0
  467. package/runtime/third_party/bearssl/src/symcipher/aes_small_enc.c +129 -0
  468. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni.c +240 -0
  469. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcdec.c +223 -0
  470. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcenc.c +122 -0
  471. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctr.c +211 -0
  472. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctrcbc.c +596 -0
  473. package/runtime/third_party/bearssl/src/symcipher/chacha20_ct.c +106 -0
  474. package/runtime/third_party/bearssl/src/symcipher/chacha20_sse2.c +237 -0
  475. package/runtime/third_party/bearssl/src/symcipher/des_ct.c +411 -0
  476. package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcdec.c +87 -0
  477. package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcenc.c +69 -0
  478. package/runtime/third_party/bearssl/src/symcipher/des_support.c +166 -0
  479. package/runtime/third_party/bearssl/src/symcipher/des_tab.c +310 -0
  480. package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcdec.c +85 -0
  481. package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcenc.c +67 -0
  482. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul.c +260 -0
  483. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul32.c +297 -0
  484. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmulq.c +475 -0
  485. package/runtime/third_party/bearssl/src/symcipher/poly1305_i15.c +221 -0
  486. package/runtime/third_party/bearssl/src/x509/asn1.t0 +757 -0
  487. package/runtime/third_party/bearssl/src/x509/asn1enc.c +93 -0
  488. package/runtime/third_party/bearssl/src/x509/encode_ec_pk8der.c +110 -0
  489. package/runtime/third_party/bearssl/src/x509/encode_ec_rawder.c +161 -0
  490. package/runtime/third_party/bearssl/src/x509/encode_rsa_pk8der.c +97 -0
  491. package/runtime/third_party/bearssl/src/x509/encode_rsa_rawder.c +96 -0
  492. package/runtime/third_party/bearssl/src/x509/skey_decoder.c +653 -0
  493. package/runtime/third_party/bearssl/src/x509/skey_decoder.t0 +376 -0
  494. package/runtime/third_party/bearssl/src/x509/x509_decoder.c +776 -0
  495. package/runtime/third_party/bearssl/src/x509/x509_decoder.t0 +324 -0
  496. package/runtime/third_party/bearssl/src/x509/x509_knownkey.c +105 -0
  497. package/runtime/third_party/bearssl/src/x509/x509_minimal.c +1722 -0
  498. package/runtime/third_party/bearssl/src/x509/x509_minimal.t0 +1526 -0
  499. package/runtime/third_party/bearssl/src/x509/x509_minimal_full.c +59 -0
  500. package/runtime/third_party/quickjs-dtoa/LICENSE +22 -0
  501. package/runtime/third_party/quickjs-dtoa/README.md +23 -0
  502. package/runtime/third_party/quickjs-dtoa/dtoa.c +1640 -0
  503. package/runtime/third_party/quickjs-dtoa/dtoa.h +83 -0
  504. package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +89 -0
  505. package/runtime/third_party/quickjs-regexp/LICENSE +22 -0
  506. package/runtime/third_party/quickjs-regexp/README.md +22 -0
  507. package/runtime/third_party/quickjs-regexp/cutils.c +641 -0
  508. package/runtime/third_party/quickjs-regexp/cutils.h +457 -0
  509. package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +73 -0
  510. package/runtime/third_party/quickjs-regexp/libregexp.c +3448 -0
  511. package/runtime/third_party/quickjs-regexp/libregexp.h +65 -0
  512. package/runtime/third_party/quickjs-regexp/libunicode-table.h +5206 -0
  513. package/runtime/third_party/quickjs-regexp/libunicode.c +2124 -0
  514. package/runtime/third_party/quickjs-regexp/libunicode.h +196 -0
  515. package/runtime/third_party/v8-ieee754/LICENSE +61 -0
  516. package/runtime/third_party/v8-ieee754/README.md +22 -0
  517. package/runtime/third_party/v8-ieee754/convert.py +84 -0
  518. package/runtime/third_party/v8-ieee754/ieee754.c +3030 -0
  519. package/runtime/third_party/v8-ieee754/ieee754.h +27 -0
  520. package/runtime/tools/regexp_compile.c +90 -0
@@ -0,0 +1,85 @@
1
+ /*
2
+ * Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining
5
+ * a copy of this software and associated documentation files (the
6
+ * "Software"), to deal in the Software without restriction, including
7
+ * without limitation the rights to use, copy, modify, merge, publish,
8
+ * distribute, sublicense, and/or sell copies of the Software, and to
9
+ * permit persons to whom the Software is furnished to do so, subject to
10
+ * the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be
13
+ * included in all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ #include "inner.h"
26
+
27
+ /* see bearssl_block.h */
28
+ void
29
+ br_des_tab_cbcdec_init(br_des_tab_cbcdec_keys *ctx,
30
+ const void *key, size_t len)
31
+ {
32
+ ctx->vtable = &br_des_tab_cbcdec_vtable;
33
+ ctx->num_rounds = br_des_tab_keysched(ctx->skey, key, len);
34
+ if (len == 8) {
35
+ br_des_rev_skey(ctx->skey);
36
+ } else {
37
+ int i;
38
+
39
+ for (i = 0; i < 48; i += 2) {
40
+ uint32_t t;
41
+
42
+ t = ctx->skey[i];
43
+ ctx->skey[i] = ctx->skey[94 - i];
44
+ ctx->skey[94 - i] = t;
45
+ t = ctx->skey[i + 1];
46
+ ctx->skey[i + 1] = ctx->skey[95 - i];
47
+ ctx->skey[95 - i] = t;
48
+ }
49
+ }
50
+ }
51
+
52
+ /* see bearssl_block.h */
53
+ void
54
+ br_des_tab_cbcdec_run(const br_des_tab_cbcdec_keys *ctx,
55
+ void *iv, void *data, size_t len)
56
+ {
57
+ unsigned char *buf, *ivbuf;
58
+
59
+ ivbuf = iv;
60
+ buf = data;
61
+ while (len > 0) {
62
+ unsigned char tmp[8];
63
+ int i;
64
+
65
+ memcpy(tmp, buf, 8);
66
+ br_des_tab_process_block(ctx->num_rounds, ctx->skey, buf);
67
+ for (i = 0; i < 8; i ++) {
68
+ buf[i] ^= ivbuf[i];
69
+ }
70
+ memcpy(ivbuf, tmp, 8);
71
+ buf += 8;
72
+ len -= 8;
73
+ }
74
+ }
75
+
76
+ /* see bearssl_block.h */
77
+ const br_block_cbcdec_class br_des_tab_cbcdec_vtable = {
78
+ sizeof(br_des_tab_cbcdec_keys),
79
+ 8,
80
+ 3,
81
+ (void (*)(const br_block_cbcdec_class **, const void *, size_t))
82
+ &br_des_tab_cbcdec_init,
83
+ (void (*)(const br_block_cbcdec_class *const *, void *, void *, size_t))
84
+ &br_des_tab_cbcdec_run
85
+ };
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining
5
+ * a copy of this software and associated documentation files (the
6
+ * "Software"), to deal in the Software without restriction, including
7
+ * without limitation the rights to use, copy, modify, merge, publish,
8
+ * distribute, sublicense, and/or sell copies of the Software, and to
9
+ * permit persons to whom the Software is furnished to do so, subject to
10
+ * the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be
13
+ * included in all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ #include "inner.h"
26
+
27
+ /* see bearssl_block.h */
28
+ void
29
+ br_des_tab_cbcenc_init(br_des_tab_cbcenc_keys *ctx,
30
+ const void *key, size_t len)
31
+ {
32
+ ctx->vtable = &br_des_tab_cbcenc_vtable;
33
+ ctx->num_rounds = br_des_tab_keysched(ctx->skey, key, len);
34
+ }
35
+
36
+ /* see bearssl_block.h */
37
+ void
38
+ br_des_tab_cbcenc_run(const br_des_tab_cbcenc_keys *ctx,
39
+ void *iv, void *data, size_t len)
40
+ {
41
+ unsigned char *buf, *ivbuf;
42
+
43
+ ivbuf = iv;
44
+ buf = data;
45
+ while (len > 0) {
46
+ int i;
47
+
48
+ for (i = 0; i < 8; i ++) {
49
+ buf[i] ^= ivbuf[i];
50
+ }
51
+ br_des_tab_process_block(ctx->num_rounds, ctx->skey, buf);
52
+ memcpy(ivbuf, buf, 8);
53
+ buf += 8;
54
+ len -= 8;
55
+ }
56
+ }
57
+
58
+ /* see bearssl_block.h */
59
+ const br_block_cbcenc_class br_des_tab_cbcenc_vtable = {
60
+ sizeof(br_des_tab_cbcenc_keys),
61
+ 8,
62
+ 3,
63
+ (void (*)(const br_block_cbcenc_class **, const void *, size_t))
64
+ &br_des_tab_cbcenc_init,
65
+ (void (*)(const br_block_cbcenc_class *const *, void *, void *, size_t))
66
+ &br_des_tab_cbcenc_run
67
+ };
@@ -0,0 +1,260 @@
1
+ /*
2
+ * Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining
5
+ * a copy of this software and associated documentation files (the
6
+ * "Software"), to deal in the Software without restriction, including
7
+ * without limitation the rights to use, copy, modify, merge, publish,
8
+ * distribute, sublicense, and/or sell copies of the Software, and to
9
+ * permit persons to whom the Software is furnished to do so, subject to
10
+ * the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be
13
+ * included in all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ #include "inner.h"
26
+
27
+ /*
28
+ * Perform the inner processing of blocks for Poly1305. The accumulator
29
+ * and the r key are provided as arrays of 26-bit words (these words
30
+ * are allowed to have an extra bit, i.e. use 27 bits).
31
+ *
32
+ * On output, all accumulator words fit on 26 bits, except acc[1], which
33
+ * may be slightly larger (but by a very small amount only).
34
+ */
35
+ static void
36
+ poly1305_inner(uint32_t *acc, const uint32_t *r, const void *data, size_t len)
37
+ {
38
+ /*
39
+ * Implementation notes: we split the 130-bit values into five
40
+ * 26-bit words. This gives us some space for carries.
41
+ *
42
+ * This code is inspired from the public-domain code available
43
+ * on:
44
+ * https://github.com/floodyberry/poly1305-donna
45
+ *
46
+ * Since we compute modulo 2^130-5, the "upper words" become
47
+ * low words with a factor of 5; that is, x*2^130 = x*5 mod p.
48
+ */
49
+ const unsigned char *buf;
50
+ uint32_t a0, a1, a2, a3, a4;
51
+ uint32_t r0, r1, r2, r3, r4;
52
+ uint32_t u1, u2, u3, u4;
53
+
54
+ r0 = r[0];
55
+ r1 = r[1];
56
+ r2 = r[2];
57
+ r3 = r[3];
58
+ r4 = r[4];
59
+
60
+ u1 = r1 * 5;
61
+ u2 = r2 * 5;
62
+ u3 = r3 * 5;
63
+ u4 = r4 * 5;
64
+
65
+ a0 = acc[0];
66
+ a1 = acc[1];
67
+ a2 = acc[2];
68
+ a3 = acc[3];
69
+ a4 = acc[4];
70
+
71
+ buf = data;
72
+ while (len > 0) {
73
+ uint64_t w0, w1, w2, w3, w4;
74
+ uint64_t c;
75
+ unsigned char tmp[16];
76
+
77
+ /*
78
+ * If there is a partial block, right-pad it with zeros.
79
+ */
80
+ if (len < 16) {
81
+ memset(tmp, 0, sizeof tmp);
82
+ memcpy(tmp, buf, len);
83
+ buf = tmp;
84
+ len = 16;
85
+ }
86
+
87
+ /*
88
+ * Decode next block and apply the "high bit"; that value
89
+ * is added to the accumulator.
90
+ */
91
+ a0 += br_dec32le(buf) & 0x03FFFFFF;
92
+ a1 += (br_dec32le(buf + 3) >> 2) & 0x03FFFFFF;
93
+ a2 += (br_dec32le(buf + 6) >> 4) & 0x03FFFFFF;
94
+ a3 += (br_dec32le(buf + 9) >> 6) & 0x03FFFFFF;
95
+ a4 += (br_dec32le(buf + 12) >> 8) | 0x01000000;
96
+
97
+ /*
98
+ * Compute multiplication.
99
+ */
100
+ #define M(x, y) ((uint64_t)(x) * (uint64_t)(y))
101
+
102
+ w0 = M(a0, r0) + M(a1, u4) + M(a2, u3) + M(a3, u2) + M(a4, u1);
103
+ w1 = M(a0, r1) + M(a1, r0) + M(a2, u4) + M(a3, u3) + M(a4, u2);
104
+ w2 = M(a0, r2) + M(a1, r1) + M(a2, r0) + M(a3, u4) + M(a4, u3);
105
+ w3 = M(a0, r3) + M(a1, r2) + M(a2, r1) + M(a3, r0) + M(a4, u4);
106
+ w4 = M(a0, r4) + M(a1, r3) + M(a2, r2) + M(a3, r1) + M(a4, r0);
107
+
108
+ #undef M
109
+ /*
110
+ * Perform some (partial) modular reduction. This step is
111
+ * enough to keep values in ranges such that there won't
112
+ * be carry overflows. Most of the reduction was done in
113
+ * the multiplication step (by using the 'u*' values, and
114
+ * using the fact that 2^130 = -5 mod p); here we perform
115
+ * some carry propagation.
116
+ */
117
+ c = w0 >> 26;
118
+ a0 = (uint32_t)w0 & 0x3FFFFFF;
119
+ w1 += c;
120
+ c = w1 >> 26;
121
+ a1 = (uint32_t)w1 & 0x3FFFFFF;
122
+ w2 += c;
123
+ c = w2 >> 26;
124
+ a2 = (uint32_t)w2 & 0x3FFFFFF;
125
+ w3 += c;
126
+ c = w3 >> 26;
127
+ a3 = (uint32_t)w3 & 0x3FFFFFF;
128
+ w4 += c;
129
+ c = w4 >> 26;
130
+ a4 = (uint32_t)w4 & 0x3FFFFFF;
131
+ a0 += (uint32_t)c * 5;
132
+ a1 += a0 >> 26;
133
+ a0 &= 0x3FFFFFF;
134
+
135
+ buf += 16;
136
+ len -= 16;
137
+ }
138
+
139
+ acc[0] = a0;
140
+ acc[1] = a1;
141
+ acc[2] = a2;
142
+ acc[3] = a3;
143
+ acc[4] = a4;
144
+ }
145
+
146
+ /* see bearssl_block.h */
147
+ void
148
+ br_poly1305_ctmul_run(const void *key, const void *iv,
149
+ void *data, size_t len, const void *aad, size_t aad_len,
150
+ void *tag, br_chacha20_run ichacha, int encrypt)
151
+ {
152
+ unsigned char pkey[32], foot[16];
153
+ uint32_t r[5], acc[5], cc, ctl, hi;
154
+ uint64_t w;
155
+ int i;
156
+
157
+ /*
158
+ * Compute the MAC key. The 'r' value is the first 16 bytes of
159
+ * pkey[].
160
+ */
161
+ memset(pkey, 0, sizeof pkey);
162
+ ichacha(key, iv, 0, pkey, sizeof pkey);
163
+
164
+ /*
165
+ * If encrypting, ChaCha20 must run first, followed by Poly1305.
166
+ * When decrypting, the operations are reversed.
167
+ */
168
+ if (encrypt) {
169
+ ichacha(key, iv, 1, data, len);
170
+ }
171
+
172
+ /*
173
+ * Run Poly1305. We must process the AAD, then ciphertext, then
174
+ * the footer (with the lengths). Note that the AAD and ciphertext
175
+ * are meant to be padded with zeros up to the next multiple of 16,
176
+ * and the length of the footer is 16 bytes as well.
177
+ */
178
+
179
+ /*
180
+ * Decode the 'r' value into 26-bit words, with the "clamping"
181
+ * operation applied.
182
+ */
183
+ r[0] = br_dec32le(pkey) & 0x03FFFFFF;
184
+ r[1] = (br_dec32le(pkey + 3) >> 2) & 0x03FFFF03;
185
+ r[2] = (br_dec32le(pkey + 6) >> 4) & 0x03FFC0FF;
186
+ r[3] = (br_dec32le(pkey + 9) >> 6) & 0x03F03FFF;
187
+ r[4] = (br_dec32le(pkey + 12) >> 8) & 0x000FFFFF;
188
+
189
+ /*
190
+ * Accumulator is 0.
191
+ */
192
+ memset(acc, 0, sizeof acc);
193
+
194
+ /*
195
+ * Process the additional authenticated data, ciphertext, and
196
+ * footer in due order.
197
+ */
198
+ br_enc64le(foot, (uint64_t)aad_len);
199
+ br_enc64le(foot + 8, (uint64_t)len);
200
+ poly1305_inner(acc, r, aad, aad_len);
201
+ poly1305_inner(acc, r, data, len);
202
+ poly1305_inner(acc, r, foot, sizeof foot);
203
+
204
+ /*
205
+ * Finalise modular reduction. This is done with carry propagation
206
+ * and applying the '2^130 = -5 mod p' rule. Note that the output
207
+ * of poly1035_inner() is already mostly reduced, since only
208
+ * acc[1] may be (very slightly) above 2^26. A single loop back
209
+ * to acc[1] will be enough to make the value fit in 130 bits.
210
+ */
211
+ cc = 0;
212
+ for (i = 1; i <= 6; i ++) {
213
+ int j;
214
+
215
+ j = (i >= 5) ? i - 5 : i;
216
+ acc[j] += cc;
217
+ cc = acc[j] >> 26;
218
+ acc[j] &= 0x03FFFFFF;
219
+ }
220
+
221
+ /*
222
+ * We may still have a value in the 2^130-5..2^130-1 range, in
223
+ * which case we must reduce it again. The code below selects,
224
+ * in constant-time, between 'acc' and 'acc-p',
225
+ */
226
+ ctl = GT(acc[0], 0x03FFFFFA);
227
+ for (i = 1; i < 5; i ++) {
228
+ ctl &= EQ(acc[i], 0x03FFFFFF);
229
+ }
230
+ cc = 5;
231
+ for (i = 0; i < 5; i ++) {
232
+ uint32_t t;
233
+
234
+ t = (acc[i] + cc);
235
+ cc = t >> 26;
236
+ t &= 0x03FFFFFF;
237
+ acc[i] = MUX(ctl, t, acc[i]);
238
+ }
239
+
240
+ /*
241
+ * Convert back the accumulator to 32-bit words, and add the
242
+ * 's' value (second half of pkey[]). That addition is done
243
+ * modulo 2^128.
244
+ */
245
+ w = (uint64_t)acc[0] + ((uint64_t)acc[1] << 26) + br_dec32le(pkey + 16);
246
+ br_enc32le((unsigned char *)tag, (uint32_t)w);
247
+ w = (w >> 32) + ((uint64_t)acc[2] << 20) + br_dec32le(pkey + 20);
248
+ br_enc32le((unsigned char *)tag + 4, (uint32_t)w);
249
+ w = (w >> 32) + ((uint64_t)acc[3] << 14) + br_dec32le(pkey + 24);
250
+ br_enc32le((unsigned char *)tag + 8, (uint32_t)w);
251
+ hi = (uint32_t)(w >> 32) + (acc[4] << 8) + br_dec32le(pkey + 28);
252
+ br_enc32le((unsigned char *)tag + 12, hi);
253
+
254
+ /*
255
+ * If decrypting, then ChaCha20 runs _after_ Poly1305.
256
+ */
257
+ if (!encrypt) {
258
+ ichacha(key, iv, 1, data, len);
259
+ }
260
+ }
@@ -0,0 +1,297 @@
1
+ /*
2
+ * Copyright (c) 2017 Thomas Pornin <pornin@bolet.org>
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining
5
+ * a copy of this software and associated documentation files (the
6
+ * "Software"), to deal in the Software without restriction, including
7
+ * without limitation the rights to use, copy, modify, merge, publish,
8
+ * distribute, sublicense, and/or sell copies of the Software, and to
9
+ * permit persons to whom the Software is furnished to do so, subject to
10
+ * the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be
13
+ * included in all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ #include "inner.h"
26
+
27
+ /*
28
+ * Perform the inner processing of blocks for Poly1305.
29
+ */
30
+ static void
31
+ poly1305_inner(uint32_t *a, const uint32_t *r, const void *data, size_t len)
32
+ {
33
+ /*
34
+ * Implementation notes: we split the 130-bit values into ten
35
+ * 13-bit words. This gives us some space for carries and allows
36
+ * using only 32x32->32 multiplications, which are way faster than
37
+ * 32x32->64 multiplications on the ARM Cortex-M0/M0+, and also
38
+ * help in making constant-time code on the Cortex-M3.
39
+ *
40
+ * Since we compute modulo 2^130-5, the "upper words" become
41
+ * low words with a factor of 5; that is, x*2^130 = x*5 mod p.
42
+ * This has already been integrated in the r[] array, which
43
+ * is extended to the 0..18 range.
44
+ *
45
+ * In each loop iteration, a[] and r[] words are 13-bit each,
46
+ * except a[1] which may use 14 bits.
47
+ */
48
+ const unsigned char *buf;
49
+
50
+ buf = data;
51
+ while (len > 0) {
52
+ unsigned char tmp[16];
53
+ uint32_t b[10];
54
+ unsigned u, v;
55
+ uint32_t z, cc1, cc2;
56
+
57
+ /*
58
+ * If there is a partial block, right-pad it with zeros.
59
+ */
60
+ if (len < 16) {
61
+ memset(tmp, 0, sizeof tmp);
62
+ memcpy(tmp, buf, len);
63
+ buf = tmp;
64
+ len = 16;
65
+ }
66
+
67
+ /*
68
+ * Decode next block and apply the "high bit"; that value
69
+ * is added to the accumulator.
70
+ */
71
+ v = br_dec16le(buf);
72
+ a[0] += v & 0x01FFF;
73
+ v >>= 13;
74
+ v |= buf[2] << 3;
75
+ v |= buf[3] << 11;
76
+ a[1] += v & 0x01FFF;
77
+ v >>= 13;
78
+ v |= buf[4] << 6;
79
+ a[2] += v & 0x01FFF;
80
+ v >>= 13;
81
+ v |= buf[5] << 1;
82
+ v |= buf[6] << 9;
83
+ a[3] += v & 0x01FFF;
84
+ v >>= 13;
85
+ v |= buf[7] << 4;
86
+ v |= buf[8] << 12;
87
+ a[4] += v & 0x01FFF;
88
+ v >>= 13;
89
+ v |= buf[9] << 7;
90
+ a[5] += v & 0x01FFF;
91
+ v >>= 13;
92
+ v |= buf[10] << 2;
93
+ v |= buf[11] << 10;
94
+ a[6] += v & 0x01FFF;
95
+ v >>= 13;
96
+ v |= buf[12] << 5;
97
+ a[7] += v & 0x01FFF;
98
+ v = br_dec16le(buf + 13);
99
+ a[8] += v & 0x01FFF;
100
+ v >>= 13;
101
+ v |= buf[15] << 3;
102
+ a[9] += v | 0x00800;
103
+
104
+ /*
105
+ * At that point, all a[] values fit on 14 bits, while
106
+ * all r[] values fit on 13 bits. Thus products fit on
107
+ * 27 bits, and we can accumulate up to 31 of them in
108
+ * a 32-bit word and still have some room for carries.
109
+ */
110
+
111
+ /*
112
+ * Now a[] contains words with values up to 14 bits each.
113
+ * We perform the multiplication with r[].
114
+ *
115
+ * The extended words of r[] may be larger than 13 bits
116
+ * (they are 5 times a 13-bit word) so the full summation
117
+ * may yield values up to 46 times a 27-bit word, which
118
+ * does not fit on a 32-bit word. To avoid that issue, we
119
+ * must split the loop below in two, with a carry
120
+ * propagation operation in the middle.
121
+ */
122
+ cc1 = 0;
123
+ for (u = 0; u < 10; u ++) {
124
+ uint32_t s;
125
+
126
+ s = cc1
127
+ + MUL15(a[0], r[u + 9 - 0])
128
+ + MUL15(a[1], r[u + 9 - 1])
129
+ + MUL15(a[2], r[u + 9 - 2])
130
+ + MUL15(a[3], r[u + 9 - 3])
131
+ + MUL15(a[4], r[u + 9 - 4]);
132
+ b[u] = s & 0x1FFF;
133
+ cc1 = s >> 13;
134
+ }
135
+ cc2 = 0;
136
+ for (u = 0; u < 10; u ++) {
137
+ uint32_t s;
138
+
139
+ s = b[u] + cc2
140
+ + MUL15(a[5], r[u + 9 - 5])
141
+ + MUL15(a[6], r[u + 9 - 6])
142
+ + MUL15(a[7], r[u + 9 - 7])
143
+ + MUL15(a[8], r[u + 9 - 8])
144
+ + MUL15(a[9], r[u + 9 - 9]);
145
+ b[u] = s & 0x1FFF;
146
+ cc2 = s >> 13;
147
+ }
148
+ memcpy(a, b, sizeof b);
149
+
150
+ /*
151
+ * The two carries "loop back" with a factor of 5. We
152
+ * propagate them into a[0] and a[1].
153
+ */
154
+ z = cc1 + cc2;
155
+ z += (z << 2) + a[0];
156
+ a[0] = z & 0x1FFF;
157
+ a[1] += z >> 13;
158
+
159
+ buf += 16;
160
+ len -= 16;
161
+ }
162
+ }
163
+
164
+ /* see bearssl_block.h */
165
+ void
166
+ br_poly1305_ctmul32_run(const void *key, const void *iv,
167
+ void *data, size_t len, const void *aad, size_t aad_len,
168
+ void *tag, br_chacha20_run ichacha, int encrypt)
169
+ {
170
+ unsigned char pkey[32], foot[16];
171
+ uint32_t z, r[19], acc[10], cc, ctl;
172
+ int i;
173
+
174
+ /*
175
+ * Compute the MAC key. The 'r' value is the first 16 bytes of
176
+ * pkey[].
177
+ */
178
+ memset(pkey, 0, sizeof pkey);
179
+ ichacha(key, iv, 0, pkey, sizeof pkey);
180
+
181
+ /*
182
+ * If encrypting, ChaCha20 must run first, followed by Poly1305.
183
+ * When decrypting, the operations are reversed.
184
+ */
185
+ if (encrypt) {
186
+ ichacha(key, iv, 1, data, len);
187
+ }
188
+
189
+ /*
190
+ * Run Poly1305. We must process the AAD, then ciphertext, then
191
+ * the footer (with the lengths). Note that the AAD and ciphertext
192
+ * are meant to be padded with zeros up to the next multiple of 16,
193
+ * and the length of the footer is 16 bytes as well.
194
+ */
195
+
196
+ /*
197
+ * Decode the 'r' value into 13-bit words, with the "clamping"
198
+ * operation applied.
199
+ */
200
+ z = br_dec32le(pkey) & 0x03FFFFFF;
201
+ r[9] = z & 0x1FFF;
202
+ r[10] = z >> 13;
203
+ z = (br_dec32le(pkey + 3) >> 2) & 0x03FFFF03;
204
+ r[11] = z & 0x1FFF;
205
+ r[12] = z >> 13;
206
+ z = (br_dec32le(pkey + 6) >> 4) & 0x03FFC0FF;
207
+ r[13] = z & 0x1FFF;
208
+ r[14] = z >> 13;
209
+ z = (br_dec32le(pkey + 9) >> 6) & 0x03F03FFF;
210
+ r[15] = z & 0x1FFF;
211
+ r[16] = z >> 13;
212
+ z = (br_dec32le(pkey + 12) >> 8) & 0x000FFFFF;
213
+ r[17] = z & 0x1FFF;
214
+ r[18] = z >> 13;
215
+
216
+ /*
217
+ * Extend r[] with the 5x factor pre-applied.
218
+ */
219
+ for (i = 0; i < 9; i ++) {
220
+ r[i] = MUL15(5, r[i + 10]);
221
+ }
222
+
223
+ /*
224
+ * Accumulator is 0.
225
+ */
226
+ memset(acc, 0, sizeof acc);
227
+
228
+ /*
229
+ * Process the additional authenticated data, ciphertext, and
230
+ * footer in due order.
231
+ */
232
+ br_enc64le(foot, (uint64_t)aad_len);
233
+ br_enc64le(foot + 8, (uint64_t)len);
234
+ poly1305_inner(acc, r, aad, aad_len);
235
+ poly1305_inner(acc, r, data, len);
236
+ poly1305_inner(acc, r, foot, sizeof foot);
237
+
238
+ /*
239
+ * Finalise modular reduction. This is done with carry propagation
240
+ * and applying the '2^130 = -5 mod p' rule. Note that the output
241
+ * of poly1035_inner() is already mostly reduced, since only
242
+ * acc[1] may be (very slightly) above 2^13. A single loop back
243
+ * to acc[1] will be enough to make the value fit in 130 bits.
244
+ */
245
+ cc = 0;
246
+ for (i = 1; i < 10; i ++) {
247
+ z = acc[i] + cc;
248
+ acc[i] = z & 0x1FFF;
249
+ cc = z >> 13;
250
+ }
251
+ z = acc[0] + cc + (cc << 2);
252
+ acc[0] = z & 0x1FFF;
253
+ acc[1] += z >> 13;
254
+
255
+ /*
256
+ * We may still have a value in the 2^130-5..2^130-1 range, in
257
+ * which case we must reduce it again. The code below selects,
258
+ * in constant-time, between 'acc' and 'acc-p',
259
+ */
260
+ ctl = GT(acc[0], 0x1FFA);
261
+ for (i = 1; i < 10; i ++) {
262
+ ctl &= EQ(acc[i], 0x1FFF);
263
+ }
264
+ acc[0] = MUX(ctl, acc[0] - 0x1FFB, acc[0]);
265
+ for (i = 1; i < 10; i ++) {
266
+ acc[i] &= ~(-ctl);
267
+ }
268
+
269
+ /*
270
+ * Convert back the accumulator to 32-bit words, and add the
271
+ * 's' value (second half of pkey[]). That addition is done
272
+ * modulo 2^128.
273
+ */
274
+ z = acc[0] + (acc[1] << 13) + br_dec16le(pkey + 16);
275
+ br_enc16le((unsigned char *)tag, z & 0xFFFF);
276
+ z = (z >> 16) + (acc[2] << 10) + br_dec16le(pkey + 18);
277
+ br_enc16le((unsigned char *)tag + 2, z & 0xFFFF);
278
+ z = (z >> 16) + (acc[3] << 7) + br_dec16le(pkey + 20);
279
+ br_enc16le((unsigned char *)tag + 4, z & 0xFFFF);
280
+ z = (z >> 16) + (acc[4] << 4) + br_dec16le(pkey + 22);
281
+ br_enc16le((unsigned char *)tag + 6, z & 0xFFFF);
282
+ z = (z >> 16) + (acc[5] << 1) + (acc[6] << 14) + br_dec16le(pkey + 24);
283
+ br_enc16le((unsigned char *)tag + 8, z & 0xFFFF);
284
+ z = (z >> 16) + (acc[7] << 11) + br_dec16le(pkey + 26);
285
+ br_enc16le((unsigned char *)tag + 10, z & 0xFFFF);
286
+ z = (z >> 16) + (acc[8] << 8) + br_dec16le(pkey + 28);
287
+ br_enc16le((unsigned char *)tag + 12, z & 0xFFFF);
288
+ z = (z >> 16) + (acc[9] << 5) + br_dec16le(pkey + 30);
289
+ br_enc16le((unsigned char *)tag + 14, z & 0xFFFF);
290
+
291
+ /*
292
+ * If decrypting, then ChaCha20 runs _after_ Poly1305.
293
+ */
294
+ if (!encrypt) {
295
+ ichacha(key, iv, 1, data, len);
296
+ }
297
+ }