Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2430990pxb; Thu, 11 Feb 2021 12:08:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzlXO1JuRE/y4hw6+KImTrzPIzWFrrYHTplgi56Bn5G9IcRHq4Ez1wIPvbCMCzOoun8YiJ X-Received: by 2002:a05:6402:34d2:: with SMTP id w18mr10353948edc.102.1613074110983; Thu, 11 Feb 2021 12:08:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613074110; cv=none; d=google.com; s=arc-20160816; b=vA/StTzZwCL42rkQrc7MHBALePMg4fRy4PKBZwFrL6y+qeGDtcBjIQcXsmNim7Zuc6 VHWiYXpxNgoEW8KYSFmSqH23jmA8WDsVG/DChayD5c5n8B5gXyxfFoApmTzwXHNN9ETm 0SmJBxNpRczljRFQ/uD5W1TEE2sXIYGUnNhythLsaO9XPFJDAUTEnpCkma5wRhn5Lkpb CKx79rxHPJMeyyuB3vS21WxHU3ihIjbwECMUK/OjiXscgEPCni2S74+uq0Xc4FAQUGGo VkNPGTpgl1a9HFwWmbEjiCci5RNmSzTxELkSLIsWCfOhHszj9NM6Gt/VhvEgY2lbnOdd aLWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H4BViZmMHUNQYYu9VpJJKST4ly897JCfdbGhTeJJKpE=; b=ICcPZzyOwV4mEa76Ls1tmpbBcS5X4vYSxQKLt4AkQcT+QsxBBg2i4kkbqq5fRD+FpU KTQbcB4W/Nj7MoH+8ab1IP75NnCXR1tZSOUsO9l96jtfSDHncp87KEys8qBDmh9NCKt9 b+wt+DGNDIN+y4Q9dyBKEiGfwWN6Aql8cfLVyEW34KTCM7xg+odf0rKhWLsCcaAUx2iS r/9qmNQVIqb3qkFpeM8wphbmIFZYZCc8W2X6vCUVZpoU/z74zwrPAygJNQeh4Xir5C13 mFjGFJQ64Hpqs7EgpOPBMI6MbtFBASg1HTd4KmPLMzQufzcxQrWSCRt7mgctzofkr5O7 n/mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d8ymdmwF; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si4451627ejc.697.2021.02.11.12.08.07; Thu, 11 Feb 2021 12:08:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=@linaro.org header.s=google header.b=d8ymdmwF; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbhBKUFh (ORCPT + 99 others); Thu, 11 Feb 2021 15:05:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231865AbhBKUDg (ORCPT ); Thu, 11 Feb 2021 15:03:36 -0500 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04D61C06121F for ; Thu, 11 Feb 2021 12:01:39 -0800 (PST) Received: by mail-qt1-x82b.google.com with SMTP id b24so5063882qtp.13 for ; Thu, 11 Feb 2021 12:01:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H4BViZmMHUNQYYu9VpJJKST4ly897JCfdbGhTeJJKpE=; b=d8ymdmwFXCwez4mLOrfhKf5mFT0mnFj75aMOO4K6woC6nV8wCoQmGV1QYH3VAl3Uoq YgUVNwD6VcAu2MtRViHxmnA/sG2aJN2lKQsaKyZE3nas3C/Rxn32TDXlYHJYU8mj19zb U8eT3V9ICgvWeem//Hbl/x66G2nQXDXcvsgdjYbh8z7pH2gKpoiYzc+dqc9mUSH2A1zN 6GqMDkGXeRidVvXqN8aa1dGIzSSa+kdDA4s8Ifz68XrFZhqZ/Xb8/V/GB6eTnnVFiw9S 0Xl6Zy1hGthmd3iI1871kouJz4sFS5GbOaXXuiP6HwVdu1WvW5/tZCDjxvsXbp2sfDm+ TpjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H4BViZmMHUNQYYu9VpJJKST4ly897JCfdbGhTeJJKpE=; b=OiuwO58gUDFcaaCClGO6o/7vG+Esn1jHugKIgKJN5r5qKTVbG8MZESRj8WYtYgPp1g zOrXLIeZk849g3kju0DxAKnK6AIX6V6qDj1NVgAplfRg/2FyeKq46xA6NKafE7GIxlco MAuThH9jKG1gjv/3MbHAMkFY+xNTGRNBd/EJQ3gEL/FYb8ZWylSshp+HZjmJPKtTLJjA IiVJgVMfcb2IpkutYhlM98cod4jujhBynenqU2Dnn4y8QMjaom8Mpx4C5DYbNtIiwkq7 HfZaANq1WZp7S13ccmo+EYFsvFuE04oKQC+lnQ/l4aTgJS43oWwGK6udbL4uQ7zx2T2N Yw3g== X-Gm-Message-State: AOAM532OjblJkfXjKqiLiVFYmMnoLUqDN6MhCTuRUOHsj0Q8yS/5E0SJ +c9A77m8TpaAUIlexSkOXZs7GRk9rQesPg== X-Received: by 2002:ac8:5992:: with SMTP id e18mr9063133qte.177.1613073698273; Thu, 11 Feb 2021 12:01:38 -0800 (PST) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id 17sm4496243qtu.23.2021.02.11.12.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 12:01:37 -0800 (PST) From: Thara Gopinath To: herbert@gondor.apana.org.au, davem@davemloft.net, bjorn.andersson@linaro.org Cc: ebiggers@google.com, ardb@kernel.org, sivaprak@codeaurora.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 09/11] crypto: qce: common: Set data unit size to message length for AES XTS transformation Date: Thu, 11 Feb 2021 15:01:26 -0500 Message-Id: <20210211200128.2886388-10-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210211200128.2886388-1-thara.gopinath@linaro.org> References: <20210211200128.2886388-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Set the register REG_ENCR_XTS_DU_SIZE to cryptlen for AES XTS transformation. Anything else causes the engine to return back wrong results. Acked-by: Bjorn Andersson Signed-off-by: Thara Gopinath --- drivers/crypto/qce/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/qce/common.c b/drivers/crypto/qce/common.c index a73db2a5637f..f7bc701a4aa2 100644 --- a/drivers/crypto/qce/common.c +++ b/drivers/crypto/qce/common.c @@ -295,15 +295,15 @@ static void qce_xtskey(struct qce_device *qce, const u8 *enckey, { u32 xtskey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0}; unsigned int xtsklen = enckeylen / (2 * sizeof(u32)); - unsigned int xtsdusize; qce_cpu_to_be32p_array((__be32 *)xtskey, enckey + enckeylen / 2, enckeylen / 2); qce_write_array(qce, REG_ENCR_XTS_KEY0, xtskey, xtsklen); - /* xts du size 512B */ - xtsdusize = min_t(u32, QCE_SECTOR_SIZE, cryptlen); - qce_write(qce, REG_ENCR_XTS_DU_SIZE, xtsdusize); + /* Set data unit size to cryptlen. Anything else causes + * crypto engine to return back incorrect results. + */ + qce_write(qce, REG_ENCR_XTS_DU_SIZE, cryptlen); } static int qce_setup_regs_skcipher(struct crypto_async_request *async_req, -- 2.25.1