openssl/crypto/evp
Matt Caswell 3ab937bc44 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>
(cherry picked from commit 3f3582139f)
2016-05-03 09:00:04 +01:00
..
bio_b64.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
bio_enc.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
bio_md.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
bio_ok.c Code style: space after 'if' 2015-04-16 13:50:01 -04:00
c_all.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
c_allc.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
c_alld.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
digest.c Fix a potential double free in EVP_DigestInit_ex 2016-03-18 11:42:19 +00:00
e_aes.c Relax CCM tag check. 2015-07-06 18:35:35 +01:00
e_aes_cbc_hmac_sha1.c e_aes_cbc_hmac_sha*.c: address linker warning about OPENSSL_ia32cap_P size mismatch. 2015-06-11 10:14:01 +02:00
e_aes_cbc_hmac_sha256.c aesni-sha256-x86_64.pl: fix crash on AMD Jaguar. 2015-11-16 13:07:33 +01:00
e_bf.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
e_camellia.c Remove the "eay" c-file-style indicators 2015-12-18 13:39:34 +01:00
e_cast.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
e_des.c evp/e_des[3].c: address compiler warnings, fix formatting. 2016-02-13 10:46:26 +01:00
e_des3.c evp/e_des3.c: address compiler warning. 2016-02-19 13:34:42 +01:00
e_dsa.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
e_idea.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
e_null.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
e_old.c Remove the "eay" c-file-style indicators 2015-12-18 13:39:34 +01:00
e_rc2.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
e_rc4.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
e_rc4_hmac_md5.c Use CRYPTO_memcmp when comparing authenticators 2015-06-08 15:01:14 +02:00
e_rc5.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
e_seed.c Remove the "eay" c-file-style indicators 2015-12-18 13:39:34 +01:00
e_xcbc_d.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
encode.c Fix indentation 2015-09-19 09:09:14 -04:00
evp.h Add funtions to set item_sign and item_verify 2015-06-03 15:18:14 +01:00
evp_acnf.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
evp_cnf.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
evp_enc.c Fix encrypt overflow 2016-05-03 09:00:04 +01:00
evp_err.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
evp_extra_test.c Fix evp_extra_test.c with no-ec 2015-02-26 23:34:54 +00:00
evp_key.c Fix missing malloc return value checks 2015-11-09 22:54:19 +00:00
evp_lib.c RFC5753 compliance. 2015-10-13 23:02:44 +01:00
evp_locl.h Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
evp_pbe.c Check memory allocation 2015-10-23 20:32:59 +02:00
evp_pkey.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
evp_test.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
evptests.txt EVP support for wrapping algorithms. 2013-10-01 14:01:17 +01:00
m_dss.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_dss1.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_ecdsa.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_md2.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_md4.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_md5.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_mdc2.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_null.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_ripemd.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_sha.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_sha1.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_sigver.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
m_wp.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
Makefile Fix the update target and remove duplicate file updates 2015-05-23 06:25:12 +02:00
names.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
openbsd_hw.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
p5_crpt.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
p5_crpt2.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
p_dec.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
p_enc.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
p_lib.c RT3754: check for NULL pointer 2015-09-10 17:23:02 +02:00
p_open.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
p_seal.c Fix RAND_(pseudo_)?_bytes returns 2015-03-25 12:41:28 +00:00
p_sign.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
p_verify.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
pmeth_fn.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00
pmeth_gn.c RT3754: check for NULL pointer 2015-09-10 17:23:02 +02:00
pmeth_lib.c Run util/openssl-format-source -v -c . 2015-01-22 09:31:38 +00:00