crypto:chtls: key len correction
authorAtul Gupta <atul.gupta@chelsio.com>
Sun, 27 May 2018 15:45:18 +0000 (21:15 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 May 2018 14:14:38 +0000 (10:14 -0400)
corrected the key length to copy 128b key. Removed 192b and 256b
key as user input supports key of size 128b in gcm_ctx

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Atul Gupta <atul.gupta@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/crypto/chelsio/chtls/chtls_hw.c

index 54a13aa99121ac3ccea2fe6c7a7489c6685232c4..55d50140f9e5a6c6fd07112f2ac650f2f31abdfb 100644 (file)
@@ -213,7 +213,7 @@ static int chtls_key_info(struct chtls_sock *csk,
                          struct _key_ctx *kctx,
                          u32 keylen, u32 optname)
 {
-       unsigned char key[CHCR_KEYCTX_CIPHER_KEY_SIZE_256];
+       unsigned char key[AES_KEYSIZE_128];
        struct tls12_crypto_info_aes_gcm_128 *gcm_ctx;
        unsigned char ghash_h[AEAD_H_SIZE];
        struct crypto_cipher *cipher;
@@ -228,10 +228,6 @@ static int chtls_key_info(struct chtls_sock *csk,
 
        if (keylen == AES_KEYSIZE_128) {
                ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_128;
-       } else if (keylen == AES_KEYSIZE_192) {
-               ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_192;
-       } else if (keylen == AES_KEYSIZE_256) {
-               ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_256;
        } else {
                pr_err("GCM: Invalid key length %d\n", keylen);
                return -EINVAL;