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

Function generator

wycheproof2blb/src/aead.rs:60–92  ·  view source on GitHub ↗
(data: &[u8], algorithm: &str, key_size: u32, iv_size: u32)

Source from the content-addressed store, hash-verified

58}
59
60fn generator(data: &[u8], algorithm: &str, key_size: u32, iv_size: u32) -> Vec<TestInfo> {
61 let suite: TestSuite = serde_json::from_slice(data).unwrap();
62 assert_eq!(algorithm, suite.suite.algorithm);
63
64 let mut infos = vec![];
65 for g in &suite.test_groups {
66 for tc in &g.tests {
67 if key_size != 0 && g.key_size != key_size {
68 continue;
69 }
70 if g.iv_size != iv_size {
71 println!(" skipping tests for iv_size={}", g.iv_size);
72 continue;
73 }
74 let mut combined_ct = Vec::new();
75 combined_ct.extend_from_slice(&tc.ct);
76 combined_ct.extend_from_slice(&tc.tag);
77
78 infos.push(TestInfo {
79 data: vec![
80 tc.key.clone(),
81 tc.iv.clone(),
82 tc.aad.clone(),
83 tc.msg.clone(),
84 combined_ct,
85 vec![case_result(&tc.case)],
86 ],
87 desc: description(&suite.suite, &tc.case),
88 });
89 }
90 }
91 infos
92}

Callers 3

aes_gcm_generatorFunction · 0.70
chacha20_poly1305Function · 0.70
xchacha20_poly1305Function · 0.70

Calls 2

descriptionFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected