Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4622997iob; Sun, 8 May 2022 19:35:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQWXvjZ98o21wPeqONtxWfRSBNGdnh7fXEbeA3yaBHloyaIzkcUJn6IkP7uKqi1CBoOTZG X-Received: by 2002:a17:902:854c:b0:158:35ce:9739 with SMTP id d12-20020a170902854c00b0015835ce9739mr13890222plo.150.1652063728084; Sun, 08 May 2022 19:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652063728; cv=none; d=google.com; s=arc-20160816; b=vUrc9RPYNPPT1sI3W6ye+GYSSVmgn59iNs1MvlJVH3BEjUhOUj3vi99EKAeFBCmtpv PH8IzIetWVEjC1YDvgv8aCTIypS3jWYru556345HRWcICz3nM283s6elVYtrGeMkPC1t SNxorDQINmxB3Xc0fRzMbYA9z4r87UILGRXYeaaueQwdZSd03Z5rSx5oxzL4Qz6tRfo5 mNiKryRa7jHWy12TF1r9V1OdFaFw7e5+SQuvKEz7xzq+2bXxMbynS5+Y4BsMAbJFUygF ayOovNCxlhttKTNMMoVW9Wv5NLDWrFXX1w7EJMEBXaz2Xd/xVhiKZ7lauoKWfW8209Px qrDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bFqH+xSCdzeoRQbrkcsMslQfIA/N11e7QDMVuvAXWYs=; b=A+D/gSwj6gv7/jJ0fBd1P6yMG3y0A6+fE0heGkK3/mBSSvlgICe7QVdKNe8IBEPfIe cb/G9SNfmPY3AcvG1Fv7nbf+NOY2tqIkmEB5mQzkdJUhfTqIWYmjQg22TyB1Mz81C4c8 FVGI42I75Ar5950HuJ4kvU6jd70FS4fcEWI8J2/WOgoC47bmTX0zL83mC84hws6tl/lZ rnCjCw3mEomMV1weHNAIjPnw5buOm4Ug/Cfzw8czGh0+ooifFwIUqpZGrgROwAyzeYmR vWVygdSr6kDqL3cZBkIE8mcSyU8rro/vLEyVCpRP2NjcADorTRoTgl/BZjatkOGgU/bu 1hbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JUVhfrYo; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g62-20020a636b41000000b003c144fa99cdsi12390445pgc.543.2022.05.08.19.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 19:35:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JUVhfrYo; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5B664737B5; Sun, 8 May 2022 19:35:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390773AbiEFKFG (ORCPT + 99 others); Fri, 6 May 2022 06:05:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358846AbiEFKFF (ORCPT ); Fri, 6 May 2022 06:05:05 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA155A2D5; Fri, 6 May 2022 03:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651831283; x=1683367283; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=v9a6QaqxlteklQ5eDNhQA4DeU/Xa34oGSnLKTwJy6DU=; b=JUVhfrYo5ayOFHdgpYwlnxBWbTIoF4PTT117/zFkqtE8Bh7DpO4qRexL t5GhcW0zsUyVYbYs58yB7FRgnbw+BKjLcBV+rVDrVSAXs5SbKxiOIl9Mm C5K4aOBS/zBwT4PiJeoYy6jTOVLrn8GIvAzuo1iEqF6yWDrldPWwWlYcE kVGl8IixDQkybWYY/UXNB8UgJxfzCUQdg8K8NWx+70o7nVNHact5jt3DQ R8IkTyHyMPRT2Kv75mU9i27GRHbSces+Fbt+a8GIwno1K9COg02haTH07 8Q8EeLbF6NMKxaMWnDErw8gPjgbhvSVpRiTVDnqpMImB7YJUmcmjE3pMW w==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="250420256" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="250420256" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 03:01:22 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="695107850" Received: from silpixa00400314.ir.intel.com (HELO silpixa00400314) ([10.237.222.76]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 03:01:20 -0700 Date: Fri, 6 May 2022 11:01:17 +0100 From: Giovanni Cabiddu To: Greg KH Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, qat-linux@intel.com, vdronov@redhat.com, stable@vger.kernel.org, Adam Guerin , Wojciech Ziemba Subject: Re: [PATCH 07/12] crypto: qat - set to zero DH parameters before free Message-ID: References: <20220506082327.21605-1-giovanni.cabiddu@intel.com> <20220506082327.21605-8-giovanni.cabiddu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Research and Development Ireland Ltd - Co. Reg. #308263 - Collinstown Industrial Park, Leixlip, County Kildare - Ireland X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-crypto@vger.kernel.org On Fri, May 06, 2022 at 11:23:50AM +0200, Greg KH wrote: > On Fri, May 06, 2022 at 09:23:22AM +0100, Giovanni Cabiddu wrote: > > Set to zero the DH context buffers containing the DH key before they are > > freed. > > That says what, but not why. > > > Cc: stable@vger.kernel.org > > Fixes: c9839143ebbf ("crypto: qat - Add DH support") > > Signed-off-by: Giovanni Cabiddu > > Reviewed-by: Adam Guerin > > Reviewed-by: Wojciech Ziemba > > --- > > drivers/crypto/qat/qat_common/qat_asym_algs.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c > > index d75eb77c9fb9..2fec89b8a188 100644 > > --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c > > +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c > > @@ -421,14 +421,17 @@ static int qat_dh_set_params(struct qat_dh_ctx *ctx, struct dh *params) > > static void qat_dh_clear_ctx(struct device *dev, struct qat_dh_ctx *ctx) > > { > > if (ctx->g) { > > + memzero_explicit(ctx->g, ctx->p_size); > > dma_free_coherent(dev, ctx->p_size, ctx->g, ctx->dma_g); > > Why is a memset() not sufficient here? Based on the previous conversation a memset() should be sufficient. > And what is this solving? Who would get this stale data? This is to make sure the buffer containing sensitive data (i.e. a key) is not leaked out by a subsequent allocation. I will clarify it in the commit message. Thanks, -- Giovanni