lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 10 Oct 2016 10:29:55 -0700
From:   Joe Perches <joe@...ches.com>
To:     Eric Biggers <ebiggers@...gle.com>, herbert@...dor.apana.org.au,
        davem@...emloft.net
Cc:     linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: cmac - fix alignment of 'consts'

On Mon, 2016-10-10 at 10:15 -0700, Eric Biggers wrote:
> The per-transform 'consts' array is accessed as __be64 in
> crypto_cmac_digest_setkey() but was only guaranteed to be aligned to
> __alignof__(long).  Fix this by aligning it to __alignof__(__be64).
[]
> diff --git a/crypto/cmac.c b/crypto/cmac.c
[]
> @@ -57,7 +57,8 @@ static int crypto_cmac_digest_setkey(struct crypto_shash *parent,
>  	unsigned long alignmask = crypto_shash_alignmask(parent);
>  	struct cmac_tfm_ctx *ctx = crypto_shash_ctx(parent);
>  	unsigned int bs = crypto_shash_blocksize(parent);
> -	__be64 *consts = PTR_ALIGN((void *)ctx->ctx, alignmask + 1);
> +	__be64 *consts = PTR_ALIGN((void *)ctx->ctx,
> +				   (alignmask | (__alignof__(__be64) - 1)) + 1);

Using a bitwise or looks very odd there.  Perhaps:

		min(alignmask + 1, __alignof__(__be64))

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