Re: [PATCH] crypto: sm3 - fix undefined shift by >= width of value

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

 



On Tue, Jan 08, 2019 at 10:12:41PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@xxxxxxxxxx>
> 
> sm3_compress() calls rol32() with shift >= 32, which causes undefined
> behavior.  This is easily detected by enabling CONFIG_UBSAN.
> 
> Explicitly AND with 31 to make the behavior well defined.
> 
> Fixes: 4f0fc1600edb ("crypto: sm3 - add OSCCA SM3 secure hash")
> Cc: <stable@xxxxxxxxxxxxxxx> # v4.15+
> Cc: Gilad Ben-Yossef <gilad@xxxxxxxxxxxxx>
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> ---
>  crypto/sm3_generic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



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

  Powered by Linux