update ASN1 sign/verify to use EVP_DigestSign and EVP_DigestVerify
[openssl.git] / crypto / asn1 / a_sign.c
index d96a622d8314c87e04e0ab14244be7a334b2c93c..018edaead76c315e15234194cba2514a39c44dd4 100644 (file)
@@ -219,7 +219,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
        {
        EVP_MD_CTX ctx;
        unsigned char *buf_in=NULL,*buf_out=NULL;
        {
        EVP_MD_CTX ctx;
        unsigned char *buf_in=NULL,*buf_out=NULL;
-       int inl=0,outl=0,outll=0;
+       size_t inl=0,outl=0,outll=0;
        int signid, paramtype;
 
        if (type == NULL)
        int signid, paramtype;
 
        if (type == NULL)
@@ -270,10 +270,9 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
                goto err;
                }
 
                goto err;
                }
 
-       if (!EVP_SignInit_ex(&ctx,type, NULL)
-               || !EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl)
-               || !EVP_SignFinal(&ctx,(unsigned char *)buf_out,
-                       (unsigned int *)&outl,pkey))
+       if (!EVP_DigestVerifyInit(&ctx, NULL, type, NULL, pkey)
+               || !EVP_DigestSignUpdate(&ctx, buf_in, inl)
+               || !EVP_DigestSignFinal(&ctx, buf_out, &outl))
                {
                outl=0;
                ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB);
                {
                outl=0;
                ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB);