Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2378704ioo; Sat, 28 May 2022 11:48:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx40HJlaw6FcLXtNP9n+RNZR60YyLkyYZSkUznf/dZh3mBzlwF7HrZ+fDWCncyHGXoI9AP X-Received: by 2002:a17:907:1b20:b0:6da:649b:d99e with SMTP id mp32-20020a1709071b2000b006da649bd99emr43042168ejc.712.1653763696556; Sat, 28 May 2022 11:48:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653763696; cv=none; d=google.com; s=arc-20160816; b=dZBqinwb7Mc+P597Odg+Ew4KldsJMkqYfTOBKX3w3Gj6tl+pvA3QPd/YJypJBkwFLD 6x1txav+ngNDWBdhPJ0Fff0N8wMdSFFwPyu19LFo7+JBKmppfI5tqGPBrw5I7cuDfioq Uufa6+MO0ZdjrHVmSBGqOh1SmC+dRyUgdRCWfGHiC8jmmOfknz1zih8Zj83likDlgtlg /ZhhDudlfmphIpltSPG8Ot1osKzJ8TjUCwONsP7uO4VKqdcQoJI+bpdNQKgmWm3bfF8E p7mv5DbjMgH1D4fVECdrRZvf8zV/kB0t3/+1DjHBOqevKNbXEK3/j4pDHxukbpBFeS9E pc3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:references :in-reply-to:mime-version:dkim-signature; bh=N+0wxHmueW5PC6Ruhk71jM9anOT1ArAHVn1hq5ZBoTo=; b=LdTnKxWTPQtL3GxsHRUJljfXAcKXxfv2lenMi8IFw9JKqxy9mqvzhFVxuq+EqyBP6z 8VdbXRw8ae+DsjR+jfImxEamaSY3C0s2+tCECEDA6U8R7AC83SDKephohteZh75WoG8W NTBcH+c/ltI/Wdy77xaTY1dSXKuJfVmnBlQn1ubk3pDAlFPMOskAxWUTe1pXxOIzUWXv b1jD7Z+E9xP/40U842Ukl/8sXhg6tYv9ee335TjE38r5ML2OE4TE8DxlWWhzJms+saqO ZQAi6UVjReImCJgLxsHO5hZpncNBPguqntDB2FWtLg0l4Znf+Zp9mZDaxoeYdUASjUMd P6fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=gAconhhG; 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=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ds7-20020a170907724700b006ff0cec978bsi7284161ejc.590.2022.05.28.11.48.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 11:48:16 -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=@zx2c4.com header.s=20210105 header.b=gAconhhG; 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=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34E852DAB6; Sat, 28 May 2022 11:37:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245537AbiE0NVE (ORCPT + 99 others); Fri, 27 May 2022 09:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242354AbiE0NVD (ORCPT ); Fri, 27 May 2022 09:21:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8818012E301; Fri, 27 May 2022 06:21:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0642861C18; Fri, 27 May 2022 13:21:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAB72C385A9; Fri, 27 May 2022 13:20:59 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="gAconhhG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1653657656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=N+0wxHmueW5PC6Ruhk71jM9anOT1ArAHVn1hq5ZBoTo=; b=gAconhhG+s5OEFBNojX/Dv8XERWyEqqQgvLVdGk3ldiawbflA55TyjOeGfLCH9cM97InIR QlGBGnCQ6c/7P6Fmw3mtmh+KPg4xxXOwrFzDiBQBKLVebVycSQBJd8UDHuo3R7fjzhzRw0 kBrpSx6cemK50G6hKahN7RcoAfgJNlo= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 16dba200 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 27 May 2022 13:20:55 +0000 (UTC) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-3003cb4e064so46930397b3.3; Fri, 27 May 2022 06:20:55 -0700 (PDT) X-Gm-Message-State: AOAM5301EQKwwPyZlWXSsMAbfl5OXH3O5z9n1OyGoTZPHYDXdd3pf3TA d+R4xsWheVUNg8PPLUu16Zj+KN+sW39s0TfFBak= X-Received: by 2002:a0d:cd04:0:b0:300:4784:caa3 with SMTP id p4-20020a0dcd04000000b003004784caa3mr15250404ywd.231.1653657654222; Fri, 27 May 2022 06:20:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:7110:6403:b0:17b:2ce3:1329 with HTTP; Fri, 27 May 2022 06:20:53 -0700 (PDT) In-Reply-To: References: <20220527081106.63227-1-Jason@zx2c4.com> From: "Jason A. Donenfeld" Date: Fri, 27 May 2022 15:20:53 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH crypto v2] crypto: blake2s - remove shash module To: David Laight Cc: "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "herbert@gondor.apana.org.au" , gaochao , Eric Biggers , Ard Biesheuvel , "stable@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,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=no 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 Hi David, On 5/27/22, David Laight wrote: > From: Jason A. Donenfeld >> Sent: 27 May 2022 09:11 >> >> BLAKE2s has no use as an shash, with no users of it. Just remove all of >> this unnecessary plumbing. Removing this shash was something we talked >> about back when we were making BLAKE2s a built-in, but I simply never >> got around to doing it. So this completes that project. > ... >> diff --git a/lib/crypto/blake2s.c b/lib/crypto/blake2s.c >> index c71c09621c09..716da32cf4dc 100644 >> --- a/lib/crypto/blake2s.c >> +++ b/lib/crypto/blake2s.c >> @@ -16,16 +16,43 @@ >> #include >> #include >> >> +static inline void blake2s_set_lastblock(struct blake2s_state *state) >> +{ >> + state->f[0] = -1; >> +} >> + >> void blake2s_update(struct blake2s_state *state, const u8 *in, size_t >> inlen) >> { >> - __blake2s_update(state, in, inlen, false); >> + const size_t fill = BLAKE2S_BLOCK_SIZE - state->buflen; >> + >> + if (unlikely(!inlen)) >> + return; > > Does this happen often enough to optimise for? > The zero length memcpy() should be fine. > (though pedants might worry about in == NULL) > I don't know and don't care here. This is a straight copy and paste for the removal. It is not the place for random performance optimizations. I have now witnessed you have random performance optimization ideas in at least 7 threads, usually unrelated to whatever the topic is. As I keep telling you every time: SEND A PATCH. Those capital letters are intentional: I care about the same things you do, so please send a patch so that all that stuff actually happens. Talk is cheap. Jason