From patchwork Sun Feb 7 14:39:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 378114 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp3953876jah; Sun, 7 Feb 2021 06:42:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhFSdaY6Rjq5y60JU7bexvIX3cd0ov2B/GCCVa7ImSMLkCEJzTKJrZe/mtEhATZTvDJOZc X-Received: by 2002:a17:906:a099:: with SMTP id q25mr2533644ejy.549.1612708919916; Sun, 07 Feb 2021 06:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612708919; cv=none; d=google.com; s=arc-20160816; b=GoZO5wuTeU0FFgQ3PHdKLu1Uq7+0MXZcO7oitPRBPAquUsWikPpN2xmgB85yaqOYUi 3ECG92/wIPFdMNyPFbkQvsE8le98aCgyhhpRyMmw3IkGH93XULUf3nnhLoD0cT/GJbTa vduiiAJ5dDlb9jIQEJmp6rbDZoTpyjheTntYxaDBt9iK5zCcHYe6DfbFR+YO/e3ZCg9F oS+dJHhV83qUO1FOif4kDQ9JJhdiVVMWmjOSdBeOeQBAzkUdKQb7184LhIZbAdmYEx5g ayT75kz7nA6g2QSMsaRtbRLZTl+qVBUY4vE1TDc3Gtt197D0uTw053XPQWXzqFZZmeEe I8ZQ== 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=ImO8jkC+DpvrTwFdTRomeqFeWgN9hrI9w+kY9c6b/Eg=; b=RZVOrILEh9wFmBFKggkCqvTjvTLnZ+s1MlBdin6KMFvPiIhiKJWafwudKbwzu8sFAu UkBNglxGuHCvcxu5JmIIQDlUK8Xyb0+2C7/ulegIglBUam4isyjnDRL/RTRiEk3Y6SrC 8CgM8f3u/2tAVE2BlRzzsvHF6a3dUDHdw8SUiNPJVlGbsGWn+Fa1K9I7FGcRX4bmtCh1 eQAom+3rkDVunWS0oXqaKIkygMKbPvX/dz9+WFzsZ9XIZ777TzgEH/yAmthBpfzuXLDT 1g1fPwpkI4lAKUgkFNn9AO7WtuBaHpfEI0J1MIvs8+GE9FRh8/1DArfnC53EskIeKHI2 VHuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OCLgpZUE; 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 g26si9550734edy.55.2021.02.07.06.41.59; Sun, 07 Feb 2021 06:41:59 -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=OCLgpZUE; 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 S229892AbhBGOlT (ORCPT + 2 others); Sun, 7 Feb 2021 09:41:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbhBGOlM (ORCPT ); Sun, 7 Feb 2021 09:41:12 -0500 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D71DC0617A9 for ; Sun, 7 Feb 2021 06:39:53 -0800 (PST) Received: by mail-qk1-x732.google.com with SMTP id x81so11978672qkb.0 for ; Sun, 07 Feb 2021 06:39:53 -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=ImO8jkC+DpvrTwFdTRomeqFeWgN9hrI9w+kY9c6b/Eg=; b=OCLgpZUE37foaDocZaEHBNJMw5JQFRlcV/GQrDUXCXyz99cMVjbMSB2FtH6tTfG2cx E40uoln4Rg3HMYsiCXRdjQ0iKjARyTtS7RBiPPm0LW+Hjo39/NnLxCUbYOsCpQplG8A0 jSwNYwfQnLgYzxJp9qkMP/VzDat7T+ILOMsk+sfT+x4fCiE4BqmogoreyTZb8eeIJ6jr tiwjBcMC3loAKNeFr9gudpWumDus6vUZbpx21UM3C/t//pjbauNLsDDn00iE6YDh4wpR cgwC1mh6tEq3/fSAYF0DtOEtS2J/DF0xxfFjtK9b1M7W+okZls1HwwHYzPlzwV6D/5z4 CpLA== 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=ImO8jkC+DpvrTwFdTRomeqFeWgN9hrI9w+kY9c6b/Eg=; b=PW02RMS1/kzBTbnscHTQPsKmINDvfFS+gljbNfF+gP3F7b64pcGXn1qpO78RM64PBd HuFtayrZeeKjwtTiWQlYsku/QtB/mQLulHW6Xw4D8FySXXcjhesl9hfxX2riGqA65Xf/ UGGN9SExRUCz6tVcA4iWzOLKJwfFxb2xMP0fHrsYkZgcwa/OIg3oDOQKT3eN53hL6hb6 hoH83Q9LfNpNKf1KVI5ui/CkwGTOzFlvRo9n0VnOQqheEvP/joNbbrzGsSidpMPXeyPx JlpGyjPhQ9XY8436PnK1D4uRu0cq6aypgIZ3e5eok9xMcu3aGdDFyXsyyOLNeCcU2Zlc 7oiA== X-Gm-Message-State: AOAM532OlPkEu9u0yryyFAGv+EC+NrQK5G3qXsWqmXocSzIKJZF6Fgzv 9plYZc+GgYTSIpUjZpsz2QNKYw== X-Received: by 2002:a05:620a:12d7:: with SMTP id e23mr12618290qkl.58.1612708792517; Sun, 07 Feb 2021 06:39:52 -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 c81sm13941493qkb.88.2021.02.07.06.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Feb 2021 06:39:52 -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 v6 05/11] crypto: qce: skcipher: Return error for zero length messages Date: Sun, 7 Feb 2021 09:39:40 -0500 Message-Id: <20210207143946.2099859-6-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210207143946.2099859-1-thara.gopinath@linaro.org> References: <20210207143946.2099859-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 --- v5->v6: - Return 0 for zero length messages instead of -EOPNOTSUPP in the cipher algorithms as pointed out by Eric Biggers. 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..96af40c2c8f3 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 0; + /* qce is hanging when AES-XTS request len > QCE_SECTOR_SIZE and * is not a multiple of it; pass such requests to the fallback */