Fix EVP_DigestInit_ex with NULL digest
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 a01087027b
)
This commit is contained in:
@@ -191,9 +191,12 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
|
|||||||
ctx->engine = impl;
|
ctx->engine = impl;
|
||||||
} else
|
} else
|
||||||
ctx->engine = NULL;
|
ctx->engine = NULL;
|
||||||
} else if (!ctx->digest) {
|
} else {
|
||||||
EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);
|
if (!ctx->digest) {
|
||||||
return 0;
|
EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
type = ctx->digest;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ctx->digest != type) {
|
if (ctx->digest != type) {
|
||||||
|
Reference in New Issue
Block a user