openssl/crypto/aes
Emilia Kasper a2fcab9978 Fix undefined behaviour in shifts.
Td4 and Te4 are arrays of u8. A u8 << int promotes the u8 to an int first then shifts.
If the mathematical result of a shift (as modelled by lhs * 2^{rhs}) is not representable
in an integer, behaviour is undefined. In other words, you can't shift into the sign bit
of a signed integer. Fix this by casting to u32 whenever we're shifting left by 24.

(For consistency, cast other shifts, too.)

Caught by -fsanitize=shift

Submitted by Nick Lewycky (Google)

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 8b37e5c14f)
2015-03-13 21:14:56 -07:00
..
asm Fix irix-cc build. 2015-01-07 18:43:34 +01:00
.cvsignore Apply mingw patches as supplied by Roumen Petrov an Alon Bar-Lev 2008-04-17 10:19:16 +00:00
aes.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_cbc.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_cfb.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_core.c Fix undefined behaviour in shifts. 2015-03-13 21:14:56 -07:00
aes_ctr.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_ecb.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_ige.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_locl.h Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_misc.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_ofb.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_wrap.c Run util/openssl-format-source -v -c . 2015-01-22 09:38:39 +00:00
aes_x86core.c Fix undefined behaviour in shifts. 2015-03-13 21:14:56 -07:00
Makefile make update 2014-01-06 13:33:27 +00:00
README Because Rijndael is more known as AES, use crypto/aes instead of 2002-01-02 16:55:35 +00:00

This is an OpenSSL-compatible version of AES (also called Rijndael).
aes_core.c is basically the same as rijndael-alg-fst.c but with an
API that looks like the rest of the OpenSSL symmetric cipher suite.