From b3263983d585171a3c91c7074dab48c46f0c754b Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sun, 9 Apr 2023 19:23:24 -0600 Subject: [PATCH] wycheproof2blb: secp224r1 support (#891) Adds support for extracting secp224r1 test vectors from Wycheproof, in order to test the `p224` crate. --- wycheproof2blb/src/ecdsa.rs | 2 +- wycheproof2blb/src/main.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wycheproof2blb/src/ecdsa.rs b/wycheproof2blb/src/ecdsa.rs index 2e0fc706..7c01a112 100644 --- a/wycheproof2blb/src/ecdsa.rs +++ b/wycheproof2blb/src/ecdsa.rs @@ -55,7 +55,7 @@ pub fn generator(data: &[u8], algorithm: &str, _key_size: u32) -> Vec let mut infos = vec![]; for g in &suite.test_groups { assert_eq!(g.key.curve, algorithm); - assert!(matches!(g.sha.as_str(), "SHA-256" | "SHA-384")); + assert!(matches!(g.sha.as_str(), "SHA-224" | "SHA-256" | "SHA-384")); for tc in &g.tests { if tc.case.result == crate::wycheproof::CaseResult::Acceptable { // TODO: figure out what to do with test cases that pass but which have weak params diff --git a/wycheproof2blb/src/main.rs b/wycheproof2blb/src/main.rs index fc5b9996..87cac8b8 100644 --- a/wycheproof2blb/src/main.rs +++ b/wycheproof2blb/src/main.rs @@ -112,6 +112,10 @@ fn main() { file: "eddsa_test.json", generator: ed25519::generator, }, + "secp224r1" => Algorithm { + file: "ecdsa_secp224r1_sha224_test.json", + generator: ecdsa::generator, + }, "secp256r1" => Algorithm { file: "ecdsa_secp256r1_sha256_test.json", generator: ecdsa::generator,