@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.
@@ -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 not yet by proof.** Nothing branches
30
- * on, or indexes by, a secret: the ladder swaps with a mask and runs all 255
31
- * steps whatever the scalar, and the final reduction subtracts p by adding a
32
- * carry bit times 19 rather than by comparing. Every `if` and every loop bound
33
- * here is on a public quantity — a limb number, a bit position or an input
34
- * length. WP34 N6's `ctSelect` and its disassembly check are what will verify
35
- * that; they do not exist yet.
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