From patchwork Thu Feb 4 21:43:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 376337 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1655718jah; Thu, 4 Feb 2021 13:46:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0Q9ldcwcYnji6eZKtUfYITPs+J2u0jz9XOHGCR4pSREwlkLYFs06KczCUR6NGqf5TcYgD X-Received: by 2002:a50:998f:: with SMTP id m15mr608593edb.342.1612475200641; Thu, 04 Feb 2021 13:46:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612475200; cv=none; d=google.com; s=arc-20160816; b=s08GlwHH9RS6VzTWlmJhSjTQsdKS5DH5zqYwOuWccZtRMkFM1v6pcspFTKSfCpdX+l T+uwpb0Jo6By0Zd+0PeLOuv7Yi3AF1do6OsKrbRoICpR4tjkxTfo3Lysyb2ZusDCkCcx 4znH6dADO9VvyDvJxkMgI60cDs9j2yW0YKYoo6bqJMen9DZ+GrnudkEcIOYkFxBOE67a 6T/OnXYTb/b+f4kyUhnNYJaxfgUzqEGZh7dF4zWlebkl8L8t94TiayV8pnri6qonexxh uL9u6l1wplpDFCIrr4zMQGdtGr/TfwO/YzLPXvv/RkuCkws45zOlURKEO3HexN5ByvSL 5nIA== 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=fbaPzVOJqVBKum7B5yoNy4q+qHm6B45n0RkRe3mNDrc=; b=H3KRwXIXr/OYLu9zWwhOyNMz9b6U0hv0l03eUE9YKeisMOq9HvtVQgxeMQ1OT7SEOE NM+2TmCUqi5xxTaE7iqPto9wuJo2qzqLHQWbfBmfz+/dFNsvxH6fpNT8L83+Wy2/ceGP 0EqRSlLd6MWmwLMyJ9c6h9CRNnC5U3tWWOKG40wOW3QB+tGNd5sTTE6LsQVVW0Slt2SN bOEbMNXQmAEdY3UMxGWlDGlTARjxjOhxcfKVjoqiMSs5dj8EqPk8qq9COJu1Lr4YJe+y dDBytTdJY0Pt0LSh/rPmXaIMWyr5cTjpha5OyVw6on21zY4zp2MZ58oeogYYidH75fzr +HEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kGJX8eyN; 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 j4si3983455ejv.17.2021.02.04.13.46.40; Thu, 04 Feb 2021 13:46:40 -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=kGJX8eyN; 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 S229513AbhBDVpe (ORCPT + 2 others); Thu, 4 Feb 2021 16:45:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbhBDVpY (ORCPT ); Thu, 4 Feb 2021 16:45:24 -0500 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A7DEC0617A9 for ; Thu, 4 Feb 2021 13:44:06 -0800 (PST) Received: by mail-qk1-x72f.google.com with SMTP id k193so4919307qke.6 for ; Thu, 04 Feb 2021 13:44:06 -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=fbaPzVOJqVBKum7B5yoNy4q+qHm6B45n0RkRe3mNDrc=; b=kGJX8eyN3yi8UlOcJJ6kU9ufahtm5U/YGN/KL9tEJ+qlTwFMpipOSJDa7XCZx8Q2dR Owa3CpMKTbBsV9fBpN5nB+yTvgiICdGsxMVhRPYcVhKf0SQCF1jB4v2iqrHp+348HZNc UcUOxHimAxMBmosQCRTnC73Gj9PrO7ztPQkDr42+QZ1hCQm8VMNNr0GaayO3VW8yS7f3 wWzuMU51Ywf0X+pvisB+l8GMqaH12XN1JuFHoon+U0zNpSLDum6H/Q5V9ph0BJunJrYS GDKt17AvSLpx3BtXwS3OxxFHRTfsNBcEObpX0pDxSv31B1mJVr1vvuNPtZOfadrEGbEC KfPQ== 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=fbaPzVOJqVBKum7B5yoNy4q+qHm6B45n0RkRe3mNDrc=; b=LZ5Wj4f9QBqTbPVbZMRBuWkUYz0XsyFVsFp7+i8RIZ43v64cZiw3ZswTxIEA8XsgE1 BuIX7u+eeMG9+8YcZlsf7ByJeAj+1nigFoxpwu2nMyZp4pn6lhPmotuGjn5TlI+1rTQK y33in7JK8pPHkJG5vPAE+AAOZkf0kk82RT2ebu58dWUWgNebTlKw1pVVsIwZOhoPnHD3 YBXC6SVk11Jg+RZYWjo7r7l8yQH4TTOGQuCCjwO3Nqe4vu0XiHwQ65DILgP6UeiU8pjV JQT5DSX5s5EaQZJ4USDLMAllacXVRd++0m2+/2XsoY4rpxcWWamat1xcDGfJn2hUzdU6 drPQ== X-Gm-Message-State: AOAM531ouyM9Kc/CuSk0JgYZ4F2JKiuh6iCsz1mzUzziI0hBx8/+ncGv YD7UStq0EjHLB9Bc39fcsVdCMw== X-Received: by 2002:a05:620a:158e:: with SMTP id d14mr1263186qkk.111.1612475045331; Thu, 04 Feb 2021 13:44:05 -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 h185sm6353858qkd.122.2021.02.04.13.44.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 13:44:04 -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 v5 05/11] crypto: qce: skcipher: Return error for zero length messages Date: Thu, 4 Feb 2021 16:43:53 -0500 Message-Id: <20210204214359.1993065-6-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204214359.1993065-1-thara.gopinath@linaro.org> References: <20210204214359.1993065-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Crypto engine BAM dma does not support 0 length data. Return unsupported if zero length messages are passed for transformation. Signed-off-by: Thara Gopinath --- drivers/crypto/qce/skcipher.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.25.1 diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c index de1f37ed4ee6..331b3c3a5b59 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -260,6 +261,10 @@ static int qce_skcipher_crypt(struct skcipher_request *req, int encrypt) rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen; + /* CE does not handle 0 length messages */ + if (!req->cryptlen) + return -EOPNOTSUPP; + /* qce is hanging when AES-XTS request len > QCE_SECTOR_SIZE and * is not a multiple of it; pass such requests to the fallback */