@amritk/nish-aarch64-linux 0.14.0 → 0.15.0
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/bin/nish +0 -0
- package/package.json +1 -1
- package/runtime/nish.d.ts +91 -0
- package/runtime/nish.h +58 -0
- package/runtime/nish.mjs +23 -0
- package/runtime/runtime-net.c +528 -0
- package/runtime/shim.mjs +15 -0
- package/scripts/build.sh +8 -7
- package/std/README.md +54 -14
- package/std/crypto/LICENSE-bearssl +21 -0
- package/std/crypto/LICENSE-fiat-crypto +21 -0
- package/std/crypto/aes.ts +899 -0
- package/std/crypto/chacha20poly1305.ts +698 -0
- package/std/crypto/p256.ts +4337 -0
- package/std/crypto/x25519.ts +22 -7
- package/std/crypto/x509.ts +1214 -0
package/std/crypto/x25519.ts
CHANGED
|
@@ -26,13 +26,28 @@
|
|
|
26
26
|
* nicety: each function states what it accepts and what it answers, and
|
|
27
27
|
* `f25519Mul` says why its sums fit.
|
|
28
28
|
*
|
|
29
|
-
* **Constant time, by construction and
|
|
30
|
-
* on, or indexes by, a secret: the ladder swaps with a mask and runs
|
|
31
|
-
* steps whatever the scalar, and the final reduction subtracts p by
|
|
32
|
-
* carry bit times 19 rather than by comparing. Every `if` and every
|
|
33
|
-
* here is on a public quantity — a limb number, a bit position or
|
|
34
|
-
* length.
|
|
35
|
-
*
|
|
29
|
+
* **Constant time, by construction, and in part by disassembly.** Nothing
|
|
30
|
+
* branches on, or indexes by, a secret: the ladder swaps with a mask and runs
|
|
31
|
+
* all 255 steps whatever the scalar, and the final reduction subtracts p by
|
|
32
|
+
* adding a carry bit times 19 rather than by comparing. Every `if` and every
|
|
33
|
+
* loop bound here is on a public quantity — a limb number, a bit position or
|
|
34
|
+
* an input length.
|
|
35
|
+
*
|
|
36
|
+
* WP34 N6's disassembly check (`tests/ct-asm.js`) verifies the part a secret
|
|
37
|
+
* flows through: `tests/cases/ct_asm_x25519` holds copies of `f25519Mul`,
|
|
38
|
+
* `f25519Square`, `f25519MulA24`, `f25519Add`, `f25519Sub`, `f25519Swap` and
|
|
39
|
+
* one pass of `x25519Ladder`'s loop, and the check reads each one's `clang -O2`
|
|
40
|
+
* machine code for x86-64 and aarch64 and finds no branch and no load or store
|
|
41
|
+
* at an address the scalar bit or a limb reaches. They are copies because the
|
|
42
|
+
* check refuses every branch, loop back-edges included, and this module's own
|
|
43
|
+
* functions keep their loops and the early `return`s below; the copies drop the
|
|
44
|
+
* guards and write `f25519Mul`'s outer loop out a row at a time, and the
|
|
45
|
+
* fixture's `main` holds them to the same RFC 7748 vectors as this module. A
|
|
46
|
+
* change to one of those functions belongs in that fixture too. What stays
|
|
47
|
+
* discipline rather than proof is the rest: the loops around the step,
|
|
48
|
+
* `f25519Decode`, `f25519Encode` and `f25519Invert`, whose branches are all on
|
|
49
|
+
* public positions. Weekly, `tests/ct-timing.js` times the fixture's functions
|
|
50
|
+
* on real x86-64 and aarch64 hardware as well.
|
|
36
51
|
*
|
|
37
52
|
* **Loop bounds are literals.** A field element is always ten limbs and an
|
|
38
53
|
* encoding always 32 bytes, and each function that indexes one opens with an
|