From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAEB2C433EF for ; Sat, 28 May 2022 03:59:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354788AbiE1D7e (ORCPT ); Fri, 27 May 2022 23:59:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbiE1D7d (ORCPT ); Fri, 27 May 2022 23:59:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0629C62BEF; Fri, 27 May 2022 20:59:32 -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 971DD61C19; Sat, 28 May 2022 03:59:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADED1C34100; Sat, 28 May 2022 03:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653710372; bh=hzVHSh4zr2vcIAinWH7zTymLIFQZIDTSRvcZXhAJ7Fo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sOlksaREXBsfBPvs4hqb11pZ8Um6NmMrLFPvrzu3BYFO8jXRWYiQH5QpAMBayUbt2 j3fTCF//XRZeQ5OZp6wMUuNSfRxavj4Db8dOrwmBVasa7+eoWdVcSWLudkXlYTtKbu 5evGnCX6n3p3bZhw5m+8V+icPgVmmnxgNJyaQPKkEzc+CSqBZa/Mw6ZXcX8C8amxcB iEsPRo8sYLB3vg9SWTEu8s4PNIgttSwJDfrEfXupl5YC7EKsd0tucsuRQxkSG51IIE +WRFhzHCdjEbZbCvNqT28wi1ASbrBfAhQvT+sNBkWOO07wBB0fl4hco7zMFYaGrRe9 m/SuOQB7NO9Tg== Date: Fri, 27 May 2022 20:59:29 -0700 From: Eric Biggers To: "Jason A. Donenfeld" Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, herbert@gondor.apana.org.au, gaochao , Ard Biesheuvel , stable@vger.kernel.org Subject: Re: [PATCH crypto v2] crypto: blake2s - remove shash module Message-ID: References: <20220527081106.63227-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220527081106.63227-1-Jason@zx2c4.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, May 27, 2022 at 10:11:06AM +0200, Jason A. Donenfeld wrote: > BLAKE2s has no use as an shash, with no users of it. "no use" => "no known current use". > diff --git a/lib/crypto/blake2s-selftest.c b/lib/crypto/blake2s-selftest.c > index 409e4b728770..38996ee73a64 100644 > --- a/lib/crypto/blake2s-selftest.c > +++ b/lib/crypto/blake2s-selftest.c > @@ -4,6 +4,8 @@ > */ > > #include > +#include > +#include > #include > > /* > @@ -548,7 +550,8 @@ bool __init blake2s_selftest(void) > u8 key[BLAKE2S_KEY_SIZE]; > u8 buf[ARRAY_SIZE(blake2s_testvecs)]; > u8 hash[BLAKE2S_HASH_SIZE]; > - struct blake2s_state state; > + u8 blocks[BLAKE2S_BLOCK_SIZE * 4]; > + struct blake2s_state state, state1, state2; > bool success = true; > int i, l; > > @@ -587,5 +590,32 @@ bool __init blake2s_selftest(void) > } > } > > + for (i = 0; i < 2048; ++i) { > + get_random_bytes(blocks, sizeof(blocks)); > + get_random_bytes(&state, sizeof(state)); > + > + memcpy(&state1, &state, sizeof(state1)); > + memcpy(&state2, &state, sizeof(state2)); > + blake2s_compress(&state1, blocks, 4, sizeof(blocks)); > + blake2s_compress_generic(&state2, blocks, 4, sizeof(blocks)); > + if (memcmp(&state1, &state2, sizeof(state1))) { > + pr_err("blake2s random compress self-test %d: FAIL\n", > + i + 1); > + success = false; > + } > + > + for (l = 1; l < 8; ++l) { > + memcpy(&state1, &state, sizeof(state1)); > + memcpy(&state2, &state, sizeof(state2)); > + blake2s_compress(&state1, blocks + l, 3, sizeof(blocks) - BLAKE2S_BLOCK_SIZE); > + blake2s_compress_generic(&state2, blocks + l, 3, sizeof(blocks) - BLAKE2S_BLOCK_SIZE); > + if (memcmp(&state1, &state2, sizeof(state1))) { > + pr_err("blake2s random compress align %d self-test %d: FAIL\n", > + l, i + 1); > + success = false; > + } > + } > + } This doesn't compile on arm, since blake2s_compress_generic() isn't defined. Also, the wrong value is being passed for the 'inc' argument. 2048 iterations is also a lot. Doing a lot of iterations here doesn't meaningfully increase the test coverage. And please run checkpatch; those are some very long lines :-( - Eric