Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp615347ybl; Wed, 29 Jan 2020 06:38:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwLFmK6C97mIqMyYMTEJgoG6X2ehChsYhZHNhJILP00Gogrq7KdI42ARtjoNse61OMESm2D X-Received: by 2002:a9d:53c2:: with SMTP id i2mr19171621oth.43.1580308727126; Wed, 29 Jan 2020 06:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580308727; cv=none; d=google.com; s=arc-20160816; b=fGv+9LBYig0xCoDBCkLXmsBe+PAKOxW6xVJoVepeJetgPhzdOeKiMV/5Egn0pDuBxY wSEbIk0CluSJ69EgMQZHKntXEFDAVc7/ktFTahs0jEhovI9HIDcU4Na+5lZ7rIkVDoCp /8wd2ptAPCi+7bIMrV/PLYwYPTiWLJEDEVVVbGZb0A0sXq54iYw8nFB4vQrgRqAM/BII l1nbQEyms7rYO5eNHIN+8+R9gdn9vqib+2cezIYMUD8HWVqoMB7GAdAXKfiwEzy0V/tC swICT+qupVe0P7OpKF7N7qeTHV0e96JNv50XA5iLw1c8FpQJRZnooMh7OZbOrq5Qt9AW 3UAg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8HH7nNsEOswujTrx02bD5pRcm2A4LoNTOoOZvof/r/A=; b=q1gLVuLnja4MG9UONiHoVlhoKEQA69RE4GETxZASjGUmIa37HDqURaVR9MzZx4mLuc iTD43DNgFCNc8Z8VvLz3c0uCUXetQzIrbGkOz/Db/659G0tPle4DnJiZRqCqCr80U6LI wglGbMcKjkk52Z97VC2m48YuYHr7Or6nIDzitgkNEdSs+SdNtK+2PBg12r2yJCiOM1tp vkx1v1sgKMdT4Tag8AELu1eLChXFqW7klVcfNlOIgQInNA+oX9kFL9jjG9B6yoXnglM5 cTRjyfqJi8xCVSwgqUiWmdYA7uwglmJxmnuMKPSBGjGaBh2N0jJzlTT4mt6eeieyp4u3 u11Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 w7si1253257otq.250.2020.01.29.06.38.36; Wed, 29 Jan 2020 06:38:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726760AbgA2OiN (ORCPT + 99 others); Wed, 29 Jan 2020 09:38:13 -0500 Received: from foss.arm.com ([217.140.110.172]:41980 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726756AbgA2OiN (ORCPT ); Wed, 29 Jan 2020 09:38:13 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C045A1045; Wed, 29 Jan 2020 06:38:12 -0800 (PST) Received: from e110176-lin.kfn.arm.com (unknown [10.50.4.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7BB163F52E; Wed, 29 Jan 2020 06:38:11 -0800 (PST) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] crypto: ccree - fix some reported cipher block sizes Date: Wed, 29 Jan 2020 16:37:56 +0200 Message-Id: <20200129143757.680-4-gilad@benyossef.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200129143757.680-1-gilad@benyossef.com> References: <20200129143757.680-1-gilad@benyossef.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org OFB and CTR modes block sizes were wrongfully reported as the underlying block sizes. Fix it to 1 bytes as they turn the block ciphers into stream ciphers. Also document why our XTS differes from the generic implementation. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_cipher.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index c08dee04941b..73457548ee92 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -1236,6 +1236,10 @@ static const struct cc_alg_template skcipher_algs[] = { .sec_func = true, }, { + /* See https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg40576.html + * for the reason why this differs from the generic + * implementation. + */ .name = "xts(aes)", .driver_name = "xts-aes-ccree", .blocksize = 1, @@ -1431,7 +1435,7 @@ static const struct cc_alg_template skcipher_algs[] = { { .name = "ofb(aes)", .driver_name = "ofb-aes-ccree", - .blocksize = AES_BLOCK_SIZE, + .blocksize = 1, .template_skcipher = { .setkey = cc_cipher_setkey, .encrypt = cc_cipher_encrypt, @@ -1584,7 +1588,7 @@ static const struct cc_alg_template skcipher_algs[] = { { .name = "ctr(sm4)", .driver_name = "ctr-sm4-ccree", - .blocksize = SM4_BLOCK_SIZE, + .blocksize = 1, .template_skcipher = { .setkey = cc_cipher_setkey, .encrypt = cc_cipher_encrypt, -- 2.25.0