diff options
author | jsing <> | 2019-08-11 10:15:30 +0000 |
---|---|---|
committer | jsing <> | 2019-08-11 10:15:30 +0000 |
commit | aa695fbdbecb8a63a9f0f512222e04a0be2b9734 (patch) | |
tree | a038b26f2da29ed31383201d4852270882e9961e /src/lib/libcrypto/cms/cms_io.c | |
parent | fa447988cd063cd304b8a827bbc5ad99dea4a159 (diff) | |
download | openbsd-aa695fbdbecb8a63a9f0f512222e04a0be2b9734.tar.gz openbsd-aa695fbdbecb8a63a9f0f512222e04a0be2b9734.tar.bz2 openbsd-aa695fbdbecb8a63a9f0f512222e04a0be2b9734.zip |
Expand ASN.1 macros.
Diffstat (limited to 'src/lib/libcrypto/cms/cms_io.c')
-rw-r--r-- | src/lib/libcrypto/cms/cms_io.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/src/lib/libcrypto/cms/cms_io.c b/src/lib/libcrypto/cms/cms_io.c index 5528ca04be..6eba856867 100644 --- a/src/lib/libcrypto/cms/cms_io.c +++ b/src/lib/libcrypto/cms/cms_io.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_io.c,v 1.9 2019/08/10 18:15:52 jsing Exp $ */ | 1 | /* $OpenBSD: cms_io.c,v 1.10 2019/08/11 10:15:30 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -82,22 +82,49 @@ CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) | |||
82 | CMS_ContentInfo * | 82 | CMS_ContentInfo * |
83 | d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms) | 83 | d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms) |
84 | { | 84 | { |
85 | return ASN1_item_d2i_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms); | 85 | return ASN1_item_d2i_bio(&CMS_ContentInfo_it, bp, cms); |
86 | } | 86 | } |
87 | 87 | ||
88 | int | 88 | int |
89 | i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms) | 89 | i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms) |
90 | { | 90 | { |
91 | return ASN1_item_i2d_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms); | 91 | return ASN1_item_i2d_bio(&CMS_ContentInfo_it, bp, cms); |
92 | } | 92 | } |
93 | 93 | ||
94 | IMPLEMENT_PEM_rw_const(CMS, CMS_ContentInfo, PEM_STRING_CMS, CMS_ContentInfo) | 94 | |
95 | CMS_ContentInfo * | ||
96 | PEM_read_bio_CMS(BIO *bp, CMS_ContentInfo **x, pem_password_cb *cb, void *u) | ||
97 | { | ||
98 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_CMS_ContentInfo, PEM_STRING_CMS, bp, | ||
99 | (void **)x, cb, u); | ||
100 | } | ||
101 | |||
102 | CMS_ContentInfo * | ||
103 | PEM_read_CMS(FILE *fp, CMS_ContentInfo **x, pem_password_cb *cb, void *u) | ||
104 | { | ||
105 | return PEM_ASN1_read((d2i_of_void *)d2i_CMS_ContentInfo, PEM_STRING_CMS, fp, | ||
106 | (void **)x, cb, u); | ||
107 | } | ||
108 | |||
109 | int | ||
110 | PEM_write_bio_CMS(BIO *bp, const CMS_ContentInfo *x) | ||
111 | { | ||
112 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_CMS_ContentInfo, PEM_STRING_CMS, bp, | ||
113 | (void *)x, NULL, NULL, 0, NULL, NULL); | ||
114 | } | ||
115 | |||
116 | int | ||
117 | PEM_write_CMS(FILE *fp, const CMS_ContentInfo *x) | ||
118 | { | ||
119 | return PEM_ASN1_write((i2d_of_void *)i2d_CMS_ContentInfo, PEM_STRING_CMS, fp, | ||
120 | (void *)x, NULL, NULL, 0, NULL, NULL); | ||
121 | } | ||
95 | 122 | ||
96 | BIO * | 123 | BIO * |
97 | BIO_new_CMS(BIO *out, CMS_ContentInfo *cms) | 124 | BIO_new_CMS(BIO *out, CMS_ContentInfo *cms) |
98 | { | 125 | { |
99 | return BIO_new_NDEF(out, (ASN1_VALUE *)cms, | 126 | return BIO_new_NDEF(out, (ASN1_VALUE *)cms, |
100 | ASN1_ITEM_rptr(CMS_ContentInfo)); | 127 | &CMS_ContentInfo_it); |
101 | } | 128 | } |
102 | 129 | ||
103 | /* CMS wrappers round generalised stream and MIME routines */ | 130 | /* CMS wrappers round generalised stream and MIME routines */ |
@@ -105,14 +132,14 @@ BIO_new_CMS(BIO *out, CMS_ContentInfo *cms) | |||
105 | int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) | 132 | int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) |
106 | { | 133 | { |
107 | return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)cms, in, flags, | 134 | return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)cms, in, flags, |
108 | ASN1_ITEM_rptr(CMS_ContentInfo)); | 135 | &CMS_ContentInfo_it); |
109 | } | 136 | } |
110 | 137 | ||
111 | int | 138 | int |
112 | PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) | 139 | PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) |
113 | { | 140 | { |
114 | return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *)cms, in, flags, | 141 | return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *)cms, in, flags, |
115 | "CMS", ASN1_ITEM_rptr(CMS_ContentInfo)); | 142 | "CMS", &CMS_ContentInfo_it); |
116 | } | 143 | } |
117 | 144 | ||
118 | int | 145 | int |
@@ -128,12 +155,12 @@ SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags) | |||
128 | mdalgs = NULL; | 155 | mdalgs = NULL; |
129 | 156 | ||
130 | return SMIME_write_ASN1(bio, (ASN1_VALUE *)cms, data, flags, ctype_nid, | 157 | return SMIME_write_ASN1(bio, (ASN1_VALUE *)cms, data, flags, ctype_nid, |
131 | econt_nid, mdalgs, ASN1_ITEM_rptr(CMS_ContentInfo)); | 158 | econt_nid, mdalgs, &CMS_ContentInfo_it); |
132 | } | 159 | } |
133 | 160 | ||
134 | CMS_ContentInfo * | 161 | CMS_ContentInfo * |
135 | SMIME_read_CMS(BIO *bio, BIO **bcont) | 162 | SMIME_read_CMS(BIO *bio, BIO **bcont) |
136 | { | 163 | { |
137 | return (CMS_ContentInfo *)SMIME_read_ASN1(bio, bcont, | 164 | return (CMS_ContentInfo *)SMIME_read_ASN1(bio, bcont, |
138 | ASN1_ITEM_rptr(CMS_ContentInfo)); | 165 | &CMS_ContentInfo_it); |
139 | } | 166 | } |