]> git.proxmox.com Git - rustc.git/blob - vendor/hmac/tests/mod.rs
New upstream version 1.70.0+dfsg2
[rustc.git] / vendor / hmac / tests / mod.rs
1 #[cfg(not(feature = "reset"))]
2 use digest::new_mac_test as test;
3 #[cfg(feature = "reset")]
4 use digest::new_resettable_mac_test as test;
5 use hmac::{Hmac, SimpleHmac};
6 use sha1::Sha1;
7 use sha2::{Sha224, Sha256, Sha384, Sha512};
8 use streebog::{Streebog256, Streebog512};
9
10 // Test vectors from RFC 2104, plus wiki test
11 test!(hmac_md5_rfc2104, "md5", Hmac<md5::Md5>);
12 test!(hmac_md5_rfc2104_simple, "md5", SimpleHmac<md5::Md5>);
13
14 // Test vectors from RFC 4231
15 test!(hmac_sha224_rfc4231, "sha224", Hmac<Sha224>);
16 test!(hmac_sha256_rfc4231, "sha256", Hmac<Sha256>);
17 test!(hmac_sha384_rfc4231, "sha384", Hmac<Sha384>);
18 test!(hmac_sha512_rfc4231, "sha512", Hmac<Sha512>);
19 test!(hmac_sha224_rfc4231_simple, "sha224", SimpleHmac<Sha224>);
20 test!(hmac_sha256_rfc4231_simple, "sha256", SimpleHmac<Sha256>);
21 test!(hmac_sha384_rfc4231_simple, "sha384", SimpleHmac<Sha384>);
22 test!(hmac_sha512_rfc4231_simple, "sha512", SimpleHmac<Sha512>);
23
24 // Test vectors from R 50.1.113-2016:
25 // https://tc26.ru/standard/rs/Р 50.1.113-2016.pdf
26 test!(hmac_streebog256, "streebog256", Hmac<Streebog256>);
27 test!(hmac_streebog512, "streebog512", Hmac<Streebog512>);
28 test!(
29 hmac_streebog256_simple,
30 "streebog256",
31 SimpleHmac<Streebog256>
32 );
33 test!(
34 hmac_streebog512_simple,
35 "streebog512",
36 SimpleHmac<Streebog512>
37 );
38
39 // Tests from Project Wycheproof:
40 // https://github.com/google/wycheproof
41 test!(
42 hmac_sha1_wycheproof,
43 "wycheproof-sha1",
44 Hmac<Sha1>,
45 trunc_left,
46 );
47 test!(
48 hmac_sha256_wycheproof,
49 "wycheproof-sha256",
50 Hmac<Sha256>,
51 trunc_left,
52 );
53 test!(
54 hmac_sha384_wycheproof,
55 "wycheproof-sha384",
56 Hmac<Sha384>,
57 trunc_left,
58 );
59 test!(
60 hmac_sha512_wycheproof,
61 "wycheproof-sha512",
62 Hmac<Sha512>,
63 trunc_left,
64 );
65 test!(
66 hmac_sha1_wycheproof_simple,
67 "wycheproof-sha1",
68 SimpleHmac<Sha1>,
69 trunc_left,
70 );
71 test!(
72 hmac_sha256_wycheproof_simple,
73 "wycheproof-sha256",
74 SimpleHmac<Sha256>,
75 trunc_left,
76 );
77 test!(
78 hmac_sha384_wycheproof_simple,
79 "wycheproof-sha384",
80 SimpleHmac<Sha384>,
81 trunc_left,
82 );
83 test!(
84 hmac_sha512_wycheproof_simple,
85 "wycheproof-sha512",
86 SimpleHmac<Sha512>,
87 trunc_left,
88 );