Re: [PATCH crypto-next v6 1/3] crypto: poly1305 - add new 32 and 64-bit generic versions

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

 



On Tue, Dec 17, 2019 at 06:44:43PM +0100, Jason A. Donenfeld wrote:
> diff --git a/crypto/poly1305_generic.c b/crypto/poly1305_generic.c
> index 21edbd8c99fb..6488e8b8379c 100644
> --- a/crypto/poly1305_generic.c
> +++ b/crypto/poly1305_generic.c
> @@ -31,6 +31,29 @@ static int crypto_poly1305_init(struct shash_desc *desc)
>  	return 0;
>  }
>  
> +static unsigned int crypto_poly1305_setdesckey(struct poly1305_desc_ctx *dctx,
> +					       const u8 *src, unsigned int srclen)
> +{
> +	if (!dctx->sset) {
> +		if (!dctx->rset && srclen >= POLY1305_BLOCK_SIZE) {
> +			poly1305_core_setkey((struct poly1305_core_key *)dctx->r, src);

Seems this should be using a union, so that all these casts to a different
struct type (which is normally undefined behavior) aren't needed.

- Eric



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

  Powered by Linux