summaryrefslogtreecommitdiffstats
path: root/vendor/hmac/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:41 +0000
commit10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87 (patch)
treebdffd5d80c26cf4a7a518281a204be1ace85b4c1 /vendor/hmac/tests
parentReleasing progress-linux version 1.70.0+dfsg1-9~progress7.99u1. (diff)
downloadrustc-10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87.tar.xz
rustc-10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87.zip
Merging upstream version 1.70.0+dfsg2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/hmac/tests')
-rw-r--r--vendor/hmac/tests/data/md5.blbbin0 -> 245 bytes
-rw-r--r--vendor/hmac/tests/data/sha224.blbbin0 -> 803 bytes
-rw-r--r--vendor/hmac/tests/data/sha256.blbbin0 -> 831 bytes
-rw-r--r--vendor/hmac/tests/data/sha384.blbbin0 -> 943 bytes
-rw-r--r--vendor/hmac/tests/data/sha512.blbbin0 -> 1062 bytes
-rw-r--r--vendor/hmac/tests/data/streebog256.blbbin0 -> 84 bytes
-rw-r--r--vendor/hmac/tests/data/streebog512.blbbin0 -> 117 bytes
-rw-r--r--vendor/hmac/tests/data/wycheproof-sha1.blbbin0 -> 4875 bytes
-rw-r--r--vendor/hmac/tests/data/wycheproof-sha256.blbbin0 -> 6153 bytes
-rw-r--r--vendor/hmac/tests/data/wycheproof-sha384.blbbin0 -> 7857 bytes
-rw-r--r--vendor/hmac/tests/data/wycheproof-sha512.blbbin0 -> 9648 bytes
-rw-r--r--vendor/hmac/tests/mod.rs88
12 files changed, 88 insertions, 0 deletions
diff --git a/vendor/hmac/tests/data/md5.blb b/vendor/hmac/tests/data/md5.blb
new file mode 100644
index 000000000..731a0ae4d
--- /dev/null
+++ b/vendor/hmac/tests/data/md5.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/sha224.blb b/vendor/hmac/tests/data/sha224.blb
new file mode 100644
index 000000000..dabb20b3d
--- /dev/null
+++ b/vendor/hmac/tests/data/sha224.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/sha256.blb b/vendor/hmac/tests/data/sha256.blb
new file mode 100644
index 000000000..6b5b288e1
--- /dev/null
+++ b/vendor/hmac/tests/data/sha256.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/sha384.blb b/vendor/hmac/tests/data/sha384.blb
new file mode 100644
index 000000000..d5cddb312
--- /dev/null
+++ b/vendor/hmac/tests/data/sha384.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/sha512.blb b/vendor/hmac/tests/data/sha512.blb
new file mode 100644
index 000000000..b79ae49fe
--- /dev/null
+++ b/vendor/hmac/tests/data/sha512.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/streebog256.blb b/vendor/hmac/tests/data/streebog256.blb
new file mode 100644
index 000000000..99d972294
--- /dev/null
+++ b/vendor/hmac/tests/data/streebog256.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/streebog512.blb b/vendor/hmac/tests/data/streebog512.blb
new file mode 100644
index 000000000..8f0f151fc
--- /dev/null
+++ b/vendor/hmac/tests/data/streebog512.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/wycheproof-sha1.blb b/vendor/hmac/tests/data/wycheproof-sha1.blb
new file mode 100644
index 000000000..a4f8f4363
--- /dev/null
+++ b/vendor/hmac/tests/data/wycheproof-sha1.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/wycheproof-sha256.blb b/vendor/hmac/tests/data/wycheproof-sha256.blb
new file mode 100644
index 000000000..62f1d3570
--- /dev/null
+++ b/vendor/hmac/tests/data/wycheproof-sha256.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/wycheproof-sha384.blb b/vendor/hmac/tests/data/wycheproof-sha384.blb
new file mode 100644
index 000000000..69a787437
--- /dev/null
+++ b/vendor/hmac/tests/data/wycheproof-sha384.blb
Binary files differ
diff --git a/vendor/hmac/tests/data/wycheproof-sha512.blb b/vendor/hmac/tests/data/wycheproof-sha512.blb
new file mode 100644
index 000000000..e061fd554
--- /dev/null
+++ b/vendor/hmac/tests/data/wycheproof-sha512.blb
Binary files differ
diff --git a/vendor/hmac/tests/mod.rs b/vendor/hmac/tests/mod.rs
new file mode 100644
index 000000000..d1798c891
--- /dev/null
+++ b/vendor/hmac/tests/mod.rs
@@ -0,0 +1,88 @@
+#[cfg(not(feature = "reset"))]
+use digest::new_mac_test as test;
+#[cfg(feature = "reset")]
+use digest::new_resettable_mac_test as test;
+use hmac::{Hmac, SimpleHmac};
+use sha1::Sha1;
+use sha2::{Sha224, Sha256, Sha384, Sha512};
+use streebog::{Streebog256, Streebog512};
+
+// Test vectors from RFC 2104, plus wiki test
+test!(hmac_md5_rfc2104, "md5", Hmac<md5::Md5>);
+test!(hmac_md5_rfc2104_simple, "md5", SimpleHmac<md5::Md5>);
+
+// Test vectors from RFC 4231
+test!(hmac_sha224_rfc4231, "sha224", Hmac<Sha224>);
+test!(hmac_sha256_rfc4231, "sha256", Hmac<Sha256>);
+test!(hmac_sha384_rfc4231, "sha384", Hmac<Sha384>);
+test!(hmac_sha512_rfc4231, "sha512", Hmac<Sha512>);
+test!(hmac_sha224_rfc4231_simple, "sha224", SimpleHmac<Sha224>);
+test!(hmac_sha256_rfc4231_simple, "sha256", SimpleHmac<Sha256>);
+test!(hmac_sha384_rfc4231_simple, "sha384", SimpleHmac<Sha384>);
+test!(hmac_sha512_rfc4231_simple, "sha512", SimpleHmac<Sha512>);
+
+// Test vectors from R 50.1.113-2016:
+// https://tc26.ru/standard/rs/Р 50.1.113-2016.pdf
+test!(hmac_streebog256, "streebog256", Hmac<Streebog256>);
+test!(hmac_streebog512, "streebog512", Hmac<Streebog512>);
+test!(
+ hmac_streebog256_simple,
+ "streebog256",
+ SimpleHmac<Streebog256>
+);
+test!(
+ hmac_streebog512_simple,
+ "streebog512",
+ SimpleHmac<Streebog512>
+);
+
+// Tests from Project Wycheproof:
+// https://github.com/google/wycheproof
+test!(
+ hmac_sha1_wycheproof,
+ "wycheproof-sha1",
+ Hmac<Sha1>,
+ trunc_left,
+);
+test!(
+ hmac_sha256_wycheproof,
+ "wycheproof-sha256",
+ Hmac<Sha256>,
+ trunc_left,
+);
+test!(
+ hmac_sha384_wycheproof,
+ "wycheproof-sha384",
+ Hmac<Sha384>,
+ trunc_left,
+);
+test!(
+ hmac_sha512_wycheproof,
+ "wycheproof-sha512",
+ Hmac<Sha512>,
+ trunc_left,
+);
+test!(
+ hmac_sha1_wycheproof_simple,
+ "wycheproof-sha1",
+ SimpleHmac<Sha1>,
+ trunc_left,
+);
+test!(
+ hmac_sha256_wycheproof_simple,
+ "wycheproof-sha256",
+ SimpleHmac<Sha256>,
+ trunc_left,
+);
+test!(
+ hmac_sha384_wycheproof_simple,
+ "wycheproof-sha384",
+ SimpleHmac<Sha384>,
+ trunc_left,
+);
+test!(
+ hmac_sha512_wycheproof_simple,
+ "wycheproof-sha512",
+ SimpleHmac<Sha512>,
+ trunc_left,
+);