Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ecdsa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: RustCrypto/actions/cargo-hack-install@master
- run: cargo hack build --target ${{ matrix.target }} --feature-powerset --exclude-features std
- run: cargo hack build --target ${{ matrix.target }} --feature-powerset --exclude-features std,getrandom

test:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ecdsa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ algorithm = ["dep:rfc6979", "digest", "elliptic-curve/arithmetic", "hazmat"]
dev = ["algorithm", "digest/dev", "elliptic-curve/dev"]
der = ["dep:der"]
digest = ["dep:digest", "elliptic-curve/digest", "signature/digest"]
getrandom = ["elliptic-curve/getrandom"]
hazmat = []
pkcs8 = ["der", "digest", "elliptic-curve/pkcs8"]
pem = ["elliptic-curve/pem", "pkcs8"]
Expand Down
13 changes: 9 additions & 4 deletions ecdsa/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use signature::{
DigestSigner, MultipartSigner, RandomizedDigestSigner, RandomizedMultipartSigner,
RandomizedSigner, Signer,
hazmat::{PrehashSigner, RandomizedPrehashSigner},
rand_core::{CryptoRng, TryCryptoRng},
rand_core::TryCryptoRng,
};

#[cfg(feature = "der")]
Expand Down Expand Up @@ -85,11 +85,16 @@ where
SignatureSize<C>: ArraySize,
{
/// Generate a cryptographically random [`SigningKey`].
pub fn random<R: CryptoRng + ?Sized>(rng: &mut R) -> Self {
NonZeroScalar::<C>::random(rng).into()
///
/// # Panics
///
/// If the system's cryptographically secure RNG has an internal error.
#[cfg(feature = "getrandom")]
pub fn generate() -> Self {
NonZeroScalar::<C>::generate().into()
}

/// Generate a cryptographically random [`SigningKey`].
/// Generate a cryptographically random [`SigningKey`], returning underlying RNG errors.
pub fn try_from_rng<R: TryCryptoRng + ?Sized>(
rng: &mut R,
) -> core::result::Result<Self, R::Error> {
Expand Down