linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/3] Crypto: xxhash: add tests
Date: Wed,  7 May 2014 18:56:31 +0800	[thread overview]
Message-ID: <1399460193-1713-3-git-send-email-bo.li.liu@oracle.com> (raw)
In-Reply-To: <1399460193-1713-1-git-send-email-bo.li.liu@oracle.com>

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 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


  parent reply	other threads:[~2014-05-07 10:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 10:56 [RFC PATCH 0/3] Btrfs: add xxhash algorithm Liu Bo
2014-05-07 10:56 ` [PATCH 1/3] Crypto: " Liu Bo
2014-05-07 10:56 ` Liu Bo [this message]
2014-05-07 10:56 ` [PATCH 3/3] Btrfs: add another checksum algorithm xxhash Liu Bo
2014-05-07 10:56 ` [PATCH] Btrfs-progs: add xxhash Liu Bo
2014-05-15 16:57   ` David Sterba
2014-05-07 11:08 ` [RFC PATCH 0/3] Btrfs: add xxhash algorithm Tomasz Torcz
2014-05-07 20:50   ` Darrick J. Wong
2014-05-07 20:58     ` Gregory Maxwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399460193-1713-3-git-send-email-bo.li.liu@oracle.com \
    --to=bo.li.liu@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).