crypto: add CMAC support to CryptoAPI
Subsystems (5)
PATCH 1/2 crypto: add CMAC support to CryptoAPI
Patch adds support for NIST recommended block cipher mode CMAC to CryptoAPI.
This work is based on Tom St Denis' earlier patch,
http://marc.info/?l=linux-crypto-vger&m=135877306305466&w=2
--- crypto/Kconfig | 11 ++ crypto/Makefile | 1 crypto/cmac.c | 315 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/tcrypt.c | 11 ++ crypto/testmgr.c | 18 +++ crypto/testmgr.h | 125 +++++++++++++++++++++ 6 files changed, 480 insertions(+), 1 deletion(-) create mode 100644 crypto/cmac.c
crypto/Kconfig +11 -0
@@ -283,6 +283,17 @@ config CRYPTO_XTS comment "Hash modes" +config CRYPTO_CMAC + tristate "CMAC support" + select CRYPTO_HASH + select CRYPTO_MANAGER + help + Cipher-based Message Authentication Code (CMAC) specified by + The National Institute of Standards and Technology (NIST). + + https://tools.ietf.org/html/rfc4493 + http://csrc.nist.gov/publications/nistpubs/800-38B/SP_800-38B.pdf + config CRYPTO_HMAC tristate "HMAC support" select CRYPTO_HASH
crypto/Makefile +1 -0
@@ -32,6 +32,7 @@ cryptomgr-y := algboss.o testmgr.o obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o obj-$(CONFIG_CRYPTO_USER) += crypto_user.o +obj-$(CONFIG_CRYPTO_CMAC) += cmac.o obj-$(CONFIG_CRYPTO_HMAC) += hmac.o obj-$(CONFIG_CRYPTO_VMAC) += vmac.o obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
crypto/cmac.c new file +315 -0
315 lines not on this page · raw message
crypto/tcrypt.c +10 -1
@@ -1095,7 +1095,6 @@ static int do_test(int m)break ;case 28 : - ret +=tcrypt_test ("tgr160" );break ;
@@ -1118,6 +1117,7 @@ static int do_test(int m) ret +=tcrypt_test ("lrw(camellia)" ); ret +=tcrypt_test ("xts(camellia)" );break ; +case 33 : ret +=tcrypt_test ("sha224" );break ;
@@ -1213,6 +1213,7 @@ static int do_test(int m)case 109 : ret +=tcrypt_test ("vmac(aes)" );break ; +case 110 : ret +=tcrypt_test ("hmac(crc32)" );break ;
@@ -1229,6 +1230,14 @@ static int do_test(int m) ret +=tcrypt_test ("rfc4543(gcm(aes))" );break ; +case 153 : + ret +=tcrypt_test ("cmac(aes)" ); +break ; + +case 154 : + ret +=tcrypt_test ("cmac(des3_ede)" ); +break ; +case 200 :test_cipher_speed ("ecb(aes)" ,ENCRYPT , sec,NULL ,0 , speed_template_16_24_32);
crypto/testmgr.c +18 -0
@@ -1913,6 +1913,24 @@ 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 = "cmac(des3_ede)", + .test = alg_test_hash, + .suite = { + .hash = { + .vecs = des3_ede_cmac64_tv_template, + .count = CMAC_DES3_EDE_TEST_VECTORS + } + } + }, { .alg = "compress_null", .test = alg_test_null, }, {
crypto/testmgr.h +125 -0
131 lines not on this page · raw message
PATCH 2/2 xfrm: add rfc4494 AES-CMAC-96 support
Now that CryptoAPI has support for CMAC, we can add support for AES-CMAC-96 (rfc4494).
--- net/xfrm/xfrm_algo.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/xfrm/xfrm_algo.c +13 -0
@@ -311,6 +311,19 @@ static struct xfrm_algo_desc aalg_list[] = { .sadb_alg_maxbits = 128 } }, +{ +/* rfc4494 */ + .name = "cmac(aes)", + + .uinfo = { + .auth = { + .icv_truncbits = 96, + .icv_fullbits = 128, + } + }, + + .pfkey_supported = 0, +}, }; static struct xfrm_algo_desc ealg_list[] = {
Steffen Klassert
maintainerQuoted 7 lines · Jussi Kivilinna
Patch adds support for NIST recommended block cipher mode CMAC to CryptoAPI.
This work is based on Tom St Denis' earlier patch,
http://marc.info/?l=linux-crypto-vger&m=135877306305466&w=2Cc Tom St Denis <[email protected]>Signed-off-by Jussi Kivilinna <[email protected]>
This patch does not apply clean to the ipsec-next tree because of some crypto changes I don't have in ipsec-next. The IPsec part should apply to the cryptodev tree, so it's probaply the best if we route this patchset through the cryptodev tree.
Herbert,
are you going to take these patches?
Quoted 6 lines · Steffen Klassert
Quoted 5 lines · Jussi Kivilinna
Patch adds support for NIST recommended block cipher mode CMAC to CryptoAPI.
This work is based on Tom St Denis' earlier patch,
http://marc.info/?l=linux-crypto-vger&m=135877306305466&w=2
Quoted 8 lines
Quoted 2 lines
Cc Tom St Denis <[email protected]>Signed-off-by Jussi Kivilinna <[email protected]>This patch does not apply clean to the ipsec-next tree because of some crypto changes I don't have in ipsec-next. The IPsec part should apply to the cryptodev tree, so it's probaply the best if we route this patchset through the cryptodev tree.
I should have mentioned that the patchset is on top of cryptodev tree and previous crypto patches that I send yesterday, likely to cause problems atleast at tcrypt.c:
http://marc.info/?l=linux-crypto-vger&m=136534223503368&w=2
-Jussi
Quoted 5 lines
Herbert,
are you going to take these patches?
Herbert Xu
maintainerQuoted 15 lines · Steffen Klassert
Quoted 7 lines · Jussi Kivilinna
Patch adds support for NIST recommended block cipher mode CMAC to CryptoAPI.
This work is based on Tom St Denis' earlier patch,
http://marc.info/?l=linux-crypto-vger&m=135877306305466&w=2Cc Tom St Denis <[email protected]>Signed-off-by Jussi Kivilinna <[email protected]>This patch does not apply clean to the ipsec-next tree because of some crypto changes I don't have in ipsec-next. The IPsec part should apply to the cryptodev tree, so it's probaply the best if we route this patchset through the cryptodev tree.
Quoted 3 lines
Herbert,
are you going to take these patches?
Sure I can do that.
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
From: Herbert Xu <[email protected]>
Date: Mon, 8 Apr 2013 17:33:40 +0800
Quoted 16 lines · Steffen Klassert
Quoted 15 lines · Jussi Kivilinna
Quoted 7 lines
Patch adds support for NIST recommended block cipher mode CMAC to CryptoAPI.
This work is based on Tom St Denis' earlier patch,
http://marc.info/?l=linux-crypto-vger&m=135877306305466&w=2Cc Tom St Denis <[email protected]>Signed-off-by Jussi Kivilinna <[email protected]>This patch does not apply clean to the ipsec-next tree because of some crypto changes I don't have in ipsec-next. The IPsec part should apply to the cryptodev tree, so it's probaply the best if we route this patchset through the cryptodev tree.
Quoted 5 lines
Quoted 3 lines
Herbert,
are you going to take these patches?
Sure I can do that.
I'm fine with this:
A message that is not in the archive (sent off-list or not yet received): CADT32eLHBWoRMvnBWbEEEWfpQtsnivYSeSgyG95MhURVEgmgjA@mail.gmail.com
This does look promising - AES_CMAC in the crypto libs would be very helpful for SMB3 for cifs.ko (for the common cases when packet signing is required, or network file system encryption is turned on for a share). Presumably with Windows 8 and Windows 2012 and some very current NAS these are required. Apparently AES_CMAC also is much faster than the algorithms used in previous network file system dialect levels as well, so will help performance, not just be more secure.
This general crypto patch is much larger than the cifs.ko specific patch I had been working on but perhaps it is because of optional features.
Quoted 34 lines
---------- Forwarded message ----------
From: Jussi Kivilinna <[email protected]>
Date: Mon, Apr 8, 2013 at 2:48 AM
Subject: [PATCH 1/2] crypto: add CMAC support to CryptoAPI
To: [email protected]
Cc: Steffen Klassert <[email protected]>, [email protected], Tom St Denis <[email protected]>, Herbert Xu <[email protected]>, "David S. Miller" <[email protected]>Patch adds support for NIST recommended block cipher mode CMAC to CryptoAPI.
This work is based on Tom St Denis' earlier patch,
http://marc.info/?l=linux-crypto-vger&m=135877306305466&w=2Cc Tom St Denis <[email protected]>Signed-off-by Jussi Kivilinna <[email protected]>--- crypto/Kconfig | 11 ++ crypto/Makefile | 1 crypto/cmac.c | 315 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/tcrypt.c | 11 ++ crypto/testmgr.c | 18 +++ crypto/testmgr.h | 125 +++++++++++++++++++++ 6 files changed, 480 insertions(+), 1 deletion(-) create mode 100644 crypto/cmac.ccrypto/Kconfig +1
-0@@ -283,6 +283,17 @@ config CRYPTO_XTS comment "Hash modes" +config CRYPTO_CMAC
crypto/Kconfig config CRYPTO_XTS · line 296
Quoted 10 lines
crypto/Kconfig +9
-0+ tristate "CMAC support" + select CRYPTO_HASH + select CRYPTO_MANAGER + help + Cipher-based Message Authentication Code (CMAC) specified by + The National Institute of Standards and Technology (NIST). + + https://tools.ietf.org/html/rfc4493 + http://csrc.nist.gov/publications/nistpubs/800-38B/SP_800-38B.pdf
--
Thanks,
Steve
Herbert Xu
maintainerQuoted 7 lines · Jussi Kivilinna
Patch adds support for NIST recommended block cipher mode CMAC to CryptoAPI.
This work is based on Tom St Denis' earlier patch,
http://marc.info/?l=linux-crypto-vger&m=135877306305466&w=2Cc Tom St Denis <[email protected]>Signed-off-by Jussi Kivilinna <[email protected]>
Both patches applied.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt