summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>2018-08-01 21:50:41 +0200
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>2018-08-03 12:02:14 +0200
commit28c5b7d482dda8597bbf93890463d7eb0f9f2355 (patch)
tree5beea77ec0d3511754413fcf41ce55248d170d73 /crypto/evp
parentd8a4f8ffd04e157d3591044cde8d7a56f605742c (diff)
Fix some undefined behaviour in the Curve448 code (2nd attempt)
Fixes #6800 Replaces #5418 This commit reverts commit 7876dbffcee9 and moves the check for a zero-length input down the callstack into sha3_update(). Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/6838)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/m_sha3.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/evp/m_sha3.c b/crypto/evp/m_sha3.c
index cf902e742c..bfc65b22e4 100644
--- a/crypto/evp/m_sha3.c
+++ b/crypto/evp/m_sha3.c
@@ -66,6 +66,9 @@ static int sha3_update(EVP_MD_CTX *evp_ctx, const void *_inp, size_t len)
size_t bsz = ctx->block_size;
size_t num, rem;
+ if (len == 0)
+ return 1;
+
if ((num = ctx->num) != 0) { /* process intermediate buffer? */
rem = bsz - num;