iang
запушил(а) main в SigmaProtocol/cmz
62baf35633 Update version to 0.4.0
- Derive the CMZ generator `A` automatically via a RFC 9380
hash-to-group of the generator. Applications no longer need to call
`cmz_group_init` at startup.
- Add `CMZGroup` trait, `cmz_generator_a` function, and curve features
for the automatic derivation. Ristretto support is enabled by default;
P-256 and secp256k1 are available through the `p256` and `k256`
features.
- Depend on `sigma-compiler` 0.3.0, `rand` 0.10, `group` 0.14, `ff` 0.14
- CMZ credential `Point` types must now implement
`group::prime::PrimeGroup`, `group::GroupEncoding`, and
`hash2group::FromHash<hash2group::rfc9380::ExpandMsgXmd<sha2::Sha512>>`.
This combination of traits is now called `CMZGroup`.
- The `rng` parameter in various APIs generated by `cmz` changed from
type `&mut (impl CryptoRng + RngCore)` to type `&mut (impl CryptoRng +
Rng)` (due to the update to `rand` 0.10)
- The ability to use `cmz` simultaneously for more than one group was
broken before, and is now fixed.
5e7b23a75b feat!: derive CMZ generator A automatically
Derive and memoize the auxiliary generator with RFC 9380 hash-to-group, while retaining explicit initialization as a pre-first-use compatibility override.
BREAKING CHANGE: CMZ credential point types must implement the encoding and SHA-512 hash-to-group bounds captured by CMZGroup.
(cherry picked from commit bbe7a7948c1aac9feba4d2505cdd95d65167adea)
78b1cbdb32 refactor: build the basepoints only on the call that loads them
`cmz_group_init` built a `CMZBasepoints` and handed it to `load_bp`, which
then dropped it on the floor unless the map was empty -- and `load_bp`
cloned it when it was not. Callers invoke this on every request, so take
a closure and construct only on the call that actually populates the map.
By itself that is a shape fix, not a measured win: `wnaf_is_constant_time`
is not a default feature and nothing enables it, so `CMZBasepoints` is
`{A_, B_}` and construction plus clone costs about 8ns. It matters under
that feature, where construction is two WnafBase tables.
The cost callers actually pay is the argument, not the call:
`cmz_group_init(G::hash_from_bytes::<Sha512>(...))` evaluates the
hash-to-curve eagerly, at roughly 4.7us per request, and nothing on the
callee side can reach it. So `cmz_group_init_with` takes the generator as
a closure too, and the hash happens once, on the call that initializes.
Both sides of a round trip call this, so it is roughly 9us a round trip
for a one-word change at each call site. `cmz_group_init` is unchanged.
(cherry picked from commit 0b8a6fbbb7f06aa68d6a00c60efdfe555e9ac528)
c953d8bdfe fix: key the basepoints map on the group type
`StaticTypeMap::call_once::<Type, _>` looks the entry up by
`TypeId::of::<Type>()`, and this passed `Box<dyn CMZbp>` -- the same type
for every group. So the map held one slot shared by all groups rather
than one per group, which is the whole point of the design described at
length above it: a second `cmz_group_init` for a different group was
ignored, and the following `cmz_basepoints` read back the first group's
basepoints and panicked in the downcast.
Key on `G` instead. This makes previously-panicking programs work, so it
is a behaviour change and kept apart from the refactor that follows it.
tests/two_groups.rs covers it, and needs a second curve: cmz had only
curve25519-dalek available, so p256 joins the dev-dependencies.
(cherry picked from commit 25aa8f25cfeb28e995665eba3d946287b841742d)
955c44ccb1 Update sigma-compiler and released proof dependencies
Use the draft-v3 sigma-compiler Git dependency with released sigma-proofs
0.4 and spongefish 0.8. Update the group, curve, hash-to-group, and RNG
dependencies and APIs to match the released versions.
- Просмотр сравнение для этих 5 коммитов »
1 неделя назад