diff options
author | beck <> | 1999-09-29 04:37:45 +0000 |
---|---|---|
committer | beck <> | 1999-09-29 04:37:45 +0000 |
commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/asn1/p7_evp.c | |
parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/asn1/p7_evp.c')
-rw-r--r-- | src/lib/libcrypto/asn1/p7_evp.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/lib/libcrypto/asn1/p7_evp.c b/src/lib/libcrypto/asn1/p7_evp.c index 4db0a7fe62..b2b3d50dcd 100644 --- a/src/lib/libcrypto/asn1/p7_evp.c +++ b/src/lib/libcrypto/asn1/p7_evp.c | |||
@@ -58,67 +58,61 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include "asn1_mac.h" | 61 | #include <openssl/asn1_mac.h> |
62 | #include "x509.h" | 62 | #include <openssl/x509.h> |
63 | 63 | ||
64 | /* | 64 | int i2d_PKCS7_ENVELOPE(PKCS7_ENVELOPE *a, unsigned char **pp) |
65 | * ASN1err(ASN1_F_PKCS7_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); | ||
66 | * ASN1err(ASN1_F_D2I_PKCS7_ENVELOPE,ASN1_R_LENGTH_MISMATCH); | ||
67 | */ | ||
68 | |||
69 | int i2d_PKCS7_ENVELOPE(a,pp) | ||
70 | PKCS7_ENVELOPE *a; | ||
71 | unsigned char **pp; | ||
72 | { | 65 | { |
73 | M_ASN1_I2D_vars(a); | 66 | M_ASN1_I2D_vars(a); |
74 | 67 | ||
75 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); | 68 | M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); |
76 | M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); | 69 | M_ASN1_I2D_len_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, |
70 | i2d_PKCS7_RECIP_INFO); | ||
77 | M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); | 71 | M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); |
78 | 72 | ||
79 | M_ASN1_I2D_seq_total(); | 73 | M_ASN1_I2D_seq_total(); |
80 | 74 | ||
81 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); | 75 | M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); |
82 | M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); | 76 | M_ASN1_I2D_put_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, |
77 | i2d_PKCS7_RECIP_INFO); | ||
83 | M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); | 78 | M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); |
84 | 79 | ||
85 | M_ASN1_I2D_finish(); | 80 | M_ASN1_I2D_finish(); |
86 | } | 81 | } |
87 | 82 | ||
88 | PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(a,pp,length) | 83 | PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(PKCS7_ENVELOPE **a, unsigned char **pp, |
89 | PKCS7_ENVELOPE **a; | 84 | long length) |
90 | unsigned char **pp; | ||
91 | long length; | ||
92 | { | 85 | { |
93 | M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new); | 86 | M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new); |
94 | 87 | ||
95 | M_ASN1_D2I_Init(); | 88 | M_ASN1_D2I_Init(); |
96 | M_ASN1_D2I_start_sequence(); | 89 | M_ASN1_D2I_start_sequence(); |
97 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); | 90 | M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); |
98 | M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); | 91 | M_ASN1_D2I_get_set_type(PKCS7_RECIP_INFO,ret->recipientinfo, |
92 | d2i_PKCS7_RECIP_INFO,PKCS7_RECIP_INFO_free); | ||
99 | M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); | 93 | M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); |
100 | 94 | ||
101 | M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE); | 95 | M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE); |
102 | } | 96 | } |
103 | 97 | ||
104 | PKCS7_ENVELOPE *PKCS7_ENVELOPE_new() | 98 | PKCS7_ENVELOPE *PKCS7_ENVELOPE_new(void) |
105 | { | 99 | { |
106 | PKCS7_ENVELOPE *ret=NULL; | 100 | PKCS7_ENVELOPE *ret=NULL; |
101 | ASN1_CTX c; | ||
107 | 102 | ||
108 | M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE); | 103 | M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE); |
109 | M_ASN1_New(ret->version,ASN1_INTEGER_new); | 104 | M_ASN1_New(ret->version,ASN1_INTEGER_new); |
110 | M_ASN1_New(ret->recipientinfo,sk_new_null); | 105 | M_ASN1_New(ret->recipientinfo,sk_PKCS7_RECIP_INFO_new_null); |
111 | M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); | 106 | M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); |
112 | return(ret); | 107 | return(ret); |
113 | M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW); | 108 | M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW); |
114 | } | 109 | } |
115 | 110 | ||
116 | void PKCS7_ENVELOPE_free(a) | 111 | void PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *a) |
117 | PKCS7_ENVELOPE *a; | ||
118 | { | 112 | { |
119 | if (a == NULL) return; | 113 | if (a == NULL) return; |
120 | ASN1_INTEGER_free(a->version); | 114 | ASN1_INTEGER_free(a->version); |
121 | sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); | 115 | sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); |
122 | PKCS7_ENC_CONTENT_free(a->enc_data); | 116 | PKCS7_ENC_CONTENT_free(a->enc_data); |
123 | Free((char *)a); | 117 | Free((char *)a); |
124 | } | 118 | } |