summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_digest.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_digest.c')
-rw-r--r--src/lib/libcrypto/asn1/a_digest.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/a_digest.c b/src/lib/libcrypto/asn1/a_digest.c
index 8257b8639e..4931e222a0 100644
--- a/src/lib/libcrypto/asn1/a_digest.c
+++ b/src/lib/libcrypto/asn1/a_digest.c
@@ -69,10 +69,11 @@
69#include <openssl/buffer.h> 69#include <openssl/buffer.h>
70#include <openssl/x509.h> 70#include <openssl/x509.h>
71 71
72#ifndef NO_ASN1_OLD
73
72int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data, 74int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
73 unsigned char *md, unsigned int *len) 75 unsigned char *md, unsigned int *len)
74 { 76 {
75 EVP_MD_CTX ctx;
76 int i; 77 int i;
77 unsigned char *str,*p; 78 unsigned char *str,*p;
78 79
@@ -81,9 +82,24 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
81 p=str; 82 p=str;
82 i2d(data,&p); 83 i2d(data,&p);
83 84
84 EVP_DigestInit(&ctx,type); 85 EVP_Digest(str, i, md, len, type, NULL);
85 EVP_DigestUpdate(&ctx,str,i); 86 OPENSSL_free(str);
86 EVP_DigestFinal(&ctx,md,len); 87 return(1);
88 }
89
90#endif
91
92
93int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
94 unsigned char *md, unsigned int *len)
95 {
96 int i;
97 unsigned char *str = NULL;
98
99 i=ASN1_item_i2d(asn,&str, it);
100 if (!str) return(0);
101
102 EVP_Digest(str, i, md, len, type, NULL);
87 OPENSSL_free(str); 103 OPENSSL_free(str);
88 return(1); 104 return(1);
89 } 105 }