Various function for commmon operations.
This commit is contained in:
@@ -74,7 +74,6 @@
|
||||
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;
|
||||
|
||||
@@ -83,9 +82,7 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
|
||||
p=str;
|
||||
i2d(data,&p);
|
||||
|
||||
EVP_DigestInit(&ctx,type);
|
||||
EVP_DigestUpdate(&ctx,str,i);
|
||||
EVP_DigestFinal(&ctx,md,len);
|
||||
EVP_Digest(str, i, md, len, type);
|
||||
OPENSSL_free(str);
|
||||
return(1);
|
||||
}
|
||||
@@ -96,16 +93,13 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
|
||||
int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
|
||||
unsigned char *md, unsigned int *len)
|
||||
{
|
||||
EVP_MD_CTX ctx;
|
||||
int i;
|
||||
unsigned char *str = NULL;
|
||||
|
||||
i=ASN1_item_i2d(asn,&str, it);
|
||||
if (!str) return(0);
|
||||
|
||||
EVP_DigestInit(&ctx,type);
|
||||
EVP_DigestUpdate(&ctx,str,i);
|
||||
EVP_DigestFinal(&ctx,md,len);
|
||||
EVP_Digest(str, i, md, len, type);
|
||||
OPENSSL_free(str);
|
||||
return(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user