EVP_*Update: ensure that input NULL with length 0 isn't passed
authorMatt Caswell <matt@openssl.org>
Thu, 4 Apr 2019 23:22:14 +0000 (01:22 +0200)
committerMatt Caswell <matt@openssl.org>
Fri, 29 Nov 2019 11:05:35 +0000 (11:05 +0000)
commit420cb707b880e4fb649094241371701013eeb15f
tree962019df7b2215f7df17829b09d9005d9b48efe5
parentaeb8d94b6bd2bfa4da2681d4609956607aa9ed7a
EVP_*Update: ensure that input NULL with length 0 isn't passed

Even with custom ciphers, the combination in == NULL && inl == 0
should not be passed down to the backend cipher function.  The reason
is that these are the values passed by EVP_*Final, and some of the
backend cipher functions do check for these to see if a "final" call
is made.

An exception is made for CCM mode which has special handling for the case
where inl == 0: this may mean the total plaintext or ciphertext length is 0.

This is based on an original commit by Richard Levitte.

Fixes #8675

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9057)
crypto/evp/evp_enc.c