MCPcopy Create free account
hub / github.com/RustCrypto/utils / generator

Function generator

wycheproof2blb/src/ecdsa.rs:52–80  ·  view source on GitHub ↗
(data: &[u8], algorithm: &str, _key_size: u32)

Source from the content-addressed store, hash-verified

50}
51
52pub fn generator(data: &[u8], algorithm: &str, _key_size: u32) -> Vec<TestInfo> {
53 let suite: TestSuite = serde_json::from_slice(data).unwrap();
54
55 let mut infos = vec![];
56 for g in &suite.test_groups {
57 assert!(algorithm.starts_with(&g.key.curve));
58 assert!(matches!(
59 g.sha.as_str(),
60 "SHA-224" | "SHA-256" | "SHA-384" | "SHA-512"
61 ));
62 for tc in &g.tests {
63 if tc.case.result == wycheproof::CaseResult::Acceptable {
64 // TODO: figure out what to do with test cases that pass but which have weak params
65 continue;
66 }
67 infos.push(TestInfo {
68 data: vec![
69 g.key.wx.clone(),
70 g.key.wy.clone(),
71 tc.msg.clone(),
72 tc.sig.clone(),
73 vec![case_result(&tc.case)],
74 ],
75 desc: description(&suite.suite, &tc.case),
76 });
77 }
78 }
79 infos
80}

Callers

nothing calls this directly

Calls 2

descriptionFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected