Fix migration guide mappings for i2o/o2i_ECPublicKey
[openssl.git] / test / mdc2test.c
index d1c2f26bdc184b41eed555974e631ff88eef427a..a524ceca160d4869060415df15c0dad08fb2c812 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,12 +7,17 @@
  * https://www.openssl.org/source/license.html
  */
 
+/*
+ * MDC2 low level APIs are deprecated for public use, but still ok for
+ * internal use.
+ */
+#include "internal/deprecated.h"
+
 #include <string.h>
 #include <openssl/provider.h>
 #include <openssl/params.h>
-#include <openssl/ossl_typ.h>
+#include <openssl/types.h>
 #include <openssl/core_names.h>
-#include "internal/nelem.h"
 #include "testutil.h"
 
 #if defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_MDC2)
@@ -42,7 +47,7 @@ static int test_mdc2(void)
     int testresult = 0;
     unsigned int pad_type = 2;
     unsigned char md[MDC2_DIGEST_LENGTH];
-    EVP_MD_CTX *c;
+    EVP_MD_CTX *c = NULL;
     static char text[] = "Now is the time for all ";
     size_t tlen = strlen(text), i = 0;
     OSSL_PROVIDER *prov = NULL;
@@ -53,6 +58,9 @@ static int test_mdc2(void)
     params[i++] = OSSL_PARAM_construct_end();
 
     prov = OSSL_PROVIDER_load(NULL, "legacy");
+    if (!TEST_ptr(prov))
+        goto end;
+
 # ifdef CHARSET_EBCDIC
     ebcdic2ascii(text, text, tlen);
 # endif