Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4512908pxb; Mon, 21 Feb 2022 23:48:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzW8nRX+o1HDf1K5VMd7Qp5HuGD2Ck2O/twcRE2sAO2hnR3ILJk4ZQy0ZORMqOgfgIZdP/H X-Received: by 2002:a17:906:5ad6:b0:6cf:5d7d:45e1 with SMTP id x22-20020a1709065ad600b006cf5d7d45e1mr18802905ejs.226.1645516107808; Mon, 21 Feb 2022 23:48:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645516107; cv=none; d=google.com; s=arc-20160816; b=OPToIwug47f+bG9RLRC0dXchJisbwf3Rn9bl8nnlLRPpwn8DkCm1R934IpGysGrDpy vg3jR4SuduK3zRsd3AwRCUdMoT59emXXYotXsSrn0zewu4ZllznB9qT5lPGl+gQ9rqtr RHb/iv301qbqMN2mfRSo0sorlROjxFGSBAGcdZyhCzwQipOru/axK11EuCwed3pcaKr1 HfiNkNqzcaNHeB+7aa4DJiYhm8p3Rhg2wzJfLumMiSWuf8v3xnTTq/58V26D/jjb3r6f JdJiYtuyte8zSmNoy0YrXdFDe09zRyxryzXWl2UEDCZ0Kt7+WBKMg0OCfl+GVHD8T9+Z q8JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=E8NTjG7D381YlFNs2VaH0rQLmmGqTfOD1kAJuZ7gDmc=; b=Hk8DfHEsJhXvTyAmj4PaBUDXJPUI4mGh6Cfg+hggtscxVDsRjY/bqEcryIS2jvgLPh JMicdIBu1ikhxnPxnvDzEaf2CXlNWJv3oP+x6jfttaWgYp0knJqrKY93scz520/RnvHc 3gjLdrqZaI7/bb4RHV2X2XVKnxpdlBuCgyKIRiTgha/7qm6NtJjIKhsvnZeP+3n9tQIj YaghffXjCWe9BMxZKRLF7Y5R853aIx6FEWcAjXk9QgBfP0M8Zig4GNH9DKxWnvHCvPKo gXeOHMLHK8YvfDWSPs9zPwsS3mXSBmkcMEiHQyXzO2wrQGWVtU/o/PJ5JA4b6hpFSphD imoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@benyossef-com.20210112.gappssmtp.com header.s=20210112 header.b=FwcGCud3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go13si11542926ejc.54.2022.02.21.23.48.05; Mon, 21 Feb 2022 23:48:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@benyossef-com.20210112.gappssmtp.com header.s=20210112 header.b=FwcGCud3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229723AbiBVHrT (ORCPT + 99 others); Tue, 22 Feb 2022 02:47:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbiBVHrQ (ORCPT ); Tue, 22 Feb 2022 02:47:16 -0500 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E963123411 for ; Mon, 21 Feb 2022 23:39:22 -0800 (PST) Received: by mail-yb1-xb2c.google.com with SMTP id c6so39272841ybk.3 for ; Mon, 21 Feb 2022 23:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benyossef-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=E8NTjG7D381YlFNs2VaH0rQLmmGqTfOD1kAJuZ7gDmc=; b=FwcGCud3nJo3hq/CkX+78UgoyxDnKXUY/tZva6JRBoODTnWCf4PjGpp9f1ZrEWXycN oGMW0fORPA4wOwXwjbtZ1Sobuc9qCFVSJg/czvDdi++7c9UvHxIHyevfz6qp89RgCxkA uhWnTsLBdcktcVU197U8Lc4YUIHISbDTO0JUCl/xs7oNwmdnTqPu/L7oFcOvPRYYZVDY P1ayXACNKLck5wKdVWjwwdOgEAso/iuSTr/y3ApcioysnpFdp99Gy0czvIGaJnW1RQ2E 2rXd+OoE3c20swVgkUK4KUnTSTR8t7RYuOgsj80sfehGp1aQ+sPYFaiMUtQ50hwjxwyJ EkxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=E8NTjG7D381YlFNs2VaH0rQLmmGqTfOD1kAJuZ7gDmc=; b=k8ePwdYDZ1oKV0p4IcsB0MwdHQSzHj1ZnsFqaPFW+TjXlmoqblki0qQ17TG49nI34a wqOqt0koiAN5IYxegdg9G2WOjETSASk1aQsbMxDIvJvMqCJymfRv4n+ogGa3cDdx66Z2 3d+N+zakbMIlIhpZKbWHqhyKQrGQNKfo946YOvaJkhRQlgKeis0M0dKIoHL/IItOJqIQ J9bhXSishARu/J8xFNaDpWKo9Rr21+SHTCErsKpBV6XIj32RfEgBJdMYY6hTD5NoSCF2 BRQEc/7e7LI4FWyD0CikLKwEMXuLm3RVe+d69uua2DUaJjP7kOynx2rsOF0XSYb9Fe2B VqJA== X-Gm-Message-State: AOAM533591KkMpxc3aBu8dDD4ENvPy8PRc6FY28OPf75Dzwsq1SIZ6Wz 6lNoAlqCSuB6qFaWHCesEMaod5Q9psG4G5yOsNzTgg== X-Received: by 2002:a25:9d81:0:b0:622:7df3:ff6c with SMTP id v1-20020a259d81000000b006227df3ff6cmr21923630ybp.617.1645515561761; Mon, 21 Feb 2022 23:39:21 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Gilad Ben-Yossef Date: Tue, 22 Feb 2022 09:39:20 +0200 Message-ID: Subject: Re: [BUG] crypto: ccree: driver does not handle case where cryptlen = authsize =0 To: Corentin Labbe Cc: Herbert Xu , Linux Crypto Mailing List , Linux kernel mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 21, 2022 at 4:05 PM Corentin Labbe wrote: > > Le Mon, Feb 21, 2022 at 12:08:12PM +0200, Gilad Ben-Yossef a =C3=A9crit : > > Hi, > > > > On Sun, Feb 20, 2022 at 9:26 PM Corentin Labbe > > wrote: > > > > > ... > > > > > > Hello > > > > > > While testing your patch for this problem, I saw another warning (unr= elated with your patch): > > > > Dear Corentin, you are a treasure trove of bug reports. I love it. > > Thank you! :-) > > > > > [ 34.061953] ------------[ cut here ]------------ ... > > > > So, this is an interesting one. > > What I *think* is happening is that the drbg implementation is > > actually doing something naughty: it is passing the same exact memory > > buffer, both as source and destination to an encryption operation to > > the crypto skcipher API, BUT via two different scatter gather lists. > > > > I'm not sure but I believe this is not a legitimate use of the API, > > but before we even go into this, let's see if this little fix helps at > > all and this is indeed the root cause. > > > > Can you test this small change for me, please? > > > > diff --git a/crypto/drbg.c b/crypto/drbg.c > > index 177983b6ae38..13824fd27627 100644 > > --- a/crypto/drbg.c > > +++ b/crypto/drbg.c > > @@ -1851,7 +1851,7 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *= drbg, > > /* Use scratchpad for in-place operation */ > > inlen =3D scratchpad_use; > > memset(drbg->outscratchpad, 0, scratchpad_use); > > - sg_set_buf(sg_in, drbg->outscratchpad, scratchpad_use); > > + sg_in =3D sg_out; > > } > > > > while (outlen) { > > > > No more stacktrace ! Thank you. I will send a patch later today. Cheers, Gilad --=20 Gilad Ben-Yossef Chief Coffee Drinker values of =CE=B2 will give rise to dom!