odhcpd: update to latest git HEAD
[openwrt/staging/dedeckeh.git] / package / libs / openssl / patches / 210-eng_devcrypto-expand-digest-failure-cases.patch
1 From add2ab1f289c24a1563c5b895d5cd133fe874f12 Mon Sep 17 00:00:00 2001
2 From: Eneas U de Queiroz <cote2004-github@yahoo.com>
3 Date: Wed, 14 Nov 2018 11:22:14 -0200
4 Subject: [PATCH 2/7] eng_devcrypto: expand digest failure cases
5
6 Return failure when the digest_ctx is null in digest_update and
7 digest_final, and when md is null in digest_final.
8
9 Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
10
11 Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
12 Reviewed-by: Richard Levitte <levitte@openssl.org>
13 (Merged from https://github.com/openssl/openssl/pull/7585)
14
15 (cherry picked from commit 4d9f99654441e36fdcb49540a1dbc9d4c70ccb68)
16
17 --- a/crypto/engine/eng_devcrypto.c
18 +++ b/crypto/engine/eng_devcrypto.c
19 @@ -438,6 +438,9 @@ static int digest_update(EVP_MD_CTX *ctx
20 if (count == 0)
21 return 1;
22
23 + if (digest_ctx == NULL)
24 + return 0;
25 +
26 if (digest_op(digest_ctx, data, count, NULL, COP_FLAG_UPDATE) < 0) {
27 SYSerr(SYS_F_IOCTL, errno);
28 return 0;
29 @@ -451,6 +454,8 @@ static int digest_final(EVP_MD_CTX *ctx,
30 struct digest_ctx *digest_ctx =
31 (struct digest_ctx *)EVP_MD_CTX_md_data(ctx);
32
33 + if (md == NULL || digest_ctx == NULL)
34 + return 0;
35 if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) {
36 SYSerr(SYS_F_IOCTL, errno);
37 return 0;