Oops^2: It was the correct line, but an incorrect change.
[oweals/openssl.git] / crypto / x509 / x509_cmp.c
index 16986231710b77c1df6da25a28f5bdb1ade2fd08..e711de228c0640c3c6cb5e36eb56a3ae19fba93e 100644 (file)
@@ -75,24 +75,26 @@ int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b)
        return(X509_NAME_cmp(ai->issuer,bi->issuer));
        }
 
-#ifndef NO_MD5
+#ifndef OPENSSL_NO_MD5
 unsigned long X509_issuer_and_serial_hash(X509 *a)
        {
        unsigned long ret=0;
-       MD5_CTX ctx;
+       EVP_MD_CTX ctx;
        unsigned char md[16];
        char str[256];
 
+       EVP_MD_CTX_init(&ctx);
        X509_NAME_oneline(a->cert_info->issuer,str,256);
        ret=strlen(str);
-       MD5_Init(&ctx);
-       MD5_Update(&ctx,(unsigned char *)str,ret);
-       MD5_Update(&ctx,(unsigned char *)a->cert_info->serialNumber->data,
+       EVP_DigestInit(&ctx,EVP_md5());
+       EVP_DigestUpdate(&ctx,(unsigned char *)str,ret);
+       EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data,
                (unsigned long)a->cert_info->serialNumber->length);
-       MD5_Final(&(md[0]),&ctx);
+       EVP_DigestFinal(&ctx,&(md[0]),NULL);
        ret=(   ((unsigned long)md[0]     )|((unsigned long)md[1]<<8L)|
                ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L)
                )&0xffffffffL;
+       EVP_MD_CTX_cleanup(&ctx);
        return(ret);
        }
 #endif
@@ -137,7 +139,7 @@ unsigned long X509_subject_name_hash(X509 *x)
        return(X509_NAME_hash(x->cert_info->subject));
        }
 
-#ifndef NO_SHA
+#ifndef OPENSSL_NO_SHA
 /* Compare two certificates: they must be identical for
  * this to work. NB: Although "cmp" operations are generally
  * prototyped to take "const" arguments (eg. for use in
@@ -192,7 +194,7 @@ int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b)
        return(0);
        }
 
-#ifndef NO_MD5
+#ifndef OPENSSL_NO_MD5
 /* I now DER encode the name and hash it.  Since I cache the DER encoding,
  * this is reasonably efficient. */
 unsigned long X509_NAME_hash(X509_NAME *x)
@@ -274,7 +276,7 @@ int X509_check_private_key(X509 *x, EVP_PKEY *k)
            }
        switch (k->type)
                {
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
        case EVP_PKEY_RSA:
                if (BN_cmp(xk->pkey.rsa->n,k->pkey.rsa->n) != 0
                    || BN_cmp(xk->pkey.rsa->e,k->pkey.rsa->e) != 0)
@@ -284,7 +286,7 @@ int X509_check_private_key(X509 *x, EVP_PKEY *k)
                    }
                break;
 #endif
-#ifndef NO_DSA
+#ifndef OPENSSL_NO_DSA
        case EVP_PKEY_DSA:
                if (BN_cmp(xk->pkey.dsa->pub_key,k->pkey.dsa->pub_key) != 0)
                    {
@@ -293,7 +295,7 @@ int X509_check_private_key(X509 *x, EVP_PKEY *k)
                    }
                break;
 #endif
-#ifndef NO_DH
+#ifndef OPENSSL_NO_DH
        case EVP_PKEY_DH:
                /* No idea */
                X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_CANT_CHECK_DH_KEY);