crypto: add support for the NIST CMAC hash
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/1 crypto: add support for the NIST CMAC hash
Signed-off-by Tom St Denis <[email protected]>
--- crypto/Kconfig | 9 ++ crypto/Makefile | 1 + crypto/cmac.c | 317 +++++++++++++++++++++++++++++++++++++++++++ crypto/testmgr.c | 9 ++ crypto/testmgr.h | 52 +++++++ include/uapi/linux/pfkeyv2.h | 1 + net/xfrm/xfrm_algo.c | 17 +++ 7 files changed, 406 insertions(+) create mode 100644 crypto/cmac.c
crypto/Kconfig +9 -0
@@ -301,6 +301,15 @@ config CRYPTO_XCBC http://csrc.nist.gov/encryption/modes/proposedmodes/ xcbc-mac/xcbc-mac-spec.pdf +config CRYPTO_CMAC + tristate "CMAC support" + select CRYPTO_HASH + select CRYPTO_MANAGER + help + NIST CMAC cipher based MAC algorithm + http://tools.ietf.org/rfc/rfc4494.txt + http://csrc.nist.gov/publications/nistpubs/800-38B/SP_800-38B.pdf + config CRYPTO_VMAC tristate "VMAC support" depends on EXPERIMENTAL
crypto/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_CRYPTO_USER) += crypto_user.o obj-$(CONFIG_CRYPTO_HMAC) += hmac.o obj-$(CONFIG_CRYPTO_VMAC) += vmac.o obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o +obj-$(CONFIG_CRYPTO_CMAC) += cmac.o obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o obj-$(CONFIG_CRYPTO_MD4) += md4.o obj-$(CONFIG_CRYPTO_MD5) += md5.o
crypto/cmac.c new file +317 -0
317 lines not on this page · raw message
crypto/testmgr.c +9 -0
@@ -2859,6 +2859,15 @@ static const struct alg_test_desc alg_test_descs[] = { } } }, { + .alg = "cmac(aes)", + .test = alg_test_hash, + .suite = { + .hash = { + .vecs = aes_cmac128_tv_template, + .count = CMAC_AES_TEST_VECTORS + } + } + }, { .alg = "xcbc(aes)", .test = alg_test_hash, .suite = {
crypto/testmgr.h +52 -0
58 lines not on this page · raw message
include/uapi/linux/pfkeyv2.h +1 -0
@@ -296,6 +296,7 @@ struct sadb_x_kmaddress {#define SADB_X_AALG_SHA2_512HMAC 7#define SADB_X_AALG_RIPEMD160HMAC 8#define SADB_X_AALG_AES_XCBC_MAC 9 +#define SADB_X_AALG_AES_CMAC_MAC 10#define SADB_X_AALG_NULL 251/* kame */ #define SADB_AALG_MAX 251
net/xfrm/xfrm_algo.c +17 -0
@@ -265,6 +265,23 @@ static struct xfrm_algo_desc aalg_list[] = { } }, { + .name = "cmac(aes)", + + .uinfo = { + .auth = { + .icv_truncbits = 96, + .icv_fullbits = 128, + } + }, + + .desc = { + .sadb_alg_id = SADB_X_AALG_AES_CMAC_MAC, + .sadb_alg_ivlen = 0, + .sadb_alg_minbits = 128, + .sadb_alg_maxbits = 128 + } +}, +{ .name = "xcbc(aes)", .uinfo = {
Signature · 1 line
1.8.1.rc2.6.g18499ba
Steffen Klassert
maintainerinclude/uapi/linux/pfkeyv2.h struct sadb_x_kmaddress { · line 299
Quoted 10 lines · Tom St Denis
Signed-off-by Tom St Denis <[email protected]>include/uapi/linux/pfkeyv2.h +1
-0@@ -296,6 +296,7 @@ struct sadb_x_kmaddress {#define SADB_X_AALG_SHA2_512HMAC 7#define SADB_X_AALG_RIPEMD160HMAC 8#define SADB_X_AALG_AES_XCBC_MAC 9 +#define SADB_X_AALG_AES_CMAC_MAC 10
We added the infrastructure to use non pfkey algorithms in the ipsec-next tree, so we don't need to add a SADB id for pfkey.
The cmac algorithm is then available if the netlink interface is used to add the cmac SA. We can add pfkey support later if cmac gets an official ikev1 iana transform identifier.
Please remove this pfkey stuff and rebase your patch to ipsec-next/master to ensure that your patch applies cleanly.
Thanks!