openssl/crypto/evp
Matt Caswell 3f3582139f Fix encrypt overflow
An overflow can occur in the EVP_EncryptUpdate function. If an attacker is
able to supply very large amounts of input data after a previous call to
EVP_EncryptUpdate with a partial block then a length check can overflow
resulting in a heap corruption.

Following an analysis of all OpenSSL internal usage of the
EVP_EncryptUpdate function all usage is one of two forms.

The first form is like this:
EVP_EncryptInit()
EVP_EncryptUpdate()

i.e. where the EVP_EncryptUpdate() call is known to be the first called
function after an EVP_EncryptInit(), and therefore that specific call
must be safe.

The second form is where the length passed to EVP_EncryptUpdate() can be
seen from the code to be some small value and therefore there is no
possibility of an overflow.

Since all instances are one of these two forms, I believe that there can
be no overflows in internal code due to this problem.

It should be noted that EVP_DecryptUpdate() can call EVP_EncryptUpdate()
in certain code paths. Also EVP_CipherUpdate() is a synonym for
EVP_EncryptUpdate(). Therefore I have checked all instances of these
calls too, and came to the same conclusion, i.e. there are no instances
in internal usage where an overflow could occur.

This could still represent a security issue for end user code that calls
this function directly.

CVE-2016-2106

Issue reported by Guido Vranken.

Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-05-03 08:57:06 +01:00
..
bio_b64.c Make BIO opaque 2016-03-29 17:40:54 +01:00
bio_enc.c Make BIO opaque 2016-03-29 17:40:54 +01:00
bio_md.c Make BIO opaque 2016-03-29 17:40:54 +01:00
bio_ok.c Make BIO opaque 2016-03-29 17:40:54 +01:00
build.info Review comments 2016-03-11 10:39:10 -05:00
c_allc.c Add aliases for des-ede-ecb and des-ede3-ecb ciphers. 2016-04-29 09:17:09 -04:00
c_alld.c Rename int_*() functions to *_int() 2016-04-13 08:59:03 +01:00
cmeth_lib.c GH641: Don't care openssl_zmalloc 2016-02-08 11:09:16 -05:00
digest.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
e_aes.c Remove obsolete defined(__INTEL__) condition. 2016-05-02 12:35:01 +02:00
e_aes_cbc_hmac_sha1.c Remove obsolete defined(__INTEL__) condition. 2016-05-02 12:35:01 +02:00
e_aes_cbc_hmac_sha256.c Remove obsolete defined(__INTEL__) condition. 2016-05-02 12:35:01 +02:00
e_bf.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
e_camellia.c Rename EVP_CIPHER_CTX_cipher_data to EVP_CIPHER_CTX_get_cipher_data 2016-03-07 21:42:09 +00:00
e_cast.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
e_chacha20_poly1305.c Rename some BUF_xxx to OPENSSL_xxx 2015-12-16 16:14:49 -05:00
e_des.c Rename EVP_CIPHER_CTX_cipher_data to EVP_CIPHER_CTX_get_cipher_data 2016-03-07 21:42:09 +00:00
e_des3.c evp/e_des[3].c: address compiler warnings, fix formatting. 2016-02-12 22:09:04 +01:00
e_idea.c Fix missing IDEA renames (windows build) 2016-04-20 14:48:54 -04:00
e_null.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
e_old.c Remove OPENSSL_NO_AES guards 2016-04-13 21:25:24 +01:00
e_rc2.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
e_rc4.c Rename EVP_CIPHER_CTX_cipher_data to EVP_CIPHER_CTX_get_cipher_data 2016-03-07 21:42:09 +00:00
e_rc4_hmac_md5.c Remove obsolete defined(__INTEL__) condition. 2016-05-02 12:35:01 +02:00
e_rc5.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
e_seed.c Fix no-seed 2016-03-21 14:42:46 +00:00
e_xcbc_d.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
encode.c GH641: Don't care openssl_zmalloc 2016-02-08 11:09:16 -05:00
evp_cnf.c Move dso.h to internal 2016-03-23 09:12:11 -04:00
evp_enc.c Fix encrypt overflow 2016-05-03 08:57:06 +01:00
evp_err.c Make PKCS8_PRIV_KEY_INFO opaque. 2016-03-07 17:11:21 +00:00
evp_key.c Elide EVP_read_pw_string() and friends for no-ui 2016-03-07 12:52:56 -05:00
evp_lib.c Rename EVP_CIPHER_CTX_cipher_data to EVP_CIPHER_CTX_get_cipher_data 2016-03-07 21:42:09 +00:00
evp_locl.h Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
evp_pbe.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
evp_pkey.c Make PKCS8_PRIV_KEY_INFO opaque. 2016-03-07 17:11:21 +00:00
m_md2.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
m_md4.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
m_md5.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
m_md5_sha1.c Remove OPENSSL_NO_SHA guards 2016-04-13 21:25:24 +01:00
m_mdc2.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
m_null.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
m_ripemd.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
m_sha1.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
m_sigver.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
m_wp.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
names.c Remove check_defer() 2016-04-13 15:05:07 +01:00
p5_crpt.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
p5_crpt2.c Remove outdated DEBUG flags. 2016-02-18 17:14:50 -05:00
p_dec.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
p_enc.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
p_lib.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
p_open.c Use NON_EMPTY_TRANSLATION_UNIT, consistently. 2016-02-09 20:13:29 -05:00
p_seal.c Remove #error from include files. 2016-03-20 19:48:36 -04:00
p_sign.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
p_verify.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
pmeth_fn.c Convert CRYPTO_LOCK_EVP_PKEY to new multi-threading API 2016-03-08 11:10:34 -05:00
pmeth_gn.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
pmeth_lib.c Make string_to_hex/hex_to_string public 2016-04-18 09:02:11 -04:00
scrypt.c Remove outdated DEBUG flags. 2016-02-18 17:14:50 -05:00