Skip to content

Commit 06afd50

Browse files
authored
testsuite: update deps (#363)
1 parent c0493fe commit 06afd50

File tree

3 files changed

+52
-43
lines changed

3 files changed

+52
-43
lines changed

Cargo.lock

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

testsuite/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ cortex-m-rt = "0.7"
8686
defmt = "0.3"
8787
defmt-rtt = "0.4"
8888
defmt-test = "0.3"
89-
ecdsa = { version = "0.14", default-features = false, features = ["arithmetic", "hazmat"] }
89+
ecdsa = { version = "0.16", default-features = false, features = ["arithmetic", "hazmat"] }
9090
embedded-time = "0.12"
91-
hex-literal = "0.3"
92-
itertools = { version = "0.10", default-features = false }
91+
hex-literal = "0.4"
92+
itertools = { version = "0.11", default-features = false }
9393
nb = "1"
94-
p256 = { version = "0.11", default-features = false, features = ["arithmetic", "ecdsa"] }
94+
p256 = { version = "0.13", default-features = false, features = ["arithmetic", "ecdsa"] }
9595
panic-probe = { version = "0.3", features = ["print-defmt" ] }
9696
rand = { version = "0.8", default-features = false }
9797
rand_chacha = { version = "0.3", default-features = false }

testsuite/src/pka.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,16 @@ mod tests {
146146
let private_key_bytes: [u8; 32] = into_bytes(PRIVATE_KEY_SWAP);
147147
let integer_bytes: [u8; 32] = into_bytes(INTEGER_SWAP);
148148

149-
let prehashed_message_as_scalar: Scalar =
150-
Scalar::from_be_bytes_reduced(hash_bytes.into());
151-
let static_scalar: Scalar = Scalar::from_be_bytes_reduced(private_key_bytes.into());
149+
let prehashed_message_as_scalar: Scalar = Scalar::reduce_bytes((&hash_bytes).into());
150+
let static_scalar: Scalar = Scalar::reduce_bytes((&private_key_bytes).into());
152151

153152
let ephemeral_secret =
154-
defmt::unwrap!(p256::SecretKey::from_be_bytes(&integer_bytes).ok());
155-
let ephemeral_scalar: Scalar =
156-
Scalar::from_be_bytes_reduced(ephemeral_secret.to_be_bytes());
153+
defmt::unwrap!(p256::SecretKey::from_bytes((&integer_bytes).into()).ok());
154+
let ephemeral_scalar: Scalar = Scalar::reduce_bytes(&ephemeral_secret.to_bytes());
157155

158156
let start: u32 = DWT::cycle_count();
159157
let (signature, _) = unwrap!(static_scalar
160-
.try_sign_prehashed(ephemeral_scalar, prehashed_message_as_scalar.to_bytes())
158+
.try_sign_prehashed(ephemeral_scalar, &prehashed_message_as_scalar.to_bytes())
161159
.ok());
162160
let elapsed: u32 = DWT::cycle_count().wrapping_sub(start);
163161
defmt::info!("Approximate cycles per rust-crypto p256 sign: {}", elapsed);
@@ -232,8 +230,7 @@ mod tests {
232230

233231
let public_key: PublicKey = unwrap!(PublicKey::from_sec1_bytes(&key).ok());
234232

235-
let prehashed_message_as_scalar: Scalar =
236-
Scalar::from_be_bytes_reduced(hash_bytes.into());
233+
let prehashed_message_as_scalar: Scalar = Scalar::reduce_bytes((&hash_bytes).into());
237234

238235
let signature: Signature<_> =
239236
unwrap!(
@@ -243,7 +240,7 @@ mod tests {
243240
let start: u32 = DWT::cycle_count();
244241
let result = public_key
245242
.as_affine()
246-
.verify_prehashed(prehashed_message_as_scalar.to_bytes(), &signature);
243+
.verify_prehashed(&prehashed_message_as_scalar.to_bytes(), &signature);
247244
let elapsed: u32 = DWT::cycle_count().wrapping_sub(start);
248245
defmt::info!(
249246
"Approximate cycles per rust-crypto p256 verify: {}",

0 commit comments

Comments
 (0)