Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1247354pxa; Thu, 20 Aug 2020 06:41:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT7ge1/bjQolFUNfmmmFn5YbJwhz32+mY0s5xJR4xcEZVPe0XP7rUVqHa8HxMkcVLVubQN X-Received: by 2002:a50:d2c7:: with SMTP id q7mr2806424edg.61.1597930914785; Thu, 20 Aug 2020 06:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597930914; cv=none; d=google.com; s=arc-20160816; b=jedxnGrfOr4xEjQwV7rLwFObJasUfi7xyxQCSBrzIRdcG2TCWC6CA3tMCunUPuoH2S Nlbusj93pdfbITtRDZVxirtdUWdcHBP6jx7KFQvt1p80g+LbJyYiII50Gvl+whvtDqY6 YvbOvPRqNqSz9esJCPNtyUUuzt8UgTI23yE+Hn/E83WqUmKql9QZnfxuDFJsc4Zf2P5l Nec55jXqb7L6PjDXLncwamPQ3u9nXb04S4TKxtr/yG22nt6cyl+9GfbPYBYyFPADIq7+ CD1gBYSo4id9+R94JP5zwATcTtZqA4Y4//e5g36wWo9vdMXuPOm7tNzY4kCb2aPREKZd XqIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u8fNX1CZJMiU9blENBOSyV2MpRlmVP9nqMLM96BmT+g=; b=TR0vdecdSv2Rx84titNaQMbnd+VGyDWTwxWz2kpSDMEBotjgs2VwXafknC8I1JbQpi dyAvJCE+h64n5EzFsJFn7EFoHNVOvukvz2ayZY1g9f4XqO0t3Lwm8FwGBhXE1EfhEknC nCDZawk3vZ76FTXS8sSpXOAAdcF++RQDK7B1L71UQ6to8r0zfOM8kXiBLYnC8VsHKNVv E287VqUcd606k0huQBwzFpnyplQ5ZaqqAXDqOP9C//V+CiJ/C2aKxWAr0GVVaM9nhVtr OWivtTDjJrRBkZpHtKOuRpvP5Ixbq4L60i1hJ/3BXXslpJNP1O+eVT/ADbVmtzic59Pe jl3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lgMXzSgV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si1972154edj.109.2020.08.20.06.41.29; Thu, 20 Aug 2020 06:41:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lgMXzSgV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730599AbgHTNkw (ORCPT + 99 others); Thu, 20 Aug 2020 09:40:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:41348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727807AbgHTJaW (ORCPT ); Thu, 20 Aug 2020 05:30:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 68791206FA; Thu, 20 Aug 2020 09:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915821; bh=0X7WpuY/jCJp0/tIa44IIaSK8ndpAN4TJYDqNrG0RlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgMXzSgVhFE0ViP6ibgE6isxuSKx9WUp9/6srzoawbUO8F7mHdUVZQk4ygh1fF+gO MQRQhlfJIKtQFYOtE3MIGen18TKFc+uUFB6TBntLNW3uJfnJq7K3C6Re6nKeq1qSOd 4zUuRwo77qFlv7BuTt72Y3epexZVaB8BeBq0G7y0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Herbert Xu , Ard Biesheuvel , =?UTF-8?q?Horia=20Geant=C4=83?= , Sasha Levin Subject: [PATCH 5.8 145/232] crypto: caam - Remove broken arc4 support Date: Thu, 20 Aug 2020 11:19:56 +0200 Message-Id: <20200820091619.842249128@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Herbert Xu [ Upstream commit eeedb618378f8a09779546a3eeac16b000447d62 ] The arc4 algorithm requires storing state in the request context in order to allow more than one encrypt/decrypt operation. As this driver does not seem to do that, it means that using it for more than one operation is broken. Fixes: eaed71a44ad9 ("crypto: caam - add ecb(*) support") Link: https://lore.kernel.org/linux-crypto/CAMj1kXGvMe_A_iQ43Pmygg9xaAM-RLy=_M=v+eg--8xNmv9P+w@mail.gmail.com Link: https://lore.kernel.org/linux-crypto/20200702101947.682-1-ardb@kernel.org Signed-off-by: Herbert Xu Acked-by: Ard Biesheuvel Acked-by: Horia Geantă Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/caam/caamalg.c | 29 ----------------------------- drivers/crypto/caam/compat.h | 1 - 2 files changed, 30 deletions(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index bf90a4fcabd1f..8149ac4d6ef22 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -810,12 +810,6 @@ static int ctr_skcipher_setkey(struct crypto_skcipher *skcipher, return skcipher_setkey(skcipher, key, keylen, ctx1_iv_off); } -static int arc4_skcipher_setkey(struct crypto_skcipher *skcipher, - const u8 *key, unsigned int keylen) -{ - return skcipher_setkey(skcipher, key, keylen, 0); -} - static int des_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key, unsigned int keylen) { @@ -1967,21 +1961,6 @@ static struct caam_skcipher_alg driver_algs[] = { }, .caam.class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_ECB, }, - { - .skcipher = { - .base = { - .cra_name = "ecb(arc4)", - .cra_driver_name = "ecb-arc4-caam", - .cra_blocksize = ARC4_BLOCK_SIZE, - }, - .setkey = arc4_skcipher_setkey, - .encrypt = skcipher_encrypt, - .decrypt = skcipher_decrypt, - .min_keysize = ARC4_MIN_KEY_SIZE, - .max_keysize = ARC4_MAX_KEY_SIZE, - }, - .caam.class1_alg_type = OP_ALG_ALGSEL_ARC4 | OP_ALG_AAI_ECB, - }, }; static struct caam_aead_alg driver_aeads[] = { @@ -3457,7 +3436,6 @@ int caam_algapi_init(struct device *ctrldev) struct caam_drv_private *priv = dev_get_drvdata(ctrldev); int i = 0, err = 0; u32 aes_vid, aes_inst, des_inst, md_vid, md_inst, ccha_inst, ptha_inst; - u32 arc4_inst; unsigned int md_limit = SHA512_DIGEST_SIZE; bool registered = false, gcm_support; @@ -3477,8 +3455,6 @@ int caam_algapi_init(struct device *ctrldev) CHA_ID_LS_DES_SHIFT; aes_inst = cha_inst & CHA_ID_LS_AES_MASK; md_inst = (cha_inst & CHA_ID_LS_MD_MASK) >> CHA_ID_LS_MD_SHIFT; - arc4_inst = (cha_inst & CHA_ID_LS_ARC4_MASK) >> - CHA_ID_LS_ARC4_SHIFT; ccha_inst = 0; ptha_inst = 0; @@ -3499,7 +3475,6 @@ int caam_algapi_init(struct device *ctrldev) md_inst = mdha & CHA_VER_NUM_MASK; ccha_inst = rd_reg32(&priv->ctrl->vreg.ccha) & CHA_VER_NUM_MASK; ptha_inst = rd_reg32(&priv->ctrl->vreg.ptha) & CHA_VER_NUM_MASK; - arc4_inst = rd_reg32(&priv->ctrl->vreg.afha) & CHA_VER_NUM_MASK; gcm_support = aesa & CHA_VER_MISC_AES_GCM; } @@ -3522,10 +3497,6 @@ int caam_algapi_init(struct device *ctrldev) if (!aes_inst && (alg_sel == OP_ALG_ALGSEL_AES)) continue; - /* Skip ARC4 algorithms if not supported by device */ - if (!arc4_inst && alg_sel == OP_ALG_ALGSEL_ARC4) - continue; - /* * Check support for AES modes not available * on LP devices. diff --git a/drivers/crypto/caam/compat.h b/drivers/crypto/caam/compat.h index 60e2a54c19f11..c3c22a8de4c00 100644 --- a/drivers/crypto/caam/compat.h +++ b/drivers/crypto/caam/compat.h @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include -- 2.25.1