Skip to content

Commit 708aa72

Browse files
authored
wycheproof2blb: secp521r1 support (#980)
Adds support for extracting secp521r1 test vectors from Wycheproof, in order to test the `p521` crate.
1 parent 6c39ebb commit 708aa72

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

wycheproof2blb/src/ecdsa.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ pub fn generator(data: &[u8], algorithm: &str, _key_size: u32) -> Vec<TestInfo>
5555
let mut infos = vec![];
5656
for g in &suite.test_groups {
5757
assert_eq!(g.key.curve, algorithm);
58-
assert!(matches!(g.sha.as_str(), "SHA-224" | "SHA-256" | "SHA-384"));
58+
assert!(matches!(
59+
g.sha.as_str(),
60+
"SHA-224" | "SHA-256" | "SHA-384" | "SHA-512"
61+
));
5962
for tc in &g.tests {
6063
if tc.case.result == crate::wycheproof::CaseResult::Acceptable {
6164
// TODO: figure out what to do with test cases that pass but which have weak params

wycheproof2blb/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ fn main() {
129129
file: "ecdsa_secp384r1_sha384_test.json",
130130
generator: ecdsa::generator,
131131
},
132+
"secp521r1" => Algorithm {
133+
file: "ecdsa_secp521r1_sha512_test.json",
134+
generator: ecdsa::generator,
135+
},
132136
_ => panic!("Unrecognized algorithm '{}'", algorithm),
133137
};
134138

0 commit comments

Comments
 (0)