Skip to content

Commit

Permalink
crypto: vmac - New hash algorithm for intel_txt support
Browse files Browse the repository at this point in the history
This patch adds VMAC (a fast MAC) support into crypto framework.

Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Shane Wang authored and Herbert Xu committed Sep 2, 2009
1 parent 2bf2901 commit f1939f7
Show file tree
Hide file tree
Showing 7 changed files with 781 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crypto/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,18 @@ config CRYPTO_XCBC
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"

config CRYPTO_CRC32C
Expand Down
1 change: 1 addition & 0 deletions crypto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions crypto/tcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions crypto/testmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,15 @@ static const struct alg_test_desc alg_test_descs[] = {
.count = TGR192_TEST_VECTORS
}
}
}, {
.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,
Expand Down
16 changes: 16 additions & 0 deletions crypto/testmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,22 @@ static struct hash_testvec aes_xcbc128_tv_template[] = {
}
};

#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,
},
};

/*
* SHA384 HMAC test vectors from RFC4231
*/
Expand Down
Loading

0 comments on commit f1939f7

Please sign in to comment.