Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5415145pxu; Thu, 22 Oct 2020 01:25:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4Wf7yb/A8Zlxk0ay1gzhntqIxWcJT1iKgaDyniIMgEKd4HnhyKTAyUeFvOxKDvpGbJmEG X-Received: by 2002:a17:906:e55:: with SMTP id q21mr1138203eji.338.1603355101327; Thu, 22 Oct 2020 01:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603355101; cv=none; d=google.com; s=arc-20160816; b=DY/+WudRK+5QjlfU9aVxLnI/+2wfozHKdVOvjbJPg1WotCm40kP9CWYfrjDJLnfa0N yctgQ79X2mDU2ZorvOHdu6Bk/q9ampW867jHhpxnu6GEdWawvEDceDzc9g3Tufs3x5Fw NitShP0KlO1al4kSBOczXjsYMQkvcNPX4bcpuy/LId879rmzzg6oF7dDbx4lVskOWgjx yFPVSwTOz/qFeJEzLzQ+1c4SKVx0ajfiTan4njmBrSWY8HPijWdQOz41E0lHr8/cMN4t Wnu7M/8BEny+9mW3sgV2+VmjBjc+il6iOLkiaRTro0i+skjY/qLUSheLhy0oaxuoL/q9 3YkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UhCm6/TCbf/DtiHIQ2byVTGgEhw72X6kILT2NCYICQ0=; b=DZwcETG8ErBMspNm4fAN97Bz1hXu9SYp8JSaD6Ij0UHXagzUUr9jt3cn/ebwPp8O31 9qdnfh0CbkIYmu8YJTlG0YA92r0OQblzqit41oTeiJFlf9SXPSQirEs1+OMiM7qXCwuB pimICkDf2tFzyca6i7KXrCubYpYIYEgipTeH9+Rwh3W64CmVi5waS0CEaFZze1oIcVDd kqp3OLmA8IoN2GypJ7RYtk0RjdQCwOfO8bSC7+s7obFjb9D3Fa/ZMX8MoChsnNwCtms5 Kvmsw5ll674bn+lL8JxuWL1uBsrAHZF0BrWNk89uSYVUJQf/BwABZLPOBQwBMVkWHTlG SzNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t8F2EKxX; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do3si495102ejc.210.2020.10.22.01.24.38; Thu, 22 Oct 2020 01:25:01 -0700 (PDT) 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=@kernel.org header.s=default header.b=t8F2EKxX; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2507675AbgJVE7w (ORCPT + 99 others); Thu, 22 Oct 2020 00:59:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:58296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2507674AbgJVE7w (ORCPT ); Thu, 22 Oct 2020 00:59:52 -0400 Received: from sol.localdomain (172-10-235-113.lightspeed.sntcca.sbcglobal.net [172.10.235.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6229E223C7; Thu, 22 Oct 2020 04:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603342791; bh=WvVuJz+/4YZGALIbT2NQSAijT0f64qk3O8quVRu9xfc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=t8F2EKxXInosJwT1lFMui9knEKRSU4hD4DoGrnxfzUdcpXtgnWfnxqGJySfQ8tMA6 5cvQ9IET7TZDpV3r3ppH7QB6IYQz13DhAQA8DvCGKGFJsh0FN67txrWYesmt7kVQGq JZqRskcDZdyhTqYOUMmiXZ5e8vV26144iZrQdSq8= Date: Wed, 21 Oct 2020 21:59:49 -0700 From: Eric Biggers To: Arvind Sankar Cc: Herbert Xu , "David S. Miller" , "linux-crypto@vger.kernel.org" , David Laight , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/6] crypto: lib/sha256 - Clear W[] in sha256_update() instead of sha256_transform() Message-ID: <20201022045949.GF857@sol.localdomain> References: <20201020203957.3512851-1-nivedita@alum.mit.edu> <20201020203957.3512851-4-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201020203957.3512851-4-nivedita@alum.mit.edu> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Oct 20, 2020 at 04:39:54PM -0400, Arvind Sankar wrote: > The temporary W[] array is currently zeroed out once every call to > sha256_transform(), i.e. once every 64 bytes of input data. Moving it to > sha256_update() instead so that it is cleared only once per update can > save about 2-3% of the total time taken to compute the digest, with a > reasonable memset() implementation, and considerably more (~20%) with a > bad one (eg the x86 purgatory currently uses a memset() coded in C). > > Signed-off-by: Arvind Sankar Looks good, Reviewed-by: Eric Biggers