[PATCH 2/3] Crypto: xxhash: add tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Liu Bo <bo.li.liu@xxxxxxxxxx>
---
 crypto/testmgr.c | 10 ++++++++++
 crypto/testmgr.h | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index dc3cf35..27ba702 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -3153,6 +3153,16 @@ static const struct alg_test_desc alg_test_descs[] = {
 			}
 		}
 	}, {
+		.alg = "xxh32",
+		.test = alg_test_hash,
+		.fips_allowed = 1,
+		.suite = {
+			.hash = {
+				.vecs = xxh32_tv_template,
+				.count = XXH32_TEST_VECTORS
+			}
+		}
+	}, {
 		.alg = "zlib",
 		.test = alg_test_pcomp,
 		.fips_allowed = 1,
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 3db83db..8e56884 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -26660,6 +26660,39 @@ static struct hash_testvec michael_mic_tv_template[] = {
 	}
 };
 
+#define XXH32_TEST_VECTORS 3
+
+static struct hash_testvec xxh32_tv_template[] = {
+	{
+		.plaintext = "\x9e",
+		.psize = 1,
+		.digest  = "\xe5\xbe\x5c\xb8",
+	},
+	{
+		.plaintext = "\x9e\xff\x1f\x4b\x5e\x53\x2f\xdd"
+			     "\xb5\x54\x4d\x2a\x95\x2b",
+		.psize = 14,
+		.digest = "\xb4\x0a\xaa\xe5",
+	},
+	{
+		.plaintext = "\x9e\xff\x1f\x4b\x5e\x53\x2f\xdd"
+			     "\xb5\x54\x4d\x2a\x95\x2b\x57\xae"
+			     "\x5d\xba\x74\xe9\xd3\xa6\x4c\x98"
+			     "\x30\x60\xc0\x80\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00\x00\x00\x00"
+			     "\x00\x00\x00\x00\x00",
+		.psize = 101,
+		.digest = "\x12\xa4\x1a\x1f",
+	}
+};
+
 /*
  * CRC32C test vectors
  */
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux