Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp483328ybl; Tue, 28 Jan 2020 06:39:51 -0800 (PST) X-Google-Smtp-Source: APXvYqztK1fNHH4gNiawMhS0nRmEwqcnV2Tsk28AQj3CSmWUPk5teq5Rudkii53hd4xAIeGJJ4UM X-Received: by 2002:a9d:d06:: with SMTP id 6mr17002773oti.176.1580222391535; Tue, 28 Jan 2020 06:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580222391; cv=none; d=google.com; s=arc-20160816; b=0oTYLPajsh5th6LxJaIWwI9LboU6dFYjHoUn6PuxguEnz56kNY0IzMV3x1YGmWQ8S/ C22kazxfCNxwTLiHlj90b1bWlMxq0Gzf64dzP/SbWEoIQrmBGzm3mNw4djhvVUVERqtE sksRIhkBrS6NZMSEIiZc6iBopDGGA3dXny7e2+6ZU2JQ1uX5s0RlVQsae53BWHs9Rljd u2gXMxkkeDZDm3NjpdJnDMC3M0hrqL7gfiHD91jbED5YqhoGUow3rVH+WHdGVa37ERfJ I50yRATyUWFRNbBCfK+0oIPdOc+kiGuqP+yDrDXgu56Fow3fRrlKwjfnw4aosVkLjGxh D00w== 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=xAs0sTO+Z/7CQ93kRWddwQqUs/EIzwyd5sJKERaPjxA=; b=bEPJ6/WDRWcBz7XvnOp6MoOrym5aBj0RwN6bTmx8vivTIts8txacdKO6zrpp4bbrvf qvFwh1fnXC3S6UidSGktnpiJBH9plLm5BSg/SFXRnrv7PtOdaQ0gdfyrf4pW/uqaZ/Zs 245ZvkUIfSCjbmmMZogVk5Fr/EHN0lOMed0Iyq3rz/Y8u3GlLND7EmRW5i6UX+GlSnVj DEEIBV3wvvu1FXSqDYEhYiD0jF9h0N4Ld5q1NXrcK/9FR95vLcacs1MXPb02V2M58Joo vLyMx/Gwf7buGRzXqKHK56gqlu02mfxpxc6kI/G8jlXs1TdOUP44/zGlss+W+nxSHErC Ff8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="SiysmG/H"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c67si1678503oib.276.2020.01.28.06.39.39; Tue, 28 Jan 2020 06:39:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="SiysmG/H"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727392AbgA1OhG (ORCPT + 99 others); Tue, 28 Jan 2020 09:37:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:45816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731133AbgA1OUr (ORCPT ); Tue, 28 Jan 2020 09:20:47 -0500 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 D9E3924688; Tue, 28 Jan 2020 14:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221246; bh=IODptUNHUasedGKHmhUQ10ZnXdsVBZIRPb84G/A80QE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SiysmG/H63DB6dmAaes3ODZAengRQ1ayBDbC1uGRH/c24g3XX+xDiqkmmo+3DWlNr BPet0p35xHhjFRHjpacuGbs+e3X7jqUrGi0lMy6nASmmQYtVwMe2XXPaWuJMd+yJhI QDw8Xon8e5HSJRpJatEQSNzwTdSCjDi+zmUveOFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gary R Hook , Herbert Xu , Sasha Levin Subject: [PATCH 4.9 146/271] crypto: ccp - fix AES CFB error exposed by new test vectors Date: Tue, 28 Jan 2020 15:04:55 +0100 Message-Id: <20200128135903.426588152@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@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: Hook, Gary [ Upstream commit c3b359d6567c0b8f413e924feb37cf025067d55a ] Updated testmgr will exhibit this error message when loading the ccp-crypto module: alg: skcipher: cfb-aes-ccp encryption failed with err -22 on test vector 3, cfg="in-place" Update the CCP crypto driver to correctly treat CFB as a streaming mode cipher (instead of block mode). Update the configuration for CFB to specify the block size as a single byte; Fixes: 2b789435d7f3 ('crypto: ccp - CCP AES crypto API support') Signed-off-by: Gary R Hook Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/ccp-crypto-aes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ccp/ccp-crypto-aes.c b/drivers/crypto/ccp/ccp-crypto-aes.c index 89291c15015cd..3f768699332ba 100644 --- a/drivers/crypto/ccp/ccp-crypto-aes.c +++ b/drivers/crypto/ccp/ccp-crypto-aes.c @@ -1,7 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * AMD Cryptographic Coprocessor (CCP) AES crypto API support * - * Copyright (C) 2013,2016 Advanced Micro Devices, Inc. + * Copyright (C) 2013-2019 Advanced Micro Devices, Inc. * * Author: Tom Lendacky * @@ -79,8 +80,7 @@ static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt) return -EINVAL; if (((ctx->u.aes.mode == CCP_AES_MODE_ECB) || - (ctx->u.aes.mode == CCP_AES_MODE_CBC) || - (ctx->u.aes.mode == CCP_AES_MODE_CFB)) && + (ctx->u.aes.mode == CCP_AES_MODE_CBC)) && (req->nbytes & (AES_BLOCK_SIZE - 1))) return -EINVAL; @@ -291,7 +291,7 @@ static struct ccp_aes_def aes_algs[] = { .version = CCP_VERSION(3, 0), .name = "cfb(aes)", .driver_name = "cfb-aes-ccp", - .blocksize = AES_BLOCK_SIZE, + .blocksize = 1, .ivsize = AES_BLOCK_SIZE, .alg_defaults = &ccp_aes_defaults, }, -- 2.20.1