summaryrefslogtreecommitdiffstats
path: root/providers/common/digests/sha2.c
diff options
context:
space:
mode:
Diffstat (limited to 'providers/common/digests/sha2.c')
-rw-r--r--providers/common/digests/sha2.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/providers/common/digests/sha2.c b/providers/common/digests/sha2.c
index 4332e9818e..fb2bd95f52 100644
--- a/providers/common/digests/sha2.c
+++ b/providers/common/digests/sha2.c
@@ -11,10 +11,12 @@
#include <openssl/crypto.h>
#include <openssl/core_numbers.h>
-static int sha256_final(void *ctx, unsigned char *md, size_t *size)
+static int sha256_final(void *ctx,
+ unsigned char *md, size_t *mdl, size_t mdsz)
{
- if (SHA256_Final(md, ctx)) {
- *size = SHA256_DIGEST_LENGTH;
+ if (mdsz >= SHA256_DIGEST_LENGTH
+ && SHA256_Final(md, ctx)) {
+ *mdl = SHA256_DIGEST_LENGTH;
return 1;
}