David Benjamin e7c0c9734f Don't overflow the output length in EVP_CipherUpdate calls.
CVE-2021-23840

(Imported from upstream's 6a51b9e1d0cf0bf8515f7201b68fb0a3482b3dc1.)

This differs slightly from upstream's version:

- EVP_R_OUTPUT_WOULD_OVERFLOW didn't seem necessary when ERR_R_OVERFLOW
  already exists. (Also since we use CIPHER_R_*, it wouldn't have helped
  with compatibility anyway. Though there's probably something to be
  said for us folding CIPHER_R_* back into EVP_R_*.)

- For simplicity, just check in_len + bl at the top, rather than trying
  to predict the exact number of bytes written.

Update-Note: Passing extremely large input lengths into EVP_CipherUpdate
will now fail. Use EVP_AEAD instead, which is size_t-based and has more
explicit output bounds.

Change-Id: I31835c89dcdecb6b112828f57deb798dc7187db5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/45685
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2021-02-16 20:50:26 +00:00
..
2016-08-03 21:37:31 +00:00
2021-01-26 19:59:29 +00:00
2020-10-09 21:06:44 +00:00
2021-01-26 19:59:29 +00:00
2019-01-03 21:46:45 +00:00
2015-05-12 00:09:57 +00:00
2021-01-05 22:49:29 +00:00
2019-01-03 21:46:45 +00:00
2018-09-06 20:07:52 +00:00
2021-02-10 17:34:17 +00:00
2020-09-16 17:33:33 +00:00
2018-09-06 20:07:52 +00:00
2020-09-30 20:32:54 +00:00
2021-02-04 17:40:21 +00:00
2021-01-26 19:59:29 +00:00
2020-04-01 18:01:12 +00:00
2015-05-08 18:02:02 +00:00
2018-05-08 01:32:14 +00:00
2021-01-07 22:41:58 +00:00
2019-04-17 20:57:57 +00:00
2018-09-06 20:07:52 +00:00
2019-01-22 22:06:43 +00:00
2020-04-15 21:23:37 +00:00
2018-05-08 20:51:15 +00:00
2018-09-06 20:07:52 +00:00
2019-05-21 17:08:43 +00:00
2018-09-06 20:07:52 +00:00
2021-01-07 16:44:54 +00:00
2020-04-26 18:31:56 +00:00
2020-04-15 21:23:37 +00:00
2019-07-10 21:14:32 +00:00
2015-09-14 23:59:37 +00:00
2018-09-26 19:10:02 +00:00
2020-11-02 17:06:41 +00:00
2020-03-24 01:51:30 +00:00
2021-02-16 18:22:32 +00:00
2020-12-08 18:13:14 +00:00