Index: crypto/signature_verifier_openssl.cc |
diff --git a/crypto/signature_verifier_openssl.cc b/crypto/signature_verifier_openssl.cc |
index 155a2cf3ef72a21cbcbb3b3f8efe9e16bc2cf641..a855120ef83bd233cae7b7e4be1d1ba2fce3627b 100644 |
--- a/crypto/signature_verifier_openssl.cc |
+++ b/crypto/signature_verifier_openssl.cc |
@@ -26,7 +26,7 @@ const EVP_MD* ToOpenSSLDigest(SignatureVerifier::HashAlgorithm hash_alg) { |
case SignatureVerifier::SHA256: |
return EVP_sha256(); |
} |
- return EVP_md_null(); |
+ return NULL; |
} |
} // namespace |
@@ -80,8 +80,11 @@ bool SignatureVerifier::VerifyInitRSAPSS(HashAlgorithm hash_alg, |
const uint8* public_key_info, |
int public_key_info_len) { |
OpenSSLErrStackTracer err_tracer(FROM_HERE); |
- const EVP_MD* digest = ToOpenSSLDigest(hash_alg); |
+ const EVP_MD* const digest = ToOpenSSLDigest(hash_alg); |
DCHECK(digest); |
+ if (!digest) { |
+ return false; |
+ } |
EVP_PKEY_CTX* pkey_ctx; |
if (!CommonInit(digest, signature, signature_len, public_key_info, |
@@ -92,8 +95,12 @@ bool SignatureVerifier::VerifyInitRSAPSS(HashAlgorithm hash_alg, |
int rv = EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, RSA_PKCS1_PSS_PADDING); |
if (rv != 1) |
return false; |
- rv = EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, |
- ToOpenSSLDigest(mask_hash_alg)); |
+ const EVP_MD* const mgf_digest = ToOpenSSLDigest(mask_hash_alg); |
+ DCHECK(mgf_digest); |
+ if (!mgf_digest) { |
+ return false; |
+ } |
+ rv = EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, mgf_digest); |
if (rv != 1) |
return false; |
rv = EVP_PKEY_CTX_set_rsa_pss_saltlen(pkey_ctx, salt_len); |