Subject: Re: [PATCH 2/5] crypto: blake2b - define shash_alg structs using macros

From: David Sterba <[email-masked]>
Date: Thu, 17 Dec 2020 18:15:17 +0100

On Tue, Dec 15, 2020 at 03:47:05PM -0800, Eric Biggers wrote:
> From: Eric Biggers <[email-masked]>
> 
> 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 <[email-masked]>

Reviewed-by: David Sterba <[email-masked]>

> +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
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel