Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2115804imu; Wed, 28 Nov 2018 22:51:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/V6+sRar4H//qtZUrSyVYNFVKsLEcCRZaJOVw4tyCyc4hze3b2w8pOiMlzYFxaB/paA70k9 X-Received: by 2002:a17:902:2f03:: with SMTP id s3mr285136plb.277.1543474286728; Wed, 28 Nov 2018 22:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543474286; cv=none; d=google.com; s=arc-20160816; b=D/ZWiUPcklaBkvLPbVU/ZFp97gSBftPsUl69v2db3jL3ZKzXjMKtswLL5L1kJq7vKS DdtEAO2RdI459Uei4pMVo/96wCxq6dvM9k/1WRW48Kt/nN44/degZ/I7tZKp9+LEcdhe hfBWUFh2CYr9dxoSInbVyXmivlTJG91x1IG3jesnWdHVWfHIz8NXNyvF374ELahnFuq+ svIrI45TPQFBcztd9uDmOoUQLBqKqoZltU+RXy/5NEf4QAbokalUlWq/AnBKa98GlU1n 8YwAoYsIP7MEb3en9Z8bVDn1SIYTQcrHv5aFyFZ9M9AUYgyCpomdh/h/Of+ZNQxZMs8S z0Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=R4RfOQcNSLRmdlZfJdrppXvm6en1DrXjLRM2921oqqw=; b=ZIu8lYyN6vC1muyB/jQvYXBqdtLMWOBFw1c1a99t2l660QIbiYZ+Pv544qYnvW26Ma h6GeaP67dTYfDbkcuMS3qDMhoGdzVWup0YW7sgHyOyBGPw+/h3ehqGLly7tHhNxMvrKX cJ7CLw9zoRh7fVe8aH2dh71c3FCk8WKuhiJnC7BiVdogZENCa4QV10gURVtM8lTM/ec7 E0A2r6lEkqvGrmjIdD1BWDep34v3Geos+9rI/YnMjAv/BKXdlZDn3SIAuE+AZwHnwDbq i1DT9d/tdKZqBSK+8VPZcP4CI7x5yMXMGqwZyqdzuMD/ujt5K6hu3zKWc2bNiQFMwQit ZIfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si1173306pla.207.2018.11.28.22.51.09; Wed, 28 Nov 2018 22:51:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727762AbeK2Rxf (ORCPT + 99 others); Thu, 29 Nov 2018 12:53:35 -0500 Received: from orcrist.hmeau.com ([104.223.48.154]:52908 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727521AbeK2Rxe (ORCPT ); Thu, 29 Nov 2018 12:53:34 -0500 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1gSG8Q-0006p9-KF; Thu, 29 Nov 2018 14:49:14 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1gSG8P-0004p5-2w; Thu, 29 Nov 2018 14:49:13 +0800 Date: Thu, 29 Nov 2018 14:49:13 +0800 From: Herbert Xu To: David CARLIER Cc: linux-kernel@vger.kernel.org, "David S. Miller" , linux-crypto@vger.kernel.org Subject: Re: [PATCH] crypto: use memzero_explicit instead of memset to clear contexts. Message-ID: <20181129064913.wbudlexjzszpa7dq@gondor.apana.org.au> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 28, 2018 at 07:36:50PM +0000, David CARLIER wrote: > There might be a little performance drop but to make sure it stands > by it comments, we really wipe the whole context after usage. > --- > crypto/chacha20poly1305.c | 3 ++- > crypto/md5.c | 2 +- > crypto/rmd128.c | 3 ++- > crypto/rmd160.c | 3 ++- > crypto/rmd256.c | 3 ++- > crypto/rmd320.c | 3 ++- > crypto/sha3_generic.c | 3 ++- > 7 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c > index 600afa99941f..6e93d998109e 100644 > --- a/crypto/chacha20poly1305.c > +++ b/crypto/chacha20poly1305.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > > #include "internal.h" > > @@ -388,7 +389,7 @@ static int poly_genkey(struct aead_request *req) > } > > sg_init_table(creq->src, 1); > - memset(rctx->key, 0, sizeof(rctx->key)); > + memzero_explicit(rctx->key, sizeof(rctx->key)); Please explain the purpose of this patch. As it stands this makes no sense. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt