From patchwork Tue Jul 24 14:12:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 142808 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp7324845ljj; Tue, 24 Jul 2018 07:14:04 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf2DNFmW5j88ADKNJwr/X/ytZOGx8fEb/2eWRz8HbLVKk+XRCrNWYHp2gMEejXLN71Dugaa X-Received: by 2002:a62:4a41:: with SMTP id x62-v6mr18001657pfa.45.1532441644481; Tue, 24 Jul 2018 07:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532441644; cv=none; d=google.com; s=arc-20160816; b=BZarkE/wg+JKgop59vLCZNjSPbeLSkZ5VXsq3PFK7Q0KCwRGOpt5aAZhFdqlEcaRGH zmPkDb99xjM8LTLWRkHIsG0AEy8wI5NvLg/C08KOUdqOoGkAQTt3nz6iSvjrVOkhbazN tfc0QhUqnznQ/qAqfAwYPM4hMr1MUWJgBGY7gpdlafD2akEjBhr3cz7Q2QZDSeiVixiw 9PMt2My/4UOvz/xrTmNfhKBSjR1CiEypw9lsw0ii9LSfrVYzhiEr7T+0dbYx27C2ktTb KhGFx/iBjLxQ4sSQqUI+gTnq7M63As1Ur7U1nBfErZ/R1aKFhYh/hawypNmX+GH6Hj+n miHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=rT9ZdVMwFqoT8GYSFR6p87uQ3+p2nU4b5WAZzTHtaTs=; b=msRi966hmG4cHUPP/EMk+aH2dh4XNUAKm2/WhiMuZmAcyBphdEsyjrLPt6W7rJwwXI +6VoXMCgYMh1Qz5mEvWy7Mf8OK3PP8whvx2ETMFDBzuGVdDWQTiVHHJxBMlpeVPz5w1Q 0yFePhFAdo/ohtt1Y38mRCQWUMsJ+T1QZBR0ByUtlTJ2JSrBbNvdBDq2GhM6VD/aXwpO QWjkfiOMFm51lSkB+VBfxmMls9sFyeuz2bDUfaNRcy8RK3fZnthYyqQmEPyBUwBUucrt YKn4XojHR5TFIoEwOz5a2kMOpU5H6181sx/jG/I46QQoZFrxUJZOm8zm2KfkCH5SNWe7 0dgg== ARC-Authentication-Results: i=1; mx.google.com; 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 x17-v6si10797947pfn.286.2018.07.24.07.14.04; Tue, 24 Jul 2018 07:14:04 -0700 (PDT) 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; 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 S2388574AbeGXPUm (ORCPT + 31 others); Tue, 24 Jul 2018 11:20:42 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52312 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388460AbeGXPUl (ORCPT ); Tue, 24 Jul 2018 11:20:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 28DFD7A9; Tue, 24 Jul 2018 07:14:01 -0700 (PDT) Received: from sugar.kfn.arm.com (E110176.Emea.Arm.com [10.50.4.179]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B04F63F237; Tue, 24 Jul 2018 07:13:59 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , Geert Uytterhoeven , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] crypto: ccree: allow bigger than sector XTS op Date: Tue, 24 Jul 2018 15:12:46 +0100 Message-Id: <1532441567-11694-5-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532441567-11694-1-git-send-email-gilad@benyossef.com> References: <1532441567-11694-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ccree driver had a sanity check that we are not asked to encrypt an XTS buffer bigger than a sane sector size since XTS IV needs to include the sector number in the IV so this is not expected in any real use case. Unfortunately, this breaks cryptsetup benchmark test which has a synthetic performance test using 64k buffer of data with the same IV. Remove the sanity check and allow the user to hang themselves and/or run benchmarks if they so wish. Reported-by: Geert Uytterhoeven Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_cipher.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index 9da0ecc..7623b299 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -19,8 +19,6 @@ #define template_skcipher template_u.skcipher -#define CC_MIN_AES_XTS_SIZE 0x10 -#define CC_MAX_AES_XTS_SIZE 0x2000 struct cc_cipher_handle { struct list_head alg_list; }; @@ -98,8 +96,7 @@ static int validate_data_size(struct cc_cipher_ctx *ctx_p, case S_DIN_to_AES: switch (ctx_p->cipher_mode) { case DRV_CIPHER_XTS: - if (size >= CC_MIN_AES_XTS_SIZE && - size <= CC_MAX_AES_XTS_SIZE && + if (size >= AES_BLOCK_SIZE && IS_ALIGNED(size, AES_BLOCK_SIZE)) return 0; break;