Commit graph

56 commits

Author SHA1 Message Date
dependabot[bot]
f458036e9f
Merge 9e8cc56407 into d275613c37 2026-07-04 21:01:16 +00:00
d275613c37 Aeneas-compat: verified-verification entry points + serial-pin cfg
Pure refactors for the Charon/Aeneas extraction pipeline; production
behavior unchanged (both default and pinned configs cargo-check clean,
pre-existing warnings only).

- ed_sigs::sha512_hash3: single-call SHA-512 oracle, semantically
  Sha512(r || a || m); a monomorphic signature with no foreign types lets
  the extractor treat the hash as one opaque oracle (sha2-0.11 stack).
- VerificationKey::verify_sha512 (+ recompute_r_sha512, a_bytes_nonzero,
  check_scalar_canonical, is_legacy_excluded_r): semantically identical
  to verify_dalek with each step spelled extractor-friendly - derived
  array PartialEq/contains as explicit index loops, and
  Scalar::from_canonical_bytes (subtle internals defeat the extractor)
  as an explicit s < l byte compare + from_bytes_mod_order (the identity
  on canonical bytes). Signature accessors each called exactly once.
- SIMD gates: cfg(target_arch = "x86_64") becomes
  cfg(all(target_arch = "x86_64", not(curve25519_serial_only))). Default
  builds are identical (the new cfg is never set); extraction builds pass
  RUSTFLAGS=--cfg curve25519_serial_only so the AVX2 dispatch arm
  compiles out and backend selection is the real constant Serial - the
  same serial-pin mechanism upstream curve25519-dalek provides natively.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 23:00:06 +02:00
