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 X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81172C4361B for ; Thu, 17 Dec 2020 18:36:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D5E2238EF for ; Thu, 17 Dec 2020 18:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730006AbgLQSgO (ORCPT ); Thu, 17 Dec 2020 13:36:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:39468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728704AbgLQSgO (ORCPT ); Thu, 17 Dec 2020 13:36:14 -0500 Date: Thu, 17 Dec 2020 10:35:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608230134; bh=bsgEVksB18d9gZCVq8tL2GRU8y8mcH/PO5uuLzrab3w=; h=From:To:Subject:References:In-Reply-To:From; b=VeO38e7BGfZhrMCm7wp1pPgiZh/eXur5evzt+1zMgD9+gcV0g+0RLmtH1v3JbhMcw DQHnAU6OErubQKTHeYhhyQ7F+/wizFaymnRy4y6lJo5c4FCKWDNzDS4iVnz7Ldqkvi GgRt/ZxgJaHkHC+EEnb4DaJMaMEuD8DdJoFL1VPyOUfV895+kOWaNWCOfFwOwc126v HozPi8anfaA2PiAxFYjP06t/w6/ug3ZKDgsL+bfx5voK12rBOfpnKYvgTeb46BR/gM eIvbMt7NofefKPltRxtV7CRzg0JQj5ABZldw84B8Ca4dgtgcbH6n4zc/rEtVx/X7yO xBi0I4M3lil2w== From: Eric Biggers To: dsterba@suse.cz, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Herbert Xu , David Sterba , "Jason A . Donenfeld" , Paul Crowley Subject: Re: [PATCH 2/5] crypto: blake2b - define shash_alg structs using macros Message-ID: References: <20201215234708.105527-1-ebiggers@kernel.org> <20201215234708.105527-3-ebiggers@kernel.org> <20201217171517.GT6430@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201217171517.GT6430@suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Dec 17, 2020 at 06:15:17PM +0100, David Sterba wrote: > On Tue, Dec 15, 2020 at 03:47:05PM -0800, Eric Biggers wrote: > > From: Eric Biggers > > > > The shash_alg structs for the four variants of BLAKE2b are identical > > except for the algorithm name, driver name, and digest size. So, avoid > > code duplication by using a macro to define these structs. > > > > Signed-off-by: Eric Biggers > > Reviewed-by: David Sterba > > > +static struct shash_alg blake2b_algs[] = { > > + BLAKE2B_ALG("blake2b-160", "blake2b-160-generic", > > + BLAKE2B_160_HASH_SIZE), > > Spelling out the algo names as string is better as it is greppable and > matches the module name, compared to using the #stringify macro > operator. > Yes, I considered trying to make it so that BLAKE2B_ALG(n) would generate the names and constant for blake2b-$n, but it seemed better to keep it greppable. - Eric 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 X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E36A4C4361B for ; Thu, 17 Dec 2020 18:37:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95EAE238EC for ; Thu, 17 Dec 2020 18:37:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95EAE238EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v9FfelCTgy14ilEnAuFXUn7133MqeZp4PvULdEMSZmo=; b=hAL2vuwl+fxRsIglQ7IjCm1QjY IvLWI0Ygw0gCyRJJSTqGU5q7GznYP//mAKkfQOaFsLph/yFQC9M2ADTdN5giweAgd9EvOHzoko02v hJHvEmyOFyPfmYWsp6Miza2l2SwSdWNPJP9hwupE2g7yacSkjPxxtPxUUMH5b5gGSkJ2WG23E0mom 07QMMIfeI0ZXTs33arzodySG4ZK4buCFORK5WIGocL3dTuiwauLl1DruJ60OoEOSKJ+PkI9ry7IFw vngLbfAFF3/L2eGloWyJk55I1ur8VJks6GSgIHdGFSQdKvskcMuNTiOkqPiGxgtsqKdTimLtDbO3z TPk5Ip+Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpy7l-000122-Nv; Thu, 17 Dec 2020 18:35:37 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpy7i-00011T-RR for linux-arm-kernel@lists.infradead.org; Thu, 17 Dec 2020 18:35:35 +0000 Date: Thu, 17 Dec 2020 10:35:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608230134; bh=bsgEVksB18d9gZCVq8tL2GRU8y8mcH/PO5uuLzrab3w=; h=From:To:Subject:References:In-Reply-To:From; b=VeO38e7BGfZhrMCm7wp1pPgiZh/eXur5evzt+1zMgD9+gcV0g+0RLmtH1v3JbhMcw DQHnAU6OErubQKTHeYhhyQ7F+/wizFaymnRy4y6lJo5c4FCKWDNzDS4iVnz7Ldqkvi GgRt/ZxgJaHkHC+EEnb4DaJMaMEuD8DdJoFL1VPyOUfV895+kOWaNWCOfFwOwc126v HozPi8anfaA2PiAxFYjP06t/w6/ug3ZKDgsL+bfx5voK12rBOfpnKYvgTeb46BR/gM eIvbMt7NofefKPltRxtV7CRzg0JQj5ABZldw84B8Ca4dgtgcbH6n4zc/rEtVx/X7yO xBi0I4M3lil2w== From: Eric Biggers To: dsterba@suse.cz, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Herbert Xu , David Sterba , "Jason A . Donenfeld" , Paul Crowley Subject: Re: [PATCH 2/5] crypto: blake2b - define shash_alg structs using macros Message-ID: References: <20201215234708.105527-1-ebiggers@kernel.org> <20201215234708.105527-3-ebiggers@kernel.org> <20201217171517.GT6430@suse.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201217171517.GT6430@suse.cz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201217_133534_962364_EDCF3562 X-CRM114-Status: GOOD ( 14.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Dec 17, 2020 at 06:15:17PM +0100, David Sterba wrote: > On Tue, Dec 15, 2020 at 03:47:05PM -0800, Eric Biggers wrote: > > From: Eric Biggers > > > > The shash_alg structs for the four variants of BLAKE2b are identical > > except for the algorithm name, driver name, and digest size. So, avoid > > code duplication by using a macro to define these structs. > > > > Signed-off-by: Eric Biggers > > Reviewed-by: David Sterba > > > +static struct shash_alg blake2b_algs[] = { > > + BLAKE2B_ALG("blake2b-160", "blake2b-160-generic", > > + BLAKE2B_160_HASH_SIZE), > > Spelling out the algo names as string is better as it is greppable and > matches the module name, compared to using the #stringify macro > operator. > Yes, I considered trying to make it so that BLAKE2B_ALG(n) would generate the names and constant for blake2b-$n, but it seemed better to keep it greppable. - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel