diff mbox

[6/6] crypto: testmgr - add more unkeyed crc32 and crc32c test vectors

Message ID 20180520050742.5008-7-ebiggers3@gmail.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Eric Biggers May 20, 2018, 5:07 a.m. UTC
From: Eric Biggers <ebiggers@google.com>

crc32c has an unkeyed test vector but crc32 did not.  Add the crc32c one
(which uses an empty input) to crc32 too, and also add a new one to both
that uses a nonempty input.  These test vectors verify that crc32 and
crc32c implementations use the correct default initial state.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 crypto/testmgr.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox

Patch

diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 816e3eb197b2..9350f9846451 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -42292,6 +42292,15 @@  static const struct hash_testvec michael_mic_tv_template[] = {
  * CRC32 test vectors
  */
 static const struct hash_testvec crc32_tv_template[] = {
+	{
+		.psize = 0,
+		.digest = "\x00\x00\x00\x00",
+	},
+	{
+		.plaintext = "abcdefg",
+		.psize = 7,
+		.digest = "\xd8\xb5\x46\xac",
+	},
 	{
 		.key = "\x87\xa9\xcb\xed",
 		.ksize = 4,
@@ -42728,6 +42737,11 @@  static const struct hash_testvec crc32c_tv_template[] = {
 		.psize = 0,
 		.digest = "\x00\x00\x00\x00",
 	},
+	{
+		.plaintext = "abcdefg",
+		.psize = 7,
+		.digest = "\x41\xf4\x27\xe6",
+	},
 	{
 		.key = "\x87\xa9\xcb\xed",
 		.ksize = 4,