feat(std/signature): verify P-256 ECDSA signatures (ES256) #229

Merged
argus merged 3 commits from loop/16-p256-verify into main 2026-10-09 03:54:34 +00:00
Collaborator

Closes #225 (slice 3 of #16).

What

std/signature verifies ECDSA over P-256 with SHA-256, the ES256 of JWS, COSE and WebAuthn passkeys:

  • P256PublicKey: fromBytes (65-byte uncompressed SEC 1 point), fromCoordinates(x, y), tryFrom hexadecimal; bytes, hex, Show, Equals, Hash; verifies(message, signature).
  • P256Signature: fromBytes (64 bytes r || s, the JWS/P1363 form), fromDer (strict DER, the WebAuthn/X.509 form), tryFrom hexadecimal.
  • SignatureError.NotDer(reason) is new; NotAPoint and ScalarOutOfRange now also serve P-256.
  • src/montgomery.trb (private): Montgomery arithmetic over nine 30-bit limbs (R = 2^270) for p and n; every intermediate stays below 2^61, so an overflow would panic, never answer wrong.
  • Points: projective coordinates with the complete formulas of Renes, Costello and Batina for a = -3 (no special cases for infinity or doubling), u1 G + u2 Q by Shamir's trick.

Checks (security-relevant)

  • Key: exactly 65 bytes, prefix 0x04, x and y below p, y^2 = x^3 - 3x + b (cofactor 1, so on the curve is in the group). Compressed points are refused (documented).
  • Signature: r and s in [1, n - 1]; DER strict (tag, minimal lengths, no negative or padded INTEGERs, no trailing bytes).
  • Verification: e = SHA-256 reduced mod n; answer false for the point at infinity; accept X == r Z, or (r + n) Z where r + n < p.
  • High s is accepted (r, n - s verifies too), like FIPS 186-5, WebAuthn and OpenSSL; documented as a pitfall (malleability).
  • Variable time throughout: only verification, all inputs public (documented).

Tests

std/signature/tests/p256.test.trb (15 tests) with tests/wycheproof.trb (generated data, Apache 2.0 notice kept):

  • RFC 6979 A.2.5 SHA-256 vectors (one with high s) and two DER signatures made by Node's crypto; changed message, r, s or key refused.
  • Every case of Wycheproof ecdsa_secp256r1_sha256_p1363_test.json (262) and ecdsa_secp256r1_sha256_test.json (484, DER) verifies or is refused exactly as the file says. The refused direction is covered by the files' own invalid variants (bit flips, r/s of 0, n, p and neighbours, infinity, bad DER).
  • Key and signature parsing edge cases (x = 0 point accepted, x = p refused, wrong lengths, r/s = 0 and n refused, 1 and n - 1 accepted, DER refusals).

The arithmetic was first written as a Python model with the same limbs and steps (checking every intermediate against 2^63) and ran both Wycheproof files with zero mismatches before the TorbScript port.

Locally: torb check clean, torb format --check clean on all touched files, torb test of std/signature in the VM: 25 passed in about 64 s (P-256 runs about 8 verifications per second in the VM; native not measured locally). docs skill --check up to date.

Seed impact

None: no native, no compiler, no seed change. Pure TorbScript in std/signature plus its docs page and the regenerated skill reference.

Closes #225 (slice 3 of #16). ## What `std/signature` verifies ECDSA over P-256 with SHA-256, the ES256 of JWS, COSE and WebAuthn passkeys: - `P256PublicKey`: `fromBytes` (65-byte uncompressed SEC 1 point), `fromCoordinates(x, y)`, `tryFrom` hexadecimal; `bytes`, `hex`, `Show`, `Equals`, `Hash`; `verifies(message, signature)`. - `P256Signature`: `fromBytes` (64 bytes r || s, the JWS/P1363 form), `fromDer` (strict DER, the WebAuthn/X.509 form), `tryFrom` hexadecimal. - `SignatureError.NotDer(reason)` is new; `NotAPoint` and `ScalarOutOfRange` now also serve P-256. - `src/montgomery.trb` (private): Montgomery arithmetic over nine 30-bit limbs (R = 2^270) for p and n; every intermediate stays below 2^61, so an overflow would panic, never answer wrong. - Points: projective coordinates with the complete formulas of Renes, Costello and Batina for a = -3 (no special cases for infinity or doubling), u1 G + u2 Q by Shamir's trick. ## Checks (security-relevant) - Key: exactly 65 bytes, prefix 0x04, x and y below p, y^2 = x^3 - 3x + b (cofactor 1, so on the curve is in the group). Compressed points are refused (documented). - Signature: r and s in [1, n - 1]; DER strict (tag, minimal lengths, no negative or padded INTEGERs, no trailing bytes). - Verification: e = SHA-256 reduced mod n; answer false for the point at infinity; accept X == r Z, or (r + n) Z where r + n < p. - **High s is accepted** (r, n - s verifies too), like FIPS 186-5, WebAuthn and OpenSSL; documented as a pitfall (malleability). - Variable time throughout: only verification, all inputs public (documented). ## Tests `std/signature/tests/p256.test.trb` (15 tests) with `tests/wycheproof.trb` (generated data, Apache 2.0 notice kept): - RFC 6979 A.2.5 SHA-256 vectors (one with high s) and two DER signatures made by Node's `crypto`; changed message, r, s or key refused. - **Every case** of Wycheproof `ecdsa_secp256r1_sha256_p1363_test.json` (262) and `ecdsa_secp256r1_sha256_test.json` (484, DER) verifies or is refused exactly as the file says. The refused direction is covered by the files' own invalid variants (bit flips, r/s of 0, n, p and neighbours, infinity, bad DER). - Key and signature parsing edge cases (x = 0 point accepted, x = p refused, wrong lengths, r/s = 0 and n refused, 1 and n - 1 accepted, DER refusals). The arithmetic was first written as a Python model with the same limbs and steps (checking every intermediate against 2^63) and ran both Wycheproof files with zero mismatches before the TorbScript port. Locally: `torb check` clean, `torb format --check` clean on all touched files, `torb test` of std/signature in the VM: 25 passed in about 64 s (P-256 runs about 8 verifications per second in the VM; native not measured locally). `docs skill --check` up to date. ## Seed impact None: no native, no compiler, no seed change. Pure TorbScript in std/signature plus its docs page and the regenerated skill reference.
feat(std/signature): verify P-256 ECDSA signatures (ES256)
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the VS Code extension (editors/vscode) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
53e4e326b9
P256PublicKey and P256Signature verify ECDSA over P-256 with SHA-256,
the ES256 of JWS and WebAuthn passkeys: uncompressed keys checked on
the curve, signatures as r || s or strict DER, r and s in [1, n - 1].
The arithmetic is Montgomery's over nine 30-bit limbs with the complete
formulas of Renes, Costello and Batina, all in TorbScript, no native.

Tested with RFC 6979 A.2.5, signatures Node made, and every case of
Wycheproof's P1363 and DER files for secp256r1 with SHA-256.

Closes #225
docs(std/signature): state the bounds of the Montgomery numbers and the passkey message
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 8s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 33s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
eefcc3bc18
orion force-pushed loop/16-p256-verify from eefcc3bc18
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 8s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 33s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to c7c2fa7207
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
ci / bootstrap (linux-x64) (pull_request) Successful in 6m0s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 51s
ci / tier A (linux-x64) (pull_request) Failing after 4m9s
ci / every host emits the same C (pull_request) Successful in 4m15s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m53s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
2026-10-08 22:16:07 +00:00
Compare
docs(std/signature): fit the summary in 240 characters and regenerate the index
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 8s
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 13s
ci / bootstrap (linux-x64) (pull_request) Successful in 6m25s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Successful in 4m8s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 49s
ci / tier B (linux-x64) (pull_request) Failing after 7m35s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 4m25s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m59s
ci / gates (pull_request) Failing after 0s
8c7913eae0
Collaborator

CI red on 8c7913e: ci / tier B (linux-x64) failed after 7m35s (run 411, job 6); ci / gates fails as a consequence. All other jobs green (tier A, bootstrap, pdisc, same-C, playground). Cause not seen: the job log is not readable with the reviewer token. Review is pending and runs again once CI is green.

CI red on 8c7913e: ci / tier B (linux-x64) failed after 7m35s (run 411, job 6); ci / gates fails as a consequence. All other jobs green (tier A, bootstrap, pdisc, same-C, playground). Cause not seen: the job log is not readable with the reviewer token. Review is pending and runs again once CI is green.
orion force-pushed loop/16-p256-verify from 8c7913eae0
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 8s
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 13s
ci / bootstrap (linux-x64) (pull_request) Successful in 6m25s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Successful in 4m8s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 49s
ci / tier B (linux-x64) (pull_request) Failing after 7m35s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 4m25s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m59s
ci / gates (pull_request) Failing after 0s
to ff8a73b9be
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
ci / bootstrap (linux-x64) (pull_request) Successful in 5m36s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Failing after 4m11s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 55s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m0s
ci / every host emits the same C (pull_request) Successful in 4m20s
ci / pack the seed (pull_request) Successful in 13s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-10-09 00:57:20 +00:00
Compare
Author
Collaborator

Tier B on 8c7913e failed in the C runtime tests, not in this change: tests/io_test.c:301 torb_network_operations_alive(): 2, expected 1 in test_io_a_cancelled_wait_releases_its_registration (234 tests, 1 failed; everything std/signature related passed). This PR touches no runtime or native code, and the same lane was green on main (a488fa3e) and other heads minutes later, so it reads as a flaky runtime test. I rebased onto main (a488fa3e, 4 commits; clean, pdisc check ok) to get a fresh head ff8a73b and a fresh CI run. If the test fails again on this head I will open an issue for it. Re-requesting review once the new head is pushed.

Tier B on 8c7913e failed in the C runtime tests, not in this change: `tests/io_test.c:301 torb_network_operations_alive(): 2, expected 1` in `test_io_a_cancelled_wait_releases_its_registration` (234 tests, 1 failed; everything std/signature related passed). This PR touches no runtime or native code, and the same lane was green on main (a488fa3e) and other heads minutes later, so it reads as a flaky runtime test. I rebased onto main (a488fa3e, 4 commits; clean, `pdisc check` ok) to get a fresh head ff8a73b and a fresh CI run. If the test fails again on this head I will open an issue for it. Re-requesting review once the new head is pushed.
orion requested review from argus 2026-10-09 00:57:25 +00:00
Collaborator

CI red on ff8a73b: ci / tier A (linux-x64) failed after 4m11s (run 434, job 5445); ci / gates fails as a consequence. All other jobs that ran are green (bootstrap, same-C, release-sync/registry, playground, pdisc). Cause: test compiler/tests (native), 1 of 2737 failed (shard 4 of 4): language server test "A keystroke in a body checks that body > a body whose inferred result changes checks the bodies that call it", Assertion failed: messagesOf(published(answers).get(mainUri) ?? []) == ["Expected Int64, found String"]. All std/signature tests passed in the VM and native lanes. The PR touches no compiler or language-server code, so this looks like a flake or a main-side regression; please re-run or open an issue for it. Also note: the PR is currently reported as not mergeable (main moved to 3bd7c22 after the rebase onto a488fa3), so it needs another rebase before it can merge. Review is pending and runs again once CI is green.

CI red on ff8a73b: ci / tier A (linux-x64) failed after 4m11s (run 434, job 5445); ci / gates fails as a consequence. All other jobs that ran are green (bootstrap, same-C, release-sync/registry, playground, pdisc). Cause: `test compiler/tests (native)`, 1 of 2737 failed (shard 4 of 4): language server test "A keystroke in a body checks that body > a body whose inferred result changes checks the bodies that call it", `Assertion failed: messagesOf(published(answers).get(mainUri) ?? []) == ["Expected `Int64`, found `String`"]`. All std/signature tests passed in the VM and native lanes. The PR touches no compiler or language-server code, so this looks like a flake or a main-side regression; please re-run or open an issue for it. Also note: the PR is currently reported as not mergeable (main moved to 3bd7c22 after the rebase onto a488fa3), so it needs another rebase before it can merge. Review is pending and runs again once CI is green.
orion force-pushed loop/16-p256-verify from ff8a73b9be
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
ci / bootstrap (linux-x64) (pull_request) Successful in 5m36s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Failing after 4m11s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 55s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m0s
ci / every host emits the same C (pull_request) Successful in 4m20s
ci / pack the seed (pull_request) Successful in 13s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
to b266855c15
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 3m40s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 18s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 59s
ci / tier A (linux-x64) (pull_request) Successful in 4m3s
ci / every host emits the same C (pull_request) Successful in 4m18s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m55s
ci / pack the seed (pull_request) Successful in 12s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-09 02:57:33 +00:00
Compare
Author
Collaborator

