You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[crypto] ec/ecdsa suites stale (unexecutable) and P-256 public API header contradicts private visibility #1055
Two verified-but-unfiled items from the lib/std/crypto/ec.w audit (P-256 math itself verifies exactly against openssl/python oracles — these are API/coverage gaps, not math defects).
tests/test_ec.w / tests/test_ecdsa.w do not execute (same drift class as [tests] crypto suites (bigint/rsa/crypto) not executable: stale unsafe:/-> void syntax #1053, which covered bigint/rsa/crypto suites): unsafe: single-line prefix rejected (test_ec.w:39, test_ecdsa.w:56, ...), &mut, -> void. Reproduced with with-stage1 check this session. The RFC 6979 vectors they assert were confirmed correct against openssl — only the harness is broken.
(Low/design) p256_compute_public / p256_ecdh sit under a ── Public API ── header but are module-private (external probe denied with symbol ... is private), so external users have no reachable P-256 API while tls.w/ecdsa.w call intra-package. Either the header or the visibility is wrong.
Explicitly NOT filed: p256_ecdh peer-key validation (no prefix/on-curve/infinity checks) — held without an independent oracle defining degenerate output; asserting one would enshrine behavior. Left as an owner decision. Variable-time point_mul noted as info only.
Verdict. Both items established. (1) tests/test_ec.w and tests/test_ecdsa.w do not compile (stale unsafe: prefix, &mut, -> void), the same drift class as #1053, and like those files they live in tests/ which no test target scans, so P-256/ECDSA have no executable coverage. (2) p256_compute_public and p256_ecdh sit under a ── Public API ── header but are declared non-pub, so an external caller is denied — the header and the visibility contradict each other. As the report says, the P-256 math itself is not in question here; these are API/coverage gaps.
Tested.
Source
main @ 5809ac1 (2026-09-14); ec.w and the two test files unchanged since the reported revision 450733e
Compilers
with v0.15.2.1 built from 5809ac1 (staging worktree); a compiler built from 450733e with the nightly-20260903 seed. Same errors
Platform
macOS Darwin 25.6.0 arm64
Claim 1 (with check, both compilers):
error: unsafe: requires a newline and indented block; use unsafe { ... } or unsafe *ptr
--> tests/test_ec.w:39:13
39 | unsafe: p256_compute_public(&priv_key[0] as *const u8, &mut pub_key[0] as *mut u8)
test_ecdsa.w:56 fails identically. Both files also carry &mut/-> void drift. And no .Test target globs tests/ (they all scan test/), so even a compiling file would not run — confirmed by grep of build.w.
Claim 2 (external use std.crypto.ec calling the "public" entry):
error: symbol 'p256_compute_public' is private to module '<embedded-std>/std/crypto/ec.w'
--> ec.w:5:14
Root cause. Test rot plus a header/visibility mismatch, both dating to the crypto port. No compiler defect. Direct check + source evidence.
Related.#1053 (bigint/rsa/crypto test drift, tests/ not wired in), #1054 (AEAD non-pub + poly1305), #1018 (std.time non-pub surface). No open PR.
Recommendation — champion, small.
Decide the P-256 surface: if p256_compute_public/p256_ecdh (and likely an ECDSA verify entry) are meant to be public, mark them pub; otherwise remove or retitle the ── Public API ── header so it does not misrepresent module-private helpers.
Keep the confirmed RFC 6979 ECDSA vectors as the regression content.
Acceptance criteria: with build :test runs an ec/ecdsa suite that asserts the RFC 6979 vectors; a pub P-256 API is reachable from an external program (or the header is corrected to reflect intentional privacy).
Explicitly not assessed (per the report).p256_ecdh peer-key validation (no on-curve/infinity checks) — left as an owner decision without an oracle for degenerate output; and the variable-time point_mul, informational only. Linux/Windows not exercised.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced for the stale suites.
$ with check tests/test_ec.w
error: unsafe: requires a newline and indented block; use unsafe { ... } or unsafe *ptr
--> tests/test_ec.w:39:13
$ with check tests/test_ecdsa.w
error: unsafe: requires a newline and indented block; use unsafe { ... } or unsafe *ptr
--> tests/test_ecdsa.w:56:22
lib/std/crypto/ec.w has no pub fn (0 of its functions); its header no longer advertises a public API.
post-release: test coverage, the same class as #1053.
Merged to main ae20d89 (#3251): P-256 (the public key of 1 is G) and ECDSA (RFC 6979 A.2.5 verifies; refused over a digest with one bit flipped) have known answers that run, in test/behavior/behav_crypto_kats_hmac_bigint_prf.w; the dead tests/test_ec.w and test_ecdsa.w are deleted. Item 2: ec.w's header now says the P-256 functions are the package's own (std.tls and std.crypto.ecdsa call them); a program reaches P-256 through std.tls.
Activity
ehartford commentedon Sep 16, 2026
Review: reproduced
Verdict. Both items established. (1)
tests/test_ec.wandtests/test_ecdsa.wdo not compile (staleunsafe:prefix,&mut,-> void), the same drift class as #1053, and like those files they live intests/which no test target scans, so P-256/ECDSA have no executable coverage. (2)p256_compute_publicandp256_ecdhsit under a── Public API ──header but are declared non-pub, so an external caller is denied — the header and the visibility contradict each other. As the report says, the P-256 math itself is not in question here; these are API/coverage gaps.Tested.
main@ 5809ac1 (2026-09-14);ec.wand the two test files unchanged since the reported revision 450733ewith v0.15.2.1built from 5809ac1 (staging worktree); a compiler built from 450733e with the nightly-20260903 seed. Same errorsClaim 1 (
with check, both compilers):test_ecdsa.w:56fails identically. Both files also carry&mut/-> voiddrift. And no.Testtarget globstests/(they all scantest/), so even a compiling file would not run — confirmed by grep ofbuild.w.Claim 2 (external
use std.crypto.eccalling the "public" entry):Source facts (5809ac1).
── Public API ──header atlib/std/crypto/ec.w:398, withunsafe fn p256_compute_publicat:403andunsafe fn p256_ecdhat:440— neitherpub. Per spec §18.3 they are unreachable outside the module. Intra-package callers (tls.w,ecdsa.w) work because they compile in the same package; external users have no P-256 API. Same non-pub-surface class as std.time Duration is private but appears in pub signatures; its constructors are uncallable #1018 and AEAD entry point chacha20_poly1305_encrypt is private (the module compiles now) #1054.Root cause. Test rot plus a header/visibility mismatch, both dating to the crypto port. No compiler defect. Direct
check+ source evidence.Related. #1053 (bigint/rsa/crypto test drift,
tests/not wired in), #1054 (AEAD non-pub+ poly1305), #1018 (std.timenon-pubsurface). No open PR.Recommendation — champion, small.
p256_compute_public/p256_ecdh(and likely an ECDSA verify entry) are meant to be public, mark thempub; otherwise remove or retitle the── Public API ──header so it does not misrepresent module-private helpers.test_ec.w/test_ecdsa.w(unsafe { }, no&mut,-> Unit) and move them undertest/sowith build :testruns them; they will also need thepubchange (or a same-module home) to reach the functions, exactly as [tests] crypto suites (bigint/rsa/crypto) not executable: stale unsafe:/-> void syntax #1053/AEAD entry point chacha20_poly1305_encrypt is private (the module compiles now) #1054.Acceptance criteria:
with build :testruns an ec/ecdsa suite that asserts the RFC 6979 vectors; apubP-256 API is reachable from an external program (or the header is corrected to reflect intentional privacy).Explicitly not assessed (per the report).
p256_ecdhpeer-key validation (no on-curve/infinity checks) — left as an owner decision without an oracle for degenerate output; and the variable-timepoint_mul, informational only. Linux/Windows not exercised.ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced for the stale suites.lib/std/crypto/ec.whas nopub fn(0 of its functions); its header no longer advertises a public API.post-release: test coverage, the same class as #1053.
Issues batch D: crypto known answers that run (#1053 #1055 #1063); de…
ehartford commentedon Nov 11, 2026
Merged to main ae20d89 (#3251): P-256 (the public key of 1 is G) and ECDSA (RFC 6979 A.2.5 verifies; refused over a digest with one bit flipped) have known answers that run, in test/behavior/behav_crypto_kats_hmac_bigint_prf.w; the dead tests/test_ec.w and test_ecdsa.w are deleted. Item 2: ec.w's header now says the P-256 functions are the package's own (std.tls and std.crypto.ecdsa call them); a program reaches P-256 through std.tls.