Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1592615pxb; Thu, 4 Feb 2021 17:55:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxI1s3exZ6WuR2wxKRDx84Qb9cIsCuDvEb6gEqDtxVJtb2tAFD08t/WHYW9Ld58GV3nUz1R X-Received: by 2002:a17:906:d937:: with SMTP id rn23mr1810728ejb.57.1612490157838; Thu, 04 Feb 2021 17:55:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612490157; cv=none; d=google.com; s=arc-20160816; b=ORgf8sVRezsVC1IoAZDsNO1hriCLiwIxJfIzmJ7bjrRsFrbOOY6yKQWfN1kH1PvQpt M1Inu7A9TyJBmfBdYTK8DRUL7BH5i5+4xTla27SlAoT/PbCN7/9irK+Gfhj+jQ6uxc0Q Psv7pmwE/ek32y/qA7DxsGmI4yeb0E51AeKbyIwPJlse6Gak5W/KnBxm/EPM2zY/7BFI 0ukTOb6Jyv+AqL9yetjwCzaRqBmaO+Pz7ePaxWLlqj40NeM3yQfw0OQGXP+2stnytOxo ZglK4/sRZh/tiQiHK8vq2PZvv00sBxYetLQiqiQbOGHjIoWFPtTGkzbvTl6T4lA3jlds H2Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=SI5j+iF4abUgLvTfrUu5p8XYf5nU55OwaIfuxVg8Ap0=; b=wzo6jAtx1VkKAzv2jtw7kRciLu51me1e/nCdSLfCdhBbJDixYyoSm4Phvr9EtrIbVG F5ERunO/o0chAQXEZKN+yxVL0PlYkqC9fCQtT18g5KaJT55PriJFQAymc0AKSpnZOKeN 2jBKC05FGLeywjgmUzE9rW3fS3UT7HFGteFsrmDsMDl9KV3inclFB5JGX10i+5/+KRqx B1XXiOOp62NwWfX1Z6I4foUGf/UYZwhqDcSzxorPP5XXHDsuV1jxU1HlU+bWHstA5Hjv ABmFe0DCVwhQ20LzQkgBR/ZXfciih4LUD2C8TZqAu+Z3ufVulQWG2cmv/o8HxI3R9Uvw +NMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H9ym7IUT; 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 m7si4420928ejc.466.2021.02.04.17.55.24; Thu, 04 Feb 2021 17:55:57 -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=H9ym7IUT; 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 S231670AbhBEAKh (ORCPT + 99 others); Thu, 4 Feb 2021 19:10:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231565AbhBEAKf (ORCPT ); Thu, 4 Feb 2021 19:10:35 -0500 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DDA7C0613D6 for ; Thu, 4 Feb 2021 16:09:55 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id v3so3857479qtw.4 for ; Thu, 04 Feb 2021 16:09:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SI5j+iF4abUgLvTfrUu5p8XYf5nU55OwaIfuxVg8Ap0=; b=H9ym7IUTalqakgHKC0f0MtYjYUKCC3VtKcANjxlXeqjZ7aiQWyr39E31AuAsXHAgks lo80EjeggpY0ZpTNhkLNAvCfZldD1KQ+9A4/6iinHlL1rnlzLql5c4lqTRWiA7h32lIa 8gfC600dffl+16Mj/FB9cb8rwIF+5fst+oUkCw53F0KHS7knK6G/NeI7n4oxdxH1tBX9 e8WDJAiJgg1LoXjIj/sCkCc0fOYzC8RHEfz2ol+cgH1We4a/WSnErfkwi0A0QOcfnXoU 8ujRTjHfe4RBFvHeS/yzl5mh5KES6CHbXmza4UsVWzdOh1mHMwZJ9VUs0zLvKSla4wNh RKTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SI5j+iF4abUgLvTfrUu5p8XYf5nU55OwaIfuxVg8Ap0=; b=aTJJl/H4H4bEx+Vvk0vvKYIW7SPcIYjZa+11mFHG0FDpUrsOuNbEBpGLB8bWUPJM2A Cd1+Svb+InSkc7KKxHg+8Ejliq6mvNMHB5MDQSNryD22sNv6OU7n5xN1x6pzfEvN6IBL cdODnXKTs9UL8OooSb2Mr/z6nBfF332I63jQgHwmg7MGUfDOTGQ4p2gVFsII0N3ylXjt z32YRqQhDzgRLxhAYs8QSHagxzX7ybufBXC7MlGeI04rlsyK23pSKtd4H2DrtHq9H1nH rPqCZ3HO3Ojv/EeOzasj3AwtKZUQyf5gi4yVm2Et/zTL4UB+mERMp36usTZOj3Atpsbg vhKA== X-Gm-Message-State: AOAM531JloWpkAI19aQ4UBYqyWmfc0L+f9oeo/uMpg7pmlub64h/6CI5 03WDqq85zmtxgqCO1Zu+yyjPFA== X-Received: by 2002:ac8:7768:: with SMTP id h8mr2048041qtu.331.1612483794726; Thu, 04 Feb 2021 16:09:54 -0800 (PST) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id q6sm6959212qkq.34.2021.02.04.16.09.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Feb 2021 16:09:54 -0800 (PST) Subject: Re: [PATCH v5 05/11] crypto: qce: skcipher: Return error for zero length messages To: Eric Biggers Cc: herbert@gondor.apana.org.au, davem@davemloft.net, bjorn.andersson@linaro.org, ardb@kernel.org, sivaprak@codeaurora.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210204214359.1993065-1-thara.gopinath@linaro.org> <20210204214359.1993065-6-thara.gopinath@linaro.org> From: Thara Gopinath Message-ID: <00d759f3-8ea3-1f85-b623-225c372c0a04@linaro.org> Date: Thu, 4 Feb 2021 19:09:53 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Eric, On 2/4/21 5:48 PM, Eric Biggers wrote: > On Thu, Feb 04, 2021 at 04:43:53PM -0500, Thara Gopinath wrote: >> 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(+) >> >> 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; >> + > > For the algorithms in question, the correct behavior is to return 0. What do you mean? The driver should return a 0 ? > > Aren't the tests catching that difference? I was anyways planning on sending an email to the list with these queries. But since you asked, these are my observations with fuzz testing which I have been doing quite a bit now (I am also working on adding a few qualcomm AEAD algorithms support in mainline). - if the generic algorithm supports 0 length messages and the transformation I am testing does not, the test framework throws an error and stops. - key support mismatch between the generic algorithm vs my algorithm /engine also does the same thing.For eg, Qualcomm CE engine does not support any three keys being same for triple des algorithms. Where as a two key 3des is a valid scenario for generic algorithm(k1=k3). Another example is hardware engine not supporting AES192. How are these scenarios usually handled ? Why not allow the test framework to proceed with the testing if the algorithm does not support a particular scenario ? > > - Eric > -- Warm Regards Thara