Skip to content

Commit f1939f7

Browse files
shane-wangherbertx
authored andcommitted
crypto: vmac - New hash algorithm for intel_txt support
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>
1 parent 2bf2901 commit f1939f7

File tree

7 files changed

+781
-0
lines changed

7 files changed

+781
-0
lines changed

crypto/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,18 @@ config CRYPTO_XCBC
269269
http://csrc.nist.gov/encryption/modes/proposedmodes/
270270
xcbc-mac/xcbc-mac-spec.pdf
271271

272+
config CRYPTO_VMAC
273+
tristate "VMAC support"
274+
depends on EXPERIMENTAL
275+
select CRYPTO_HASH
276+
select CRYPTO_MANAGER
277+
help
278+
VMAC is a message authentication algorithm designed for
279+
very high speed on 64-bit architectures.
280+
281+
See also:
282+
<http://fastcrypto.org/vmac>
283+
272284
comment "Digest"
273285

274286
config CRYPTO_CRC32C

crypto/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ cryptomgr-objs := algboss.o testmgr.o
3232

3333
obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o
3434
obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
35+
obj-$(CONFIG_CRYPTO_VMAC) += vmac.o
3536
obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
3637
obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o
3738
obj-$(CONFIG_CRYPTO_MD4) += md4.o

crypto/tcrypt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,10 @@ static int do_test(int m)
719719
ret += tcrypt_test("hmac(rmd160)");
720720
break;
721721

722+
case 109:
723+
ret += tcrypt_test("vmac(aes)");
724+
break;
725+
722726
case 150:
723727
ret += tcrypt_test("ansi_cprng");
724728
break;

crypto/testmgr.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,6 +2247,15 @@ static const struct alg_test_desc alg_test_descs[] = {
22472247
.count = TGR192_TEST_VECTORS
22482248
}
22492249
}
2250+
}, {
2251+
.alg = "vmac(aes)",
2252+
.test = alg_test_hash,
2253+
.suite = {
2254+
.hash = {
2255+
.vecs = aes_vmac128_tv_template,
2256+
.count = VMAC_AES_TEST_VECTORS
2257+
}
2258+
}
22502259
}, {
22512260
.alg = "wp256",
22522261
.test = alg_test_hash,

crypto/testmgr.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,22 @@ static struct hash_testvec aes_xcbc128_tv_template[] = {
16541654
}
16551655
};
16561656

1657+
#define VMAC_AES_TEST_VECTORS 1
1658+
static char vmac_string[128] = {'\x01', '\x01', '\x01', '\x01',
1659+
'\x02', '\x03', '\x02', '\x02',
1660+
'\x02', '\x04', '\x01', '\x07',
1661+
'\x04', '\x01', '\x04', '\x03',};
1662+
static struct hash_testvec aes_vmac128_tv_template[] = {
1663+
{
1664+
.key = "\x00\x01\x02\x03\x04\x05\x06\x07"
1665+
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1666+
.plaintext = vmac_string,
1667+
.digest = "\xcb\xd7\x8a\xfd\xb7\x33\x79\xe7",
1668+
.psize = 128,
1669+
.ksize = 16,
1670+
},
1671+
};
1672+
16571673
/*
16581674
* SHA384 HMAC test vectors from RFC4231
16591675
*/

0 commit comments

Comments
 (0)