summaryrefslogtreecommitdiffstats
path: root/crypto/evp/mac_lib.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-03-26 15:25:15 +0000
committerMatt Caswell <matt@openssl.org>2019-03-27 10:14:03 +0000
commita8274ea351988aa754cb9983b27d7059613ee11e (patch)
treea2f2212f0617ecf1aee259e2f0def82cf334f368 /crypto/evp/mac_lib.c
parent1f019cd0ac9343c51dfdcef1df9a1859cf8fbe03 (diff)
Tolerate 0 byte input length for Update functions
We treat that as automatic success. Other EVP_*Update functions already do this (e.g. EVP_EncryptUpdate, EVP_DecryptUpdate etc). EVP_EncodeUpdate is a bit of an anomoly. That treats 0 byte input length as an error. Fixes #8576 Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8587)
Diffstat (limited to 'crypto/evp/mac_lib.c')
-rw-r--r--crypto/evp/mac_lib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/evp/mac_lib.c b/crypto/evp/mac_lib.c
index 2f46277bf0..39efff0842 100644
--- a/crypto/evp/mac_lib.c
+++ b/crypto/evp/mac_lib.c
@@ -82,6 +82,8 @@ int EVP_MAC_init(EVP_MAC_CTX *ctx)
int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen)
{
+ if (datalen == 0)
+ return 1;
return ctx->meth->update(ctx->data, data, datalen);
}