X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fasn1%2Fa_digest.c;h=4931e222a05e30c0f47e530f18b05bbe29657049;hb=6446e0c3c8286428374ec738ffdc859802bd3c92;hp=c838f60b46c5d1bee5ee3aca970673e77fa1d54d;hpb=17f389bbbfccf057a8bc04084ed068c4b368e751;p=oweals%2Fopenssl.git diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c index c838f60b46..4931e222a0 100644 --- a/crypto/asn1/a_digest.c +++ b/crypto/asn1/a_digest.c @@ -69,22 +69,38 @@ #include #include -int ASN1_digest(int (*i2d)(), EVP_MD *type, char *data, unsigned char *md, - unsigned int *len) +#ifndef NO_ASN1_OLD + +int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data, + unsigned char *md, unsigned int *len) { - EVP_MD_CTX ctx; int i; unsigned char *str,*p; i=i2d(data,NULL); - if ((str=(unsigned char *)Malloc(i)) == NULL) return(0); + if ((str=(unsigned char *)OPENSSL_malloc(i)) == NULL) return(0); p=str; i2d(data,&p); - EVP_DigestInit(&ctx,type); - EVP_DigestUpdate(&ctx,str,i); - EVP_DigestFinal(&ctx,md,len); - Free(str); + EVP_Digest(str, i, md, len, type, NULL); + OPENSSL_free(str); + return(1); + } + +#endif + + +int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn, + unsigned char *md, unsigned int *len) + { + int i; + unsigned char *str = NULL; + + i=ASN1_item_i2d(asn,&str, it); + if (!str) return(0); + + EVP_Digest(str, i, md, len, type, NULL); + OPENSSL_free(str); return(1); }