25 Commits

Author SHA1 Message Date
Tony Arcieri 1b47ec5298 dsa: impl Generate for Components and SigningKey (#1372)
This renames the old `SigningKey::generate` to
`try_generate_from_rng_with_components`, having the new one generate
random `Components` with a 3072-bit modulus size, which is now the
`Default` for `KeySize`.
2026-06-06 11:27:17 -06:00
Arthur Gautier 43d9831ccf rfc6979: allow the use of non-block_api-backed hashes (#1360)
Never mind, I'll take care of it
2026-06-06 09:58:40 -06:00
Tony Arcieri 275aea5146 dsa: add TryCryptoRng support (#1367)
This renames the previous `generate` methods to
`try_generate_from_rng_with_key_size` and changes them to accept a
`TryCryptoRng`, returning a `Result` with potential RNG errors.

This helps clear the way for implementing the `Generate` trait from
`crypto-common`, which defines its own `generate` method which takes
no parameters, using the system RNG and default key size.
2026-06-02 15:20:32 -06:00
Tony Arcieri 66295315cf Bump rand_core to v0.10.0-rc-6 (#1170)
Renames `(Try)RngCore` => `(Try)Rng`
2026-01-24 15:30:36 -07:00
Tony Arcieri 837975e56c dsa: bump crypto-bigint to v0.7.0-rc.16 (#1148)
Includes changes to the `BoxedMontyForm::new` API, and also bumps
`crypto-primes` to v0.7.0-rc.6 which includes the associated updates
to that crate for the API change.
2026-01-12 13:34:07 -07:00
Steven Dee 4112075105 dsa: decouple precise RNG state from tests (#1139)
The `signature` test was too tightly coupled with the precise RNG
output, in effect not just testing the DSA signature/verification logic
but also testing that the exact bit sequence was produced by the
dependent crate.

We already have tests against deterministic keys and signatures at
`tests/deterministic.rs`, so modify `tests/signature.rs` to instead
generate a random keypair using the system RNG, then generate a
signature with that keypair, and then verify that signature.

The existing hard-coded signatures have been left in place as they are
used to test PKCS decoding and encoding.
2026-01-05 17:33:18 -07:00
Tony Arcieri 48b7f61e52 RNG cleanup (#1127)
Switches every crate except `slh-dsa` away from a direct `rand`
dependency they don't need. Right now we can't publish any crate that
directly depends on `rand`.

Uses a consistent default strategy for RNGs: `SysRng`, sourced from the
`getrandom` or as `rand::rngs::SysRng` in the case of `slh-dsa` which is
actually using `rand`-specific features.

If this causes too much of a slowdown, we can re-evaluate and go (back)
to `ChaCha8Rng` where needed for testing.
2025-12-29 21:07:55 -07:00
Tony Arcieri e68b77acbd Bump rand_core to v0.10.0-rc-2 (#1097)
This also accordingly bumps all of the underlying crates to versions
which (transitively) depend on the `rand`/`rand_core` v0.10 release
series
2025-11-05 17:44:01 -07:00
daxpedda 0e4a329998 Update to digest::EagerHash (#1077)
ecdsa: merges `arithmetic` into `algorithm` crate feature
2025-09-18 09:25:25 -06:00
daxpedda 580758e3e7 rfc6979: replace Digest requirement with EagerHash (#1076) 2025-09-15 16:34:49 -06:00
daxpedda 923fe6f856 Update to signature::DigestSigner/Verifier changes (#1064)
Companion PR to RustCrypto/traits#2004
2025-09-12 20:13:18 -06:00
Tony Arcieri 90757c3022 dsa: make pkcs8 feature optional (#1014)
It's not needed in applications which define their own key encodings,
for example SSH.

The feature is still enabled by-default.
2025-07-10 16:49:25 -06:00
Tony Arcieri 6cbef4f168 dsa: handle NonZero/Odd conversions on BoxedUint internally (#998)
Makes `BoxedUint` the one unsigned integer type in the public API,
converting to `NonZero<BoxedUint>` and `Odd<BoxedUint>` as needed.

This makes the API simpler to use for end-users, with fewer types for
them to manage.

Closes #987
2025-06-16 12:02:57 -06:00
dishmaker c84a3c411e all: test: apply cargo clippy fixes (#966)
* dsa+ecdsa+ed25519+ed448+ml-dsa: apply cargo clippy fixes
* ml-dsa: test: allow `clippy::integer_division_remainder_used`
2025-06-14 12:38:13 -06:00
Arthur Gautier 132a6b1b38 chore(deps): bump digest git pin (#971) 2025-05-27 12:13:58 -06:00
Arthur Gautier 8f770af1a2 dsa: migrate to crypto-bigint (#906)
Closes #779
2025-04-23 11:30:26 -06:00
Mirek Sedzinski 40649077c2 dsa: gate signing under hazmat feature (#859)
Resolves #858
2025-01-19 14:12:56 -07:00
Tony Arcieri 5d18f2a133 dsa: bump pkcs8 dependency to v0.10; MSRV 1.65 (#664) 2023-02-28 20:56:55 -07:00
Tony Arcieri 1578fe31b9 Bump signature to v2.0.0-pre.2; use impl CryptoRngCore (#579)
As discussed in RustCrypto/traits#1148, this uses
`&mut impl CryptoRngCore` as the API for passing CSRNGs.

This removes the need for a generic parameter in the type signature
while also keeping syntax to a minimum.

The traits in `signature` v2.0.0-pre.2 switched to these APIs. See
RustCrypto/traits#1147.
2022-11-04 11:15:20 -06:00
Tony Arcieri 1eec6b429d Bump signature to 2.0.0-pre (#562)
Implements the proposed breaking changes to the `signature` crate from
https://github.com/RustCrypto/traits/pull/1141

Most notably the `Signature` trait has been replaced with a
`SignatureEncoding` trait which permits an internally structured
signature representation.
2022-10-31 14:11:34 -06:00
cobratbq 4ed617c514 dsa: implement Signer and Verifier using SHA-256 as default (#559) 2022-10-29 14:56:08 -06:00
Tony Arcieri a440df135a rfc6979: use SimpleHmac to implement HmacDrbg (#499)
`SimpleHmac` allows for significantly simpler bounds on generic digest
types versus `Hmac`.
2022-06-26 20:55:32 -06:00
aumetra 491fe5c2c6 dsa: Small API overhaul (#489) 2022-05-21 14:16:53 -06:00
Tony Arcieri ba86f16292 dsa: rename key types to SigningKey and VerifyingKey (#485)
For consistency with the `ecdsa` crate.

This naming scheme follows the philosophy that in a digital signature
scheme, it's clearer to name keys after their roles.

DSA admittedly benefits less than other schemes where there are other
potential algorithms that can be implemented using the same core
mathematics which share the same key representations.
2022-05-16 16:37:32 -06:00
aumetra 373e4fe08b dsa: Add initial DSA implementation (#471)
Adds an initial implementation of DSA (see #8)  

The following things work when tested against OpenSSL:

- The generated keys are valid and can be imported and exported from/to their DER/PEM representation
- Signatures generated by this library can be successfully verified
- Signatures can be imported and exported from/into their DER representation
- Signatures generated by OpenSSL can be successfully imported and verified
2022-05-16 11:53:39 -06:00