* [PATCH v2] crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD
@ 2017-05-02 13:38 Martin Hicks
2017-05-02 14:02 ` Horia Geantă
2017-06-19 6:38 ` Herbert Xu
0 siblings, 2 replies; 4+ messages in thread
From: Martin Hicks @ 2017-05-02 13:38 UTC (permalink / raw)
To: linuxppc-dev, linux-crypto; +Cc: stable, horia.geanta
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: <stable@vger.kernel.org> # 3.6+
Fixes: 357fb60502ede ("crypto: talitos - add sha224, sha384 and sha512 to existing AEAD algorithms")
Signed-off-by: Martin Hicks <mort@bork.org>
---
drivers/crypto/talitos.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 0bba6a1..79791c6 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -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;
--
1.7.10.4
--
Martin Hicks P.Eng. | mort@bork.org
Bork Consulting Inc. | +1 (613) 266-2296
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD
2017-05-02 13:38 [PATCH v2] crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD Martin Hicks
@ 2017-05-02 14:02 ` Horia Geantă
2017-06-19 6:38 ` Herbert Xu
1 sibling, 0 replies; 4+ messages in thread
From: Horia Geantă @ 2017-05-02 14:02 UTC (permalink / raw)
To: Martin Hicks, linuxppc-dev, linux-crypto; +Cc: stable
On 5/2/2017 4:38 PM, Martin Hicks wrote:
>
> 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: <stable@vger.kernel.org> # 3.6+
> Fixes: 357fb60502ede ("crypto: talitos - add sha224, sha384 and sha512 to existing AEAD algorithms")
> Signed-off-by: Martin Hicks <mort@bork.org>
Acked-by: Horia Geantă <horia.geanta@nxp.com>
Thanks,
Horia
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD
@ 2017-05-02 14:02 ` Horia Geantă
0 siblings, 0 replies; 4+ messages in thread
From: Horia Geantă @ 2017-05-02 14:02 UTC (permalink / raw)
To: Martin Hicks, linuxppc-dev, linux-crypto; +Cc: stable
On 5/2/2017 4:38 PM, Martin Hicks wrote:=0A=
> =0A=
> An updated patch that also handles the additional key length requirements=
=0A=
> for the AEAD algorithms.=0A=
> =0A=
> The max keysize is not 96. For SHA384/512 it's 128, and for the AEAD=0A=
> algorithms it's longer still. Extend the max keysize for the=0A=
> AEAD size for AES256 + HMAC(SHA512).=0A=
> =0A=
> Cc: <stable@vger.kernel.org> # 3.6+=0A=
> Fixes: 357fb60502ede ("crypto: talitos - add sha224, sha384 and sha512 to=
existing AEAD algorithms")=0A=
> Signed-off-by: Martin Hicks <mort@bork.org>=0A=
Acked-by: Horia Geant=E3 <horia.geanta@nxp.com>=0A=
=0A=
Thanks,=0A=
Horia=0A=
=0A=
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD
2017-05-02 13:38 [PATCH v2] crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD Martin Hicks
2017-05-02 14:02 ` Horia Geantă
@ 2017-06-19 6:38 ` Herbert Xu
1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2017-06-19 6:38 UTC (permalink / raw)
To: Martin Hicks; +Cc: linuxppc-dev, linux-crypto, stable, horia.geanta
Martin Hicks <mort@bork.org> wrote:
>
> 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: <stable@vger.kernel.org> # 3.6+
> Fixes: 357fb60502ede ("crypto: talitos - add sha224, sha384 and sha512 to existing AEAD algorithms")
> Signed-off-by: Martin Hicks <mort@bork.org>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-19 6:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02 13:38 [PATCH v2] crypto: talitos: Extend max key length for SHA384/512-HMAC and AEAD Martin Hicks
2017-05-02 14:02 ` Horia Geantă
2017-05-02 14:02 ` Horia Geantă
2017-06-19 6:38 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.