1c8497d682 Aeneas-compat: index-based LE word load in non_adjacent_form
Pure refactor, semantics identical: the read_le_u64_into call (whose
chunks/zip iterators are opaque to the extraction) becomes an explicit
nested index loop, the same shape as the proven from_bytes_wide unpack.
With this the entire vartime_double_base::mul extraction closure is
self-contained: zero external axioms, zero sorries.
2026-07-04 11:39:11 +02:00
58894a049a Aeneas-compat: make vartime_double_base::mul extraction-clean
Pure refactors (cargo check green under both feature sets), semantics of
mul unchanged:
- dsm_top_index / dsm_loop / dsm_step_p / dsm_step_b helpers: the main
  double-and-add loop becomes a strictly-decreasing while with a
  single-assignment body and parameter-rooted borrows (the original
  loop/break shape with match-updates fails Aeneas' loop fixed point);
- the starting-index scan always returns 255: leading zero NAF digits
  double the identity (a no-op), so the result is unchanged - only the
  variable-time skip is dropped (constant-time behavior improves);
- the downward break-scan (which failed Aeneas' symbolic join) is gone.

With these, Charon+Aeneas extract the complete path - non_adjacent_form,
NafLookupTable5::from/select, the affine basepoint table, the 256-step
dsm_loop, and mul - with zero errors and zero sorries. This opens the
double-scalar-multiplication verification campaign (the EdDSA verify
equation's core).
2026-07-04 11:10:33 +02:00
8e299cd0f5 Aeneas-compat: factor from_bytes_wide through named, closure-free helpers
Pure refactor, semantics identical (cargo check green):
- from_bytes_wide_parts(bytes) -> (Scalar52, Scalar52): the byte-unpack
  loops + the 52-bit lo/hi split, as a named prefix
- split_words_lo / split_words_hi: the two split halves, built with
  Scalar52([...]) struct literals instead of per-index mutation
- from_bytes_wide: parts -> montgomery_mul(lo, R) ->
  montgomery_mul(hi, RR) -> add

Why: the verification side measured that (a) a WP walk whose motives
contain a montgomery_mul call replays its whole body at every kernel
step, and (b) straight-line chains of IndexMut closure back-functions
make kernel defeq exponential in chain depth. Named prefix functions fix
(a); struct-literal construction eliminates the closures and fixes (b).
With this shape the full from_bytes_wide certificate kernel-checks in
77 seconds (was: aborted after 30+ minutes).
2026-07-04 10:23:24 +02:00
0cf451c896 Aeneas-compat: mask the bare shift in Scalar52::from_bytes_wide
hi[4] = words[7] >> 20  is the only shift in the function whose result is
stored without a trailing mask/or; at the pinned Aeneas (bf13c42e) a bare
`x >> c` as a full RHS extracts ill-typed (wrapping_shr applied to an i32
with an emitted-but-unsubstituted U32 cast). Masking is a semantic no-op:
words[7] >> 20 < 2^44 < 2^52.  Semantics unchanged; needed to bring
from_bytes_wide (the hash-to-scalar reduction) into verification scope.
2026-07-03 22:40:00 +02:00
dependabot[bot]
9e8cc56407
Bump p3-air from 0.4.3 to 0.6.1
Bumps [p3-air](https://github.com/Plonky3/Plonky3) from 0.4.3 to 0.6.1.
- [Release notes](https://github.com/Plonky3/Plonky3/releases)
- [Changelog](https://github.com/Plonky3/Plonky3/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Plonky3/Plonky3/compare/p3-air-v0.4.3...p3-air-v0.6.1)

---
updated-dependencies:
- dependency-name: p3-air
  dependency-version: 0.6.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-30 15:46:01 +00:00
77043ab804 chore: remove upstream CI workflows (not our CI infrastructure) 2026-06-30 17:44:29 +02:00
e5f4598766 patch: remove ConditionallyNegatable for Aeneas/Charon transpilation
Upstream: anza-xyz/cryptography
Required for: formal verification via Aeneas bf13c42e + Charon 9dd7f23c
2026-06-30 17:30:34 +02:00
Edvard Fagerholm
0a54ccaf04
ed25519: add 128-bit NAF path (#27)
* ed25519: add 128-bit NAF path

Add Scalar::non_adjacent_form_128 and use it in the serial and vector triple-base verifier paths for scalars known to fit in 128 bits. The helper computes only the HEEA-readable digit range instead of producing a full 256-entry NAF array for each scalar.

Benchmark notes:

- Ran this repository's Criterion benchmark program, benches/bench.rs, filtering to Single Verification, pinned to CPU 4 with 1s warmup, 2s measurement, and sample size 10.

- local_verify_zebra estimate was 19.740 us, with 95% CI 19.686..19.789 us.

- master measured 20.051 us, with 95% CI 19.938..20.134 us, so this branch was about 1.55% faster in that run.

* Use 128-bit NAF in triple-base paths

---------

Co-authored-by: zz-sol <allaboutshop10@163.com>
2026-06-24 16:47:31 +09:00
dependabot[bot]
11a5cf38fb
Bump taiki-e/install-action from 2.81.6 to 2.81.10 (#61)
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.81.6 to 2.81.10.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](59012be088...7a79fe8c3a)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.81.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 14:54:15 -04:00
dependabot[bot]
0a13fe85bf
Bump actions/checkout from 6 to 6.0.3 (#62)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 6.0.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v6...v6.0.3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 14:52:08 -04:00
dependabot[bot]
df06b0758b
Bump rust-lang/crates-io-auth-action from 1 to 1.0.4 (#64)
Bumps [rust-lang/crates-io-auth-action](https://github.com/rust-lang/crates-io-auth-action) from 1 to 1.0.4.
- [Release notes](https://github.com/rust-lang/crates-io-auth-action/releases)
- [Commits](https://github.com/rust-lang/crates-io-auth-action/compare/v1...v1.0.4)

---
updated-dependencies:
- dependency-name: rust-lang/crates-io-auth-action
  dependency-version: 1.0.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 14:51:36 -04:00
zz-sol
9c7161d652
simply lookup table constructor (#56) 2026-06-22 09:47:37 -04:00
zz-sol
69e1efe684
better error handling for batch verify (#57) 2026-06-22 09:47:19 -04:00
zz-sol
bfc9f01bbb
[ed25519] improve signing key life cycle (#51)
* make sk non-copy

* lint

* simplify zeroization
2026-06-18 09:25:12 -04:00
zz-sol
f08b2c94fc
[ed25519] fix pkcs8 (#52)
* fix pkcs8

* Propagate PKCS#8 errors; add decoding test

Replace unwraps with ? to propagate pkcs8::Error when parsing PKCS#8 key material (in TryFrom<&KeypairBytes> and from_pkcs8_der), use the parsed SigningKey directly for public-key verification, and return Ok(signing_key). Add a test to ensure malformed/non-PKCS#8 bytes are rejected without panicking, and import BitStringRef in tests to simplify references.
2026-06-18 07:33:08 -04:00
zz-sol
ff4e6654d1
[ed25519] improve rng bounds for random function (#54) 2026-06-18 07:32:53 -04:00
zz-sol
34e36a7c32
[ed25519] implement add for SW form (#55)
* impl add for SW

* Update short_weierstrass.rs
2026-06-18 07:32:25 -04:00
zz-sol
dd4164eefe
impl secp256r1 (#45)
* impl secp256r1

* CI

* refactor: remove sigantures; add msm

* clean up scalar_mul APIs

* ci

* address comments

* CI

* fix Eq/PartialEq bug for projective point
2026-06-17 09:45:41 -04:00
zz-sol
06cc7111db
improve test coverage (#50) 2026-06-17 08:25:25 -04:00
zz-sol
7cca75ad6e
[ed25519] improve docs (#53)
* improve docs

* more docs

* improve docs
2026-06-16 23:13:07 -04:00
zz-sol
befbe09d36
[ed25519] fix point conversions (#46)
* Update short_weierstrass.rs

* remove option for to_affine_le_bytes
2026-06-16 09:05:18 -04:00
zz-sol
53383206b8
fix 128bits scalar precondition (#44)
* Add prechecked optimized triple-base mul

Introduce a prechecked 128/128/256 optimized path for vartime triple-base multiplication: vartime_triple_base_mul_128_128_256 now checks whether a1 and a2 fit in 128 bits and falls back to general multiplication if not. Add vartime_triple_base_mul_128_128_256_prechecked and corresponding serial/vector backend implementations (renamed to *_prechecked). Add scalar_fits_in_128_bits helper and update callers (verification_key) to use the prechecked path. Update docs/comments and add a test to ensure full-width scalars are handled by the fallback path.

* bring back the docs

* CI
2026-06-16 08:59:35 -04:00
dependabot[bot]
cdc0688a81
Bump which from 4.4.2 to 8.0.2 (#32)
Bumps [which](https://github.com/harryfei/which-rs) from 4.4.2 to 8.0.2.
- [Release notes](https://github.com/harryfei/which-rs/releases)
- [Changelog](https://github.com/harryfei/which-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/harryfei/which-rs/compare/4.4.2...8.0.2)

---
updated-dependencies:
- dependency-name: which
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-15 18:06:17 -04:00
dependabot[bot]
7ff8829131
Bump cpufeatures from 0.2.17 to 0.3.0 (#34)
Bumps [cpufeatures](https://github.com/RustCrypto/utils) from 0.2.17 to 0.3.0.
- [Commits](https://github.com/RustCrypto/utils/compare/cpufeatures-v0.2.17...cpufeatures-v0.3.0)

---
updated-dependencies:
- dependency-name: cpufeatures
  dependency-version: 0.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-13 11:19:04 -04:00
dependabot[bot]
20c7fbb48d
Bump criterion from 0.5.1 to 0.8.2 (#31)
Bumps [criterion](https://github.com/criterion-rs/criterion.rs) from 0.5.1 to 0.8.2.
- [Release notes](https://github.com/criterion-rs/criterion.rs/releases)
- [Changelog](https://github.com/criterion-rs/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/criterion-rs/criterion.rs/compare/0.5.1...criterion-v0.8.2)

---
updated-dependencies:
- dependency-name: criterion
  dependency-version: 0.8.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-13 11:18:07 -04:00
dependabot[bot]
c6c109e139
Bump taiki-e/install-action from 2.77.1 to 2.81.6 (#48)
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.77.1 to 2.81.6.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](cca35edeb1...59012be088)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.81.6
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-13 11:17:27 -04:00
dependabot[bot]
798bd721f6
Bump actions/checkout from 4 to 6 (#49)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-13 11:16:41 -04:00
zz-sol
eed50b4d8d
[ed25519] improve docs (#47)
* improve docs

* more docs
2026-06-11 22:10:13 -04:00
zz-sol
c41adab68f
Validate SPKI OID/bytes and add pkcs8 tests (#43)
Add strict SPKI validation and tests for PKCS#8 public keys. Introduce OID and ALGORITHM_ID constants and refactor SPKI parsing into verification_key_bytes_from_spki which verifies the algorithm OID, parameters, and key byte length/format, returning appropriate pkcs8::spki::Error values. Update TryFrom/EncodePublicKey/DecodePublicKey implementations to use the new helper and to propagate/mapping errors correctly. Add two tests (behind the pkcs8 feature) to assert rejection of SPKI docs with the wrong algorithm OID and with malformed key bytes.
2026-06-10 06:44:35 -04:00
zz-sol
34a01d5b75
fix pkcs8 (#41) 2026-06-10 06:44:17 -04:00
zz-sol
bcc21e28bb
[ed25519] fix serdes error (#42) 2026-06-09 08:28:19 -04:00
Edvard Fagerholm
de07b0a389
ed25519: precompute AVX2 basepoint-128 table (#25)
Add a static AVX2 NafLookupTable5<CachedPoint> for B * 2^128 and use it from the vector triple-base verifier path instead of rebuilding that table every verification.

Benchmark notes:

- Ran this repository's Criterion benchmark program, benches/bench.rs, filtering to Single Verification, pinned to CPU 4 with 1s warmup, 2s measurement, and sample size 10.

- local_verify_zebra estimate was 19.382 us, with 95% CI 19.327..19.426 us.

- master measured 20.051 us, with 95% CI 19.938..20.134 us, so this branch was about 3.34% faster in that run.
2026-06-08 13:04:02 -04:00
Edvard Fagerholm
7d80488798
ed25519: avoid split-scalar canonical checks (#24)
The triple-base verifier splits b into zero-extended 128-bit halves, so b_lo and b_hi are already canonical. Add a crate-private unchecked constructor and use it for that internal AVX2 path.

Benchmark notes:

- Ran this repository's Criterion benchmark program, benches/bench.rs, filtering to Single Verification, pinned to CPU 4 with 1s warmup, 2s measurement, and sample size 10.

- local_verify_zebra estimate was 19.996 us, with 95% CI 19.862..20.077 us.

- master measured 20.051 us, with 95% CI 19.938..20.134 us, so this branch was about 0.27% faster in that run.
2026-06-08 13:02:22 -04:00
Yihau Chen
d5aa796046
ci: add dependabot.yml (#23) 2026-06-05 10:23:47 +08:00
Yihau Chen
4413a1284a
ci: check each feature individually (#18)
* ci: check each feature individually

* fix test all targets

* Update ristretto.rs

* Update lizard_ristretto.rs

---------

Co-authored-by: zz-sol <allaboutshop10@163.com>
2026-05-20 10:23:03 +08:00
zz-sol
154b58b3f4
[ed25519] downgrade rand_core (#21)
* downgrade rand_core

* Update bench.rs

* remove `try_from_rng`
2026-05-18 21:50:26 -04:00
Sam Kim
ed4a212bcb
[solana-bn254-syscall] Add solana-bn254-syscall crate (#13)
* add `solana-bn254-syscall` crate

* use `Validate::Yes` for `G1::deserialize_with_mode`

* fix crate name

* inherit dependencies from workspace

* update edition to 2021

* remove unnecessary `is_on_curve` check

* add `#[inline(always)]`

* make `PodG1` and `PodG2` pub(crate)

* remove unnecessary `is_on_curve` check

* remove custom logic for legacy versions

* `convert_endianness` -> `swap_endianness`

* simplify `swap_endianness`

* update function return types to arrays instead of vecs

* copy over docs

* update cargo lock

* copy over unit tests for serialization

* clean up docs for the syscall implementation functions

* Apply suggestions from code review

Co-authored-by: Stanislav Ladyzhenskiy <LStan@users.noreply.github.com>

* Update syscall/bn254-syscall/src/multiplication.rs

Co-authored-by: Stanislav Ladyzhenskiy <LStan@users.noreply.github.com>

* cargo lock

* remove `all-features` and `rustdoc-args`

* Apply suggestions from code review

Co-authored-by: Stanislav Ladyzhenskiy <LStan@users.noreply.github.com>

* Update syscall/bn254-syscall/Cargo.toml

Co-authored-by: Stanislav Ladyzhenskiy <LStan@users.noreply.github.com>

* remove `include = ...`

---------

Co-authored-by: Stanislav Ladyzhenskiy <LStan@users.noreply.github.com>
2026-05-19 08:56:06 +09:00
Yihau Chen
7170a1147d
ci: replace app-id with client-id (#20) 2026-05-14 10:25:08 +08:00
zz-sol
1b728159eb
impl zeroize for signing key (#16) 2026-05-13 18:11:16 -04:00
Yihau Chen
3a141c3fe3
ci: update release pipeline (#15) 2026-05-01 08:56:59 -04:00
Sam Kim
09198923bb
Add workspace.package information and do minor clean-up (#14)
* remove README.md in the syscall directory

* use workspace dependency in `bls12-381`

* add `workspace.package` information

* use 2021 edition for bls12-381

* inherit workspace.package for `ed25519-pokos`

* cargo fmt
2026-04-26 10:11:05 +09:00
zz-sol
cbee436037
[chore] remove unused features and downgrade to stable deps (#12)
* remove unnecessary features

* downgrade repos and remove rc/pre release
2026-04-22 20:23:12 -04:00
Sam Kim
77b39b268d
[bls12-381-syscall] Add solana-bls12-381-syscall crate (#11)
* add `bls12-381-syscall` crate

* add benchmark check in the CI

* cargo fmt

* remove 16 pair bench since the maximum bound is set to 8
2026-04-22 09:33:15 +09:00
zz-sol
1384fe1040
[chore] ci for crate release (#7)
* refactor and merge curve and ed crates

* fmt

* ci

* fmt again

* ci

* Update bench.rs

* fix ubuntu

* CI for crate release

* Update README.md
2026-04-15 08:44:33 -04:00
zz-sol
0f7379cc05
[feat] ed25519-pokos: Proof of Knowledge of Seed (POKOS) for Ed25519 (#10)
* init pokos

* fix soundness bug

* update doc

* fix

* simplification

* refactor

* add docs

* clean up

* ci

* Update experimental/ed25519-pokos/readme.md

Co-authored-by: Sam Kim <skim13@cs.stanford.edu>

---------

Co-authored-by: Sam Kim <skim13@cs.stanford.edu>
2026-04-08 10:24:32 -04:00
zz-sol
bccf7e13c0
[feat] impl legacy dalek verification method for ed25519 (#8)
* Initial commit

* skeleton

* refactor and merge curve and ed crates

* fmt

* ci

* fmt again

* ci

* Update bench.rs

* fix ubuntu

* implement dalek api

* clean up
2026-03-31 07:46:24 -04:00
zz-sol
b801651332
refactor cargo toml to use worksapce (#9) 2026-03-30 08:48:31 -04:00
zz-sol
1587b4c24f
refactor and merge curve and ed crates (#6)
* refactor and merge curve and ed crates

* fmt

* ci

* fmt again

* ci

* Update bench.rs

* fix ubuntu
2026-03-26 08:09:10 -04:00