crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD
Subsystems (2)
PATCH v2 1/1 crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD
An updated patch that also handles the additional key length requirements for the AEAD algorithms.
The max keysize is not 96. For SHA384/512 it's 128, and for the AEAD algorithms it's longer still. Extend the max keysize for the AEAD size for AES256 + HMAC(SHA512).
--- drivers/crypto/talitos.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/crypto/talitos.c +6 -1
@@ -816,7 +816,7 @@ static void talitos_unregister_rng(struct device *dev)* HMAC_SNOOP_NO_AFEA (HSNA) instead of type IPSEC_ESP */ #define TALITOS_CRA_PRIORITY_AEAD_HSNA (TALITOS_CRA_PRIORITY - 1) -#define TALITOS_MAX_KEY_SIZE 96 +#define TALITOS_MAX_KEY_SIZE (AES_MAX_KEY_SIZE + SHA512_BLOCK_SIZE)#define TALITOS_MAX_IV_LENGTH 16/* max of AES_BLOCK_SIZE, DES3_EDE_BLOCK_SIZE */ struct talitos_ctx {
@@ -1495,6 +1495,11 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *cipher, {struct talitos_ctx *ctx =crypto_ablkcipher_ctx (cipher); +if (keylen >TALITOS_MAX_KEY_SIZE ) { +crypto_ablkcipher_set_flags (cipher,CRYPTO_TFM_RES_BAD_KEY_LEN ); +return -EINVAL ; + } +memcpy (&ctx->key, key, keylen); ctx->keylen = keylen;
Signature · 6 lines
1.7.10.4 -- Martin Hicks P.Eng. | [email protected] Bork Consulting Inc. | +1 (613) 266-2296
Quoted 11 lines · Martin Hicks
An updated patch that also handles the additional key length requirements for the AEAD algorithms.
The max keysize is not 96. For SHA384/512 it's 128, and for the AEAD algorithms it's longer still. Extend the max keysize for the AEAD size for AES256 + HMAC(SHA512).
Cc <[email protected]> # 3.6+Fixes 357fb60502ede ("crypto: talitos - add sha224, sha384 and sha512 to existing AEAD algorithms")Signed-off-by Martin Hicks <[email protected]>
Thanks,
Horia
Herbert Xu
maintainerQuoted 11 lines · Martin Hicks
An updated patch that also handles the additional key length requirements for the AEAD algorithms.
The max keysize is not 96. For SHA384/512 it's 128, and for the AEAD algorithms it's longer still. Extend the max keysize for the AEAD size for AES256 + HMAC(SHA512).
Cc <[email protected]> # 3.6+Fixes 357fb60502ede ("crypto: talitos - add sha224, sha384 and sha512 to existing AEAD algorithms")Signed-off-by Martin Hicks <[email protected]>
Patch applied. Thanks.
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