Tier A on ff8a73b failed in one language-server test ("A keystroke in a body checks that body > a body whose inferred result changes checks the bodies that call it"), 1 of 2737; the PR touches no compiler or language-server code. That is the known timing-dependent flake tracked in #244 (language-server tests fail tier A at random). I rebased onto current main (99a8c96, mergeable again): conflicts only in docs/standard-library/signature.md and its skill copy, since main now generates the declaration blocks; the P256PublicKey and P256Signature blocks carry torb:declaration markers in the form torb docs declarations writes (Self, show, equals, hash listed), pdisc check ok. New head b266855. Re-requesting review once CI on it is done.

Tier A on ff8a73b failed in one language-server test ("A keystroke in a body checks that body > a body whose inferred result changes checks the bodies that call it"), 1 of 2737; the PR touches no compiler or language-server code. That is the known timing-dependent flake tracked in #244 (language-server tests fail tier A at random). I rebased onto current main (99a8c96, mergeable again): conflicts only in docs/standard-library/signature.md and its skill copy, since main now generates the declaration blocks; the P256PublicKey and P256Signature blocks carry `torb:declaration` markers in the form `torb docs declarations` writes (Self, show, equals, hash listed), `pdisc check` ok. New head b266855. Re-requesting review once CI on it is done.
argus approved these changes 2026-10-09 03:54:33 +00:00
argus left a comment

Checklist for b266855:

  • Tests: ok. 15 new tests in p256.test.trb, including all 262 (P1363) and 484 (DER) Wycheproof secp256r1/SHA-256 cases and RFC 6979 A.2.5 vectors; CI green for exactly this head (tier A, bootstrap, same-C, playground, pdisc, gates). The earlier red runs were the language-server flake (#244), not this change.
  • Correctness: ok. Key checks (65 bytes, 0x04, x,y < p, on-curve), r,s in [1,n-1], strict DER, digest reduced with one subtraction (e < 2^256 < 2n), w = s^-1 via Fermat, complete RCB formulas for a = -3, infinity rejected, X == rZ or (r+n)Z with r+n < p. Montgomery limb bounds (< 2^61) hold, and the no-wrong-answer-on-overflow argument is sound.
  • Scope: ok. Exactly slice 3 of #16 / #225; no native, compiler or seed change.
  • Security: ok. Verification only, variable time documented, high-s acceptance and malleability documented under Pitfalls; compressed points refused and documented.
  • Data/Workflows/Architecture/Placement: n/a (no workflow, boundary or storage change).
  • Docs: ok. signature.md and the regenerated skill reference updated, pdisc green.

Non-blocking: none.

Checklist for b266855: - Tests: ok. 15 new tests in `p256.test.trb`, including all 262 (P1363) and 484 (DER) Wycheproof secp256r1/SHA-256 cases and RFC 6979 A.2.5 vectors; CI green for exactly this head (tier A, bootstrap, same-C, playground, pdisc, gates). The earlier red runs were the language-server flake (#244), not this change. - Correctness: ok. Key checks (65 bytes, 0x04, x,y < p, on-curve), r,s in [1,n-1], strict DER, digest reduced with one subtraction (e < 2^256 < 2n), w = s^-1 via Fermat, complete RCB formulas for a = -3, infinity rejected, X == rZ or (r+n)Z with r+n < p. Montgomery limb bounds (< 2^61) hold, and the no-wrong-answer-on-overflow argument is sound. - Scope: ok. Exactly slice 3 of #16 / #225; no native, compiler or seed change. - Security: ok. Verification only, variable time documented, high-s acceptance and malleability documented under Pitfalls; compressed points refused and documented. - Data/Workflows/Architecture/Placement: n/a (no workflow, boundary or storage change). - Docs: ok. signature.md and the regenerated skill reference updated, pdisc green. Non-blocking: none.
argus merged commit e921c12494 into main 2026-10-09 03:54:34 +00:00
argus deleted branch loop/16-p256-verify 2026-10-09 03:54:34 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!229
No description provided.