Skip to contentSkip to conversation

crypto: Add VMAC(AES) to kernel for intel_txt support (resend)

PATCH In review Shane Wang 2 participants 2 messages Sep 1, 2009 – Sep 2, 2009

Subsystems (2)
lore
Share & tools
lore

Shane Wang

author
#0 lore raw

PATCH 1/1 crypto: Add VMAC(AES) to kernel for intel_txt support (resend)

Hi Herbert,

I am wondering whether the email system converts tab indent into spaces.
Please use the attached file (it is the same as the plain text below).
This patch is based on the latest git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git

Any problem, let me know.

Thanks.
Shane

This patch adds VMAC (a fast MAC) support into crypto framework.

---

 crypto/Kconfig        |   12
 crypto/Makefile       |    1
 crypto/tcrypt.c       |    4
 crypto/testmgr.c      |    9
 crypto/testmgr.h      |   16
 crypto/vmac.c         |  678 ++++++++++++++++++++++++++++++++++++++++
 include/crypto/vmac.h |   61 +++
 7 files changed, 781 insertions(+)
crypto/Kconfig +12 -0
diff -r fc8c170d4af8 crypto/Kconfig
@@ -268,6 +268,18 @@ config CRYPTO_XCBC
 		http://www.ietf.org/rfc/rfc3566.txt
 		http://csrc.nist.gov/encryption/modes/proposedmodes/
 		 xcbc-mac/xcbc-mac-spec.pdf
+
+config CRYPTO_VMAC
+	tristate "VMAC support"
+	depends on EXPERIMENTAL
+	select CRYPTO_HASH
+	select CRYPTO_MANAGER
+	help
+	  VMAC is a message authentication algorithm designed for
+	  very high speed on 64-bit architectures.
+
+	  See also:
+	  <http://fastcrypto.org/vmac>
 
 comment "Digest"
 
crypto/Makefile +1 -0
diff -r fc8c170d4af8 crypto/Makefile
@@ -32,6 +32,7 @@ cryptomgr-objs := algboss.o testmgr.o
 
 obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o
 obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
+obj-$(CONFIG_CRYPTO_VMAC) += vmac.o
 obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
 obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o
 obj-$(CONFIG_CRYPTO_MD4) += md4.o
crypto/tcrypt.c +4 -0
diff -r fc8c170d4af8 crypto/tcrypt.c
@@ -719,6 +719,10 @@ static int do_test(int m)
 		ret += tcrypt_test("hmac(rmd160)");
 		break;
 
+	case 109:
+		ret += tcrypt_test("vmac(aes)");
+		break;
+
 	case 150:
 		ret += tcrypt_test("ansi_cprng");
 		break;
