visaljs 0.0.2 → 0.0.4
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.
- package/README.md +3 -1
- package/cli.js +545 -86
- package/node/include/js_node.h +30 -5
- package/node/include/js_uv.h +36 -0
- package/node/prelude/async_hooks.js +0 -0
- package/node/prelude/buffer.js +0 -0
- package/node/prelude/crypto.js +7 -10
- package/node/prelude/dns.js +99 -0
- package/node/prelude/dns_promises.js +10 -0
- package/node/prelude/events.js +0 -0
- package/node/prelude/fs.js +0 -0
- package/node/prelude/http.js +1039 -195
- package/node/prelude/http2.js +0 -0
- package/node/prelude/internal/crypto/asym.js +39 -12
- package/node/prelude/internal/crypto/cipher.js +0 -0
- package/node/prelude/internal/crypto/dh_groups.js +12 -0
- package/node/prelude/internal/crypto/diffiehellman.js +354 -0
- package/node/prelude/internal/crypto/hash.js +1 -1
- package/node/prelude/internal/crypto/kdf.js +0 -0
- package/node/prelude/internal/crypto/key_type.js +3 -0
- package/node/prelude/internal/crypto/keys.js +39 -9
- package/node/prelude/internal/crypto/random.js +0 -0
- package/node/prelude/internal/crypto/util.js +0 -0
- package/node/prelude/internal/errors.js +0 -0
- package/node/prelude/internal/http_agent.js +249 -0
- package/node/prelude/internal/net.js +33 -0
- package/node/prelude/internal/querystring.js +0 -0
- package/node/prelude/internal/socketaddress.js +249 -0
- package/node/prelude/internal/tls/common.js +306 -0
- package/node/prelude/internal/tls/wrap.js +1220 -0
- package/node/prelude/internal/tls/x509.js +394 -0
- package/node/prelude/module.js +0 -0
- package/node/prelude/net.js +1082 -50
- package/node/prelude/os.js +2 -2
- package/node/prelude/path.js +0 -0
- package/node/prelude/process.js +0 -0
- package/node/prelude/querystring.js +0 -0
- package/node/prelude/stream.js +6 -0
- package/node/prelude/stream_promises.js +0 -0
- package/node/prelude/stream_web.js +0 -0
- package/node/prelude/string_decoder.js +0 -0
- package/node/prelude/tls.js +141 -0
- package/node/prelude/tty.js +0 -0
- package/node/prelude/url.js +0 -0
- package/node/prelude/util.js +5 -2
- package/node/prelude/util_types.js +85 -0
- package/node/prelude/zlib.js +0 -0
- package/node/src/host_fs.c +10 -2
- package/node/src/host_http.c +268 -270
- package/node/src/host_loop.c +84 -0
- package/node/src/host_net.c +495 -0
- package/node/src/host_os.c +0 -0
- package/node/src/host_sys.c +54 -26
- package/node/third_party/libuv/LICENSE +0 -0
- package/node/third_party/libuv/include/uv/aix.h +0 -0
- package/node/third_party/libuv/include/uv/bsd.h +0 -0
- package/node/third_party/libuv/include/uv/darwin.h +0 -0
- package/node/third_party/libuv/include/uv/errno.h +0 -0
- package/node/third_party/libuv/include/uv/linux.h +0 -0
- package/node/third_party/libuv/include/uv/os390.h +0 -0
- package/node/third_party/libuv/include/uv/posix.h +0 -0
- package/node/third_party/libuv/include/uv/sunos.h +0 -0
- package/node/third_party/libuv/include/uv/threadpool.h +0 -0
- package/node/third_party/libuv/include/uv/tree.h +0 -0
- package/node/third_party/libuv/include/uv/unix.h +0 -0
- package/node/third_party/libuv/include/uv/version.h +0 -0
- package/node/third_party/libuv/include/uv/win.h +0 -0
- package/node/third_party/libuv/include/uv.h +0 -0
- package/node/third_party/libuv/src/fs-poll.c +0 -0
- package/node/third_party/libuv/src/heap-inl.h +0 -0
- package/node/third_party/libuv/src/idna.c +0 -0
- package/node/third_party/libuv/src/idna.h +0 -0
- package/node/third_party/libuv/src/inet.c +0 -0
- package/node/third_party/libuv/src/queue.h +0 -0
- package/node/third_party/libuv/src/random.c +0 -0
- package/node/third_party/libuv/src/strscpy.c +0 -0
- package/node/third_party/libuv/src/strscpy.h +0 -0
- package/node/third_party/libuv/src/strtok.c +0 -0
- package/node/third_party/libuv/src/strtok.h +0 -0
- package/node/third_party/libuv/src/thread-common.c +0 -0
- package/node/third_party/libuv/src/threadpool.c +0 -0
- package/node/third_party/libuv/src/timer.c +0 -0
- package/node/third_party/libuv/src/unix/async.c +0 -0
- package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +0 -0
- package/node/third_party/libuv/src/unix/core.c +0 -0
- package/node/third_party/libuv/src/unix/darwin-proctitle.c +0 -0
- package/node/third_party/libuv/src/unix/darwin-stub.h +0 -0
- package/node/third_party/libuv/src/unix/darwin-syscalls.h +0 -0
- package/node/third_party/libuv/src/unix/darwin.c +0 -0
- package/node/third_party/libuv/src/unix/dl.c +0 -0
- package/node/third_party/libuv/src/unix/fs.c +0 -0
- package/node/third_party/libuv/src/unix/fsevents.c +0 -0
- package/node/third_party/libuv/src/unix/getaddrinfo.c +0 -0
- package/node/third_party/libuv/src/unix/getnameinfo.c +0 -0
- package/node/third_party/libuv/src/unix/internal.h +0 -0
- package/node/third_party/libuv/src/unix/kqueue.c +0 -0
- package/node/third_party/libuv/src/unix/linux.c +0 -0
- package/node/third_party/libuv/src/unix/loop-watcher.c +0 -0
- package/node/third_party/libuv/src/unix/loop.c +0 -0
- package/node/third_party/libuv/src/unix/pipe.c +0 -0
- package/node/third_party/libuv/src/unix/poll.c +0 -0
- package/node/third_party/libuv/src/unix/process.c +0 -0
- package/node/third_party/libuv/src/unix/procfs-exepath.c +0 -0
- package/node/third_party/libuv/src/unix/proctitle.c +0 -0
- package/node/third_party/libuv/src/unix/random-devurandom.c +0 -0
- package/node/third_party/libuv/src/unix/random-getentropy.c +0 -0
- package/node/third_party/libuv/src/unix/random-getrandom.c +0 -0
- package/node/third_party/libuv/src/unix/random-sysctl-linux.c +0 -0
- package/node/third_party/libuv/src/unix/signal.c +0 -0
- package/node/third_party/libuv/src/unix/stream.c +0 -0
- package/node/third_party/libuv/src/unix/tcp.c +0 -0
- package/node/third_party/libuv/src/unix/thread.c +0 -0
- package/node/third_party/libuv/src/unix/tty.c +0 -0
- package/node/third_party/libuv/src/unix/udp.c +0 -0
- package/node/third_party/libuv/src/uv-common.c +0 -0
- package/node/third_party/libuv/src/uv-common.h +0 -0
- package/node/third_party/libuv/src/uv-data-getter-setters.c +0 -0
- package/node/third_party/libuv/src/version.c +0 -0
- package/node/third_party/libuv/src/win/async.c +98 -0
- package/node/third_party/libuv/src/win/atomicops-inl.h +61 -0
- package/node/third_party/libuv/src/win/core.c +683 -0
- package/node/third_party/libuv/src/win/detect-wakeup.c +56 -0
- package/node/third_party/libuv/src/win/dl.c +135 -0
- package/node/third_party/libuv/src/win/error.c +183 -0
- package/node/third_party/libuv/src/win/fs-event.c +620 -0
- package/node/third_party/libuv/src/win/fs-fd-hash-inl.h +200 -0
- package/node/third_party/libuv/src/win/fs.c +3774 -0
- package/node/third_party/libuv/src/win/getaddrinfo.c +388 -0
- package/node/third_party/libuv/src/win/getnameinfo.c +146 -0
- package/node/third_party/libuv/src/win/handle-inl.h +180 -0
- package/node/third_party/libuv/src/win/handle.c +162 -0
- package/node/third_party/libuv/src/win/internal.h +335 -0
- package/node/third_party/libuv/src/win/loop-watcher.c +122 -0
- package/node/third_party/libuv/src/win/pipe.c +2725 -0
- package/node/third_party/libuv/src/win/poll.c +586 -0
- package/node/third_party/libuv/src/win/process-stdio.c +419 -0
- package/node/third_party/libuv/src/win/process.c +1407 -0
- package/node/third_party/libuv/src/win/req-inl.h +214 -0
- package/node/third_party/libuv/src/win/signal.c +282 -0
- package/node/third_party/libuv/src/win/snprintf.c +42 -0
- package/node/third_party/libuv/src/win/stream-inl.h +54 -0
- package/node/third_party/libuv/src/win/stream.c +252 -0
- package/node/third_party/libuv/src/win/tcp.c +1674 -0
- package/node/third_party/libuv/src/win/thread.c +568 -0
- package/node/third_party/libuv/src/win/tty.c +2460 -0
- package/node/third_party/libuv/src/win/udp.c +1162 -0
- package/node/third_party/libuv/src/win/util.c +1750 -0
- package/node/third_party/libuv/src/win/winapi.c +144 -0
- package/node/third_party/libuv/src/win/winapi.h +4831 -0
- package/node/third_party/libuv/src/win/winsock.c +575 -0
- package/node/third_party/libuv/src/win/winsock.h +160 -0
- package/node/third_party/llhttp/LICENSE +0 -0
- package/node/third_party/llhttp/api.c +0 -0
- package/node/third_party/llhttp/http.c +0 -0
- package/node/third_party/llhttp/llhttp.c +0 -0
- package/node/third_party/llhttp/llhttp.h +0 -0
- package/package.json +1 -1
- package/runtime/include/js_atoms.gen.h +0 -0
- package/runtime/include/js_atoms.h +0 -0
- package/runtime/include/js_bigint.h +0 -0
- package/runtime/include/js_buffer.h +0 -0
- package/runtime/include/js_builtins.h +16 -0
- package/runtime/include/js_console.h +2 -0
- package/runtime/include/js_convert.h +0 -0
- package/runtime/include/js_core.def +23 -0
- package/runtime/include/js_crypto.h +23 -0
- package/runtime/include/js_error.h +0 -0
- package/runtime/include/js_exception.h +0 -0
- package/runtime/include/js_function.h +0 -0
- package/runtime/include/js_gc.h +0 -0
- package/runtime/include/js_generator.h +2 -3
- package/runtime/include/js_host.h +0 -0
- package/runtime/include/js_jobs.h +0 -0
- package/runtime/include/js_module.h +0 -0
- package/runtime/include/js_object.h +0 -0
- package/runtime/include/js_ops.h +0 -0
- package/runtime/include/js_promise.h +0 -2
- package/runtime/include/js_regexp.h +0 -0
- package/runtime/include/js_runtime.h +0 -0
- package/runtime/include/js_symbol.h +0 -0
- package/runtime/include/js_web.h +0 -0
- package/runtime/include/jscell.h +0 -0
- package/runtime/include/jscontext.h +0 -0
- package/runtime/include/jsnum.h +0 -0
- package/runtime/include/jsstring.h +0 -0
- package/runtime/include/jsvalue.h +0 -0
- package/runtime/src/arguments.c +0 -0
- package/runtime/src/array.c +0 -0
- package/runtime/src/arraybuffer.c +0 -0
- package/runtime/src/async_iter.c +4 -1
- package/runtime/src/atoms.c +0 -0
- package/runtime/src/base64.c +0 -0
- package/runtime/src/bigint.c +0 -0
- package/runtime/src/blob.c +0 -0
- package/runtime/src/boringssl_support.cc +37 -0
- package/runtime/src/buffer.c +0 -0
- package/runtime/src/builtin_table.c +8 -0
- package/runtime/src/builtins.c +0 -0
- package/runtime/src/builtins_util.h +0 -0
- package/runtime/src/collections.c +0 -0
- package/runtime/src/components.c +10 -0
- package/runtime/src/console.c +6 -18
- package/runtime/src/convert.c +0 -0
- package/runtime/src/core_all.c +1 -0
- package/runtime/src/crypto.c +0 -0
- package/runtime/src/crypto_asym.c +450 -241
- package/runtime/src/crypto_bn.c +91 -0
- package/runtime/src/crypto_cipher.c +153 -75
- package/runtime/src/crypto_hash.c +68 -53
- package/runtime/src/crypto_host.c +0 -0
- package/runtime/src/crypto_internal.h +55 -26
- package/runtime/src/crypto_kdf.c +0 -0
- package/runtime/src/crypto_key.c +0 -0
- package/runtime/src/crypto_pkey.c +198 -61
- package/runtime/src/crypto_subtle.c +42 -16
- package/runtime/src/crypto_tls.c +678 -0
- package/runtime/src/date.c +0 -0
- package/runtime/src/domexception.c +0 -0
- package/runtime/src/elements.c +0 -0
- package/runtime/src/elements.h +0 -0
- package/runtime/src/encoding.c +0 -0
- package/runtime/src/error.c +0 -0
- package/runtime/src/events.c +0 -0
- package/runtime/src/exception.c +0 -0
- package/runtime/src/fetch.c +0 -0
- package/runtime/src/function.c +0 -0
- package/runtime/src/gc.c +0 -0
- package/runtime/src/generator.c +8 -1
- package/runtime/src/global.c +2 -4
- package/runtime/src/headers.c +0 -0
- package/runtime/src/inspect.c +0 -0
- package/runtime/src/internal.h +0 -1
- package/runtime/src/iterate.c +0 -0
- package/runtime/src/iterator.c +0 -0
- package/runtime/src/jobs.c +2 -1
- package/runtime/src/jsnum.c +0 -0
- package/runtime/src/json.c +0 -0
- package/runtime/src/math.c +0 -0
- package/runtime/src/module.c +0 -0
- package/runtime/src/number.c +0 -0
- package/runtime/src/object.c +0 -0
- package/runtime/src/ops.c +0 -0
- package/runtime/src/os.c +0 -0
- package/runtime/src/os.h +0 -0
- package/runtime/src/process.c +7 -0
- package/runtime/src/promise.c +4 -1
- package/runtime/src/proxy.c +0 -0
- package/runtime/src/reflect.c +0 -0
- package/runtime/src/regexp.c +0 -0
- package/runtime/src/regexp_anchor.h +0 -0
- package/runtime/src/regexp_message.h +0 -0
- package/runtime/src/shape.c +0 -0
- package/runtime/src/shape.h +0 -0
- package/runtime/src/streams.c +0 -0
- package/runtime/src/streams.h +0 -0
- package/runtime/src/string.c +0 -0
- package/runtime/src/string_builtins.c +0 -0
- package/runtime/src/symbol.c +0 -0
- package/runtime/src/test_host.c +0 -0
- package/runtime/src/tls_roots.gen.h +3215 -0
- package/runtime/src/typedarray.c +0 -0
- package/runtime/src/tznames.gen.h +0 -0
- package/runtime/src/uri.c +0 -0
- package/runtime/src/url.c +0 -0
- package/runtime/src/util_types.c +52 -0
- package/runtime/src/weak.c +2 -1
- package/runtime/src/web.c +0 -0
- package/runtime/src/wrapper.c +0 -0
- package/runtime/src/writable.c +0 -0
- package/runtime/third_party/ada-idna/LICENSE-MIT +0 -0
- package/runtime/third_party/ada-idna/README.md +0 -0
- package/runtime/third_party/ada-idna/convert.mjs +0 -0
- package/runtime/third_party/ada-idna/idna.c +0 -0
- package/runtime/third_party/ada-idna/idna.h +0 -0
- package/runtime/third_party/ada-idna/idna_tables.h +0 -0
- package/runtime/third_party/boringssl/LICENSE +238 -0
- package/runtime/third_party/boringssl/README.md +46 -0
- package/runtime/third_party/boringssl/VERSION +1 -0
- package/runtime/third_party/boringssl/crypto/aes/aes.cc +44 -0
- package/runtime/third_party/boringssl/crypto/armv8_feature_parsing.h +67 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_bitstr.cc +297 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_bool.cc +50 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_d2i_fp.cc +47 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_dup.cc +42 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_gentm.cc +130 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_i2d_fp.cc +44 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_int.cc +467 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_mbstr.cc +242 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_object.cc +191 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_octet.cc +32 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_strex.cc +411 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_strnid.cc +208 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_time.cc +248 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_type.cc +467 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_utctm.cc +128 -0
- package/runtime/third_party/boringssl/crypto/asn1/asn1_lib.cc +453 -0
- package/runtime/third_party/boringssl/crypto/asn1/asn1_par.cc +61 -0
- package/runtime/third_party/boringssl/crypto/asn1/asn_pack.cc +56 -0
- package/runtime/third_party/boringssl/crypto/asn1/f_int.cc +63 -0
- package/runtime/third_party/boringssl/crypto/asn1/f_string.cc +52 -0
- package/runtime/third_party/boringssl/crypto/asn1/internal.h +430 -0
- package/runtime/third_party/boringssl/crypto/asn1/posix_time.cc +244 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_dec.cc +611 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_enc.cc +348 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_fre.cc +163 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_new.cc +274 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_typ.cc +92 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_utl.cc +218 -0
- package/runtime/third_party/boringssl/crypto/base64/base64.cc +433 -0
- package/runtime/third_party/boringssl/crypto/bcm_support.h +62 -0
- package/runtime/third_party/boringssl/crypto/bio/bio.cc +715 -0
- package/runtime/third_party/boringssl/crypto/bio/bio_mem.cc +260 -0
- package/runtime/third_party/boringssl/crypto/bio/connect.cc +463 -0
- package/runtime/third_party/boringssl/crypto/bio/errno.cc +52 -0
- package/runtime/third_party/boringssl/crypto/bio/fd.cc +193 -0
- package/runtime/third_party/boringssl/crypto/bio/file.cc +283 -0
- package/runtime/third_party/boringssl/crypto/bio/hexdump.cc +154 -0
- package/runtime/third_party/boringssl/crypto/bio/internal.h +128 -0
- package/runtime/third_party/boringssl/crypto/bio/pair.cc +426 -0
- package/runtime/third_party/boringssl/crypto/bio/printf.cc +59 -0
- package/runtime/third_party/boringssl/crypto/bio/socket.cc +210 -0
- package/runtime/third_party/boringssl/crypto/bio/socket_helper.cc +179 -0
- package/runtime/third_party/boringssl/crypto/blake2/blake2.cc +173 -0
- package/runtime/third_party/boringssl/crypto/bn/bn_asn1.cc +57 -0
- package/runtime/third_party/boringssl/crypto/bn/convert.cc +409 -0
- package/runtime/third_party/boringssl/crypto/bn/div.cc +102 -0
- package/runtime/third_party/boringssl/crypto/bn/exponentiation.cc +168 -0
- package/runtime/third_party/boringssl/crypto/bn/sqrt.cc +93 -0
- package/runtime/third_party/boringssl/crypto/buf/buf.cc +119 -0
- package/runtime/third_party/boringssl/crypto/bytestring/asn1_compat.cc +54 -0
- package/runtime/third_party/boringssl/crypto/bytestring/ber.cc +268 -0
- package/runtime/third_party/boringssl/crypto/bytestring/cbb.cc +787 -0
- package/runtime/third_party/boringssl/crypto/bytestring/cbs.cc +977 -0
- package/runtime/third_party/boringssl/crypto/bytestring/internal.h +134 -0
- package/runtime/third_party/boringssl/crypto/bytestring/unicode.cc +156 -0
- package/runtime/third_party/boringssl/crypto/chacha/chacha.cc +226 -0
- package/runtime/third_party/boringssl/crypto/chacha/internal.h +103 -0
- package/runtime/third_party/boringssl/crypto/cipher/derive_key.cc +106 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_aesctrhmac.cc +294 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_aeseax.cc +351 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_aesgcmsiv.cc +918 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_chacha20poly1305.cc +404 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_des.cc +214 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_null.cc +55 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_rc2.cc +432 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_rc4.cc +56 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_tls.cc +615 -0
- package/runtime/third_party/boringssl/crypto/cipher/get_cipher.cc +85 -0
- package/runtime/third_party/boringssl/crypto/cipher/internal.h +399 -0
- package/runtime/third_party/boringssl/crypto/cipher/tls_cbc.cc +476 -0
- package/runtime/third_party/boringssl/crypto/cms/cms.cc +178 -0
- package/runtime/third_party/boringssl/crypto/conf/conf.cc +637 -0
- package/runtime/third_party/boringssl/crypto/conf/internal.h +54 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_apple.cc +76 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_fuchsia.cc +58 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_linux.cc +66 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_openbsd.cc +45 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_sysreg.cc +66 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_win.cc +52 -0
- package/runtime/third_party/boringssl/crypto/cpu_arm_freebsd.cc +55 -0
- package/runtime/third_party/boringssl/crypto/cpu_arm_linux.cc +173 -0
- package/runtime/third_party/boringssl/crypto/cpu_arm_linux.h +141 -0
- package/runtime/third_party/boringssl/crypto/cpu_intel.cc +287 -0
- package/runtime/third_party/boringssl/crypto/crypto.cc +152 -0
- package/runtime/third_party/boringssl/crypto/curve25519/asm/x25519-asm-arm.S +2124 -0
- package/runtime/third_party/boringssl/crypto/curve25519/cpace.cc +227 -0
- package/runtime/third_party/boringssl/crypto/curve25519/curve25519.cc +2436 -0
- package/runtime/third_party/boringssl/crypto/curve25519/curve25519_64_adx.cc +18 -0
- package/runtime/third_party/boringssl/crypto/curve25519/curve25519_tables.h +3264 -0
- package/runtime/third_party/boringssl/crypto/curve25519/internal.h +202 -0
- package/runtime/third_party/boringssl/crypto/curve25519/spake25519.cc +532 -0
- package/runtime/third_party/boringssl/crypto/des/des.cc +837 -0
- package/runtime/third_party/boringssl/crypto/des/internal.h +144 -0
- package/runtime/third_party/boringssl/crypto/dh/dh_asn1.cc +109 -0
- package/runtime/third_party/boringssl/crypto/dh/params.cc +411 -0
- package/runtime/third_party/boringssl/crypto/digest/digest_extra.cc +361 -0
- package/runtime/third_party/boringssl/crypto/dsa/dsa.cc +922 -0
- package/runtime/third_party/boringssl/crypto/dsa/dsa_asn1.cc +306 -0
- package/runtime/third_party/boringssl/crypto/dsa/internal.h +56 -0
- package/runtime/third_party/boringssl/crypto/ec/ec_asn1.cc +542 -0
- package/runtime/third_party/boringssl/crypto/ec/ec_derive.cc +94 -0
- package/runtime/third_party/boringssl/crypto/ec/hash_to_curve.cc +773 -0
- package/runtime/third_party/boringssl/crypto/ec/internal.h +114 -0
- package/runtime/third_party/boringssl/crypto/ecdh/ecdh.cc +75 -0
- package/runtime/third_party/boringssl/crypto/ecdsa/ecdsa_asn1.cc +337 -0
- package/runtime/third_party/boringssl/crypto/ecdsa/ecdsa_p1363.cc +54 -0
- package/runtime/third_party/boringssl/crypto/engine/engine.cc +95 -0
- package/runtime/third_party/boringssl/crypto/err/err.cc +820 -0
- package/runtime/third_party/boringssl/crypto/err/internal.h +45 -0
- package/runtime/third_party/boringssl/crypto/evp/evp.cc +454 -0
- package/runtime/third_party/boringssl/crypto/evp/evp_asn1.cc +439 -0
- package/runtime/third_party/boringssl/crypto/evp/evp_ctx.cc +541 -0
- package/runtime/third_party/boringssl/crypto/evp/evp_kem.cc +101 -0
- package/runtime/third_party/boringssl/crypto/evp/internal.h +427 -0
- package/runtime/third_party/boringssl/crypto/evp/p_dh.cc +326 -0
- package/runtime/third_party/boringssl/crypto/evp/p_dsa.cc +333 -0
- package/runtime/third_party/boringssl/crypto/evp/p_ec.cc +736 -0
- package/runtime/third_party/boringssl/crypto/evp/p_ed25519.cc +359 -0
- package/runtime/third_party/boringssl/crypto/evp/p_hkdf.cc +204 -0
- package/runtime/third_party/boringssl/crypto/evp/p_mldsa.cc +549 -0
- package/runtime/third_party/boringssl/crypto/evp/p_mlkem.cc +510 -0
- package/runtime/third_party/boringssl/crypto/evp/p_rsa.cc +1185 -0
- package/runtime/third_party/boringssl/crypto/evp/p_x25519.cc +371 -0
- package/runtime/third_party/boringssl/crypto/evp/p_xwing.cc +300 -0
- package/runtime/third_party/boringssl/crypto/evp/pbkdf.cc +105 -0
- package/runtime/third_party/boringssl/crypto/evp/print.cc +287 -0
- package/runtime/third_party/boringssl/crypto/evp/scrypt.cc +218 -0
- package/runtime/third_party/boringssl/crypto/evp/sign.cc +95 -0
- package/runtime/third_party/boringssl/crypto/ex_data.cc +140 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/aes.cc.inc +208 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/aes_nohw.cc.inc +1279 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/cbc.cc.inc +132 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/cfb.cc.inc +168 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/ctr.cc.inc +102 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/gcm.cc.inc +614 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/gcm_nohw.cc.inc +304 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/internal.h +590 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/key_wrap.cc.inc +211 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.cc.inc +97 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/ofb.cc.inc +55 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bcm.cc +288 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bcm_interface.h +953 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/add.cc.inc +276 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +573 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/bn.cc.inc +377 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/bytes.cc.inc +230 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/cmp.cc.inc +161 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/ctx.cc.inc +127 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/div.cc.inc +738 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/div_extra.cc.inc +90 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.cc.inc +743 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/gcd.cc.inc +281 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/gcd_extra.cc.inc +327 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/generic.cc.inc +579 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/internal.h +810 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/jacobi.cc.inc +101 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/montgomery.cc.inc +408 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.cc.inc +179 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/mul.cc.inc +347 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/prime.cc.inc +931 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/random.cc.inc +261 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.cc.inc +144 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +109 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/shift.cc.inc +317 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/sqrt.cc.inc +370 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/aead.cc.inc +619 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/cipher.cc.inc +837 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.cc.inc +1240 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/e_aesccm.cc.inc +440 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/internal.h +461 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cmac/cmac.cc.inc +293 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/delocate.h +95 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/dh/check.cc.inc +198 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/dh/dh.cc.inc +401 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/dh/internal.h +63 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digest/digest.cc.inc +221 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digest/digests.cc.inc +184 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digest/internal.h +72 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digest/md32_common.h +166 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digestsign/digestsign.cc.inc +230 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/builtin_curves.h +277 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec.cc.inc +1024 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec_key.cc.inc +536 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.cc.inc +379 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/felem.cc.inc +250 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/internal.h +752 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/oct.cc.inc +174 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz-table.h +9502 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz.cc.inc +740 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz.h +207 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256.cc.inc +578 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256_table.h +297 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/scalar.cc.inc +184 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/simple.cc.inc +246 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/simple_mul.cc.inc +274 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/util.cc.inc +258 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/wnaf.cc.inc +224 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ecdh/ecdh.cc.inc +91 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +288 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ecdsa/internal.h +57 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/internal.h +38 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/jitter.cc.inc +487 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/sha512.cc.inc +329 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/fips_shared_support.cc +28 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/hkdf/hkdf.cc.inc +114 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/hmac/hmac.cc.inc +218 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/keccak/internal.h +165 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/keccak/keccak.cc.inc +647 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/mldsa/fips_known_values.inc +1345 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/mldsa/mldsa.cc.inc +3323 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/mlkem/fips_known_values.inc +411 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/mlkem/mlkem.cc.inc +1856 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rand/android_entropy_client.cc.inc +82 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.cc.inc +401 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rand/internal.h +99 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rand/rand.cc.inc +486 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +167 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/padding.cc.inc +371 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/rsa.cc.inc +996 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.cc.inc +1000 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/self_check/fips.cc.inc +129 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/self_check/self_check.cc.inc +1093 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/service_indicator/internal.h +112 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/service_indicator/service_indicator.cc.inc +330 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/sha/internal.h +205 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha1.cc.inc +404 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha256.cc.inc +315 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha512.cc.inc +473 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/address.h +144 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fips_known_values.inc +674 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fors.cc.inc +179 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fors.h +48 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/merkle.cc.inc +164 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/merkle.h +58 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/params.h +178 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/slhdsa.cc.inc +690 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/thash.cc.inc +326 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/thash.h +71 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/wots.cc.inc +172 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/wots.h +40 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/tls/internal.h +33 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/tls/kdf.cc.inc +180 -0
- package/runtime/third_party/boringssl/crypto/fuzzer_mode.cc +30 -0
- package/runtime/third_party/boringssl/crypto/hpke/hpke.cc +1514 -0
- package/runtime/third_party/boringssl/crypto/hrss/asm/poly_rq_mul.S +8489 -0
- package/runtime/third_party/boringssl/crypto/hrss/hrss.cc +2189 -0
- package/runtime/third_party/boringssl/crypto/hrss/internal.h +64 -0
- package/runtime/third_party/boringssl/crypto/internal.h +1767 -0
- package/runtime/third_party/boringssl/crypto/lhash/internal.h +222 -0
- package/runtime/third_party/boringssl/crypto/lhash/lhash.cc +312 -0
- package/runtime/third_party/boringssl/crypto/md4/md4.cc +207 -0
- package/runtime/third_party/boringssl/crypto/md5/internal.h +34 -0
- package/runtime/third_party/boringssl/crypto/md5/md5.cc +255 -0
- package/runtime/third_party/boringssl/crypto/mem.cc +577 -0
- package/runtime/third_party/boringssl/crypto/mem_internal.h +706 -0
- package/runtime/third_party/boringssl/crypto/mldsa/mldsa.cc +296 -0
- package/runtime/third_party/boringssl/crypto/mlkem/mlkem.cc +108 -0
- package/runtime/third_party/boringssl/crypto/obj/obj.cc +494 -0
- package/runtime/third_party/boringssl/crypto/obj/obj_dat.h +11722 -0
- package/runtime/third_party/boringssl/crypto/obj/obj_xref.cc +83 -0
- package/runtime/third_party/boringssl/crypto/params_internal.h +30 -0
- package/runtime/third_party/boringssl/crypto/pem/internal.h +135 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_all.cc +153 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_info.cc +250 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_lib.cc +707 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_oth.cc +45 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_pk8.cc +211 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_pkey.cc +147 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_x509.cc +25 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_xaux.cc +25 -0
- package/runtime/third_party/boringssl/crypto/pkcs7/internal.h +67 -0
- package/runtime/third_party/boringssl/crypto/pkcs7/pkcs7.cc +198 -0
- package/runtime/third_party/boringssl/crypto/pkcs7/pkcs7_x509.cc +527 -0
- package/runtime/third_party/boringssl/crypto/pkcs8/internal.h +98 -0
- package/runtime/third_party/boringssl/crypto/pkcs8/p5_pbev2.cc +286 -0
- package/runtime/third_party/boringssl/crypto/pkcs8/pkcs8.cc +473 -0
- package/runtime/third_party/boringssl/crypto/pkcs8/pkcs8_x509.cc +1328 -0
- package/runtime/third_party/boringssl/crypto/poly1305/internal.h +54 -0
- package/runtime/third_party/boringssl/crypto/poly1305/poly1305.cc +315 -0
- package/runtime/third_party/boringssl/crypto/poly1305/poly1305_arm.cc +294 -0
- package/runtime/third_party/boringssl/crypto/poly1305/poly1305_arm_asm.S +2017 -0
- package/runtime/third_party/boringssl/crypto/poly1305/poly1305_vec.cc +853 -0
- package/runtime/third_party/boringssl/crypto/pool/internal.h +95 -0
- package/runtime/third_party/boringssl/crypto/pool/pool.cc +282 -0
- package/runtime/third_party/boringssl/crypto/rand/deterministic.cc +58 -0
- package/runtime/third_party/boringssl/crypto/rand/fork_detect.cc +222 -0
- package/runtime/third_party/boringssl/crypto/rand/forkunsafe.cc +44 -0
- package/runtime/third_party/boringssl/crypto/rand/getentropy.cc +53 -0
- package/runtime/third_party/boringssl/crypto/rand/internal.h +67 -0
- package/runtime/third_party/boringssl/crypto/rand/ios.cc +35 -0
- package/runtime/third_party/boringssl/crypto/rand/rand.cc +79 -0
- package/runtime/third_party/boringssl/crypto/rand/trusty.cc +39 -0
- package/runtime/third_party/boringssl/crypto/rand/urandom.cc +149 -0
- package/runtime/third_party/boringssl/crypto/rand/windows.cc +91 -0
- package/runtime/third_party/boringssl/crypto/rc4/rc4.cc +56 -0
- package/runtime/third_party/boringssl/crypto/refcount.cc +49 -0
- package/runtime/third_party/boringssl/crypto/rsa/internal.h +51 -0
- package/runtime/third_party/boringssl/crypto/rsa/rsa_asn1.cc +404 -0
- package/runtime/third_party/boringssl/crypto/rsa/rsa_crypt.cc +530 -0
- package/runtime/third_party/boringssl/crypto/rsa/rsa_extra.cc +30 -0
- package/runtime/third_party/boringssl/crypto/rsa/rsa_print.cc +25 -0
- package/runtime/third_party/boringssl/crypto/sha/sha1.cc +55 -0
- package/runtime/third_party/boringssl/crypto/sha/sha256.cc +89 -0
- package/runtime/third_party/boringssl/crypto/sha/sha512.cc +106 -0
- package/runtime/third_party/boringssl/crypto/siphash/siphash.cc +81 -0
- package/runtime/third_party/boringssl/crypto/slhdsa/slhdsa.cc +167 -0
- package/runtime/third_party/boringssl/crypto/spake2plus/internal.h +204 -0
- package/runtime/third_party/boringssl/crypto/spake2plus/spake2plus.cc +501 -0
- package/runtime/third_party/boringssl/crypto/stack/stack.cc +462 -0
- package/runtime/third_party/boringssl/crypto/thread.cc +68 -0
- package/runtime/third_party/boringssl/crypto/thread_none.cc +48 -0
- package/runtime/third_party/boringssl/crypto/thread_pthread.cc +138 -0
- package/runtime/third_party/boringssl/crypto/thread_win.cc +227 -0
- package/runtime/third_party/boringssl/crypto/trust_token/internal.h +405 -0
- package/runtime/third_party/boringssl/crypto/trust_token/pmbtoken.cc +1672 -0
- package/runtime/third_party/boringssl/crypto/trust_token/trust_token.cc +701 -0
- package/runtime/third_party/boringssl/crypto/trust_token/voprf.cc +1266 -0
- package/runtime/third_party/boringssl/crypto/x509/a_digest.cc +52 -0
- package/runtime/third_party/boringssl/crypto/x509/a_sign.cc +100 -0
- package/runtime/third_party/boringssl/crypto/x509/a_verify.cc +77 -0
- package/runtime/third_party/boringssl/crypto/x509/algorithm.cc +167 -0
- package/runtime/third_party/boringssl/crypto/x509/asn1_gen.cc +540 -0
- package/runtime/third_party/boringssl/crypto/x509/by_dir.cc +301 -0
- package/runtime/third_party/boringssl/crypto/x509/by_file.cc +226 -0
- package/runtime/third_party/boringssl/crypto/x509/i2d_pr.cc +37 -0
- package/runtime/third_party/boringssl/crypto/x509/internal.h +697 -0
- package/runtime/third_party/boringssl/crypto/x509/name_print.cc +187 -0
- package/runtime/third_party/boringssl/crypto/x509/policy.cc +686 -0
- package/runtime/third_party/boringssl/crypto/x509/rsa_pss.cc +187 -0
- package/runtime/third_party/boringssl/crypto/x509/t_crl.cc +106 -0
- package/runtime/third_party/boringssl/crypto/x509/t_req.cc +206 -0
- package/runtime/third_party/boringssl/crypto/x509/t_x509.cc +292 -0
- package/runtime/third_party/boringssl/crypto/x509/t_x509a.cc +81 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_akey.cc +174 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_akeya.cc +31 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_alt.cc +636 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_bcons.cc +96 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_bitst.cc +100 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_conf.cc +369 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_cpols.cc +417 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_crld.cc +471 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_enum.cc +74 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_extku.cc +97 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_genn.cc +238 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_ia5.cc +83 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_info.cc +162 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_int.cc +83 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_lib.cc +349 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_ncons.cc +798 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_ocsp.cc +92 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_pcons.cc +102 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_pmaps.cc +110 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_prn.cc +183 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_purp.cc +580 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_skey.cc +128 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_utl.cc +1311 -0
- package/runtime/third_party/boringssl/crypto/x509/x509.cc +47 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_att.cc +188 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_cmp.cc +243 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_d2.cc +66 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_def.cc +42 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_ext.cc +161 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_lu.cc +570 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_mtc.cc +598 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_obj.cc +169 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_req.cc +248 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_set.cc +166 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_trs.cc +123 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_txt.cc +147 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_v3.cc +249 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_vfy.cc +1531 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_vpm.cc +449 -0
- package/runtime/third_party/boringssl/crypto/x509/x509cset.cc +222 -0
- package/runtime/third_party/boringssl/crypto/x509/x509name.cc +377 -0
- package/runtime/third_party/boringssl/crypto/x509/x509rset.cc +55 -0
- package/runtime/third_party/boringssl/crypto/x509/x509spki.cc +91 -0
- package/runtime/third_party/boringssl/crypto/x509/x_algor.cc +223 -0
- package/runtime/third_party/boringssl/crypto/x509/x_all.cc +352 -0
- package/runtime/third_party/boringssl/crypto/x509/x_attrib.cc +61 -0
- package/runtime/third_party/boringssl/crypto/x509/x_crl.cc +325 -0
- package/runtime/third_party/boringssl/crypto/x509/x_exten.cc +42 -0
- package/runtime/third_party/boringssl/crypto/x509/x_name.cc +407 -0
- package/runtime/third_party/boringssl/crypto/x509/x_pubkey.cc +199 -0
- package/runtime/third_party/boringssl/crypto/x509/x_req.cc +80 -0
- package/runtime/third_party/boringssl/crypto/x509/x_sig.cc +51 -0
- package/runtime/third_party/boringssl/crypto/x509/x_spki.cc +44 -0
- package/runtime/third_party/boringssl/crypto/x509/x_x509.cc +495 -0
- package/runtime/third_party/boringssl/crypto/x509/x_x509a.cc +169 -0
- package/runtime/third_party/boringssl/crypto/xwing/xwing.cc +257 -0
- package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx2-x86_64-apple.S +1326 -0
- package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx2-x86_64-linux.S +1327 -0
- package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx512-x86_64-apple.S +1252 -0
- package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx512-x86_64-linux.S +1253 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-gcm-x86_64-apple.S +873 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-gcm-x86_64-linux.S +885 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-x86-apple.S +2490 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-x86-linux.S +2530 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-x86_64-apple.S +2413 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-x86_64-linux.S +2397 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-armv7-linux.S +784 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-apple.S +792 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-linux.S +786 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-win.S +798 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-apple.S +2912 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-linux.S +2907 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-win.S +2915 -0
- package/runtime/third_party/boringssl/gen/bcm/armv4-mont-linux.S +932 -0
- package/runtime/third_party/boringssl/gen/bcm/armv8-mont-apple.S +1440 -0
- package/runtime/third_party/boringssl/gen/bcm/armv8-mont-linux.S +1440 -0
- package/runtime/third_party/boringssl/gen/bcm/armv8-mont-win.S +1446 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-586-apple.S +530 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-586-linux.S +540 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-armv8-apple.S +88 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-armv8-linux.S +87 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-armv8-win.S +87 -0
- package/runtime/third_party/boringssl/gen/bcm/bsaes-armv7-linux.S +1520 -0
- package/runtime/third_party/boringssl/gen/bcm/co-586-apple.S +1256 -0
- package/runtime/third_party/boringssl/gen/bcm/co-586-linux.S +1264 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-armv4-linux.S +242 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-apple.S +337 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-linux.S +335 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-win.S +341 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86-apple.S +288 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86-linux.S +292 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86_64-apple.S +426 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86_64-linux.S +425 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-x86-apple.S +322 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-x86-linux.S +328 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-x86_64-apple.S +1134 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-x86_64-linux.S +1129 -0
- package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv7-linux.S +244 -0
- package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-apple.S +567 -0
- package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-linux.S +563 -0
- package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-win.S +571 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-apple.S +1744 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-linux.S +1725 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-win.S +1765 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-x86_64-asm-apple.S +4544 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-x86_64-asm-linux.S +4600 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-apple.S +310 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-linux.S +310 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-win.S +310 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-x86_64-asm-apple.S +321 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-x86_64-asm-linux.S +335 -0
- package/runtime/third_party/boringssl/gen/bcm/rdrand-x86_64-apple.S +58 -0
- package/runtime/third_party/boringssl/gen/bcm/rdrand-x86_64-linux.S +57 -0
- package/runtime/third_party/boringssl/gen/bcm/rsaz-avx2-apple.S +1756 -0
- package/runtime/third_party/boringssl/gen/bcm/rsaz-avx2-linux.S +1751 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-586-apple.S +3782 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-586-linux.S +3788 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-armv4-large-linux.S +1479 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-apple.S +1219 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-linux.S +1218 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-win.S +1222 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-x86_64-apple.S +5454 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-x86_64-linux.S +5450 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-586-apple.S +5593 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-586-linux.S +5599 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-armv4-linux.S +2840 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-apple.S +1195 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-linux.S +1194 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-win.S +1198 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-x86_64-apple.S +4173 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-x86_64-linux.S +4170 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-586-apple.S +2406 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-586-linux.S +2410 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-armv4-linux.S +1857 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-apple.S +1598 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-linux.S +1597 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-win.S +1601 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-x86_64-apple.S +2979 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-x86_64-linux.S +2978 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-armv7-linux.S +1225 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-apple.S +1238 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-linux.S +1220 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-win.S +1256 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-x86-apple.S +680 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-x86-linux.S +706 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-x86_64-apple.S +1146 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-x86_64-linux.S +1133 -0
- package/runtime/third_party/boringssl/gen/bcm/x86-mont-apple.S +216 -0
- package/runtime/third_party/boringssl/gen/bcm/x86-mont-linux.S +218 -0
- package/runtime/third_party/boringssl/gen/bcm/x86_64-mont-apple.S +1238 -0
- package/runtime/third_party/boringssl/gen/bcm/x86_64-mont-linux.S +1237 -0
- package/runtime/third_party/boringssl/gen/bcm/x86_64-mont5-apple.S +3644 -0
- package/runtime/third_party/boringssl/gen/bcm/x86_64-mont5-linux.S +3628 -0
- package/runtime/third_party/boringssl/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +325 -0
- package/runtime/third_party/boringssl/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +325 -0
- package/runtime/third_party/boringssl/gen/crypto/aes128gcmsiv-x86_64-apple.S +3113 -0
- package/runtime/third_party/boringssl/gen/crypto/aes128gcmsiv-x86_64-linux.S +3091 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-armv4-linux.S +1450 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-apple.S +1969 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-linux.S +1967 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-win.S +1973 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-x86-apple.S +957 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-x86-linux.S +961 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-x86_64-apple.S +1608 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-x86_64-linux.S +1611 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-apple.S +3010 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-linux.S +3008 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-win.S +3014 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_x86_64-apple.S +8903 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_x86_64-linux.S +8940 -0
- package/runtime/third_party/boringssl/gen/crypto/err_data.cc +1578 -0
- package/runtime/third_party/boringssl/gen/crypto/md5-586-apple.S +684 -0
- package/runtime/third_party/boringssl/gen/crypto/md5-586-linux.S +686 -0
- package/runtime/third_party/boringssl/gen/crypto/md5-x86_64-apple.S +690 -0
- package/runtime/third_party/boringssl/gen/crypto/md5-x86_64-linux.S +695 -0
- package/runtime/third_party/boringssl/include/openssl/aead.h +650 -0
- package/runtime/third_party/boringssl/include/openssl/aes.h +173 -0
- package/runtime/third_party/boringssl/include/openssl/arm_arch.h +24 -0
- package/runtime/third_party/boringssl/include/openssl/asm_base.h +219 -0
- package/runtime/third_party/boringssl/include/openssl/asn1.h +2002 -0
- package/runtime/third_party/boringssl/include/openssl/asn1_mac.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/asn1t.h +584 -0
- package/runtime/third_party/boringssl/include/openssl/base.h +548 -0
- package/runtime/third_party/boringssl/include/openssl/base64.h +156 -0
- package/runtime/third_party/boringssl/include/openssl/bio.h +1061 -0
- package/runtime/third_party/boringssl/include/openssl/blake2.h +63 -0
- package/runtime/third_party/boringssl/include/openssl/blowfish.h +58 -0
- package/runtime/third_party/boringssl/include/openssl/bn.h +986 -0
- package/runtime/third_party/boringssl/include/openssl/buf.h +95 -0
- package/runtime/third_party/boringssl/include/openssl/buffer.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/bytestring.h +798 -0
- package/runtime/third_party/boringssl/include/openssl/cast.h +91 -0
- package/runtime/third_party/boringssl/include/openssl/chacha.h +47 -0
- package/runtime/third_party/boringssl/include/openssl/cipher.h +819 -0
- package/runtime/third_party/boringssl/include/openssl/cmac.h +91 -0
- package/runtime/third_party/boringssl/include/openssl/cms.h +147 -0
- package/runtime/third_party/boringssl/include/openssl/conf.h +136 -0
- package/runtime/third_party/boringssl/include/openssl/configuration.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/cpu.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/crypto.h +235 -0
- package/runtime/third_party/boringssl/include/openssl/ctrdrbg.h +116 -0
- package/runtime/third_party/boringssl/include/openssl/curve25519.h +309 -0
- package/runtime/third_party/boringssl/include/openssl/des.h +134 -0
- package/runtime/third_party/boringssl/include/openssl/dh.h +336 -0
- package/runtime/third_party/boringssl/include/openssl/digest.h +399 -0
- package/runtime/third_party/boringssl/include/openssl/dsa.h +392 -0
- package/runtime/third_party/boringssl/include/openssl/dtls1.h +16 -0
- package/runtime/third_party/boringssl/include/openssl/e_os2.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/ec.h +530 -0
- package/runtime/third_party/boringssl/include/openssl/ec_key.h +358 -0
- package/runtime/third_party/boringssl/include/openssl/ecdh.h +67 -0
- package/runtime/third_party/boringssl/include/openssl/ecdsa.h +242 -0
- package/runtime/third_party/boringssl/include/openssl/engine.h +109 -0
- package/runtime/third_party/boringssl/include/openssl/err.h +416 -0
- package/runtime/third_party/boringssl/include/openssl/evp.h +1645 -0
- package/runtime/third_party/boringssl/include/openssl/evp_errors.h +66 -0
- package/runtime/third_party/boringssl/include/openssl/ex_data.h +117 -0
- package/runtime/third_party/boringssl/include/openssl/hkdf.h +68 -0
- package/runtime/third_party/boringssl/include/openssl/hmac.h +151 -0
- package/runtime/third_party/boringssl/include/openssl/hpke.h +456 -0
- package/runtime/third_party/boringssl/include/openssl/hrss.h +108 -0
- package/runtime/third_party/boringssl/include/openssl/is_boringssl.h +16 -0
- package/runtime/third_party/boringssl/include/openssl/kdf.h +92 -0
- package/runtime/third_party/boringssl/include/openssl/lhash.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/md4.h +73 -0
- package/runtime/third_party/boringssl/include/openssl/md5.h +67 -0
- package/runtime/third_party/boringssl/include/openssl/mem.h +215 -0
- package/runtime/third_party/boringssl/include/openssl/mldsa.h +486 -0
- package/runtime/third_party/boringssl/include/openssl/mlkem.h +222 -0
- package/runtime/third_party/boringssl/include/openssl/nid.h +5561 -0
- package/runtime/third_party/boringssl/include/openssl/obj.h +225 -0
- package/runtime/third_party/boringssl/include/openssl/obj_mac.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/objects.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/opensslconf.h +108 -0
- package/runtime/third_party/boringssl/include/openssl/opensslv.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/ossl_typ.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/params.h +42 -0
- package/runtime/third_party/boringssl/include/openssl/pem.h +769 -0
- package/runtime/third_party/boringssl/include/openssl/pkcs12.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/pkcs7.h +239 -0
- package/runtime/third_party/boringssl/include/openssl/pkcs8.h +267 -0
- package/runtime/third_party/boringssl/include/openssl/poly1305.h +52 -0
- package/runtime/third_party/boringssl/include/openssl/pool.h +137 -0
- package/runtime/third_party/boringssl/include/openssl/posix_time.h +51 -0
- package/runtime/third_party/boringssl/include/openssl/prefix_symbols.h +8000 -0
- package/runtime/third_party/boringssl/include/openssl/prefix_symbols_internal_S.h +633 -0
- package/runtime/third_party/boringssl/include/openssl/prefix_symbols_internal_c.h +329 -0
- package/runtime/third_party/boringssl/include/openssl/rand.h +138 -0
- package/runtime/third_party/boringssl/include/openssl/rc4.h +54 -0
- package/runtime/third_party/boringssl/include/openssl/ripemd.h +71 -0
- package/runtime/third_party/boringssl/include/openssl/rsa.h +893 -0
- package/runtime/third_party/boringssl/include/openssl/safestack.h +16 -0
- package/runtime/third_party/boringssl/include/openssl/service_indicator.h +19 -0
- package/runtime/third_party/boringssl/include/openssl/sha.h +108 -0
- package/runtime/third_party/boringssl/include/openssl/sha2.h +201 -0
- package/runtime/third_party/boringssl/include/openssl/siphash.h +37 -0
- package/runtime/third_party/boringssl/include/openssl/slhdsa.h +250 -0
- package/runtime/third_party/boringssl/include/openssl/span.h +376 -0
- package/runtime/third_party/boringssl/include/openssl/srtp.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/ssl.h +7211 -0
- package/runtime/third_party/boringssl/include/openssl/ssl3.h +171 -0
- package/runtime/third_party/boringssl/include/openssl/stack.h +688 -0
- package/runtime/third_party/boringssl/include/openssl/target.h +246 -0
- package/runtime/third_party/boringssl/include/openssl/thread.h +114 -0
- package/runtime/third_party/boringssl/include/openssl/time.h +22 -0
- package/runtime/third_party/boringssl/include/openssl/tls1.h +263 -0
- package/runtime/third_party/boringssl/include/openssl/tls_prf.h +47 -0
- package/runtime/third_party/boringssl/include/openssl/trust_token.h +349 -0
- package/runtime/third_party/boringssl/include/openssl/type_check.h +37 -0
- package/runtime/third_party/boringssl/include/openssl/types.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/x509.h +5404 -0
- package/runtime/third_party/boringssl/include/openssl/x509_vfy.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/x509v3.h +63 -0
- package/runtime/third_party/boringssl/include/openssl/x509v3_errors.h +84 -0
- package/runtime/third_party/boringssl/include/openssl/xwing.h +115 -0
- package/runtime/third_party/boringssl/sources.json +696 -0
- package/runtime/third_party/boringssl/ssl/bio_ssl.cc +196 -0
- package/runtime/third_party/boringssl/ssl/d1_both.cc +1137 -0
- package/runtime/third_party/boringssl/ssl/d1_lib.cc +245 -0
- package/runtime/third_party/boringssl/ssl/d1_pkt.cc +322 -0
- package/runtime/third_party/boringssl/ssl/d1_srtp.cc +128 -0
- package/runtime/third_party/boringssl/ssl/dtls_method.cc +216 -0
- package/runtime/third_party/boringssl/ssl/dtls_record.cc +586 -0
- package/runtime/third_party/boringssl/ssl/encrypted_client_hello.cc +1110 -0
- package/runtime/third_party/boringssl/ssl/extensions.cc +5368 -0
- package/runtime/third_party/boringssl/ssl/handoff.cc +625 -0
- package/runtime/third_party/boringssl/ssl/handshake.cc +694 -0
- package/runtime/third_party/boringssl/ssl/handshake_client.cc +1958 -0
- package/runtime/third_party/boringssl/ssl/handshake_server.cc +1875 -0
- package/runtime/third_party/boringssl/ssl/internal.h +4506 -0
- package/runtime/third_party/boringssl/ssl/s3_both.cc +555 -0
- package/runtime/third_party/boringssl/ssl/s3_lib.cc +88 -0
- package/runtime/third_party/boringssl/ssl/s3_pkt.cc +396 -0
- package/runtime/third_party/boringssl/ssl/ssl_aead_ctx.cc +416 -0
- package/runtime/third_party/boringssl/ssl/ssl_asn1.cc +851 -0
- package/runtime/third_party/boringssl/ssl/ssl_buffer.cc +304 -0
- package/runtime/third_party/boringssl/ssl/ssl_cert.cc +723 -0
- package/runtime/third_party/boringssl/ssl/ssl_cipher.cc +1762 -0
- package/runtime/third_party/boringssl/ssl/ssl_credential.cc +913 -0
- package/runtime/third_party/boringssl/ssl/ssl_file.cc +375 -0
- package/runtime/third_party/boringssl/ssl/ssl_key_share.cc +445 -0
- package/runtime/third_party/boringssl/ssl/ssl_lib.cc +4132 -0
- package/runtime/third_party/boringssl/ssl/ssl_privkey.cc +973 -0
- package/runtime/third_party/boringssl/ssl/ssl_session.cc +1273 -0
- package/runtime/third_party/boringssl/ssl/ssl_stat.cc +162 -0
- package/runtime/third_party/boringssl/ssl/ssl_transcript.cc +224 -0
- package/runtime/third_party/boringssl/ssl/ssl_versions.cc +436 -0
- package/runtime/third_party/boringssl/ssl/ssl_x509.cc +1229 -0
- package/runtime/third_party/boringssl/ssl/t1_enc.cc +266 -0
- package/runtime/third_party/boringssl/ssl/tls13_both.cc +764 -0
- package/runtime/third_party/boringssl/ssl/tls13_client.cc +1325 -0
- package/runtime/third_party/boringssl/ssl/tls13_enc.cc +746 -0
- package/runtime/third_party/boringssl/ssl/tls13_server.cc +1623 -0
- package/runtime/third_party/boringssl/ssl/tls_method.cc +266 -0
- package/runtime/third_party/boringssl/ssl/tls_record.cc +524 -0
- package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_curve25519_adx_mul.S +178 -0
- package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_curve25519_adx_square.S +146 -0
- package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_p256_adx_mul.S +177 -0
- package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_p256_adx_sqr.S +166 -0
- package/runtime/third_party/boringssl/third_party/fiat/bedrock_unverified_bareminimum.c.inc +47 -0
- package/runtime/third_party/boringssl/third_party/fiat/bedrock_unverified_platform.c.inc +137 -0
- package/runtime/third_party/boringssl/third_party/fiat/curve25519_32.h +1571 -0
- package/runtime/third_party/boringssl/third_party/fiat/curve25519_64.h +978 -0
- package/runtime/third_party/boringssl/third_party/fiat/curve25519_64_adx.h +700 -0
- package/runtime/third_party/boringssl/third_party/fiat/curve25519_64_msvc.h +1281 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_32.h +4760 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_64.h +1984 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_64_msvc.h +1939 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_field.c.inc +26 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_field_32.br.c.inc +71 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_field_64.br.c.inc +84 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_point.br.c.inc +112 -0
- package/runtime/third_party/quickjs-dtoa/LICENSE +0 -0
- package/runtime/third_party/quickjs-dtoa/README.md +0 -0
- package/runtime/third_party/quickjs-dtoa/dtoa.c +0 -0
- package/runtime/third_party/quickjs-dtoa/dtoa.h +0 -0
- package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +0 -0
- package/runtime/third_party/quickjs-regexp/LICENSE +0 -0
- package/runtime/third_party/quickjs-regexp/README.md +0 -0
- package/runtime/third_party/quickjs-regexp/cutils.c +0 -0
- package/runtime/third_party/quickjs-regexp/cutils.h +0 -0
- package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +0 -0
- package/runtime/third_party/quickjs-regexp/libregexp.c +0 -0
- package/runtime/third_party/quickjs-regexp/libregexp.h +0 -0
- package/runtime/third_party/quickjs-regexp/libunicode-table.h +0 -0
- package/runtime/third_party/quickjs-regexp/libunicode.c +0 -0
- package/runtime/third_party/quickjs-regexp/libunicode.h +0 -0
- package/runtime/third_party/v8-ieee754/LICENSE +0 -0
- package/runtime/third_party/v8-ieee754/README.md +2 -1
- package/runtime/third_party/v8-ieee754/convert.py +4 -0
- package/runtime/third_party/v8-ieee754/ieee754.c +1 -1
- package/runtime/third_party/v8-ieee754/ieee754.h +0 -0
- package/runtime/tools/regexp_compile.c +0 -0
- package/runtime/third_party/bearssl/LICENSE.txt +0 -21
- package/runtime/third_party/bearssl/README.txt +0 -136
- package/runtime/third_party/bearssl/VERSION +0 -1
- package/runtime/third_party/bearssl/inc/bearssl.h +0 -183
- package/runtime/third_party/bearssl/inc/bearssl_aead.h +0 -1059
- package/runtime/third_party/bearssl/inc/bearssl_block.h +0 -2618
- package/runtime/third_party/bearssl/inc/bearssl_ec.h +0 -967
- package/runtime/third_party/bearssl/inc/bearssl_hash.h +0 -1346
- package/runtime/third_party/bearssl/inc/bearssl_hmac.h +0 -241
- package/runtime/third_party/bearssl/inc/bearssl_kdf.h +0 -284
- package/runtime/third_party/bearssl/inc/bearssl_pem.h +0 -294
- package/runtime/third_party/bearssl/inc/bearssl_prf.h +0 -150
- package/runtime/third_party/bearssl/inc/bearssl_rand.h +0 -397
- package/runtime/third_party/bearssl/inc/bearssl_rsa.h +0 -1655
- package/runtime/third_party/bearssl/inc/bearssl_ssl.h +0 -4296
- package/runtime/third_party/bearssl/inc/bearssl_x509.h +0 -1474
- package/runtime/third_party/bearssl/src/aead/ccm.c +0 -346
- package/runtime/third_party/bearssl/src/aead/eax.c +0 -525
- package/runtime/third_party/bearssl/src/aead/gcm.c +0 -318
- package/runtime/third_party/bearssl/src/codec/ccopy.c +0 -44
- package/runtime/third_party/bearssl/src/codec/dec16be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec16le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec32be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec32le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec64be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec64le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc16be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc16le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc32be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc32le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc64be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc64le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/pemdec.c +0 -526
- package/runtime/third_party/bearssl/src/codec/pemdec.t0 +0 -314
- package/runtime/third_party/bearssl/src/codec/pemenc.c +0 -173
- package/runtime/third_party/bearssl/src/config.h +0 -247
- package/runtime/third_party/bearssl/src/ec/ec_all_m15.c +0 -121
- package/runtime/third_party/bearssl/src/ec/ec_all_m31.c +0 -171
- package/runtime/third_party/bearssl/src/ec/ec_c25519_i15.c +0 -398
- package/runtime/third_party/bearssl/src/ec/ec_c25519_i31.c +0 -390
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m15.c +0 -1478
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m31.c +0 -800
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m62.c +0 -605
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m64.c +0 -831
- package/runtime/third_party/bearssl/src/ec/ec_curve25519.c +0 -46
- package/runtime/third_party/bearssl/src/ec/ec_default.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ec_keygen.c +0 -86
- package/runtime/third_party/bearssl/src/ec/ec_p256_m15.c +0 -2124
- package/runtime/third_party/bearssl/src/ec/ec_p256_m31.c +0 -1469
- package/runtime/third_party/bearssl/src/ec/ec_p256_m62.c +0 -1765
- package/runtime/third_party/bearssl/src/ec/ec_p256_m64.c +0 -1781
- package/runtime/third_party/bearssl/src/ec/ec_prime_i15.c +0 -824
- package/runtime/third_party/bearssl/src/ec/ec_prime_i31.c +0 -826
- package/runtime/third_party/bearssl/src/ec/ec_pubkey.c +0 -85
- package/runtime/third_party/bearssl/src/ec/ec_secp256r1.c +0 -51
- package/runtime/third_party/bearssl/src/ec/ec_secp384r1.c +0 -57
- package/runtime/third_party/bearssl/src/ec/ec_secp521r1.c +0 -64
- package/runtime/third_party/bearssl/src/ec/ecdsa_atr.c +0 -134
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_asn1.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_raw.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_asn1.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_raw.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_bits.c +0 -47
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_asn1.c +0 -45
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_raw.c +0 -174
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_asn1.c +0 -48
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_raw.c +0 -166
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_bits.c +0 -47
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_asn1.c +0 -45
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_raw.c +0 -173
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_asn1.c +0 -48
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_raw.c +0 -165
- package/runtime/third_party/bearssl/src/ec/ecdsa_rta.c +0 -121
- package/runtime/third_party/bearssl/src/hash/dig_oid.c +0 -84
- package/runtime/third_party/bearssl/src/hash/dig_size.c +0 -50
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul.c +0 -345
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul32.c +0 -251
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul64.c +0 -154
- package/runtime/third_party/bearssl/src/hash/ghash_pclmul.c +0 -389
- package/runtime/third_party/bearssl/src/hash/ghash_pwr8.c +0 -411
- package/runtime/third_party/bearssl/src/hash/md5.c +0 -208
- package/runtime/third_party/bearssl/src/hash/md5sha1.c +0 -141
- package/runtime/third_party/bearssl/src/hash/mgf1.c +0 -56
- package/runtime/third_party/bearssl/src/hash/multihash.c +0 -166
- package/runtime/third_party/bearssl/src/hash/sha1.c +0 -191
- package/runtime/third_party/bearssl/src/hash/sha2big.c +0 -285
- package/runtime/third_party/bearssl/src/hash/sha2small.c +0 -341
- package/runtime/third_party/bearssl/src/inner.h +0 -2577
- package/runtime/third_party/bearssl/src/int/i15_add.c +0 -46
- package/runtime/third_party/bearssl/src/int/i15_bitlen.c +0 -44
- package/runtime/third_party/bearssl/src/int/i15_decmod.c +0 -124
- package/runtime/third_party/bearssl/src/int/i15_decode.c +0 -56
- package/runtime/third_party/bearssl/src/int/i15_decred.c +0 -100
- package/runtime/third_party/bearssl/src/int/i15_encode.c +0 -56
- package/runtime/third_party/bearssl/src/int/i15_fmont.c +0 -59
- package/runtime/third_party/bearssl/src/int/i15_iszero.c +0 -39
- package/runtime/third_party/bearssl/src/int/i15_moddiv.c +0 -465
- package/runtime/third_party/bearssl/src/int/i15_modpow.c +0 -50
- package/runtime/third_party/bearssl/src/int/i15_modpow2.c +0 -160
- package/runtime/third_party/bearssl/src/int/i15_montmul.c +0 -184
- package/runtime/third_party/bearssl/src/int/i15_mulacc.c +0 -61
- package/runtime/third_party/bearssl/src/int/i15_muladd.c +0 -173
- package/runtime/third_party/bearssl/src/int/i15_ninv15.c +0 -38
- package/runtime/third_party/bearssl/src/int/i15_reduce.c +0 -66
- package/runtime/third_party/bearssl/src/int/i15_rshift.c +0 -47
- package/runtime/third_party/bearssl/src/int/i15_sub.c +0 -46
- package/runtime/third_party/bearssl/src/int/i15_tmont.c +0 -36
- package/runtime/third_party/bearssl/src/int/i31_add.c +0 -46
- package/runtime/third_party/bearssl/src/int/i31_bitlen.c +0 -44
- package/runtime/third_party/bearssl/src/int/i31_decmod.c +0 -124
- package/runtime/third_party/bearssl/src/int/i31_decode.c +0 -57
- package/runtime/third_party/bearssl/src/int/i31_decred.c +0 -103
- package/runtime/third_party/bearssl/src/int/i31_encode.c +0 -79
- package/runtime/third_party/bearssl/src/int/i31_fmont.c +0 -60
- package/runtime/third_party/bearssl/src/int/i31_iszero.c +0 -39
- package/runtime/third_party/bearssl/src/int/i31_moddiv.c +0 -488
- package/runtime/third_party/bearssl/src/int/i31_modpow.c +0 -65
- package/runtime/third_party/bearssl/src/int/i31_modpow2.c +0 -160
- package/runtime/third_party/bearssl/src/int/i31_montmul.c +0 -127
- package/runtime/third_party/bearssl/src/int/i31_mulacc.c +0 -74
- package/runtime/third_party/bearssl/src/int/i31_muladd.c +0 -157
- package/runtime/third_party/bearssl/src/int/i31_ninv31.c +0 -39
- package/runtime/third_party/bearssl/src/int/i31_reduce.c +0 -66
- package/runtime/third_party/bearssl/src/int/i31_rshift.c +0 -47
- package/runtime/third_party/bearssl/src/int/i31_sub.c +0 -46
- package/runtime/third_party/bearssl/src/int/i31_tmont.c +0 -36
- package/runtime/third_party/bearssl/src/int/i32_add.c +0 -51
- package/runtime/third_party/bearssl/src/int/i32_bitlen.c +0 -44
- package/runtime/third_party/bearssl/src/int/i32_decmod.c +0 -77
- package/runtime/third_party/bearssl/src/int/i32_decode.c +0 -63
- package/runtime/third_party/bearssl/src/int/i32_decred.c +0 -107
- package/runtime/third_party/bearssl/src/int/i32_div32.c +0 -56
- package/runtime/third_party/bearssl/src/int/i32_encode.c +0 -72
- package/runtime/third_party/bearssl/src/int/i32_fmont.c +0 -60
- package/runtime/third_party/bearssl/src/int/i32_iszero.c +0 -39
- package/runtime/third_party/bearssl/src/int/i32_modpow.c +0 -65
- package/runtime/third_party/bearssl/src/int/i32_montmul.c +0 -69
- package/runtime/third_party/bearssl/src/int/i32_mulacc.c +0 -56
- package/runtime/third_party/bearssl/src/int/i32_muladd.c +0 -138
- package/runtime/third_party/bearssl/src/int/i32_ninv32.c +0 -39
- package/runtime/third_party/bearssl/src/int/i32_reduce.c +0 -66
- package/runtime/third_party/bearssl/src/int/i32_sub.c +0 -51
- package/runtime/third_party/bearssl/src/int/i32_tmont.c +0 -36
- package/runtime/third_party/bearssl/src/int/i62_modpow2.c +0 -493
- package/runtime/third_party/bearssl/src/kdf/hkdf.c +0 -107
- package/runtime/third_party/bearssl/src/kdf/shake.c +0 -590
- package/runtime/third_party/bearssl/src/mac/hmac.c +0 -122
- package/runtime/third_party/bearssl/src/mac/hmac_ct.c +0 -193
- package/runtime/third_party/bearssl/src/rand/aesctr_drbg.c +0 -206
- package/runtime/third_party/bearssl/src/rand/hmac_drbg.c +0 -157
- package/runtime/third_party/bearssl/src/rand/sysrng.c +0 -252
- package/runtime/third_party/bearssl/src/rsa/rsa_default_keygen.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_modulus.c +0 -36
- package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_decrypt.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_encrypt.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_sign.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_vrfy.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_priv.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_privexp.c +0 -36
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_sign.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_vrfy.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pub.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pubexp.c +0 -36
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_keygen.c +0 -583
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_modulus.c +0 -99
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_decrypt.c +0 -41
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_encrypt.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_sign.c +0 -37
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_vrfy.c +0 -43
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_priv.c +0 -209
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_privexp.c +0 -320
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_sign.c +0 -40
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_vrfy.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pub.c +0 -113
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pubexp.c +0 -152
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen.c +0 -37
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen_inner.c +0 -608
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_modulus.c +0 -99
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_decrypt.c +0 -41
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_encrypt.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_sign.c +0 -37
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_vrfy.c +0 -43
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_priv.c +0 -203
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_privexp.c +0 -318
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_sign.c +0 -40
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_vrfy.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pub.c +0 -106
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pubexp.c +0 -152
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_decrypt.c +0 -41
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_encrypt.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_sign.c +0 -37
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_vrfy.c +0 -43
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_priv.c +0 -160
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_sign.c +0 -40
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_vrfy.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pub.c +0 -77
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_keygen.c +0 -57
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_decrypt.c +0 -61
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_encrypt.c +0 -64
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_sign.c +0 -57
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_vrfy.c +0 -63
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_priv.c +0 -223
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_sign.c +0 -60
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_vrfy.c +0 -64
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pub.c +0 -125
- package/runtime/third_party/bearssl/src/rsa/rsa_oaep_pad.c +0 -112
- package/runtime/third_party/bearssl/src/rsa/rsa_oaep_unpad.c +0 -145
- package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_pad.c +0 -100
- package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_unpad.c +0 -121
- package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_pad.c +0 -106
- package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_unpad.c +0 -121
- package/runtime/third_party/bearssl/src/rsa/rsa_ssl_decrypt.c +0 -52
- package/runtime/third_party/bearssl/src/settings.c +0 -306
- package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcdec.c +0 -69
- package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcenc.c +0 -67
- package/runtime/third_party/bearssl/src/symcipher/aes_big_ctr.c +0 -84
- package/runtime/third_party/bearssl/src/symcipher/aes_big_ctrcbc.c +0 -142
- package/runtime/third_party/bearssl/src/symcipher/aes_big_dec.c +0 -254
- package/runtime/third_party/bearssl/src/symcipher/aes_big_enc.c +0 -157
- package/runtime/third_party/bearssl/src/symcipher/aes_common.c +0 -112
- package/runtime/third_party/bearssl/src/symcipher/aes_ct.c +0 -328
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64.c +0 -398
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcdec.c +0 -104
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcenc.c +0 -81
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctr.c +0 -114
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctrcbc.c +0 -433
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_dec.c +0 -159
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_enc.c +0 -115
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcdec.c +0 -111
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcenc.c +0 -91
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctr.c +0 -116
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctrcbc.c +0 -422
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_dec.c +0 -170
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_enc.c +0 -112
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8.c +0 -445
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcdec.c +0 -670
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcenc.c +0 -417
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctr.c +0 -717
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctrcbc.c +0 -946
- package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcdec.c +0 -69
- package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcenc.c +0 -67
- package/runtime/third_party/bearssl/src/symcipher/aes_small_ctr.c +0 -84
- package/runtime/third_party/bearssl/src/symcipher/aes_small_ctrcbc.c +0 -142
- package/runtime/third_party/bearssl/src/symcipher/aes_small_dec.c +0 -176
- package/runtime/third_party/bearssl/src/symcipher/aes_small_enc.c +0 -129
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni.c +0 -240
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcdec.c +0 -223
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcenc.c +0 -122
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctr.c +0 -211
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctrcbc.c +0 -596
- package/runtime/third_party/bearssl/src/symcipher/chacha20_ct.c +0 -106
- package/runtime/third_party/bearssl/src/symcipher/chacha20_sse2.c +0 -237
- package/runtime/third_party/bearssl/src/symcipher/des_ct.c +0 -411
- package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcdec.c +0 -87
- package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcenc.c +0 -69
- package/runtime/third_party/bearssl/src/symcipher/des_support.c +0 -166
- package/runtime/third_party/bearssl/src/symcipher/des_tab.c +0 -310
- package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcdec.c +0 -85
- package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcenc.c +0 -67
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul.c +0 -260
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul32.c +0 -297
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmulq.c +0 -475
- package/runtime/third_party/bearssl/src/symcipher/poly1305_i15.c +0 -221
- package/runtime/third_party/bearssl/src/x509/asn1.t0 +0 -757
- package/runtime/third_party/bearssl/src/x509/asn1enc.c +0 -93
- package/runtime/third_party/bearssl/src/x509/encode_ec_pk8der.c +0 -110
- package/runtime/third_party/bearssl/src/x509/encode_ec_rawder.c +0 -161
- package/runtime/third_party/bearssl/src/x509/encode_rsa_pk8der.c +0 -97
- package/runtime/third_party/bearssl/src/x509/encode_rsa_rawder.c +0 -96
- package/runtime/third_party/bearssl/src/x509/skey_decoder.c +0 -653
- package/runtime/third_party/bearssl/src/x509/skey_decoder.t0 +0 -376
- package/runtime/third_party/bearssl/src/x509/x509_decoder.c +0 -776
- package/runtime/third_party/bearssl/src/x509/x509_decoder.t0 +0 -324
- package/runtime/third_party/bearssl/src/x509/x509_knownkey.c +0 -105
- package/runtime/third_party/bearssl/src/x509/x509_minimal.c +0 -1722
- package/runtime/third_party/bearssl/src/x509/x509_minimal.t0 +0 -1526
- package/runtime/third_party/bearssl/src/x509/x509_minimal_full.c +0 -59
|
@@ -1,1765 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2018 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
|
-
#if BR_INT128 || BR_UMUL128
|
|
28
|
-
|
|
29
|
-
#if BR_UMUL128
|
|
30
|
-
#include <intrin.h>
|
|
31
|
-
#endif
|
|
32
|
-
|
|
33
|
-
static const unsigned char P256_G[] = {
|
|
34
|
-
0x04, 0x6B, 0x17, 0xD1, 0xF2, 0xE1, 0x2C, 0x42, 0x47, 0xF8,
|
|
35
|
-
0xBC, 0xE6, 0xE5, 0x63, 0xA4, 0x40, 0xF2, 0x77, 0x03, 0x7D,
|
|
36
|
-
0x81, 0x2D, 0xEB, 0x33, 0xA0, 0xF4, 0xA1, 0x39, 0x45, 0xD8,
|
|
37
|
-
0x98, 0xC2, 0x96, 0x4F, 0xE3, 0x42, 0xE2, 0xFE, 0x1A, 0x7F,
|
|
38
|
-
0x9B, 0x8E, 0xE7, 0xEB, 0x4A, 0x7C, 0x0F, 0x9E, 0x16, 0x2B,
|
|
39
|
-
0xCE, 0x33, 0x57, 0x6B, 0x31, 0x5E, 0xCE, 0xCB, 0xB6, 0x40,
|
|
40
|
-
0x68, 0x37, 0xBF, 0x51, 0xF5
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
static const unsigned char P256_N[] = {
|
|
44
|
-
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
|
|
45
|
-
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xE6, 0xFA, 0xAD,
|
|
46
|
-
0xA7, 0x17, 0x9E, 0x84, 0xF3, 0xB9, 0xCA, 0xC2, 0xFC, 0x63,
|
|
47
|
-
0x25, 0x51
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
static const unsigned char *
|
|
51
|
-
api_generator(int curve, size_t *len)
|
|
52
|
-
{
|
|
53
|
-
(void)curve;
|
|
54
|
-
*len = sizeof P256_G;
|
|
55
|
-
return P256_G;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static const unsigned char *
|
|
59
|
-
api_order(int curve, size_t *len)
|
|
60
|
-
{
|
|
61
|
-
(void)curve;
|
|
62
|
-
*len = sizeof P256_N;
|
|
63
|
-
return P256_N;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
static size_t
|
|
67
|
-
api_xoff(int curve, size_t *len)
|
|
68
|
-
{
|
|
69
|
-
(void)curve;
|
|
70
|
-
*len = 32;
|
|
71
|
-
return 1;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/*
|
|
75
|
-
* A field element is encoded as five 64-bit integers, in basis 2^52.
|
|
76
|
-
* Limbs may occasionally exceed 2^52.
|
|
77
|
-
*
|
|
78
|
-
* A _partially reduced_ value is such that the following hold:
|
|
79
|
-
* - top limb is less than 2^48 + 2^30
|
|
80
|
-
* - the other limbs fit on 53 bits each
|
|
81
|
-
* In particular, such a value is less than twice the modulus p.
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
#define BIT(n) ((uint64_t)1 << (n))
|
|
85
|
-
#define MASK48 (BIT(48) - BIT(0))
|
|
86
|
-
#define MASK52 (BIT(52) - BIT(0))
|
|
87
|
-
|
|
88
|
-
/* R = 2^260 mod p */
|
|
89
|
-
static const uint64_t F256_R[] = {
|
|
90
|
-
0x0000000000010, 0xF000000000000, 0xFFFFFFFFFFFFF,
|
|
91
|
-
0xFFEFFFFFFFFFF, 0x00000000FFFFF
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/* Curve equation is y^2 = x^3 - 3*x + B. This constant is B*R mod p
|
|
95
|
-
(Montgomery representation of B). */
|
|
96
|
-
static const uint64_t P256_B_MONTY[] = {
|
|
97
|
-
0xDF6229C4BDDFD, 0xCA8843090D89C, 0x212ED6ACF005C,
|
|
98
|
-
0x83415A220ABF7, 0x0C30061DD4874
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/*
|
|
102
|
-
* Addition in the field. Carry propagation is not performed.
|
|
103
|
-
* On input, limbs may be up to 63 bits each; on output, they will
|
|
104
|
-
* be up to one bit more than on input.
|
|
105
|
-
*/
|
|
106
|
-
static inline void
|
|
107
|
-
f256_add(uint64_t *d, const uint64_t *a, const uint64_t *b)
|
|
108
|
-
{
|
|
109
|
-
d[0] = a[0] + b[0];
|
|
110
|
-
d[1] = a[1] + b[1];
|
|
111
|
-
d[2] = a[2] + b[2];
|
|
112
|
-
d[3] = a[3] + b[3];
|
|
113
|
-
d[4] = a[4] + b[4];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/*
|
|
117
|
-
* Partially reduce the provided value.
|
|
118
|
-
* Input: limbs can go up to 61 bits each.
|
|
119
|
-
* Output: partially reduced.
|
|
120
|
-
*/
|
|
121
|
-
static inline void
|
|
122
|
-
f256_partial_reduce(uint64_t *a)
|
|
123
|
-
{
|
|
124
|
-
uint64_t w, cc, s;
|
|
125
|
-
|
|
126
|
-
/*
|
|
127
|
-
* Propagate carries.
|
|
128
|
-
*/
|
|
129
|
-
w = a[0];
|
|
130
|
-
a[0] = w & MASK52;
|
|
131
|
-
cc = w >> 52;
|
|
132
|
-
w = a[1] + cc;
|
|
133
|
-
a[1] = w & MASK52;
|
|
134
|
-
cc = w >> 52;
|
|
135
|
-
w = a[2] + cc;
|
|
136
|
-
a[2] = w & MASK52;
|
|
137
|
-
cc = w >> 52;
|
|
138
|
-
w = a[3] + cc;
|
|
139
|
-
a[3] = w & MASK52;
|
|
140
|
-
cc = w >> 52;
|
|
141
|
-
a[4] += cc;
|
|
142
|
-
|
|
143
|
-
s = a[4] >> 48; /* s < 2^14 */
|
|
144
|
-
a[0] += s; /* a[0] < 2^52 + 2^14 */
|
|
145
|
-
w = a[1] - (s << 44);
|
|
146
|
-
a[1] = w & MASK52; /* a[1] < 2^52 */
|
|
147
|
-
cc = -(w >> 52) & 0xFFF; /* cc < 16 */
|
|
148
|
-
w = a[2] - cc;
|
|
149
|
-
a[2] = w & MASK52; /* a[2] < 2^52 */
|
|
150
|
-
cc = w >> 63; /* cc = 0 or 1 */
|
|
151
|
-
w = a[3] - cc - (s << 36);
|
|
152
|
-
a[3] = w & MASK52; /* a[3] < 2^52 */
|
|
153
|
-
cc = w >> 63; /* cc = 0 or 1 */
|
|
154
|
-
w = a[4] & MASK48;
|
|
155
|
-
a[4] = w + (s << 16) - cc; /* a[4] < 2^48 + 2^30 */
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/*
|
|
159
|
-
* Subtraction in the field.
|
|
160
|
-
* Input: limbs must fit on 60 bits each; in particular, the complete
|
|
161
|
-
* integer will be less than 2^268 + 2^217.
|
|
162
|
-
* Output: partially reduced.
|
|
163
|
-
*/
|
|
164
|
-
static inline void
|
|
165
|
-
f256_sub(uint64_t *d, const uint64_t *a, const uint64_t *b)
|
|
166
|
-
{
|
|
167
|
-
uint64_t t[5], w, s, cc;
|
|
168
|
-
|
|
169
|
-
/*
|
|
170
|
-
* We compute d = 2^13*p + a - b; this ensures a positive
|
|
171
|
-
* intermediate value.
|
|
172
|
-
*
|
|
173
|
-
* Each individual addition/subtraction may yield a positive or
|
|
174
|
-
* negative result; thus, we need to handle a signed carry, thus
|
|
175
|
-
* with sign extension. We prefer not to use signed types (int64_t)
|
|
176
|
-
* because conversion from unsigned to signed is cumbersome (a
|
|
177
|
-
* direct cast with the top bit set is undefined behavior; instead,
|
|
178
|
-
* we have to use pointer aliasing, using the guaranteed properties
|
|
179
|
-
* of exact-width types, but this requires the compiler to optimize
|
|
180
|
-
* away the writes and reads from RAM), and right-shifting a
|
|
181
|
-
* signed negative value is implementation-defined. Therefore,
|
|
182
|
-
* we use a custom sign extension.
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
w = a[0] - b[0] - BIT(13);
|
|
186
|
-
t[0] = w & MASK52;
|
|
187
|
-
cc = w >> 52;
|
|
188
|
-
cc |= -(cc & BIT(11));
|
|
189
|
-
w = a[1] - b[1] + cc;
|
|
190
|
-
t[1] = w & MASK52;
|
|
191
|
-
cc = w >> 52;
|
|
192
|
-
cc |= -(cc & BIT(11));
|
|
193
|
-
w = a[2] - b[2] + cc;
|
|
194
|
-
t[2] = (w & MASK52) + BIT(5);
|
|
195
|
-
cc = w >> 52;
|
|
196
|
-
cc |= -(cc & BIT(11));
|
|
197
|
-
w = a[3] - b[3] + cc;
|
|
198
|
-
t[3] = (w & MASK52) + BIT(49);
|
|
199
|
-
cc = w >> 52;
|
|
200
|
-
cc |= -(cc & BIT(11));
|
|
201
|
-
t[4] = (BIT(61) - BIT(29)) + a[4] - b[4] + cc;
|
|
202
|
-
|
|
203
|
-
/*
|
|
204
|
-
* Perform partial reduction. Rule is:
|
|
205
|
-
* 2^256 = 2^224 - 2^192 - 2^96 + 1 mod p
|
|
206
|
-
*
|
|
207
|
-
* At that point:
|
|
208
|
-
* 0 <= t[0] <= 2^52 - 1
|
|
209
|
-
* 0 <= t[1] <= 2^52 - 1
|
|
210
|
-
* 2^5 <= t[2] <= 2^52 + 2^5 - 1
|
|
211
|
-
* 2^49 <= t[3] <= 2^52 + 2^49 - 1
|
|
212
|
-
* 2^59 < t[4] <= 2^61 + 2^60 - 2^29
|
|
213
|
-
*
|
|
214
|
-
* Thus, the value 's' (t[4] / 2^48) will be necessarily
|
|
215
|
-
* greater than 2048, and less than 12288.
|
|
216
|
-
*/
|
|
217
|
-
s = t[4] >> 48;
|
|
218
|
-
|
|
219
|
-
d[0] = t[0] + s; /* d[0] <= 2^52 + 12287 */
|
|
220
|
-
w = t[1] - (s << 44);
|
|
221
|
-
d[1] = w & MASK52; /* d[1] <= 2^52 - 1 */
|
|
222
|
-
cc = -(w >> 52) & 0xFFF; /* cc <= 48 */
|
|
223
|
-
w = t[2] - cc;
|
|
224
|
-
cc = w >> 63; /* cc = 0 or 1 */
|
|
225
|
-
d[2] = w + (cc << 52); /* d[2] <= 2^52 + 31 */
|
|
226
|
-
w = t[3] - cc - (s << 36);
|
|
227
|
-
cc = w >> 63; /* cc = 0 or 1 */
|
|
228
|
-
d[3] = w + (cc << 52); /* t[3] <= 2^52 + 2^49 - 1 */
|
|
229
|
-
d[4] = (t[4] & MASK48) + (s << 16) - cc; /* d[4] < 2^48 + 2^30 */
|
|
230
|
-
|
|
231
|
-
/*
|
|
232
|
-
* If s = 0, then none of the limbs is modified, and there cannot
|
|
233
|
-
* be an overflow; if s != 0, then (s << 16) > cc, and there is
|
|
234
|
-
* no overflow either.
|
|
235
|
-
*/
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/*
|
|
239
|
-
* Montgomery multiplication in the field.
|
|
240
|
-
* Input: limbs must fit on 56 bits each.
|
|
241
|
-
* Output: partially reduced.
|
|
242
|
-
*/
|
|
243
|
-
static void
|
|
244
|
-
f256_montymul(uint64_t *d, const uint64_t *a, const uint64_t *b)
|
|
245
|
-
{
|
|
246
|
-
#if BR_INT128
|
|
247
|
-
|
|
248
|
-
int i;
|
|
249
|
-
uint64_t t[5];
|
|
250
|
-
|
|
251
|
-
t[0] = 0;
|
|
252
|
-
t[1] = 0;
|
|
253
|
-
t[2] = 0;
|
|
254
|
-
t[3] = 0;
|
|
255
|
-
t[4] = 0;
|
|
256
|
-
for (i = 0; i < 5; i ++) {
|
|
257
|
-
uint64_t x, f, cc, w, s;
|
|
258
|
-
unsigned __int128 z;
|
|
259
|
-
|
|
260
|
-
/*
|
|
261
|
-
* Since limbs of a[] and b[] fit on 56 bits each,
|
|
262
|
-
* each individual product fits on 112 bits. Also,
|
|
263
|
-
* the factor f fits on 52 bits, so f<<48 fits on
|
|
264
|
-
* 112 bits too. This guarantees that carries (cc)
|
|
265
|
-
* will fit on 62 bits, thus no overflow.
|
|
266
|
-
*
|
|
267
|
-
* The operations below compute:
|
|
268
|
-
* t <- (t + x*b + f*p) / 2^64
|
|
269
|
-
*/
|
|
270
|
-
x = a[i];
|
|
271
|
-
z = (unsigned __int128)b[0] * (unsigned __int128)x
|
|
272
|
-
+ (unsigned __int128)t[0];
|
|
273
|
-
f = (uint64_t)z & MASK52;
|
|
274
|
-
cc = (uint64_t)(z >> 52);
|
|
275
|
-
z = (unsigned __int128)b[1] * (unsigned __int128)x
|
|
276
|
-
+ (unsigned __int128)t[1] + cc
|
|
277
|
-
+ ((unsigned __int128)f << 44);
|
|
278
|
-
t[0] = (uint64_t)z & MASK52;
|
|
279
|
-
cc = (uint64_t)(z >> 52);
|
|
280
|
-
z = (unsigned __int128)b[2] * (unsigned __int128)x
|
|
281
|
-
+ (unsigned __int128)t[2] + cc;
|
|
282
|
-
t[1] = (uint64_t)z & MASK52;
|
|
283
|
-
cc = (uint64_t)(z >> 52);
|
|
284
|
-
z = (unsigned __int128)b[3] * (unsigned __int128)x
|
|
285
|
-
+ (unsigned __int128)t[3] + cc
|
|
286
|
-
+ ((unsigned __int128)f << 36);
|
|
287
|
-
t[2] = (uint64_t)z & MASK52;
|
|
288
|
-
cc = (uint64_t)(z >> 52);
|
|
289
|
-
z = (unsigned __int128)b[4] * (unsigned __int128)x
|
|
290
|
-
+ (unsigned __int128)t[4] + cc
|
|
291
|
-
+ ((unsigned __int128)f << 48)
|
|
292
|
-
- ((unsigned __int128)f << 16);
|
|
293
|
-
t[3] = (uint64_t)z & MASK52;
|
|
294
|
-
t[4] = (uint64_t)(z >> 52);
|
|
295
|
-
|
|
296
|
-
/*
|
|
297
|
-
* t[4] may be up to 62 bits here; we need to do a
|
|
298
|
-
* partial reduction. Note that limbs t[0] to t[3]
|
|
299
|
-
* fit on 52 bits each.
|
|
300
|
-
*/
|
|
301
|
-
s = t[4] >> 48; /* s < 2^14 */
|
|
302
|
-
t[0] += s; /* t[0] < 2^52 + 2^14 */
|
|
303
|
-
w = t[1] - (s << 44);
|
|
304
|
-
t[1] = w & MASK52; /* t[1] < 2^52 */
|
|
305
|
-
cc = -(w >> 52) & 0xFFF; /* cc < 16 */
|
|
306
|
-
w = t[2] - cc;
|
|
307
|
-
t[2] = w & MASK52; /* t[2] < 2^52 */
|
|
308
|
-
cc = w >> 63; /* cc = 0 or 1 */
|
|
309
|
-
w = t[3] - cc - (s << 36);
|
|
310
|
-
t[3] = w & MASK52; /* t[3] < 2^52 */
|
|
311
|
-
cc = w >> 63; /* cc = 0 or 1 */
|
|
312
|
-
w = t[4] & MASK48;
|
|
313
|
-
t[4] = w + (s << 16) - cc; /* t[4] < 2^48 + 2^30 */
|
|
314
|
-
|
|
315
|
-
/*
|
|
316
|
-
* The final t[4] cannot overflow because cc is 0 or 1,
|
|
317
|
-
* and cc can be 1 only if s != 0.
|
|
318
|
-
*/
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
d[0] = t[0];
|
|
322
|
-
d[1] = t[1];
|
|
323
|
-
d[2] = t[2];
|
|
324
|
-
d[3] = t[3];
|
|
325
|
-
d[4] = t[4];
|
|
326
|
-
|
|
327
|
-
#elif BR_UMUL128
|
|
328
|
-
|
|
329
|
-
int i;
|
|
330
|
-
uint64_t t[5];
|
|
331
|
-
|
|
332
|
-
t[0] = 0;
|
|
333
|
-
t[1] = 0;
|
|
334
|
-
t[2] = 0;
|
|
335
|
-
t[3] = 0;
|
|
336
|
-
t[4] = 0;
|
|
337
|
-
for (i = 0; i < 5; i ++) {
|
|
338
|
-
uint64_t x, f, cc, w, s, zh, zl;
|
|
339
|
-
unsigned char k;
|
|
340
|
-
|
|
341
|
-
/*
|
|
342
|
-
* Since limbs of a[] and b[] fit on 56 bits each,
|
|
343
|
-
* each individual product fits on 112 bits. Also,
|
|
344
|
-
* the factor f fits on 52 bits, so f<<48 fits on
|
|
345
|
-
* 112 bits too. This guarantees that carries (cc)
|
|
346
|
-
* will fit on 62 bits, thus no overflow.
|
|
347
|
-
*
|
|
348
|
-
* The operations below compute:
|
|
349
|
-
* t <- (t + x*b + f*p) / 2^64
|
|
350
|
-
*/
|
|
351
|
-
x = a[i];
|
|
352
|
-
zl = _umul128(b[0], x, &zh);
|
|
353
|
-
k = _addcarry_u64(0, t[0], zl, &zl);
|
|
354
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
355
|
-
f = zl & MASK52;
|
|
356
|
-
cc = (zl >> 52) | (zh << 12);
|
|
357
|
-
|
|
358
|
-
zl = _umul128(b[1], x, &zh);
|
|
359
|
-
k = _addcarry_u64(0, t[1], zl, &zl);
|
|
360
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
361
|
-
k = _addcarry_u64(0, cc, zl, &zl);
|
|
362
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
363
|
-
k = _addcarry_u64(0, f << 44, zl, &zl);
|
|
364
|
-
(void)_addcarry_u64(k, f >> 20, zh, &zh);
|
|
365
|
-
t[0] = zl & MASK52;
|
|
366
|
-
cc = (zl >> 52) | (zh << 12);
|
|
367
|
-
|
|
368
|
-
zl = _umul128(b[2], x, &zh);
|
|
369
|
-
k = _addcarry_u64(0, t[2], zl, &zl);
|
|
370
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
371
|
-
k = _addcarry_u64(0, cc, zl, &zl);
|
|
372
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
373
|
-
t[1] = zl & MASK52;
|
|
374
|
-
cc = (zl >> 52) | (zh << 12);
|
|
375
|
-
|
|
376
|
-
zl = _umul128(b[3], x, &zh);
|
|
377
|
-
k = _addcarry_u64(0, t[3], zl, &zl);
|
|
378
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
379
|
-
k = _addcarry_u64(0, cc, zl, &zl);
|
|
380
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
381
|
-
k = _addcarry_u64(0, f << 36, zl, &zl);
|
|
382
|
-
(void)_addcarry_u64(k, f >> 28, zh, &zh);
|
|
383
|
-
t[2] = zl & MASK52;
|
|
384
|
-
cc = (zl >> 52) | (zh << 12);
|
|
385
|
-
|
|
386
|
-
zl = _umul128(b[4], x, &zh);
|
|
387
|
-
k = _addcarry_u64(0, t[4], zl, &zl);
|
|
388
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
389
|
-
k = _addcarry_u64(0, cc, zl, &zl);
|
|
390
|
-
(void)_addcarry_u64(k, 0, zh, &zh);
|
|
391
|
-
k = _addcarry_u64(0, f << 48, zl, &zl);
|
|
392
|
-
(void)_addcarry_u64(k, f >> 16, zh, &zh);
|
|
393
|
-
k = _subborrow_u64(0, zl, f << 16, &zl);
|
|
394
|
-
(void)_subborrow_u64(k, zh, f >> 48, &zh);
|
|
395
|
-
t[3] = zl & MASK52;
|
|
396
|
-
t[4] = (zl >> 52) | (zh << 12);
|
|
397
|
-
|
|
398
|
-
/*
|
|
399
|
-
* t[4] may be up to 62 bits here; we need to do a
|
|
400
|
-
* partial reduction. Note that limbs t[0] to t[3]
|
|
401
|
-
* fit on 52 bits each.
|
|
402
|
-
*/
|
|
403
|
-
s = t[4] >> 48; /* s < 2^14 */
|
|
404
|
-
t[0] += s; /* t[0] < 2^52 + 2^14 */
|
|
405
|
-
w = t[1] - (s << 44);
|
|
406
|
-
t[1] = w & MASK52; /* t[1] < 2^52 */
|
|
407
|
-
cc = -(w >> 52) & 0xFFF; /* cc < 16 */
|
|
408
|
-
w = t[2] - cc;
|
|
409
|
-
t[2] = w & MASK52; /* t[2] < 2^52 */
|
|
410
|
-
cc = w >> 63; /* cc = 0 or 1 */
|
|
411
|
-
w = t[3] - cc - (s << 36);
|
|
412
|
-
t[3] = w & MASK52; /* t[3] < 2^52 */
|
|
413
|
-
cc = w >> 63; /* cc = 0 or 1 */
|
|
414
|
-
w = t[4] & MASK48;
|
|
415
|
-
t[4] = w + (s << 16) - cc; /* t[4] < 2^48 + 2^30 */
|
|
416
|
-
|
|
417
|
-
/*
|
|
418
|
-
* The final t[4] cannot overflow because cc is 0 or 1,
|
|
419
|
-
* and cc can be 1 only if s != 0.
|
|
420
|
-
*/
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
d[0] = t[0];
|
|
424
|
-
d[1] = t[1];
|
|
425
|
-
d[2] = t[2];
|
|
426
|
-
d[3] = t[3];
|
|
427
|
-
d[4] = t[4];
|
|
428
|
-
|
|
429
|
-
#endif
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/*
|
|
433
|
-
* Montgomery squaring in the field; currently a basic wrapper around
|
|
434
|
-
* multiplication (inline, should be optimized away).
|
|
435
|
-
* TODO: see if some extra speed can be gained here.
|
|
436
|
-
*/
|
|
437
|
-
static inline void
|
|
438
|
-
f256_montysquare(uint64_t *d, const uint64_t *a)
|
|
439
|
-
{
|
|
440
|
-
f256_montymul(d, a, a);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/*
|
|
444
|
-
* Convert to Montgomery representation.
|
|
445
|
-
*/
|
|
446
|
-
static void
|
|
447
|
-
f256_tomonty(uint64_t *d, const uint64_t *a)
|
|
448
|
-
{
|
|
449
|
-
/*
|
|
450
|
-
* R2 = 2^520 mod p.
|
|
451
|
-
* If R = 2^260 mod p, then R2 = R^2 mod p; and the Montgomery
|
|
452
|
-
* multiplication of a by R2 is: a*R2/R = a*R mod p, i.e. the
|
|
453
|
-
* conversion to Montgomery representation.
|
|
454
|
-
*/
|
|
455
|
-
static const uint64_t R2[] = {
|
|
456
|
-
0x0000000000300, 0xFFFFFFFF00000, 0xFFFFEFFFFFFFB,
|
|
457
|
-
0xFDFFFFFFFFFFF, 0x0000004FFFFFF
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
f256_montymul(d, a, R2);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/*
|
|
464
|
-
* Convert from Montgomery representation.
|
|
465
|
-
*/
|
|
466
|
-
static void
|
|
467
|
-
f256_frommonty(uint64_t *d, const uint64_t *a)
|
|
468
|
-
{
|
|
469
|
-
/*
|
|
470
|
-
* Montgomery multiplication by 1 is division by 2^260 modulo p.
|
|
471
|
-
*/
|
|
472
|
-
static const uint64_t one[] = { 1, 0, 0, 0, 0 };
|
|
473
|
-
|
|
474
|
-
f256_montymul(d, a, one);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/*
|
|
478
|
-
* Inversion in the field. If the source value is 0 modulo p, then this
|
|
479
|
-
* returns 0 or p. This function uses Montgomery representation.
|
|
480
|
-
*/
|
|
481
|
-
static void
|
|
482
|
-
f256_invert(uint64_t *d, const uint64_t *a)
|
|
483
|
-
{
|
|
484
|
-
/*
|
|
485
|
-
* We compute a^(p-2) mod p. The exponent pattern (from high to
|
|
486
|
-
* low) is:
|
|
487
|
-
* - 32 bits of value 1
|
|
488
|
-
* - 31 bits of value 0
|
|
489
|
-
* - 1 bit of value 1
|
|
490
|
-
* - 96 bits of value 0
|
|
491
|
-
* - 94 bits of value 1
|
|
492
|
-
* - 1 bit of value 0
|
|
493
|
-
* - 1 bit of value 1
|
|
494
|
-
* To speed up the square-and-multiply algorithm, we precompute
|
|
495
|
-
* a^(2^31-1).
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
uint64_t r[5], t[5];
|
|
499
|
-
int i;
|
|
500
|
-
|
|
501
|
-
memcpy(t, a, sizeof t);
|
|
502
|
-
for (i = 0; i < 30; i ++) {
|
|
503
|
-
f256_montysquare(t, t);
|
|
504
|
-
f256_montymul(t, t, a);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
memcpy(r, t, sizeof t);
|
|
508
|
-
for (i = 224; i >= 0; i --) {
|
|
509
|
-
f256_montysquare(r, r);
|
|
510
|
-
switch (i) {
|
|
511
|
-
case 0:
|
|
512
|
-
case 2:
|
|
513
|
-
case 192:
|
|
514
|
-
case 224:
|
|
515
|
-
f256_montymul(r, r, a);
|
|
516
|
-
break;
|
|
517
|
-
case 3:
|
|
518
|
-
case 34:
|
|
519
|
-
case 65:
|
|
520
|
-
f256_montymul(r, r, t);
|
|
521
|
-
break;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
memcpy(d, r, sizeof r);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/*
|
|
528
|
-
* Finalize reduction.
|
|
529
|
-
* Input value should be partially reduced.
|
|
530
|
-
* On output, limbs a[0] to a[3] fit on 52 bits each, limb a[4] fits
|
|
531
|
-
* on 48 bits, and the integer is less than p.
|
|
532
|
-
*/
|
|
533
|
-
static inline void
|
|
534
|
-
f256_final_reduce(uint64_t *a)
|
|
535
|
-
{
|
|
536
|
-
uint64_t r[5], t[5], w, cc;
|
|
537
|
-
int i;
|
|
538
|
-
|
|
539
|
-
/*
|
|
540
|
-
* Propagate carries to ensure that limbs 0 to 3 fit on 52 bits.
|
|
541
|
-
*/
|
|
542
|
-
cc = 0;
|
|
543
|
-
for (i = 0; i < 5; i ++) {
|
|
544
|
-
w = a[i] + cc;
|
|
545
|
-
r[i] = w & MASK52;
|
|
546
|
-
cc = w >> 52;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/*
|
|
550
|
-
* We compute t = r + (2^256 - p) = r + 2^224 - 2^192 - 2^96 + 1.
|
|
551
|
-
* If t < 2^256, then r < p, and we return r. Otherwise, we
|
|
552
|
-
* want to return r - p = t - 2^256.
|
|
553
|
-
*/
|
|
554
|
-
|
|
555
|
-
/*
|
|
556
|
-
* Add 2^224 + 1, and propagate carries to ensure that limbs
|
|
557
|
-
* t[0] to t[3] fit in 52 bits each.
|
|
558
|
-
*/
|
|
559
|
-
w = r[0] + 1;
|
|
560
|
-
t[0] = w & MASK52;
|
|
561
|
-
cc = w >> 52;
|
|
562
|
-
w = r[1] + cc;
|
|
563
|
-
t[1] = w & MASK52;
|
|
564
|
-
cc = w >> 52;
|
|
565
|
-
w = r[2] + cc;
|
|
566
|
-
t[2] = w & MASK52;
|
|
567
|
-
cc = w >> 52;
|
|
568
|
-
w = r[3] + cc;
|
|
569
|
-
t[3] = w & MASK52;
|
|
570
|
-
cc = w >> 52;
|
|
571
|
-
t[4] = r[4] + cc + BIT(16);
|
|
572
|
-
|
|
573
|
-
/*
|
|
574
|
-
* Subtract 2^192 + 2^96. Since we just added 2^224 + 1, the
|
|
575
|
-
* result cannot be negative.
|
|
576
|
-
*/
|
|
577
|
-
w = t[1] - BIT(44);
|
|
578
|
-
t[1] = w & MASK52;
|
|
579
|
-
cc = w >> 63;
|
|
580
|
-
w = t[2] - cc;
|
|
581
|
-
t[2] = w & MASK52;
|
|
582
|
-
cc = w >> 63;
|
|
583
|
-
w = t[3] - BIT(36) - cc;
|
|
584
|
-
t[3] = w & MASK52;
|
|
585
|
-
cc = w >> 63;
|
|
586
|
-
t[4] -= cc;
|
|
587
|
-
|
|
588
|
-
/*
|
|
589
|
-
* If the top limb t[4] fits on 48 bits, then r[] is already
|
|
590
|
-
* in the proper range. Otherwise, t[] is the value to return
|
|
591
|
-
* (truncated to 256 bits).
|
|
592
|
-
*/
|
|
593
|
-
cc = -(t[4] >> 48);
|
|
594
|
-
t[4] &= MASK48;
|
|
595
|
-
for (i = 0; i < 5; i ++) {
|
|
596
|
-
a[i] = r[i] ^ (cc & (r[i] ^ t[i]));
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
/*
|
|
601
|
-
* Points in affine and Jacobian coordinates.
|
|
602
|
-
*
|
|
603
|
-
* - In affine coordinates, the point-at-infinity cannot be encoded.
|
|
604
|
-
* - Jacobian coordinates (X,Y,Z) correspond to affine (X/Z^2,Y/Z^3);
|
|
605
|
-
* if Z = 0 then this is the point-at-infinity.
|
|
606
|
-
*/
|
|
607
|
-
typedef struct {
|
|
608
|
-
uint64_t x[5];
|
|
609
|
-
uint64_t y[5];
|
|
610
|
-
} p256_affine;
|
|
611
|
-
|
|
612
|
-
typedef struct {
|
|
613
|
-
uint64_t x[5];
|
|
614
|
-
uint64_t y[5];
|
|
615
|
-
uint64_t z[5];
|
|
616
|
-
} p256_jacobian;
|
|
617
|
-
|
|
618
|
-
/*
|
|
619
|
-
* Decode a field element (unsigned big endian notation).
|
|
620
|
-
*/
|
|
621
|
-
static void
|
|
622
|
-
f256_decode(uint64_t *a, const unsigned char *buf)
|
|
623
|
-
{
|
|
624
|
-
uint64_t w0, w1, w2, w3;
|
|
625
|
-
|
|
626
|
-
w3 = br_dec64be(buf + 0);
|
|
627
|
-
w2 = br_dec64be(buf + 8);
|
|
628
|
-
w1 = br_dec64be(buf + 16);
|
|
629
|
-
w0 = br_dec64be(buf + 24);
|
|
630
|
-
a[0] = w0 & MASK52;
|
|
631
|
-
a[1] = ((w0 >> 52) | (w1 << 12)) & MASK52;
|
|
632
|
-
a[2] = ((w1 >> 40) | (w2 << 24)) & MASK52;
|
|
633
|
-
a[3] = ((w2 >> 28) | (w3 << 36)) & MASK52;
|
|
634
|
-
a[4] = w3 >> 16;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
/*
|
|
638
|
-
* Encode a field element (unsigned big endian notation). The field
|
|
639
|
-
* element MUST be fully reduced.
|
|
640
|
-
*/
|
|
641
|
-
static void
|
|
642
|
-
f256_encode(unsigned char *buf, const uint64_t *a)
|
|
643
|
-
{
|
|
644
|
-
uint64_t w0, w1, w2, w3;
|
|
645
|
-
|
|
646
|
-
w0 = a[0] | (a[1] << 52);
|
|
647
|
-
w1 = (a[1] >> 12) | (a[2] << 40);
|
|
648
|
-
w2 = (a[2] >> 24) | (a[3] << 28);
|
|
649
|
-
w3 = (a[3] >> 36) | (a[4] << 16);
|
|
650
|
-
br_enc64be(buf + 0, w3);
|
|
651
|
-
br_enc64be(buf + 8, w2);
|
|
652
|
-
br_enc64be(buf + 16, w1);
|
|
653
|
-
br_enc64be(buf + 24, w0);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
/*
|
|
657
|
-
* Decode a point. The returned point is in Jacobian coordinates, but
|
|
658
|
-
* with z = 1. If the encoding is invalid, or encodes a point which is
|
|
659
|
-
* not on the curve, or encodes the point at infinity, then this function
|
|
660
|
-
* returns 0. Otherwise, 1 is returned.
|
|
661
|
-
*
|
|
662
|
-
* The buffer is assumed to have length exactly 65 bytes.
|
|
663
|
-
*/
|
|
664
|
-
static uint32_t
|
|
665
|
-
point_decode(p256_jacobian *P, const unsigned char *buf)
|
|
666
|
-
{
|
|
667
|
-
uint64_t x[5], y[5], t[5], x3[5], tt;
|
|
668
|
-
uint32_t r;
|
|
669
|
-
|
|
670
|
-
/*
|
|
671
|
-
* Header byte shall be 0x04.
|
|
672
|
-
*/
|
|
673
|
-
r = EQ(buf[0], 0x04);
|
|
674
|
-
|
|
675
|
-
/*
|
|
676
|
-
* Decode X and Y coordinates, and convert them into
|
|
677
|
-
* Montgomery representation.
|
|
678
|
-
*/
|
|
679
|
-
f256_decode(x, buf + 1);
|
|
680
|
-
f256_decode(y, buf + 33);
|
|
681
|
-
f256_tomonty(x, x);
|
|
682
|
-
f256_tomonty(y, y);
|
|
683
|
-
|
|
684
|
-
/*
|
|
685
|
-
* Verify y^2 = x^3 + A*x + B. In curve P-256, A = -3.
|
|
686
|
-
* Note that the Montgomery representation of 0 is 0. We must
|
|
687
|
-
* take care to apply the final reduction to make sure we have
|
|
688
|
-
* 0 and not p.
|
|
689
|
-
*/
|
|
690
|
-
f256_montysquare(t, y);
|
|
691
|
-
f256_montysquare(x3, x);
|
|
692
|
-
f256_montymul(x3, x3, x);
|
|
693
|
-
f256_sub(t, t, x3);
|
|
694
|
-
f256_add(t, t, x);
|
|
695
|
-
f256_add(t, t, x);
|
|
696
|
-
f256_add(t, t, x);
|
|
697
|
-
f256_sub(t, t, P256_B_MONTY);
|
|
698
|
-
f256_final_reduce(t);
|
|
699
|
-
tt = t[0] | t[1] | t[2] | t[3] | t[4];
|
|
700
|
-
r &= EQ((uint32_t)(tt | (tt >> 32)), 0);
|
|
701
|
-
|
|
702
|
-
/*
|
|
703
|
-
* Return the point in Jacobian coordinates (and Montgomery
|
|
704
|
-
* representation).
|
|
705
|
-
*/
|
|
706
|
-
memcpy(P->x, x, sizeof x);
|
|
707
|
-
memcpy(P->y, y, sizeof y);
|
|
708
|
-
memcpy(P->z, F256_R, sizeof F256_R);
|
|
709
|
-
return r;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
/*
|
|
713
|
-
* Final conversion for a point:
|
|
714
|
-
* - The point is converted back to affine coordinates.
|
|
715
|
-
* - Final reduction is performed.
|
|
716
|
-
* - The point is encoded into the provided buffer.
|
|
717
|
-
*
|
|
718
|
-
* If the point is the point-at-infinity, all operations are performed,
|
|
719
|
-
* but the buffer contents are indeterminate, and 0 is returned. Otherwise,
|
|
720
|
-
* the encoded point is written in the buffer, and 1 is returned.
|
|
721
|
-
*/
|
|
722
|
-
static uint32_t
|
|
723
|
-
point_encode(unsigned char *buf, const p256_jacobian *P)
|
|
724
|
-
{
|
|
725
|
-
uint64_t t1[5], t2[5], z;
|
|
726
|
-
|
|
727
|
-
/* Set t1 = 1/z^2 and t2 = 1/z^3. */
|
|
728
|
-
f256_invert(t2, P->z);
|
|
729
|
-
f256_montysquare(t1, t2);
|
|
730
|
-
f256_montymul(t2, t2, t1);
|
|
731
|
-
|
|
732
|
-
/* Compute affine coordinates x (in t1) and y (in t2). */
|
|
733
|
-
f256_montymul(t1, P->x, t1);
|
|
734
|
-
f256_montymul(t2, P->y, t2);
|
|
735
|
-
|
|
736
|
-
/* Convert back from Montgomery representation, and finalize
|
|
737
|
-
reductions. */
|
|
738
|
-
f256_frommonty(t1, t1);
|
|
739
|
-
f256_frommonty(t2, t2);
|
|
740
|
-
f256_final_reduce(t1);
|
|
741
|
-
f256_final_reduce(t2);
|
|
742
|
-
|
|
743
|
-
/* Encode. */
|
|
744
|
-
buf[0] = 0x04;
|
|
745
|
-
f256_encode(buf + 1, t1);
|
|
746
|
-
f256_encode(buf + 33, t2);
|
|
747
|
-
|
|
748
|
-
/* Return success if and only if P->z != 0. */
|
|
749
|
-
z = P->z[0] | P->z[1] | P->z[2] | P->z[3] | P->z[4];
|
|
750
|
-
return NEQ((uint32_t)(z | z >> 32), 0);
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
/*
|
|
754
|
-
* Point doubling in Jacobian coordinates: point P is doubled.
|
|
755
|
-
* Note: if the source point is the point-at-infinity, then the result is
|
|
756
|
-
* still the point-at-infinity, which is correct. Moreover, if the three
|
|
757
|
-
* coordinates were zero, then they still are zero in the returned value.
|
|
758
|
-
*/
|
|
759
|
-
static void
|
|
760
|
-
p256_double(p256_jacobian *P)
|
|
761
|
-
{
|
|
762
|
-
/*
|
|
763
|
-
* Doubling formulas are:
|
|
764
|
-
*
|
|
765
|
-
* s = 4*x*y^2
|
|
766
|
-
* m = 3*(x + z^2)*(x - z^2)
|
|
767
|
-
* x' = m^2 - 2*s
|
|
768
|
-
* y' = m*(s - x') - 8*y^4
|
|
769
|
-
* z' = 2*y*z
|
|
770
|
-
*
|
|
771
|
-
* These formulas work for all points, including points of order 2
|
|
772
|
-
* and points at infinity:
|
|
773
|
-
* - If y = 0 then z' = 0. But there is no such point in P-256
|
|
774
|
-
* anyway.
|
|
775
|
-
* - If z = 0 then z' = 0.
|
|
776
|
-
*/
|
|
777
|
-
uint64_t t1[5], t2[5], t3[5], t4[5];
|
|
778
|
-
|
|
779
|
-
/*
|
|
780
|
-
* Compute z^2 in t1.
|
|
781
|
-
*/
|
|
782
|
-
f256_montysquare(t1, P->z);
|
|
783
|
-
|
|
784
|
-
/*
|
|
785
|
-
* Compute x-z^2 in t2 and x+z^2 in t1.
|
|
786
|
-
*/
|
|
787
|
-
f256_add(t2, P->x, t1);
|
|
788
|
-
f256_sub(t1, P->x, t1);
|
|
789
|
-
|
|
790
|
-
/*
|
|
791
|
-
* Compute 3*(x+z^2)*(x-z^2) in t1.
|
|
792
|
-
*/
|
|
793
|
-
f256_montymul(t3, t1, t2);
|
|
794
|
-
f256_add(t1, t3, t3);
|
|
795
|
-
f256_add(t1, t3, t1);
|
|
796
|
-
|
|
797
|
-
/*
|
|
798
|
-
* Compute 4*x*y^2 (in t2) and 2*y^2 (in t3).
|
|
799
|
-
*/
|
|
800
|
-
f256_montysquare(t3, P->y);
|
|
801
|
-
f256_add(t3, t3, t3);
|
|
802
|
-
f256_montymul(t2, P->x, t3);
|
|
803
|
-
f256_add(t2, t2, t2);
|
|
804
|
-
|
|
805
|
-
/*
|
|
806
|
-
* Compute x' = m^2 - 2*s.
|
|
807
|
-
*/
|
|
808
|
-
f256_montysquare(P->x, t1);
|
|
809
|
-
f256_sub(P->x, P->x, t2);
|
|
810
|
-
f256_sub(P->x, P->x, t2);
|
|
811
|
-
|
|
812
|
-
/*
|
|
813
|
-
* Compute z' = 2*y*z.
|
|
814
|
-
*/
|
|
815
|
-
f256_montymul(t4, P->y, P->z);
|
|
816
|
-
f256_add(P->z, t4, t4);
|
|
817
|
-
f256_partial_reduce(P->z);
|
|
818
|
-
|
|
819
|
-
/*
|
|
820
|
-
* Compute y' = m*(s - x') - 8*y^4. Note that we already have
|
|
821
|
-
* 2*y^2 in t3.
|
|
822
|
-
*/
|
|
823
|
-
f256_sub(t2, t2, P->x);
|
|
824
|
-
f256_montymul(P->y, t1, t2);
|
|
825
|
-
f256_montysquare(t4, t3);
|
|
826
|
-
f256_add(t4, t4, t4);
|
|
827
|
-
f256_sub(P->y, P->y, t4);
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
/*
|
|
831
|
-
* Point addition (Jacobian coordinates): P1 is replaced with P1+P2.
|
|
832
|
-
* This function computes the wrong result in the following cases:
|
|
833
|
-
*
|
|
834
|
-
* - If P1 == 0 but P2 != 0
|
|
835
|
-
* - If P1 != 0 but P2 == 0
|
|
836
|
-
* - If P1 == P2
|
|
837
|
-
*
|
|
838
|
-
* In all three cases, P1 is set to the point at infinity.
|
|
839
|
-
*
|
|
840
|
-
* Returned value is 0 if one of the following occurs:
|
|
841
|
-
*
|
|
842
|
-
* - P1 and P2 have the same Y coordinate.
|
|
843
|
-
* - P1 == 0 and P2 == 0.
|
|
844
|
-
* - The Y coordinate of one of the points is 0 and the other point is
|
|
845
|
-
* the point at infinity.
|
|
846
|
-
*
|
|
847
|
-
* The third case cannot actually happen with valid points, since a point
|
|
848
|
-
* with Y == 0 is a point of order 2, and there is no point of order 2 on
|
|
849
|
-
* curve P-256.
|
|
850
|
-
*
|
|
851
|
-
* Therefore, assuming that P1 != 0 and P2 != 0 on input, then the caller
|
|
852
|
-
* can apply the following:
|
|
853
|
-
*
|
|
854
|
-
* - If the result is not the point at infinity, then it is correct.
|
|
855
|
-
* - Otherwise, if the returned value is 1, then this is a case of
|
|
856
|
-
* P1+P2 == 0, so the result is indeed the point at infinity.
|
|
857
|
-
* - Otherwise, P1 == P2, so a "double" operation should have been
|
|
858
|
-
* performed.
|
|
859
|
-
*
|
|
860
|
-
* Note that you can get a returned value of 0 with a correct result,
|
|
861
|
-
* e.g. if P1 and P2 have the same Y coordinate, but distinct X coordinates.
|
|
862
|
-
*/
|
|
863
|
-
static uint32_t
|
|
864
|
-
p256_add(p256_jacobian *P1, const p256_jacobian *P2)
|
|
865
|
-
{
|
|
866
|
-
/*
|
|
867
|
-
* Addtions formulas are:
|
|
868
|
-
*
|
|
869
|
-
* u1 = x1 * z2^2
|
|
870
|
-
* u2 = x2 * z1^2
|
|
871
|
-
* s1 = y1 * z2^3
|
|
872
|
-
* s2 = y2 * z1^3
|
|
873
|
-
* h = u2 - u1
|
|
874
|
-
* r = s2 - s1
|
|
875
|
-
* x3 = r^2 - h^3 - 2 * u1 * h^2
|
|
876
|
-
* y3 = r * (u1 * h^2 - x3) - s1 * h^3
|
|
877
|
-
* z3 = h * z1 * z2
|
|
878
|
-
*/
|
|
879
|
-
uint64_t t1[5], t2[5], t3[5], t4[5], t5[5], t6[5], t7[5], tt;
|
|
880
|
-
uint32_t ret;
|
|
881
|
-
|
|
882
|
-
/*
|
|
883
|
-
* Compute u1 = x1*z2^2 (in t1) and s1 = y1*z2^3 (in t3).
|
|
884
|
-
*/
|
|
885
|
-
f256_montysquare(t3, P2->z);
|
|
886
|
-
f256_montymul(t1, P1->x, t3);
|
|
887
|
-
f256_montymul(t4, P2->z, t3);
|
|
888
|
-
f256_montymul(t3, P1->y, t4);
|
|
889
|
-
|
|
890
|
-
/*
|
|
891
|
-
* Compute u2 = x2*z1^2 (in t2) and s2 = y2*z1^3 (in t4).
|
|
892
|
-
*/
|
|
893
|
-
f256_montysquare(t4, P1->z);
|
|
894
|
-
f256_montymul(t2, P2->x, t4);
|
|
895
|
-
f256_montymul(t5, P1->z, t4);
|
|
896
|
-
f256_montymul(t4, P2->y, t5);
|
|
897
|
-
|
|
898
|
-
/*
|
|
899
|
-
* Compute h = h2 - u1 (in t2) and r = s2 - s1 (in t4).
|
|
900
|
-
* We need to test whether r is zero, so we will do some extra
|
|
901
|
-
* reduce.
|
|
902
|
-
*/
|
|
903
|
-
f256_sub(t2, t2, t1);
|
|
904
|
-
f256_sub(t4, t4, t3);
|
|
905
|
-
f256_final_reduce(t4);
|
|
906
|
-
tt = t4[0] | t4[1] | t4[2] | t4[3] | t4[4];
|
|
907
|
-
ret = (uint32_t)(tt | (tt >> 32));
|
|
908
|
-
ret = (ret | -ret) >> 31;
|
|
909
|
-
|
|
910
|
-
/*
|
|
911
|
-
* Compute u1*h^2 (in t6) and h^3 (in t5);
|
|
912
|
-
*/
|
|
913
|
-
f256_montysquare(t7, t2);
|
|
914
|
-
f256_montymul(t6, t1, t7);
|
|
915
|
-
f256_montymul(t5, t7, t2);
|
|
916
|
-
|
|
917
|
-
/*
|
|
918
|
-
* Compute x3 = r^2 - h^3 - 2*u1*h^2.
|
|
919
|
-
*/
|
|
920
|
-
f256_montysquare(P1->x, t4);
|
|
921
|
-
f256_sub(P1->x, P1->x, t5);
|
|
922
|
-
f256_sub(P1->x, P1->x, t6);
|
|
923
|
-
f256_sub(P1->x, P1->x, t6);
|
|
924
|
-
|
|
925
|
-
/*
|
|
926
|
-
* Compute y3 = r*(u1*h^2 - x3) - s1*h^3.
|
|
927
|
-
*/
|
|
928
|
-
f256_sub(t6, t6, P1->x);
|
|
929
|
-
f256_montymul(P1->y, t4, t6);
|
|
930
|
-
f256_montymul(t1, t5, t3);
|
|
931
|
-
f256_sub(P1->y, P1->y, t1);
|
|
932
|
-
|
|
933
|
-
/*
|
|
934
|
-
* Compute z3 = h*z1*z2.
|
|
935
|
-
*/
|
|
936
|
-
f256_montymul(t1, P1->z, P2->z);
|
|
937
|
-
f256_montymul(P1->z, t1, t2);
|
|
938
|
-
|
|
939
|
-
return ret;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
/*
|
|
943
|
-
* Point addition (mixed coordinates): P1 is replaced with P1+P2.
|
|
944
|
-
* This is a specialised function for the case when P2 is a non-zero point
|
|
945
|
-
* in affine coordinates.
|
|
946
|
-
*
|
|
947
|
-
* This function computes the wrong result in the following cases:
|
|
948
|
-
*
|
|
949
|
-
* - If P1 == 0
|
|
950
|
-
* - If P1 == P2
|
|
951
|
-
*
|
|
952
|
-
* In both cases, P1 is set to the point at infinity.
|
|
953
|
-
*
|
|
954
|
-
* Returned value is 0 if one of the following occurs:
|
|
955
|
-
*
|
|
956
|
-
* - P1 and P2 have the same Y (affine) coordinate.
|
|
957
|
-
* - The Y coordinate of P2 is 0 and P1 is the point at infinity.
|
|
958
|
-
*
|
|
959
|
-
* The second case cannot actually happen with valid points, since a point
|
|
960
|
-
* with Y == 0 is a point of order 2, and there is no point of order 2 on
|
|
961
|
-
* curve P-256.
|
|
962
|
-
*
|
|
963
|
-
* Therefore, assuming that P1 != 0 on input, then the caller
|
|
964
|
-
* can apply the following:
|
|
965
|
-
*
|
|
966
|
-
* - If the result is not the point at infinity, then it is correct.
|
|
967
|
-
* - Otherwise, if the returned value is 1, then this is a case of
|
|
968
|
-
* P1+P2 == 0, so the result is indeed the point at infinity.
|
|
969
|
-
* - Otherwise, P1 == P2, so a "double" operation should have been
|
|
970
|
-
* performed.
|
|
971
|
-
*
|
|
972
|
-
* Again, a value of 0 may be returned in some cases where the addition
|
|
973
|
-
* result is correct.
|
|
974
|
-
*/
|
|
975
|
-
static uint32_t
|
|
976
|
-
p256_add_mixed(p256_jacobian *P1, const p256_affine *P2)
|
|
977
|
-
{
|
|
978
|
-
/*
|
|
979
|
-
* Addtions formulas are:
|
|
980
|
-
*
|
|
981
|
-
* u1 = x1
|
|
982
|
-
* u2 = x2 * z1^2
|
|
983
|
-
* s1 = y1
|
|
984
|
-
* s2 = y2 * z1^3
|
|
985
|
-
* h = u2 - u1
|
|
986
|
-
* r = s2 - s1
|
|
987
|
-
* x3 = r^2 - h^3 - 2 * u1 * h^2
|
|
988
|
-
* y3 = r * (u1 * h^2 - x3) - s1 * h^3
|
|
989
|
-
* z3 = h * z1
|
|
990
|
-
*/
|
|
991
|
-
uint64_t t1[5], t2[5], t3[5], t4[5], t5[5], t6[5], t7[5], tt;
|
|
992
|
-
uint32_t ret;
|
|
993
|
-
|
|
994
|
-
/*
|
|
995
|
-
* Compute u1 = x1 (in t1) and s1 = y1 (in t3).
|
|
996
|
-
*/
|
|
997
|
-
memcpy(t1, P1->x, sizeof t1);
|
|
998
|
-
memcpy(t3, P1->y, sizeof t3);
|
|
999
|
-
|
|
1000
|
-
/*
|
|
1001
|
-
* Compute u2 = x2*z1^2 (in t2) and s2 = y2*z1^3 (in t4).
|
|
1002
|
-
*/
|
|
1003
|
-
f256_montysquare(t4, P1->z);
|
|
1004
|
-
f256_montymul(t2, P2->x, t4);
|
|
1005
|
-
f256_montymul(t5, P1->z, t4);
|
|
1006
|
-
f256_montymul(t4, P2->y, t5);
|
|
1007
|
-
|
|
1008
|
-
/*
|
|
1009
|
-
* Compute h = h2 - u1 (in t2) and r = s2 - s1 (in t4).
|
|
1010
|
-
* We need to test whether r is zero, so we will do some extra
|
|
1011
|
-
* reduce.
|
|
1012
|
-
*/
|
|
1013
|
-
f256_sub(t2, t2, t1);
|
|
1014
|
-
f256_sub(t4, t4, t3);
|
|
1015
|
-
f256_final_reduce(t4);
|
|
1016
|
-
tt = t4[0] | t4[1] | t4[2] | t4[3] | t4[4];
|
|
1017
|
-
ret = (uint32_t)(tt | (tt >> 32));
|
|
1018
|
-
ret = (ret | -ret) >> 31;
|
|
1019
|
-
|
|
1020
|
-
/*
|
|
1021
|
-
* Compute u1*h^2 (in t6) and h^3 (in t5);
|
|
1022
|
-
*/
|
|
1023
|
-
f256_montysquare(t7, t2);
|
|
1024
|
-
f256_montymul(t6, t1, t7);
|
|
1025
|
-
f256_montymul(t5, t7, t2);
|
|
1026
|
-
|
|
1027
|
-
/*
|
|
1028
|
-
* Compute x3 = r^2 - h^3 - 2*u1*h^2.
|
|
1029
|
-
*/
|
|
1030
|
-
f256_montysquare(P1->x, t4);
|
|
1031
|
-
f256_sub(P1->x, P1->x, t5);
|
|
1032
|
-
f256_sub(P1->x, P1->x, t6);
|
|
1033
|
-
f256_sub(P1->x, P1->x, t6);
|
|
1034
|
-
|
|
1035
|
-
/*
|
|
1036
|
-
* Compute y3 = r*(u1*h^2 - x3) - s1*h^3.
|
|
1037
|
-
*/
|
|
1038
|
-
f256_sub(t6, t6, P1->x);
|
|
1039
|
-
f256_montymul(P1->y, t4, t6);
|
|
1040
|
-
f256_montymul(t1, t5, t3);
|
|
1041
|
-
f256_sub(P1->y, P1->y, t1);
|
|
1042
|
-
|
|
1043
|
-
/*
|
|
1044
|
-
* Compute z3 = h*z1*z2.
|
|
1045
|
-
*/
|
|
1046
|
-
f256_montymul(P1->z, P1->z, t2);
|
|
1047
|
-
|
|
1048
|
-
return ret;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
#if 0
|
|
1052
|
-
/* unused */
|
|
1053
|
-
/*
|
|
1054
|
-
* Point addition (mixed coordinates, complete): P1 is replaced with P1+P2.
|
|
1055
|
-
* This is a specialised function for the case when P2 is a non-zero point
|
|
1056
|
-
* in affine coordinates.
|
|
1057
|
-
*
|
|
1058
|
-
* This function returns the correct result in all cases.
|
|
1059
|
-
*/
|
|
1060
|
-
static uint32_t
|
|
1061
|
-
p256_add_complete_mixed(p256_jacobian *P1, const p256_affine *P2)
|
|
1062
|
-
{
|
|
1063
|
-
/*
|
|
1064
|
-
* Addtions formulas, in the general case, are:
|
|
1065
|
-
*
|
|
1066
|
-
* u1 = x1
|
|
1067
|
-
* u2 = x2 * z1^2
|
|
1068
|
-
* s1 = y1
|
|
1069
|
-
* s2 = y2 * z1^3
|
|
1070
|
-
* h = u2 - u1
|
|
1071
|
-
* r = s2 - s1
|
|
1072
|
-
* x3 = r^2 - h^3 - 2 * u1 * h^2
|
|
1073
|
-
* y3 = r * (u1 * h^2 - x3) - s1 * h^3
|
|
1074
|
-
* z3 = h * z1
|
|
1075
|
-
*
|
|
1076
|
-
* These formulas mishandle the two following cases:
|
|
1077
|
-
*
|
|
1078
|
-
* - If P1 is the point-at-infinity (z1 = 0), then z3 is
|
|
1079
|
-
* incorrectly set to 0.
|
|
1080
|
-
*
|
|
1081
|
-
* - If P1 = P2, then u1 = u2 and s1 = s2, and x3, y3 and z3
|
|
1082
|
-
* are all set to 0.
|
|
1083
|
-
*
|
|
1084
|
-
* However, if P1 + P2 = 0, then u1 = u2 but s1 != s2, and then
|
|
1085
|
-
* we correctly get z3 = 0 (the point-at-infinity).
|
|
1086
|
-
*
|
|
1087
|
-
* To fix the case P1 = 0, we perform at the end a copy of P2
|
|
1088
|
-
* over P1, conditional to z1 = 0.
|
|
1089
|
-
*
|
|
1090
|
-
* For P1 = P2: in that case, both h and r are set to 0, and
|
|
1091
|
-
* we get x3, y3 and z3 equal to 0. We can test for that
|
|
1092
|
-
* occurrence to make a mask which will be all-one if P1 = P2,
|
|
1093
|
-
* or all-zero otherwise; then we can compute the double of P2
|
|
1094
|
-
* and add it, combined with the mask, to (x3,y3,z3).
|
|
1095
|
-
*
|
|
1096
|
-
* Using the doubling formulas in p256_double() on (x2,y2),
|
|
1097
|
-
* simplifying since P2 is affine (i.e. z2 = 1, implicitly),
|
|
1098
|
-
* we get:
|
|
1099
|
-
* s = 4*x2*y2^2
|
|
1100
|
-
* m = 3*(x2 + 1)*(x2 - 1)
|
|
1101
|
-
* x' = m^2 - 2*s
|
|
1102
|
-
* y' = m*(s - x') - 8*y2^4
|
|
1103
|
-
* z' = 2*y2
|
|
1104
|
-
* which requires only 6 multiplications. Added to the 11
|
|
1105
|
-
* multiplications of the normal mixed addition in Jacobian
|
|
1106
|
-
* coordinates, we get a cost of 17 multiplications in total.
|
|
1107
|
-
*/
|
|
1108
|
-
uint64_t t1[5], t2[5], t3[5], t4[5], t5[5], t6[5], t7[5], tt, zz;
|
|
1109
|
-
int i;
|
|
1110
|
-
|
|
1111
|
-
/*
|
|
1112
|
-
* Set zz to -1 if P1 is the point at infinity, 0 otherwise.
|
|
1113
|
-
*/
|
|
1114
|
-
zz = P1->z[0] | P1->z[1] | P1->z[2] | P1->z[3] | P1->z[4];
|
|
1115
|
-
zz = ((zz | -zz) >> 63) - (uint64_t)1;
|
|
1116
|
-
|
|
1117
|
-
/*
|
|
1118
|
-
* Compute u1 = x1 (in t1) and s1 = y1 (in t3).
|
|
1119
|
-
*/
|
|
1120
|
-
memcpy(t1, P1->x, sizeof t1);
|
|
1121
|
-
memcpy(t3, P1->y, sizeof t3);
|
|
1122
|
-
|
|
1123
|
-
/*
|
|
1124
|
-
* Compute u2 = x2*z1^2 (in t2) and s2 = y2*z1^3 (in t4).
|
|
1125
|
-
*/
|
|
1126
|
-
f256_montysquare(t4, P1->z);
|
|
1127
|
-
f256_montymul(t2, P2->x, t4);
|
|
1128
|
-
f256_montymul(t5, P1->z, t4);
|
|
1129
|
-
f256_montymul(t4, P2->y, t5);
|
|
1130
|
-
|
|
1131
|
-
/*
|
|
1132
|
-
* Compute h = h2 - u1 (in t2) and r = s2 - s1 (in t4).
|
|
1133
|
-
* reduce.
|
|
1134
|
-
*/
|
|
1135
|
-
f256_sub(t2, t2, t1);
|
|
1136
|
-
f256_sub(t4, t4, t3);
|
|
1137
|
-
|
|
1138
|
-
/*
|
|
1139
|
-
* If both h = 0 and r = 0, then P1 = P2, and we want to set
|
|
1140
|
-
* the mask tt to -1; otherwise, the mask will be 0.
|
|
1141
|
-
*/
|
|
1142
|
-
f256_final_reduce(t2);
|
|
1143
|
-
f256_final_reduce(t4);
|
|
1144
|
-
tt = t2[0] | t2[1] | t2[2] | t2[3] | t2[4]
|
|
1145
|
-
| t4[0] | t4[1] | t4[2] | t4[3] | t4[4];
|
|
1146
|
-
tt = ((tt | -tt) >> 63) - (uint64_t)1;
|
|
1147
|
-
|
|
1148
|
-
/*
|
|
1149
|
-
* Compute u1*h^2 (in t6) and h^3 (in t5);
|
|
1150
|
-
*/
|
|
1151
|
-
f256_montysquare(t7, t2);
|
|
1152
|
-
f256_montymul(t6, t1, t7);
|
|
1153
|
-
f256_montymul(t5, t7, t2);
|
|
1154
|
-
|
|
1155
|
-
/*
|
|
1156
|
-
* Compute x3 = r^2 - h^3 - 2*u1*h^2.
|
|
1157
|
-
*/
|
|
1158
|
-
f256_montysquare(P1->x, t4);
|
|
1159
|
-
f256_sub(P1->x, P1->x, t5);
|
|
1160
|
-
f256_sub(P1->x, P1->x, t6);
|
|
1161
|
-
f256_sub(P1->x, P1->x, t6);
|
|
1162
|
-
|
|
1163
|
-
/*
|
|
1164
|
-
* Compute y3 = r*(u1*h^2 - x3) - s1*h^3.
|
|
1165
|
-
*/
|
|
1166
|
-
f256_sub(t6, t6, P1->x);
|
|
1167
|
-
f256_montymul(P1->y, t4, t6);
|
|
1168
|
-
f256_montymul(t1, t5, t3);
|
|
1169
|
-
f256_sub(P1->y, P1->y, t1);
|
|
1170
|
-
|
|
1171
|
-
/*
|
|
1172
|
-
* Compute z3 = h*z1.
|
|
1173
|
-
*/
|
|
1174
|
-
f256_montymul(P1->z, P1->z, t2);
|
|
1175
|
-
|
|
1176
|
-
/*
|
|
1177
|
-
* The "double" result, in case P1 = P2.
|
|
1178
|
-
*/
|
|
1179
|
-
|
|
1180
|
-
/*
|
|
1181
|
-
* Compute z' = 2*y2 (in t1).
|
|
1182
|
-
*/
|
|
1183
|
-
f256_add(t1, P2->y, P2->y);
|
|
1184
|
-
f256_partial_reduce(t1);
|
|
1185
|
-
|
|
1186
|
-
/*
|
|
1187
|
-
* Compute 2*(y2^2) (in t2) and s = 4*x2*(y2^2) (in t3).
|
|
1188
|
-
*/
|
|
1189
|
-
f256_montysquare(t2, P2->y);
|
|
1190
|
-
f256_add(t2, t2, t2);
|
|
1191
|
-
f256_add(t3, t2, t2);
|
|
1192
|
-
f256_montymul(t3, P2->x, t3);
|
|
1193
|
-
|
|
1194
|
-
/*
|
|
1195
|
-
* Compute m = 3*(x2^2 - 1) (in t4).
|
|
1196
|
-
*/
|
|
1197
|
-
f256_montysquare(t4, P2->x);
|
|
1198
|
-
f256_sub(t4, t4, F256_R);
|
|
1199
|
-
f256_add(t5, t4, t4);
|
|
1200
|
-
f256_add(t4, t4, t5);
|
|
1201
|
-
|
|
1202
|
-
/*
|
|
1203
|
-
* Compute x' = m^2 - 2*s (in t5).
|
|
1204
|
-
*/
|
|
1205
|
-
f256_montysquare(t5, t4);
|
|
1206
|
-
f256_sub(t5, t3);
|
|
1207
|
-
f256_sub(t5, t3);
|
|
1208
|
-
|
|
1209
|
-
/*
|
|
1210
|
-
* Compute y' = m*(s - x') - 8*y2^4 (in t6).
|
|
1211
|
-
*/
|
|
1212
|
-
f256_sub(t6, t3, t5);
|
|
1213
|
-
f256_montymul(t6, t6, t4);
|
|
1214
|
-
f256_montysquare(t7, t2);
|
|
1215
|
-
f256_sub(t6, t6, t7);
|
|
1216
|
-
f256_sub(t6, t6, t7);
|
|
1217
|
-
|
|
1218
|
-
/*
|
|
1219
|
-
* We now have the alternate (doubling) coordinates in (t5,t6,t1).
|
|
1220
|
-
* We combine them with (x3,y3,z3).
|
|
1221
|
-
*/
|
|
1222
|
-
for (i = 0; i < 5; i ++) {
|
|
1223
|
-
P1->x[i] |= tt & t5[i];
|
|
1224
|
-
P1->y[i] |= tt & t6[i];
|
|
1225
|
-
P1->z[i] |= tt & t1[i];
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
/*
|
|
1229
|
-
* If P1 = 0, then we get z3 = 0 (which is invalid); if z1 is 0,
|
|
1230
|
-
* then we want to replace the result with a copy of P2. The
|
|
1231
|
-
* test on z1 was done at the start, in the zz mask.
|
|
1232
|
-
*/
|
|
1233
|
-
for (i = 0; i < 5; i ++) {
|
|
1234
|
-
P1->x[i] ^= zz & (P1->x[i] ^ P2->x[i]);
|
|
1235
|
-
P1->y[i] ^= zz & (P1->y[i] ^ P2->y[i]);
|
|
1236
|
-
P1->z[i] ^= zz & (P1->z[i] ^ F256_R[i]);
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
#endif
|
|
1240
|
-
|
|
1241
|
-
/*
|
|
1242
|
-
* Inner function for computing a point multiplication. A window is
|
|
1243
|
-
* provided, with points 1*P to 15*P in affine coordinates.
|
|
1244
|
-
*
|
|
1245
|
-
* Assumptions:
|
|
1246
|
-
* - All provided points are valid points on the curve.
|
|
1247
|
-
* - Multiplier is non-zero, and smaller than the curve order.
|
|
1248
|
-
* - Everything is in Montgomery representation.
|
|
1249
|
-
*/
|
|
1250
|
-
static void
|
|
1251
|
-
point_mul_inner(p256_jacobian *R, const p256_affine *W,
|
|
1252
|
-
const unsigned char *k, size_t klen)
|
|
1253
|
-
{
|
|
1254
|
-
p256_jacobian Q;
|
|
1255
|
-
uint32_t qz;
|
|
1256
|
-
|
|
1257
|
-
memset(&Q, 0, sizeof Q);
|
|
1258
|
-
qz = 1;
|
|
1259
|
-
while (klen -- > 0) {
|
|
1260
|
-
int i;
|
|
1261
|
-
unsigned bk;
|
|
1262
|
-
|
|
1263
|
-
bk = *k ++;
|
|
1264
|
-
for (i = 0; i < 2; i ++) {
|
|
1265
|
-
uint32_t bits;
|
|
1266
|
-
uint32_t bnz;
|
|
1267
|
-
p256_affine T;
|
|
1268
|
-
p256_jacobian U;
|
|
1269
|
-
uint32_t n;
|
|
1270
|
-
int j;
|
|
1271
|
-
uint64_t m;
|
|
1272
|
-
|
|
1273
|
-
p256_double(&Q);
|
|
1274
|
-
p256_double(&Q);
|
|
1275
|
-
p256_double(&Q);
|
|
1276
|
-
p256_double(&Q);
|
|
1277
|
-
bits = (bk >> 4) & 0x0F;
|
|
1278
|
-
bnz = NEQ(bits, 0);
|
|
1279
|
-
|
|
1280
|
-
/*
|
|
1281
|
-
* Lookup point in window. If the bits are 0,
|
|
1282
|
-
* we get something invalid, which is not a
|
|
1283
|
-
* problem because we will use it only if the
|
|
1284
|
-
* bits are non-zero.
|
|
1285
|
-
*/
|
|
1286
|
-
memset(&T, 0, sizeof T);
|
|
1287
|
-
for (n = 0; n < 15; n ++) {
|
|
1288
|
-
m = -(uint64_t)EQ(bits, n + 1);
|
|
1289
|
-
T.x[0] |= m & W[n].x[0];
|
|
1290
|
-
T.x[1] |= m & W[n].x[1];
|
|
1291
|
-
T.x[2] |= m & W[n].x[2];
|
|
1292
|
-
T.x[3] |= m & W[n].x[3];
|
|
1293
|
-
T.x[4] |= m & W[n].x[4];
|
|
1294
|
-
T.y[0] |= m & W[n].y[0];
|
|
1295
|
-
T.y[1] |= m & W[n].y[1];
|
|
1296
|
-
T.y[2] |= m & W[n].y[2];
|
|
1297
|
-
T.y[3] |= m & W[n].y[3];
|
|
1298
|
-
T.y[4] |= m & W[n].y[4];
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
U = Q;
|
|
1302
|
-
p256_add_mixed(&U, &T);
|
|
1303
|
-
|
|
1304
|
-
/*
|
|
1305
|
-
* If qz is still 1, then Q was all-zeros, and this
|
|
1306
|
-
* is conserved through p256_double().
|
|
1307
|
-
*/
|
|
1308
|
-
m = -(uint64_t)(bnz & qz);
|
|
1309
|
-
for (j = 0; j < 5; j ++) {
|
|
1310
|
-
Q.x[j] ^= m & (Q.x[j] ^ T.x[j]);
|
|
1311
|
-
Q.y[j] ^= m & (Q.y[j] ^ T.y[j]);
|
|
1312
|
-
Q.z[j] ^= m & (Q.z[j] ^ F256_R[j]);
|
|
1313
|
-
}
|
|
1314
|
-
CCOPY(bnz & ~qz, &Q, &U, sizeof Q);
|
|
1315
|
-
qz &= ~bnz;
|
|
1316
|
-
bk <<= 4;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
*R = Q;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
/*
|
|
1323
|
-
* Convert a window from Jacobian to affine coordinates. A single
|
|
1324
|
-
* field inversion is used. This function works for windows up to
|
|
1325
|
-
* 32 elements.
|
|
1326
|
-
*
|
|
1327
|
-
* The destination array (aff[]) and the source array (jac[]) may
|
|
1328
|
-
* overlap, provided that the start of aff[] is not after the start of
|
|
1329
|
-
* jac[]. Even if the arrays do _not_ overlap, the source array is
|
|
1330
|
-
* modified.
|
|
1331
|
-
*/
|
|
1332
|
-
static void
|
|
1333
|
-
window_to_affine(p256_affine *aff, p256_jacobian *jac, int num)
|
|
1334
|
-
{
|
|
1335
|
-
/*
|
|
1336
|
-
* Convert the window points to affine coordinates. We use the
|
|
1337
|
-
* following trick to mutualize the inversion computation: if
|
|
1338
|
-
* we have z1, z2, z3, and z4, and want to invert all of them,
|
|
1339
|
-
* we compute u = 1/(z1*z2*z3*z4), and then we have:
|
|
1340
|
-
* 1/z1 = u*z2*z3*z4
|
|
1341
|
-
* 1/z2 = u*z1*z3*z4
|
|
1342
|
-
* 1/z3 = u*z1*z2*z4
|
|
1343
|
-
* 1/z4 = u*z1*z2*z3
|
|
1344
|
-
*
|
|
1345
|
-
* The partial products are computed recursively:
|
|
1346
|
-
*
|
|
1347
|
-
* - on input (z_1,z_2), return (z_2,z_1) and z_1*z_2
|
|
1348
|
-
* - on input (z_1,z_2,... z_n):
|
|
1349
|
-
* recurse on (z_1,z_2,... z_(n/2)) -> r1 and m1
|
|
1350
|
-
* recurse on (z_(n/2+1),z_(n/2+2)... z_n) -> r2 and m2
|
|
1351
|
-
* multiply elements of r1 by m2 -> s1
|
|
1352
|
-
* multiply elements of r2 by m1 -> s2
|
|
1353
|
-
* return r1||r2 and m1*m2
|
|
1354
|
-
*
|
|
1355
|
-
* In the example below, we suppose that we have 14 elements.
|
|
1356
|
-
* Let z1, z2,... zE be the 14 values to invert (index noted in
|
|
1357
|
-
* hexadecimal, starting at 1).
|
|
1358
|
-
*
|
|
1359
|
-
* - Depth 1:
|
|
1360
|
-
* swap(z1, z2); z12 = z1*z2
|
|
1361
|
-
* swap(z3, z4); z34 = z3*z4
|
|
1362
|
-
* swap(z5, z6); z56 = z5*z6
|
|
1363
|
-
* swap(z7, z8); z78 = z7*z8
|
|
1364
|
-
* swap(z9, zA); z9A = z9*zA
|
|
1365
|
-
* swap(zB, zC); zBC = zB*zC
|
|
1366
|
-
* swap(zD, zE); zDE = zD*zE
|
|
1367
|
-
*
|
|
1368
|
-
* - Depth 2:
|
|
1369
|
-
* z1 <- z1*z34, z2 <- z2*z34, z3 <- z3*z12, z4 <- z4*z12
|
|
1370
|
-
* z1234 = z12*z34
|
|
1371
|
-
* z5 <- z5*z78, z6 <- z6*z78, z7 <- z7*z56, z8 <- z8*z56
|
|
1372
|
-
* z5678 = z56*z78
|
|
1373
|
-
* z9 <- z9*zBC, zA <- zA*zBC, zB <- zB*z9A, zC <- zC*z9A
|
|
1374
|
-
* z9ABC = z9A*zBC
|
|
1375
|
-
*
|
|
1376
|
-
* - Depth 3:
|
|
1377
|
-
* z1 <- z1*z5678, z2 <- z2*z5678, z3 <- z3*z5678, z4 <- z4*z5678
|
|
1378
|
-
* z5 <- z5*z1234, z6 <- z6*z1234, z7 <- z7*z1234, z8 <- z8*z1234
|
|
1379
|
-
* z12345678 = z1234*z5678
|
|
1380
|
-
* z9 <- z9*zDE, zA <- zA*zDE, zB <- zB*zDE, zC <- zC*zDE
|
|
1381
|
-
* zD <- zD*z9ABC, zE*z9ABC
|
|
1382
|
-
* z9ABCDE = z9ABC*zDE
|
|
1383
|
-
*
|
|
1384
|
-
* - Depth 4:
|
|
1385
|
-
* multiply z1..z8 by z9ABCDE
|
|
1386
|
-
* multiply z9..zE by z12345678
|
|
1387
|
-
* final z = z12345678*z9ABCDE
|
|
1388
|
-
*/
|
|
1389
|
-
|
|
1390
|
-
uint64_t z[16][5];
|
|
1391
|
-
int i, k, s;
|
|
1392
|
-
#define zt (z[15])
|
|
1393
|
-
#define zu (z[14])
|
|
1394
|
-
#define zv (z[13])
|
|
1395
|
-
|
|
1396
|
-
/*
|
|
1397
|
-
* First recursion step (pairwise swapping and multiplication).
|
|
1398
|
-
* If there is an odd number of elements, then we "invent" an
|
|
1399
|
-
* extra one with coordinate Z = 1 (in Montgomery representation).
|
|
1400
|
-
*/
|
|
1401
|
-
for (i = 0; (i + 1) < num; i += 2) {
|
|
1402
|
-
memcpy(zt, jac[i].z, sizeof zt);
|
|
1403
|
-
memcpy(jac[i].z, jac[i + 1].z, sizeof zt);
|
|
1404
|
-
memcpy(jac[i + 1].z, zt, sizeof zt);
|
|
1405
|
-
f256_montymul(z[i >> 1], jac[i].z, jac[i + 1].z);
|
|
1406
|
-
}
|
|
1407
|
-
if ((num & 1) != 0) {
|
|
1408
|
-
memcpy(z[num >> 1], jac[num - 1].z, sizeof zt);
|
|
1409
|
-
memcpy(jac[num - 1].z, F256_R, sizeof F256_R);
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
/*
|
|
1413
|
-
* Perform further recursion steps. At the entry of each step,
|
|
1414
|
-
* the process has been done for groups of 's' points. The
|
|
1415
|
-
* integer k is the log2 of s.
|
|
1416
|
-
*/
|
|
1417
|
-
for (k = 1, s = 2; s < num; k ++, s <<= 1) {
|
|
1418
|
-
int n;
|
|
1419
|
-
|
|
1420
|
-
for (i = 0; i < num; i ++) {
|
|
1421
|
-
f256_montymul(jac[i].z, jac[i].z, z[(i >> k) ^ 1]);
|
|
1422
|
-
}
|
|
1423
|
-
n = (num + s - 1) >> k;
|
|
1424
|
-
for (i = 0; i < (n >> 1); i ++) {
|
|
1425
|
-
f256_montymul(z[i], z[i << 1], z[(i << 1) + 1]);
|
|
1426
|
-
}
|
|
1427
|
-
if ((n & 1) != 0) {
|
|
1428
|
-
memmove(z[n >> 1], z[n], sizeof zt);
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
/*
|
|
1433
|
-
* Invert the final result, and convert all points.
|
|
1434
|
-
*/
|
|
1435
|
-
f256_invert(zt, z[0]);
|
|
1436
|
-
for (i = 0; i < num; i ++) {
|
|
1437
|
-
f256_montymul(zv, jac[i].z, zt);
|
|
1438
|
-
f256_montysquare(zu, zv);
|
|
1439
|
-
f256_montymul(zv, zv, zu);
|
|
1440
|
-
f256_montymul(aff[i].x, jac[i].x, zu);
|
|
1441
|
-
f256_montymul(aff[i].y, jac[i].y, zv);
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
/*
|
|
1446
|
-
* Multiply the provided point by an integer.
|
|
1447
|
-
* Assumptions:
|
|
1448
|
-
* - Source point is a valid curve point.
|
|
1449
|
-
* - Source point is not the point-at-infinity.
|
|
1450
|
-
* - Integer is not 0, and is lower than the curve order.
|
|
1451
|
-
* If these conditions are not met, then the result is indeterminate
|
|
1452
|
-
* (but the process is still constant-time).
|
|
1453
|
-
*/
|
|
1454
|
-
static void
|
|
1455
|
-
p256_mul(p256_jacobian *P, const unsigned char *k, size_t klen)
|
|
1456
|
-
{
|
|
1457
|
-
union {
|
|
1458
|
-
p256_affine aff[15];
|
|
1459
|
-
p256_jacobian jac[15];
|
|
1460
|
-
} window;
|
|
1461
|
-
int i;
|
|
1462
|
-
|
|
1463
|
-
/*
|
|
1464
|
-
* Compute window, in Jacobian coordinates.
|
|
1465
|
-
*/
|
|
1466
|
-
window.jac[0] = *P;
|
|
1467
|
-
for (i = 2; i < 16; i ++) {
|
|
1468
|
-
window.jac[i - 1] = window.jac[(i >> 1) - 1];
|
|
1469
|
-
if ((i & 1) == 0) {
|
|
1470
|
-
p256_double(&window.jac[i - 1]);
|
|
1471
|
-
} else {
|
|
1472
|
-
p256_add(&window.jac[i - 1], &window.jac[i >> 1]);
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
/*
|
|
1477
|
-
* Convert the window points to affine coordinates. Point
|
|
1478
|
-
* window[0] is the source point, already in affine coordinates.
|
|
1479
|
-
*/
|
|
1480
|
-
window_to_affine(window.aff, window.jac, 15);
|
|
1481
|
-
|
|
1482
|
-
/*
|
|
1483
|
-
* Perform point multiplication.
|
|
1484
|
-
*/
|
|
1485
|
-
point_mul_inner(P, window.aff, k, klen);
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
/*
|
|
1489
|
-
* Precomputed window for the conventional generator: P256_Gwin[n]
|
|
1490
|
-
* contains (n+1)*G (affine coordinates, in Montgomery representation).
|
|
1491
|
-
*/
|
|
1492
|
-
static const p256_affine P256_Gwin[] = {
|
|
1493
|
-
{
|
|
1494
|
-
{ 0x30D418A9143C1, 0xC4FEDB60179E7, 0x62251075BA95F,
|
|
1495
|
-
0x5C669FB732B77, 0x08905F76B5375 },
|
|
1496
|
-
{ 0x5357CE95560A8, 0x43A19E45CDDF2, 0x21F3258B4AB8E,
|
|
1497
|
-
0xD8552E88688DD, 0x0571FF18A5885 }
|
|
1498
|
-
},
|
|
1499
|
-
{
|
|
1500
|
-
{ 0x46D410DDD64DF, 0x0B433827D8500, 0x1490D9AA6AE3C,
|
|
1501
|
-
0xA3A832205038D, 0x06BB32E52DCF3 },
|
|
1502
|
-
{ 0x48D361BEE1A57, 0xB7B236FF82F36, 0x042DBE152CD7C,
|
|
1503
|
-
0xA3AA9A8FB0E92, 0x08C577517A5B8 }
|
|
1504
|
-
},
|
|
1505
|
-
{
|
|
1506
|
-
{ 0x3F904EEBC1272, 0x9E87D81FBFFAC, 0xCBBC98B027F84,
|
|
1507
|
-
0x47E46AD77DD87, 0x06936A3FD6FF7 },
|
|
1508
|
-
{ 0x5C1FC983A7EBD, 0xC3861FE1AB04C, 0x2EE98E583E47A,
|
|
1509
|
-
0xC06A88208311A, 0x05F06A2AB587C }
|
|
1510
|
-
},
|
|
1511
|
-
{
|
|
1512
|
-
{ 0xB50D46918DCC5, 0xD7623C17374B0, 0x100AF24650A6E,
|
|
1513
|
-
0x76ABCDAACACE8, 0x077362F591B01 },
|
|
1514
|
-
{ 0xF24CE4CBABA68, 0x17AD6F4472D96, 0xDDD22E1762847,
|
|
1515
|
-
0x862EB6C36DEE5, 0x04B14C39CC5AB }
|
|
1516
|
-
},
|
|
1517
|
-
{
|
|
1518
|
-
{ 0x8AAEC45C61F5C, 0x9D4B9537DBE1B, 0x76C20C90EC649,
|
|
1519
|
-
0x3C7D41CB5AAD0, 0x0907960649052 },
|
|
1520
|
-
{ 0x9B4AE7BA4F107, 0xF75EB882BEB30, 0x7A1F6873C568E,
|
|
1521
|
-
0x915C540A9877E, 0x03A076BB9DD1E }
|
|
1522
|
-
},
|
|
1523
|
-
{
|
|
1524
|
-
{ 0x47373E77664A1, 0xF246CEE3E4039, 0x17A3AD55AE744,
|
|
1525
|
-
0x673C50A961A5B, 0x03074B5964213 },
|
|
1526
|
-
{ 0x6220D377E44BA, 0x30DFF14B593D3, 0x639F11299C2B5,
|
|
1527
|
-
0x75F5424D44CEF, 0x04C9916DEA07F }
|
|
1528
|
-
},
|
|
1529
|
-
{
|
|
1530
|
-
{ 0x354EA0173B4F1, 0x3C23C00F70746, 0x23BB082BD2021,
|
|
1531
|
-
0xE03E43EAAB50C, 0x03BA5119D3123 },
|
|
1532
|
-
{ 0xD0303F5B9D4DE, 0x17DA67BDD2847, 0xC941956742F2F,
|
|
1533
|
-
0x8670F933BDC77, 0x0AEDD9164E240 }
|
|
1534
|
-
},
|
|
1535
|
-
{
|
|
1536
|
-
{ 0x4CD19499A78FB, 0x4BF9B345527F1, 0x2CFC6B462AB5C,
|
|
1537
|
-
0x30CDF90F02AF0, 0x0763891F62652 },
|
|
1538
|
-
{ 0xA3A9532D49775, 0xD7F9EBA15F59D, 0x60BBF021E3327,
|
|
1539
|
-
0xF75C23C7B84BE, 0x06EC12F2C706D }
|
|
1540
|
-
},
|
|
1541
|
-
{
|
|
1542
|
-
{ 0x6E8F264E20E8E, 0xC79A7A84175C9, 0xC8EB00ABE6BFE,
|
|
1543
|
-
0x16A4CC09C0444, 0x005B3081D0C4E },
|
|
1544
|
-
{ 0x777AA45F33140, 0xDCE5D45E31EB7, 0xB12F1A56AF7BE,
|
|
1545
|
-
0xF9B2B6E019A88, 0x086659CDFD835 }
|
|
1546
|
-
},
|
|
1547
|
-
{
|
|
1548
|
-
{ 0xDBD19DC21EC8C, 0x94FCF81392C18, 0x250B4998F9868,
|
|
1549
|
-
0x28EB37D2CD648, 0x0C61C947E4B34 },
|
|
1550
|
-
{ 0x407880DD9E767, 0x0C83FBE080C2B, 0x9BE5D2C43A899,
|
|
1551
|
-
0xAB4EF7D2D6577, 0x08719A555B3B4 }
|
|
1552
|
-
},
|
|
1553
|
-
{
|
|
1554
|
-
{ 0x260A6245E4043, 0x53E7FDFE0EA7D, 0xAC1AB59DE4079,
|
|
1555
|
-
0x072EFF3A4158D, 0x0E7090F1949C9 },
|
|
1556
|
-
{ 0x85612B944E886, 0xE857F61C81A76, 0xAD643D250F939,
|
|
1557
|
-
0x88DAC0DAA891E, 0x089300244125B }
|
|
1558
|
-
},
|
|
1559
|
-
{
|
|
1560
|
-
{ 0x1AA7D26977684, 0x58A345A3304B7, 0x37385EABDEDEF,
|
|
1561
|
-
0x155E409D29DEE, 0x0EE1DF780B83E },
|
|
1562
|
-
{ 0x12D91CBB5B437, 0x65A8956370CAC, 0xDE6D66170ED2F,
|
|
1563
|
-
0xAC9B8228CFA8A, 0x0FF57C95C3238 }
|
|
1564
|
-
},
|
|
1565
|
-
{
|
|
1566
|
-
{ 0x25634B2ED7097, 0x9156FD30DCCC4, 0x9E98110E35676,
|
|
1567
|
-
0x7594CBCD43F55, 0x038477ACC395B },
|
|
1568
|
-
{ 0x2B90C00EE17FF, 0xF842ED2E33575, 0x1F5BC16874838,
|
|
1569
|
-
0x7968CD06422BD, 0x0BC0876AB9E7B }
|
|
1570
|
-
},
|
|
1571
|
-
{
|
|
1572
|
-
{ 0xA35BB0CF664AF, 0x68F9707E3A242, 0x832660126E48F,
|
|
1573
|
-
0x72D2717BF54C6, 0x0AAE7333ED12C },
|
|
1574
|
-
{ 0x2DB7995D586B1, 0xE732237C227B5, 0x65E7DBBE29569,
|
|
1575
|
-
0xBBBD8E4193E2A, 0x052706DC3EAA1 }
|
|
1576
|
-
},
|
|
1577
|
-
{
|
|
1578
|
-
{ 0xD8B7BC60055BE, 0xD76E27E4B72BC, 0x81937003CC23E,
|
|
1579
|
-
0xA090E337424E4, 0x02AA0E43EAD3D },
|
|
1580
|
-
{ 0x524F6383C45D2, 0x422A41B2540B8, 0x8A4797D766355,
|
|
1581
|
-
0xDF444EFA6DE77, 0x0042170A9079A }
|
|
1582
|
-
},
|
|
1583
|
-
};
|
|
1584
|
-
|
|
1585
|
-
/*
|
|
1586
|
-
* Multiply the conventional generator of the curve by the provided
|
|
1587
|
-
* integer. Return is written in *P.
|
|
1588
|
-
*
|
|
1589
|
-
* Assumptions:
|
|
1590
|
-
* - Integer is not 0, and is lower than the curve order.
|
|
1591
|
-
* If this conditions is not met, then the result is indeterminate
|
|
1592
|
-
* (but the process is still constant-time).
|
|
1593
|
-
*/
|
|
1594
|
-
static void
|
|
1595
|
-
p256_mulgen(p256_jacobian *P, const unsigned char *k, size_t klen)
|
|
1596
|
-
{
|
|
1597
|
-
point_mul_inner(P, P256_Gwin, k, klen);
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
/*
|
|
1601
|
-
* Return 1 if all of the following hold:
|
|
1602
|
-
* - klen <= 32
|
|
1603
|
-
* - k != 0
|
|
1604
|
-
* - k is lower than the curve order
|
|
1605
|
-
* Otherwise, return 0.
|
|
1606
|
-
*
|
|
1607
|
-
* Constant-time behaviour: only klen may be observable.
|
|
1608
|
-
*/
|
|
1609
|
-
static uint32_t
|
|
1610
|
-
check_scalar(const unsigned char *k, size_t klen)
|
|
1611
|
-
{
|
|
1612
|
-
uint32_t z;
|
|
1613
|
-
int32_t c;
|
|
1614
|
-
size_t u;
|
|
1615
|
-
|
|
1616
|
-
if (klen > 32) {
|
|
1617
|
-
return 0;
|
|
1618
|
-
}
|
|
1619
|
-
z = 0;
|
|
1620
|
-
for (u = 0; u < klen; u ++) {
|
|
1621
|
-
z |= k[u];
|
|
1622
|
-
}
|
|
1623
|
-
if (klen == 32) {
|
|
1624
|
-
c = 0;
|
|
1625
|
-
for (u = 0; u < klen; u ++) {
|
|
1626
|
-
c |= -(int32_t)EQ0(c) & CMP(k[u], P256_N[u]);
|
|
1627
|
-
}
|
|
1628
|
-
} else {
|
|
1629
|
-
c = -1;
|
|
1630
|
-
}
|
|
1631
|
-
return NEQ(z, 0) & LT0(c);
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
static uint32_t
|
|
1635
|
-
api_mul(unsigned char *G, size_t Glen,
|
|
1636
|
-
const unsigned char *k, size_t klen, int curve)
|
|
1637
|
-
{
|
|
1638
|
-
uint32_t r;
|
|
1639
|
-
p256_jacobian P;
|
|
1640
|
-
|
|
1641
|
-
(void)curve;
|
|
1642
|
-
if (Glen != 65) {
|
|
1643
|
-
return 0;
|
|
1644
|
-
}
|
|
1645
|
-
r = check_scalar(k, klen);
|
|
1646
|
-
r &= point_decode(&P, G);
|
|
1647
|
-
p256_mul(&P, k, klen);
|
|
1648
|
-
r &= point_encode(G, &P);
|
|
1649
|
-
return r;
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
static size_t
|
|
1653
|
-
api_mulgen(unsigned char *R,
|
|
1654
|
-
const unsigned char *k, size_t klen, int curve)
|
|
1655
|
-
{
|
|
1656
|
-
p256_jacobian P;
|
|
1657
|
-
|
|
1658
|
-
(void)curve;
|
|
1659
|
-
p256_mulgen(&P, k, klen);
|
|
1660
|
-
point_encode(R, &P);
|
|
1661
|
-
return 65;
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
static uint32_t
|
|
1665
|
-
api_muladd(unsigned char *A, const unsigned char *B, size_t len,
|
|
1666
|
-
const unsigned char *x, size_t xlen,
|
|
1667
|
-
const unsigned char *y, size_t ylen, int curve)
|
|
1668
|
-
{
|
|
1669
|
-
/*
|
|
1670
|
-
* We might want to use Shamir's trick here: make a composite
|
|
1671
|
-
* window of u*P+v*Q points, to merge the two doubling-ladders
|
|
1672
|
-
* into one. This, however, has some complications:
|
|
1673
|
-
*
|
|
1674
|
-
* - During the computation, we may hit the point-at-infinity.
|
|
1675
|
-
* Thus, we would need p256_add_complete_mixed() (complete
|
|
1676
|
-
* formulas for point addition), with a higher cost (17 muls
|
|
1677
|
-
* instead of 11).
|
|
1678
|
-
*
|
|
1679
|
-
* - A 4-bit window would be too large, since it would involve
|
|
1680
|
-
* 16*16-1 = 255 points. For the same window size as in the
|
|
1681
|
-
* p256_mul() case, we would need to reduce the window size
|
|
1682
|
-
* to 2 bits, and thus perform twice as many non-doubling
|
|
1683
|
-
* point additions.
|
|
1684
|
-
*
|
|
1685
|
-
* - The window may itself contain the point-at-infinity, and
|
|
1686
|
-
* thus cannot be in all generality be made of affine points.
|
|
1687
|
-
* Instead, we would need to make it a window of points in
|
|
1688
|
-
* Jacobian coordinates. Even p256_add_complete_mixed() would
|
|
1689
|
-
* be inappropriate.
|
|
1690
|
-
*
|
|
1691
|
-
* For these reasons, the code below performs two separate
|
|
1692
|
-
* point multiplications, then computes the final point addition
|
|
1693
|
-
* (which is both a "normal" addition, and a doubling, to handle
|
|
1694
|
-
* all cases).
|
|
1695
|
-
*/
|
|
1696
|
-
|
|
1697
|
-
p256_jacobian P, Q;
|
|
1698
|
-
uint32_t r, t, s;
|
|
1699
|
-
uint64_t z;
|
|
1700
|
-
|
|
1701
|
-
(void)curve;
|
|
1702
|
-
if (len != 65) {
|
|
1703
|
-
return 0;
|
|
1704
|
-
}
|
|
1705
|
-
r = point_decode(&P, A);
|
|
1706
|
-
p256_mul(&P, x, xlen);
|
|
1707
|
-
if (B == NULL) {
|
|
1708
|
-
p256_mulgen(&Q, y, ylen);
|
|
1709
|
-
} else {
|
|
1710
|
-
r &= point_decode(&Q, B);
|
|
1711
|
-
p256_mul(&Q, y, ylen);
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
/*
|
|
1715
|
-
* The final addition may fail in case both points are equal.
|
|
1716
|
-
*/
|
|
1717
|
-
t = p256_add(&P, &Q);
|
|
1718
|
-
f256_final_reduce(P.z);
|
|
1719
|
-
z = P.z[0] | P.z[1] | P.z[2] | P.z[3] | P.z[4];
|
|
1720
|
-
s = EQ((uint32_t)(z | (z >> 32)), 0);
|
|
1721
|
-
p256_double(&Q);
|
|
1722
|
-
|
|
1723
|
-
/*
|
|
1724
|
-
* If s is 1 then either P+Q = 0 (t = 1) or P = Q (t = 0). So we
|
|
1725
|
-
* have the following:
|
|
1726
|
-
*
|
|
1727
|
-
* s = 0, t = 0 return P (normal addition)
|
|
1728
|
-
* s = 0, t = 1 return P (normal addition)
|
|
1729
|
-
* s = 1, t = 0 return Q (a 'double' case)
|
|
1730
|
-
* s = 1, t = 1 report an error (P+Q = 0)
|
|
1731
|
-
*/
|
|
1732
|
-
CCOPY(s & ~t, &P, &Q, sizeof Q);
|
|
1733
|
-
point_encode(A, &P);
|
|
1734
|
-
r &= ~(s & t);
|
|
1735
|
-
return r;
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
/* see bearssl_ec.h */
|
|
1739
|
-
const br_ec_impl br_ec_p256_m62 = {
|
|
1740
|
-
(uint32_t)0x00800000,
|
|
1741
|
-
&api_generator,
|
|
1742
|
-
&api_order,
|
|
1743
|
-
&api_xoff,
|
|
1744
|
-
&api_mul,
|
|
1745
|
-
&api_mulgen,
|
|
1746
|
-
&api_muladd
|
|
1747
|
-
};
|
|
1748
|
-
|
|
1749
|
-
/* see bearssl_ec.h */
|
|
1750
|
-
const br_ec_impl *
|
|
1751
|
-
br_ec_p256_m62_get(void)
|
|
1752
|
-
{
|
|
1753
|
-
return &br_ec_p256_m62;
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
#else
|
|
1757
|
-
|
|
1758
|
-
/* see bearssl_ec.h */
|
|
1759
|
-
const br_ec_impl *
|
|
1760
|
-
br_ec_p256_m62_get(void)
|
|
1761
|
-
{
|
|
1762
|
-
return 0;
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
#endif
|