Ensure EVP_MD_CTX_md returns the EVP_MD originally used
[openssl.git] / crypto / evp / evp_lib.c
index 219ae532d1d4e4c3110cb0ea9f499af60f86a14e..f99e905e42af263f87428d41ddf37b63235df2da 100644 (file)
@@ -479,9 +479,9 @@ int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
 
 const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
 {
-    if (!ctx)
+    if (ctx == NULL)
         return NULL;
-    return ctx->digest;
+    return ctx->reqdigest;
 }
 
 EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)