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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ebiggers@xxxxxxxxxx>
> > 
> > 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 <ebiggers@xxxxxxxxxx>
> 
> Reviewed-by: David Sterba <dsterba@xxxxxxxx>
> 
> > +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



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux