remove unused old directory crypto/rijndael (superseded by crypto/aes)
[openssl.git] / crypto / asn1 / a_verify.c
index be5a27e58b132645f2bf09df2c427084a7e57da0..bf41de5146dfd2f752e05d97190f64d187714784 100644 (file)
@@ -71,6 +71,8 @@
 #include <openssl/buffer.h>
 #include <openssl/evp.h>
 
+#ifndef NO_ASN1_OLD
+
 int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
             char *data, EVP_PKEY *pkey)
        {
@@ -79,6 +81,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
        unsigned char *p,*buf_in=NULL;
        int ret= -1,i,inl;
 
+       EVP_MD_CTX_init(&ctx);
        i=OBJ_obj2nid(a->algorithm);
        type=EVP_get_digestbyname(OBJ_nid2sn(i));
        if (type == NULL)
@@ -97,7 +100,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
        p=buf_in;
 
        i2d(data,&p);
-       EVP_VerifyInit(&ctx,type);
+       EVP_VerifyInit_ex(&ctx,type, NULL);
        EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
 
        memset(buf_in,0,(unsigned int)inl);
@@ -115,9 +118,12 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
        /* memset(&ctx,0,sizeof(ctx)); */
        ret=1;
 err:
+       EVP_MD_CTX_cleanup(&ctx);
        return(ret);
        }
 
+#endif
+
 
 int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signature,
             void *asn, EVP_PKEY *pkey)
@@ -127,6 +133,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
        unsigned char *buf_in=NULL;
        int ret= -1,i,inl;
 
+       EVP_MD_CTX_init(&ctx);
        i=OBJ_obj2nid(a->algorithm);
        type=EVP_get_digestbyname(OBJ_nid2sn(i));
        if (type == NULL)
@@ -143,7 +150,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
                goto err;
                }
 
-       EVP_VerifyInit(&ctx,type);
+       EVP_VerifyInit_ex(&ctx,type, NULL);
        EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
 
        memset(buf_in,0,(unsigned int)inl);
@@ -161,6 +168,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
        /* memset(&ctx,0,sizeof(ctx)); */
        ret=1;
 err:
+       EVP_MD_CTX_cleanup(&ctx);
        return(ret);
        }