Skip to content

Commit

Permalink
Fix EVP_DigestInit_ex with NULL digest
Browse files Browse the repository at this point in the history
Calling EVP_DigestInit_ex which has already had the digest set up for it
should be possible. You are supposed to be able to pass NULL for the type.
However currently this seg faults.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit a010870)
  • Loading branch information
mattcaswell committed Mar 12, 2015
1 parent 8944d10 commit ff2459b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crypto/evp/digest.c
Expand Up @@ -203,9 +203,12 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
ctx->engine = impl;
} else
ctx->engine = NULL;
} else if (!ctx->digest) {
EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);
return 0;
} else {
if (!ctx->digest) {
EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);
return 0;
}
type = ctx->digest;
}
#endif
if (ctx->digest != type) {
Expand Down

0 comments on commit ff2459b

Please sign in to comment.