summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x_all.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-03-29 12:28:10 +1000
committerTomas Mraz <tomas@openssl.org>2021-03-30 18:57:29 +0200
commit03915534851daef6232c514cf1a8ea3158a7704e (patch)
treee7fcb3b7f8304526cb9cea53f5ce2286b7f93f9f /crypto/x509/x_all.c
parent2db9bef264ba39e173d6b6a3a800595e15eef31b (diff)
x509: fix coverity 1474471: NULL pointer dereference
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14716)
Diffstat (limited to 'crypto/x509/x_all.c')
-rw-r--r--crypto/x509/x_all.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/x509/x_all.c b/crypto/x509/x_all.c
index c5e0c0b1ec..042425456c 100644
--- a/crypto/x509/x_all.c
+++ b/crypto/x509/x_all.c
@@ -434,8 +434,11 @@ ASN1_OCTET_STRING *X509_digest_sig(const X509 *cert)
int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type,
unsigned char *md, unsigned int *len)
{
- if (type != NULL
- && EVP_MD_is_a(type, SN_sha1)
+ if (type == NULL) {
+ ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER);
+ return 0;
+ }
+ if (EVP_MD_is_a(type, SN_sha1)
&& (data->flags & EXFLAG_SET) != 0
&& (data->flags & EXFLAG_NO_FINGERPRINT) == 0) {
/* Asking for SHA1; always computed in CRL d2i. */