Skip to content

Commit 8599e52

Browse files
authored
Bump crypto-bigint to v0.7.0-rc.5 (#1067)
* dsa: bump `crypto-bigint` to v0.7.0-rc.5 * ecdsa: rename `ScalarPrimitive` to `ScalarValue` Companion PR to RustCrypto/traits#2008
1 parent ecc8d27 commit 8599e52

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

Cargo.lock

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ lms-signature = { path = "./lms" }
2525
ml-dsa = { path = "./ml-dsa" }
2626
rfc6979 = { path = "./rfc6979" }
2727
slh-dsa = { path = "./slh-dsa" }
28+
29+
# https://github.com/RustCrypto/traits/pull/2008
30+
elliptic-curve = { git = "https://github.com/RustCrypto/traits" }

dsa/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ rust-version = "1.85"
1818
[dependencies]
1919
der = { version = "0.8.0-rc.8", features = ["alloc"] }
2020
digest = "0.11.0-rc.1"
21-
crypto-bigint = { version = "0.7.0-rc.4", default-features = false, features = ["alloc", "zeroize"] }
22-
crypto-primes = { version = "0.7.0-pre.1", default-features = false }
21+
crypto-bigint = { version = "0.7.0-rc.5", default-features = false, features = ["alloc", "zeroize"] }
22+
crypto-primes = { version = "0.7.0-pre.2", default-features = false }
2323
rfc6979 = { version = "0.5.0-rc.1" }
2424
sha2 = { version = "0.11.0-rc.2", default-features = false }
2525
signature = { version = "3.0.0-rc.3", default-features = false, features = ["alloc", "digest", "rand_core"] }

ecdsa/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub use crate::verifying::VerifyingKey;
8686

8787
use core::{fmt, ops::Add};
8888
use elliptic_curve::{
89-
FieldBytes, FieldBytesSize, ScalarPrimitive,
89+
FieldBytes, FieldBytesSize, ScalarValue,
9090
array::{Array, ArraySize, typenum::Unsigned},
9191
};
9292

@@ -208,8 +208,8 @@ pub type SignatureBytes<C> = Array<u8, SignatureSize<C>>;
208208
/// [IEEE P1363]: https://en.wikipedia.org/wiki/IEEE_P1363
209209
#[derive(Clone, Eq, PartialEq)]
210210
pub struct Signature<C: EcdsaCurve> {
211-
r: ScalarPrimitive<C>,
212-
s: ScalarPrimitive<C>,
211+
r: ScalarValue<C>,
212+
s: ScalarValue<C>,
213213
}
214214

215215
impl<C> Signature<C>
@@ -258,8 +258,8 @@ where
258258
/// - `Err(err)` if the `r` and/or `s` component of the signature is
259259
/// out-of-range when interpreted as a big endian integer.
260260
pub fn from_scalars(r: impl Into<FieldBytes<C>>, s: impl Into<FieldBytes<C>>) -> Result<Self> {
261-
let r = ScalarPrimitive::from_slice(&r.into()).map_err(|_| Error::new())?;
262-
let s = ScalarPrimitive::from_slice(&s.into()).map_err(|_| Error::new())?;
261+
let r = ScalarValue::from_slice(&r.into()).map_err(|_| Error::new())?;
262+
let s = ScalarValue::from_slice(&s.into()).map_err(|_| Error::new())?;
263263

264264
if r.is_zero().into() || s.is_zero().into() {
265265
return Err(Error::new());
@@ -327,7 +327,7 @@ where
327327
/// [1]: https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki
328328
pub fn normalize_s(&self) -> Self {
329329
let mut result = self.clone();
330-
let s_inv = ScalarPrimitive::from(-self.s());
330+
let s_inv = ScalarValue::from(-self.s());
331331
result.s.conditional_assign(&s_inv, self.s.is_high());
332332
result
333333
}
@@ -524,8 +524,8 @@ where
524524

525525
impl<C: EcdsaCurve> Zeroize for Signature<C> {
526526
fn zeroize(&mut self) {
527-
self.r = ScalarPrimitive::ONE;
528-
self.s = ScalarPrimitive::ONE;
527+
self.r = ScalarValue::ONE;
528+
self.s = ScalarValue::ONE;
529529
}
530530
}
531531

0 commit comments

Comments
 (0)