crypto/testmgr.c +9 -0
diff -r fc8c170d4af8 crypto/testmgr.c
@@ -2248,6 +2248,15 @@ static const struct alg_test_desc alg_te
 			}
 		}
 	}, {
+		.alg = "vmac(aes)",
+		.test = alg_test_hash,
+		.suite = {
+			.hash = {
+				.vecs = aes_vmac128_tv_template,
+				.count = VMAC_AES_TEST_VECTORS
+			}
+		}
+	}, {
 		.alg = "wp256",
 		.test = alg_test_hash,
 		.suite = {
crypto/testmgr.h +16 -0
diff -r fc8c170d4af8 crypto/testmgr.h
@@ -1652,6 +1652,22 @@ static struct hash_testvec aes_xcbc128_t
 		.np	= 2,
 		.ksize	= 16,
 	}
+};
+
+#define VMAC_AES_TEST_VECTORS	1
+static char vmac_string[128] = {'\x01', '\x01', '\x01', '\x01',
+				'\x02', '\x03', '\x02', '\x02',
+				'\x02', '\x04', '\x01', '\x07',
+				'\x04', '\x01', '\x04', '\x03',};
+static struct hash_testvec aes_vmac128_tv_template[] = {
+	{
+		.key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+		.plaintext = vmac_string,
+		.digest = "\xcb\xd7\x8a\xfd\xb7\x33\x79\xe7",
+		.psize  = 128,
+		.ksize  = 16,
+	},
 };
 
 /*
crypto/vmac.c new file +678 -0

678 lines not on this page · raw message

include/crypto/vmac.h new file +61 -0

61 lines not on this page · raw message

This patch adds VMAC (a fast MAC) support into crypto framework.

crypto/Kconfig +12 -0
diff -r fc8c170d4af8 crypto/Kconfig
@@ -268,6 +268,18 @@ config CRYPTO_XCBC
 		http://www.ietf.org/rfc/rfc3566.txt
 		http://csrc.nist.gov/encryption/modes/proposedmodes/
 		 xcbc-mac/xcbc-mac-spec.pdf
+
+config CRYPTO_VMAC
+	tristate "VMAC support"
+	depends on EXPERIMENTAL
+	select CRYPTO_HASH
+	select CRYPTO_MANAGER
+	help
+	  VMAC is a message authentication algorithm designed for
+	  very high speed on 64-bit architectures.
+
+	  See also:
+	  <http://fastcrypto.org/vmac>
 
 comment "Digest"
 
crypto/Makefile +1 -0
diff -r fc8c170d4af8 crypto/Makefile
@@ -32,6 +32,7 @@ cryptomgr-objs := algboss.o testmgr.o
 
 obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o
 obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
+obj-$(CONFIG_CRYPTO_VMAC) += vmac.o
 obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
 obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o
 obj-$(CONFIG_CRYPTO_MD4) += md4.o
crypto/tcrypt.c +4 -0
diff -r fc8c170d4af8 crypto/tcrypt.c
@@ -719,6 +719,10 @@ static int do_test(int m)
 		ret += tcrypt_test("hmac(rmd160)");
 		break;
 
+	case 109:
+		ret += tcrypt_test("vmac(aes)");
+		break;
+
 	case 150:
 		ret += tcrypt_test("ansi_cprng");
 		break;
crypto/testmgr.c +9 -0
diff -r fc8c170d4af8 crypto/testmgr.c
@@ -2248,6 +2248,15 @@ static const struct alg_test_desc alg_te
 			}
 		}
 	}, {
+		.alg = "vmac(aes)",
+		.test = alg_test_hash,
+		.suite = {
+			.hash = {
+				.vecs = aes_vmac128_tv_template,
+				.count = VMAC_AES_TEST_VECTORS
+			}
+		}
+	}, {
 		.alg = "wp256",
 		.test = alg_test_hash,
 		.suite = {
crypto/testmgr.h +16 -0
diff -r fc8c170d4af8 crypto/testmgr.h
@@ -1652,6 +1652,22 @@ static struct hash_testvec aes_xcbc128_t
 		.np	= 2,
 		.ksize	= 16,
 	}
+};
+
+#define VMAC_AES_TEST_VECTORS	1
+static char vmac_string[128] = {'\x01', '\x01', '\x01', '\x01',
+				'\x02', '\x03', '\x02', '\x02',
+				'\x02', '\x04', '\x01', '\x07',
+				'\x04', '\x01', '\x04', '\x03',};
+static struct hash_testvec aes_vmac128_tv_template[] = {
+	{
+		.key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+			  "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+		.plaintext = vmac_string,
+		.digest = "\xcb\xd7\x8a\xfd\xb7\x33\x79\xe7",
+		.psize  = 128,
+		.ksize  = 16,
+	},
 };
 
 /*
crypto/vmac.c new file +678 -0

678 lines not on this page · raw message

include/crypto/vmac.h new file +61 -0

61 lines not on this page · raw message

maintainer
#1 lore raw
Quoted 5 lines · Shane Wang

I am wondering whether the email system converts tab indent into spaces. Please use the attached file (it is the same as the plain text below). This patch is based on the latest
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git

Patch applied. Thanks a lot Shane!

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt