All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Cope <alexcope@google.com>
To: linux-crypto@vger.kernel.org
Cc: mhalcrow@google.com, edknapp@google.com,
	Alex Cope <alexcope@google.com>,
	Eric Biggers <ebiggers@google.com>
Subject: [RFC][PATCH 6/7] crypto: testmgr - Add test vectors for HEH
Date: Mon, 14 Nov 2016 13:01:17 -0800	[thread overview]
Message-ID: <1479157277-10251-7-git-send-email-alexcope@google.com> (raw)
In-Reply-To: <1479157277-10251-1-git-send-email-alexcope@google.com>

Adding test vectors from
https://tools.ietf.org/html/draft-cope-heh-00

Signed-off-by: Alex Cope <alexcope@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 crypto/testmgr.c |  15 ++++
 crypto/testmgr.h | 226 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 241 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ded50b6..bab027b 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -3481,6 +3481,21 @@ static const struct alg_test_desc alg_test_descs[] = {
 			}
 		}
 	}, {
+		.alg = "heh(aes)",
+		.test = alg_test_skcipher,
+		.suite = {
+			.cipher = {
+				.enc = {
+					.vecs = aes_heh_enc_tv_template,
+					.count = AES_HEH_ENC_TEST_VECTORS
+				},
+				.dec = {
+					.vecs = aes_heh_dec_tv_template,
+					.count = AES_HEH_DEC_TEST_VECTORS
+				}
+			}
+		}
+	}, {
 		.alg = "hmac(crc32)",
 		.test = alg_test_hash,
 		.suite = {
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index e64a4ef..b2daad3 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -15172,6 +15172,8 @@ static struct cipher_testvec cast6_xts_dec_tv_template[] = {
 #define AES_DEC_TEST_VECTORS 4
 #define AES_CBC_ENC_TEST_VECTORS 5
 #define AES_CBC_DEC_TEST_VECTORS 5
+#define AES_HEH_ENC_TEST_VECTORS 4
+#define AES_HEH_DEC_TEST_VECTORS 4
 #define HMAC_MD5_ECB_CIPHER_NULL_ENC_TEST_VECTORS 2
 #define HMAC_MD5_ECB_CIPHER_NULL_DEC_TEST_VECTORS 2
 #define HMAC_SHA1_ECB_CIPHER_NULL_ENC_TEST_VEC 2
@@ -15544,6 +15546,230 @@ static struct cipher_testvec aes_dec_tv_template[] = {
 	},
 };
 
+static struct cipher_testvec aes_heh_enc_tv_template[] = {
+	{
+		.key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
+		.klen   = 48,
+		.iv	= "\x00\x00\x00\x00\x00\x00\x00\x00"
+			  "\x00\x00\x00\x00\x00\x00\x00\x00",
+		.input	= "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
+		.ilen   = 16,
+		.result = "\x61\x76\x38\xa5\x12\x0b\x6d\x89"
+			  "\x92\x68\x30\x7e\x0d\x6e\x81\xe3",
+		.rlen   = 16,
+		.also_non_np = 1,
+		.np	= 2,
+		.tap	= { 8, 8 },
+	}, {
+		.key    = "\x68\xf8\x27\x87\xdc\x30\x33\xfd"
+			  "\x65\x5b\x8e\x51\x2e\x02\xff\x9d"
+			  "\x21\x28\x1e\x64\xcd\x9c\x33\x88"
+			  "\xf6\x2c\x43\x8f\xf5\x6f\xf5\x8f"
+			  "\xa8\xda\x24\x9b\x5e\xfa\x13\xc2"
+			  "\xc1\x94\xbf\x32\xba\x38\xa3\x77",
+		.klen   = 48,
+		.iv	= "\x4d\x47\x61\x37\x2b\x47\x86\xf0"
+			  "\xd6\x47\xb5\xc2\xe8\xcf\x85\x27",
+		.input	= "\xb8\xee\x29\xe4\xa5\xd1\xe7\x55"
+			  "\xd0\xfd\xe7\x22\x63\x76\x36\xe2"
+			  "\xf8\x0c\xf8\xfe\x65\x76\xe7\xca"
+			  "\xc1\x42\xf5\xca\x5a\xa8\xac\x2a",
+		.ilen   = 32,
+		.result = "\x1f\x4c\x6a\x1e\x1d\x20\x0d\x99"
+			  "\xdf\xbb\x13\xd8\x35\xdc\x1d\xbe"
+			  "\xed\x50\x0a\x9f\xfd\xd6\x94\x85"
+			  "\xd0\x8b\xf7\xb4\x49\x7f\x70\x6d",
+		.rlen   = 32,
+		.also_non_np = 1,
+		.np	= 3,
+		.tap	= { 16, 13, 3 },
+	}, {
+		.key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
+		.klen   = 48,
+		.iv	= "\x00\x00\x00\x00\x00\x00\x00\x00"
+			  "\x00\x00\x00\x00\x00\x00\x00\x00",
+		.input	= "\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",
+		.ilen   = 63,
+		.result = "\xfb\x30\x90\x47\xc5\x4e\xcc\xfd"
+			  "\xc4\x90\xa2\x9f\x7c\x03\x63\xc3"
+			  "\xcb\xaf\x2e\xee\x62\x18\xeb\x20"
+			  "\x62\x97\xe4\x9b\xf2\x8b\xf3\x3f"
+			  "\x76\x3b\xaa\xab\xf0\x19\x54\xdb"
+			  "\xb4\xaf\x2e\xd9\xa7\xe0\x92\x04"
+			  "\x5a\xe4\x81\xfc\x58\xf2\xda\xbf"
+			  "\x5d\xc9\xb1\x47\xd5\x08\xb1",
+		.rlen   = 63,
+		.also_non_np = 1,
+		.np	= 8,
+		.tap	= { 20, 20, 10, 8, 2, 1, 1, 1 },
+	}, {
+		.key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
+		.klen   = 48,
+		.iv	= "\x00\x00\x00\x00\x00\x00\x00\x00"
+			  "\x00\x00\x00\x00\x00\x00\x00\x00",
+		.input	= "\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\x01"
+			  "\x00\x00\x00\x00\x00\x00\x00\x00"
+			  "\x00\x00\x00\x00\x00\x00\x00",
+		.ilen   = 63,
+		.result = "\x9c\xdf\xa5\x50\x83\xe0\xa3\xb5"
+			  "\x0d\x35\x83\x34\x6e\x6e\x40\xd6"
+			  "\x0f\x81\xc8\x1a\x9c\x40\x81\xfb"
+			  "\xb3\x6e\xb4\xbf\xfc\xca\xc9\x50"
+			  "\xcd\x33\xfd\xb3\x43\x11\xe6\x32"
+			  "\x02\x3d\x3e\xc6\x49\x6e\xcf\x58"
+			  "\x3e\x14\x15\x6d\x39\x2a\x58\x99"
+			  "\x83\xaf\xdd\x22\x3e\x7f\x6c",
+		.rlen   = 63,
+		.also_non_np = 1,
+		.np	= 8,
+		.tap	= { 20, 20, 10, 8, 2, 1, 1, 1 },
+	}
+};
+
+static struct cipher_testvec aes_heh_dec_tv_template[] = {
+	{
+		.key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
+		.klen   = 48,
+		.iv	= "\x00\x00\x00\x00\x00\x00\x00\x00"
+			  "\x00\x00\x00\x00\x00\x00\x00\x00",
+		.input = "\x61\x76\x38\xa5\x12\x0b\x6d\x89"
+			  "\x92\x68\x30\x7e\x0d\x6e\x81\xe3",
+		.ilen   = 16,
+		.result	= "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
+		.rlen   = 16,
+		.also_non_np = 1,
+		.np	= 2,
+		.tap	= { 8, 8 },
+	}, {
+		.key    = "\x68\xf8\x27\x87\xdc\x30\x33\xfd"
+			  "\x65\x5b\x8e\x51\x2e\x02\xff\x9d"
+			  "\x21\x28\x1e\x64\xcd\x9c\x33\x88"
+			  "\xf6\x2c\x43\x8f\xf5\x6f\xf5\x8f"
+			  "\xa8\xda\x24\x9b\x5e\xfa\x13\xc2"
+			  "\xc1\x94\xbf\x32\xba\x38\xa3\x77",
+		.klen   = 48,
+		.iv	= "\x4d\x47\x61\x37\x2b\x47\x86\xf0"
+			  "\xd6\x47\xb5\xc2\xe8\xcf\x85\x27",
+		.input =  "\x1f\x4c\x6a\x1e\x1d\x20\x0d\x99"
+			  "\xdf\xbb\x13\xd8\x35\xdc\x1d\xbe"
+			  "\xed\x50\x0a\x9f\xfd\xd6\x94\x85"
+			  "\xd0\x8b\xf7\xb4\x49\x7f\x70\x6d",
+		.ilen   = 32,
+		.result	= "\xb8\xee\x29\xe4\xa5\xd1\xe7\x55"
+			  "\xd0\xfd\xe7\x22\x63\x76\x36\xe2"
+			  "\xf8\x0c\xf8\xfe\x65\x76\xe7\xca"
+			  "\xc1\x42\xf5\xca\x5a\xa8\xac\x2a",
+		.rlen   = 32,
+		.also_non_np = 1,
+		.np	= 3,
+		.tap	= { 16, 13, 3 },
+	}, {
+		.key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
+		.klen   = 48,
+		.iv	= "\x00\x00\x00\x00\x00\x00\x00\x00"
+			  "\x00\x00\x00\x00\x00\x00\x00\x00",
+		.result = "\xfb\x30\x90\x47\xc5\x4e\xcc\xfd"
+			  "\xc4\x90\xa2\x9f\x7c\x03\x63\xc3"
+			  "\xcb\xaf\x2e\xee\x62\x18\xeb\x20"
+			  "\x62\x97\xe4\x9b\xf2\x8b\xf3\x3f"
+			  "\x76\x3b\xaa\xab\xf0\x19\x54\xdb"
+			  "\xb4\xaf\x2e\xd9\xa7\xe0\x92\x04"
+			  "\x5a\xe4\x81\xfc\x58\xf2\xda\xbf"
+			  "\x5d\xc9\xb1\x47\xd5\x08\xb1",
+		.ilen   = 63,
+		.input = "\xfb\x30\x90\x47\xc5\x4e\xcc\xfd"
+			  "\xc4\x90\xa2\x9f\x7c\x03\x63\xc3"
+			  "\xcb\xaf\x2e\xee\x62\x18\xeb\x20"
+			  "\x62\x97\xe4\x9b\xf2\x8b\xf3\x3f"
+			  "\x76\x3b\xaa\xab\xf0\x19\x54\xdb"
+			  "\xb4\xaf\x2e\xd9\xa7\xe0\x92\x04"
+			  "\x5a\xe4\x81\xfc\x58\xf2\xda\xbf"
+			  "\x5d\xc9\xb1\x47\xd5\x08\xb1",
+		.result	= "\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",
+		.rlen   = 63,
+		.also_non_np = 1,
+		.np	= 8,
+		.tap	= { 20, 20, 10, 8, 2, 1, 1, 1 },
+	}, {
+		.key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+			  "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
+		.klen   = 48,
+		.iv	= "\x00\x00\x00\x00\x00\x00\x00\x00"
+			  "\x00\x00\x00\x00\x00\x00\x00\x00",
+		.input =  "\x9c\xdf\xa5\x50\x83\xe0\xa3\xb5"
+			  "\x0d\x35\x83\x34\x6e\x6e\x40\xd6"
+			  "\x0f\x81\xc8\x1a\x9c\x40\x81\xfb"
+			  "\xb3\x6e\xb4\xbf\xfc\xca\xc9\x50"
+			  "\xcd\x33\xfd\xb3\x43\x11\xe6\x32"
+			  "\x02\x3d\x3e\xc6\x49\x6e\xcf\x58"
+			  "\x3e\x14\x15\x6d\x39\x2a\x58\x99"
+			  "\x83\xaf\xdd\x22\x3e\x7f\x6c",
+		.ilen   = 63,
+		.result	= "\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\x01"
+			  "\x00\x00\x00\x00\x00\x00\x00\x00"
+			  "\x00\x00\x00\x00\x00\x00\x00",
+		.rlen   = 63,
+		.also_non_np = 1,
+		.np	= 8,
+		.tap	= { 20, 20, 10, 8, 2, 1, 1, 1 },
+	}
+};
+
 static struct cipher_testvec aes_cbc_enc_tv_template[] = {
 	{ /* From RFC 3602 */
 		.key    = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b"
-- 
2.8.0.rc3.226.g39d4020

      parent reply	other threads:[~2016-11-14 21:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 21:01 [RFC][PATCH 0/7] crypto: Adding Hash-Encrypt-Hash(HEH) Alex Cope
2016-11-14 21:01 ` [RFC][PATCH 1/7] crypto: skcipher adding skciper_walk_virt_init Alex Cope
2016-11-14 21:01 ` [RFC][PATCH 2/7] crypto: gf128mul - Refactor gf128 overflow macros Alex Cope
2016-11-14 21:01 ` [RFC][PATCH 3/7] crypto: gf128mul - Add ble multiplication functions Alex Cope
2016-11-14 21:01 ` [RFC][PATCH 4/7] crypto: shash - Add crypto_grab_shash() and crypto_spawn_shash_alg() Alex Cope
2016-11-14 21:01 ` [RFC][PATCH 5/7] crypto: heh - Add Hash Encrypt Hash(HEH) algorithm Alex Cope
2016-11-14 21:01 ` Alex Cope [this message]

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=1479157277-10251-7-git-send-email-alexcope@google.com \
    --to=alexcope@google.com \
    --cc=ebiggers@google.com \
    --cc=edknapp@google.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=mhalcrow@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.