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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 1E60FC4361B for ; Thu, 17 Dec 2020 17:17:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3A92238EC for ; Thu, 17 Dec 2020 17:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728160AbgLQRRj (ORCPT ); Thu, 17 Dec 2020 12:17:39 -0500 Received: from mx2.suse.de ([195.135.220.15]:35772 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728760AbgLQRRi (ORCPT ); Thu, 17 Dec 2020 12:17:38 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7A7FDACBD; Thu, 17 Dec 2020 17:16:57 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 7D751DA83A; Thu, 17 Dec 2020 18:15:17 +0100 (CET) Date: Thu, 17 Dec 2020 18:15:17 +0100 From: David Sterba To: Eric Biggers Cc: 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: <20201217171517.GT6430@suse.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Eric Biggers , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Herbert Xu , David Sterba , "Jason A . Donenfeld" , Paul Crowley References: <20201215234708.105527-1-ebiggers@kernel.org> <20201215234708.105527-3-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201215234708.105527-3-ebiggers@kernel.org> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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. > + BLAKE2B_ALG("blake2b-256", "blake2b-256-generic", > + BLAKE2B_256_HASH_SIZE), > + BLAKE2B_ALG("blake2b-384", "blake2b-384-generic", > + BLAKE2B_384_HASH_SIZE), > + BLAKE2B_ALG("blake2b-512", "blake2b-512-generic", > + BLAKE2B_512_HASH_SIZE), > }; > > static int __init blake2b_mod_init(void) > -- > 2.29.2 > 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=-10.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 29B37C4361B for ; Thu, 17 Dec 2020 17:18:13 +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 D4CD6238EF for ; Thu, 17 Dec 2020 17:18:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4CD6238EF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz 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:Cc:Reply-To:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SeirLa3tY0zBJie/FAHGkIjZwmlJRIO9+Cyr3cBu8g4=; b=wScx2r7+TqJ/jQgyLIL3S8/Bdf UsyRlNXk901MrjVwiCAM+dzo9Bf3sYFehVh0Wiyj9mkTfuWZKrrMk2+grCJqyUYZN6cFpJcoeqhEx AgFUkyUcWrwBewMe/vqkLpcHq6+IR9deXgVyFiwK07I/LBG0fpOVL4/AJ2fFzMvPt3Jf+L1IcZ5IF iT8hIxXYVjXxLjbEj7fclrCgr4aO/mMZRyZr/P9SiCNhPpA+q5Yg8ZxIGQDcLioZ257LBPG9FufTW QsdzhPxy+ts91J9qe4l9xQdwMHY4MIqIfc9n9eo3y3sGrjdNegAtk+iF4pWBr7ebod5KANMJ5OuZD yQyCzlTA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpwth-000657-3D; Thu, 17 Dec 2020 17:17:01 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpwte-00064M-IU for linux-arm-kernel@lists.infradead.org; Thu, 17 Dec 2020 17:16:59 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7A7FDACBD; Thu, 17 Dec 2020 17:16:57 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 7D751DA83A; Thu, 17 Dec 2020 18:15:17 +0100 (CET) Date: Thu, 17 Dec 2020 18:15:17 +0100 From: David Sterba To: Eric Biggers Subject: Re: [PATCH 2/5] crypto: blake2b - define shash_alg structs using macros Message-ID: <20201217171517.GT6430@suse.cz> Mail-Followup-To: dsterba@suse.cz, Eric Biggers , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Herbert Xu , David Sterba , "Jason A . Donenfeld" , Paul Crowley References: <20201215234708.105527-1-ebiggers@kernel.org> <20201215234708.105527-3-ebiggers@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201215234708.105527-3-ebiggers@kernel.org> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201217_121658_742398_DA1B73A8 X-CRM114-Status: GOOD ( 15.20 ) 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: , Reply-To: dsterba@suse.cz Cc: "Jason A . Donenfeld" , Herbert Xu , linux-crypto@vger.kernel.org, David Sterba , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, Paul Crowley 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 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. > + BLAKE2B_ALG("blake2b-256", "blake2b-256-generic", > + BLAKE2B_256_HASH_SIZE), > + BLAKE2B_ALG("blake2b-384", "blake2b-384-generic", > + BLAKE2B_384_HASH_SIZE), > + BLAKE2B_ALG("blake2b-512", "blake2b-512-generic", > + BLAKE2B_512_HASH_SIZE), > }; > > static int __init blake2b_mod_init(void) > -- > 2.29.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel