summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/digest.c
diff options
context:
space:
mode:
authormiod <>2015-02-10 09:52:35 +0000
committermiod <>2015-02-10 09:52:35 +0000
commitd2f68f95d95ff1ca4370b66eb67e8add10d9d079 (patch)
tree58f7f299c05557099d7278079e061aed0f4a9f23 /src/lib/libcrypto/evp/digest.c
parent9c8f4b278d0fe6c5ae67ecea60905c57ccf4c4e1 (diff)
downloadopenbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.tar.gz
openbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.tar.bz2
openbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.zip
Replace assert() and OPENSSL_assert() calls with proper error return paths.
Careful review, feedback & ok doug@ jsing@
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/evp/digest.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c
index 4a18aff657..c9fb60d49b 100644
--- a/src/lib/libcrypto/evp/digest.c
+++ b/src/lib/libcrypto/evp/digest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: digest.c,v 1.24 2014/11/09 19:12:18 miod Exp $ */ 1/* $OpenBSD: digest.c,v 1.25 2015/02/10 09:52:35 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -249,7 +249,10 @@ EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
249{ 249{
250 int ret; 250 int ret;
251 251
252 OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); 252 if ((size_t)ctx->digest->md_size > EVP_MAX_MD_SIZE) {
253 EVPerr(EVP_F_EVP_DIGESTFINAL_EX, EVP_R_TOO_LARGE);
254 return 0;
255 }
253 ret = ctx->digest->final(ctx, md); 256 ret = ctx->digest->final(ctx, md);
254 if (size != NULL) 257 if (size != NULL)
255 *size = ctx->digest->md_size; 258 *size = ctx->digest->md_size;