Skip to content

Commit

Permalink
wycheproof2blb: secp521r1 support (#980)
Browse files Browse the repository at this point in the history
Adds support for extracting secp521r1 test vectors from Wycheproof, in
order to test the `p521` crate.
  • Loading branch information
tarcieri authored Nov 2, 2023
1 parent 6c39ebb commit 708aa72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wycheproof2blb/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ pub fn generator(data: &[u8], algorithm: &str, _key_size: u32) -> Vec<TestInfo>
let mut infos = vec![];
for g in &suite.test_groups {
assert_eq!(g.key.curve, algorithm);
assert!(matches!(g.sha.as_str(), "SHA-224" | "SHA-256" | "SHA-384"));
assert!(matches!(
g.sha.as_str(),
"SHA-224" | "SHA-256" | "SHA-384" | "SHA-512"
));
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
Expand Down
4 changes: 4 additions & 0 deletions wycheproof2blb/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ fn main() {
file: "ecdsa_secp384r1_sha384_test.json",
generator: ecdsa::generator,
},
"secp521r1" => Algorithm {
file: "ecdsa_secp521r1_sha512_test.json",
generator: ecdsa::generator,
},
_ => panic!("Unrecognized algorithm '{}'", algorithm),
};

Expand Down

0 comments on commit 708aa72

Please sign in to comment.