Skip to content

Commit

Permalink
Bump ecdsa, p256, p384
Browse files Browse the repository at this point in the history
Bumps the following crate dependencies:

- `ecdsa` v0.12
- `p256` v0.9
- `p384` v0.8
  • Loading branch information
tarcieri committed Jun 8, 2021
1 parent 8e00e97 commit 75ade34
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 31 deletions.
32 changes: 20 additions & 12 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Expand Up @@ -17,12 +17,12 @@ keywords = ["aead", "digest", "crypto", "ring", "signature"]
[dependencies]
aead = { version = "0.4", optional = true, default-features = false }
digest = { version = "0.9", optional = true }
ecdsa = { version = "0.11", optional = true, default-features = false }
ecdsa = { version = "0.12", optional = true, default-features = false }
ed25519 = { version = "1", optional = true, default-features = false }
generic-array = { version = "0.14", default-features = false }
opaque-debug = "0.3"
p256 = { version = "0.8", optional = true, default-features = false, features = ["ecdsa-core"] }
p384 = { version = "0.7", optional = true, default-features = false, features = ["ecdsa"] }
p256 = { version = "0.9", optional = true, default-features = false, features = ["ecdsa-core"] }
p384 = { version = "0.8", optional = true, default-features = false, features = ["ecdsa"] }
ring = { version = "0.16", default-features = false }
zeroize = { version = "1", default-features = false }

Expand Down
11 changes: 4 additions & 7 deletions src/signature/ecdsa/signing_key.rs
Expand Up @@ -3,10 +3,7 @@
use super::{Curve, CurveAlg, Signature, VerifyingKey};
use crate::signature::{Error, Signature as _, Signer};
use ::ecdsa::{
elliptic_curve::{
sec1::{UncompressedPointSize, UntaggedPointSize},
Order,
},
elliptic_curve::sec1::{UncompressedPointSize, UntaggedPointSize},
SignatureSize,
};
use core::marker::PhantomData;
Expand All @@ -21,7 +18,7 @@ use ring::{
/// ECDSA signing key. Generic over elliptic curves.
pub struct SigningKey<C>
where
C: Curve + CurveAlg + Order,
C: Curve + CurveAlg,
SignatureSize<C>: ArrayLength<u8>,
{
/// *ring* ECDSA keypair
Expand All @@ -36,7 +33,7 @@ where

impl<C> SigningKey<C>
where
C: Curve + CurveAlg + Order,
C: Curve + CurveAlg,
SignatureSize<C>: ArrayLength<u8>,
{
/// Initialize a [`SigningKey`] from a PKCS#8-encoded private key
Expand Down Expand Up @@ -73,7 +70,7 @@ where

impl<C> Signer<Signature<C>> for SigningKey<C>
where
C: Curve + CurveAlg + Order,
C: Curve + CurveAlg,
SignatureSize<C>: ArrayLength<u8>,
{
fn try_sign(&self, msg: &[u8]) -> Result<Signature<C>, Error> {
Expand Down
15 changes: 6 additions & 9 deletions src/signature/ecdsa/verifying_key.rs
Expand Up @@ -4,37 +4,34 @@ use super::{Curve, CurveAlg, Signature};
use crate::signature::{Error, Verifier};
use ::ecdsa::{
elliptic_curve::{
bigint::Encoding as _,
sec1::{self, UncompressedPointSize, UntaggedPointSize},
Order,
},
SignatureSize,
};
use core::{convert::TryInto, ops::Add};
use generic_array::{
typenum::{Unsigned, U1},
ArrayLength,
};
use generic_array::{typenum::U1, ArrayLength};
use ring::signature::UnparsedPublicKey;

/// ECDSA verifying key. Generic over elliptic curves.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VerifyingKey<C>(sec1::EncodedPoint<C>)
where
C: Curve + CurveAlg + Order,
C: Curve + CurveAlg,
SignatureSize<C>: ArrayLength<u8>,
UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
UncompressedPointSize<C>: ArrayLength<u8>;

impl<C> VerifyingKey<C>
where
C: Curve + CurveAlg + Order,
C: Curve + CurveAlg,
SignatureSize<C>: ArrayLength<u8>,
UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
UncompressedPointSize<C>: ArrayLength<u8>,
{
/// Initialize [`VerifyingKey`] from a SEC1-encoded public key
pub fn new(bytes: &[u8]) -> Result<Self, Error> {
let point_result = if bytes.len() == C::FieldSize::to_usize() * 2 {
let point_result = if bytes.len() == C::UInt::BYTE_SIZE * 2 {
Ok(sec1::EncodedPoint::from_untagged_bytes(
bytes.try_into().unwrap(),
))
Expand All @@ -53,7 +50,7 @@ where

impl<C: Curve> Verifier<Signature<C>> for VerifyingKey<C>
where
C: Curve + CurveAlg + Order,
C: Curve + CurveAlg,
SignatureSize<C>: ArrayLength<u8>,
UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
UncompressedPointSize<C>: ArrayLength<u8>,
Expand Down

0 comments on commit 75ade34

Please sign in to comment.