diff options
author | beck <> | 2002-05-15 02:29:21 +0000 |
---|---|---|
committer | beck <> | 2002-05-15 02:29:21 +0000 |
commit | b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch) | |
tree | fa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/asn1/a_digest.c | |
parent | e471e1ea98d673597b182ea85f29e30c97cd08b5 (diff) | |
download | openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2 openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip |
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/asn1/a_digest.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_digest.c | 24 |
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 | |||
72 | int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data, | 74 | int 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 | |||
93 | int 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 | } |