For self signed root only indicate one error.
[oweals/openssl.git] / crypto / evp / digest.c
index cfd5401dbd2380ae67a802e43eb74d7fdf4b6e31..af0044ff43d7486b1302c56b8e7d4e988d0b09b6 100644 (file)
 
 #ifdef OPENSSL_FIPS
 #include <openssl/fips.h>
+#include "evp_locl.h"
 #endif
 
 void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
@@ -152,7 +153,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
                const EVP_MD *fipsmd;
                if (type)
                        {
-                       fipsmd = FIPS_get_digestbynid(EVP_MD_type(type));
+                       fipsmd = evp_get_fips_md(type);
                        if (fipsmd)
                                type = fipsmd;
                        }
@@ -379,8 +380,11 @@ int EVP_Digest(const void *data, size_t count,
 
 void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx)
        {
-       EVP_MD_CTX_cleanup(ctx);
-       OPENSSL_free(ctx);
+       if (ctx)
+               {
+               EVP_MD_CTX_cleanup(ctx);
+               OPENSSL_free(ctx);
+               }
        }
 
 /* This call frees resources associated with the context */