summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/bio_ndef.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/asn1/bio_ndef.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c
index 595e6471c2..f00d38e5e4 100644
--- a/src/lib/libcrypto/asn1/bio_ndef.c
+++ b/src/lib/libcrypto/asn1/bio_ndef.c
@@ -10,7 +10,7 @@
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 14 *
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in 16 * notice, this list of conditions and the following disclaimer in
@@ -78,8 +78,7 @@
78 78
79/* BIO support data stored in the ASN1 BIO ex_arg */ 79/* BIO support data stored in the ASN1 BIO ex_arg */
80 80
81typedef struct ndef_aux_st 81typedef struct ndef_aux_st {
82{
83 /* ASN1 structure this BIO refers to */ 82 /* ASN1 structure this BIO refers to */
84 ASN1_VALUE *val; 83 ASN1_VALUE *val;
85 const ASN1_ITEM *it; 84 const ASN1_ITEM *it;
@@ -98,7 +97,8 @@ static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg)
98static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg); 97static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg);
99static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg); 98static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg);
100 99
101BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) 100BIO *
101BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
102{ 102{
103 NDEF_SUPPORT *ndef_aux = NULL; 103 NDEF_SUPPORT *ndef_aux = NULL;
104 BIO *asn_bio = NULL; 104 BIO *asn_bio = NULL;
@@ -143,7 +143,7 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
143 143
144 return sarg.ndef_bio; 144 return sarg.ndef_bio;
145 145
146 err: 146err:
147 if (asn_bio) 147 if (asn_bio)
148 BIO_free(asn_bio); 148 BIO_free(asn_bio);
149 if (ndef_aux) 149 if (ndef_aux)
@@ -151,7 +151,8 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
151 return NULL; 151 return NULL;
152} 152}
153 153
154static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg) 154static int
155ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
155{ 156{
156 NDEF_SUPPORT *ndef_aux; 157 NDEF_SUPPORT *ndef_aux;
157 unsigned char *p; 158 unsigned char *p;
@@ -176,7 +177,8 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
176 return 1; 177 return 1;
177} 178}
178 179
179static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) 180static int
181ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg)
180{ 182{
181 NDEF_SUPPORT *ndef_aux; 183 NDEF_SUPPORT *ndef_aux;
182 184
@@ -194,7 +196,8 @@ static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg)
194 return 1; 196 return 1;
195} 197}
196 198
197static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) 199static int
200ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg)
198{ 201{
199 NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg; 202 NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg;
200 if (!ndef_prefix_free(b, pbuf, plen, parg)) 203 if (!ndef_prefix_free(b, pbuf, plen, parg))
@@ -204,7 +207,8 @@ static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg)
204 return 1; 207 return 1;
205} 208}
206 209
207static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg) 210static int
211ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
208{ 212{
209 NDEF_SUPPORT *ndef_aux; 213 NDEF_SUPPORT *ndef_aux;
210 unsigned char *p; 214 unsigned char *p;
@@ -224,7 +228,7 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
224 sarg.out = ndef_aux->out; 228 sarg.out = ndef_aux->out;
225 sarg.boundary = ndef_aux->boundary; 229 sarg.boundary = ndef_aux->boundary;
226 if (aux->asn1_cb(ASN1_OP_STREAM_POST, 230 if (aux->asn1_cb(ASN1_OP_STREAM_POST,
227 &ndef_aux->val, ndef_aux->it, &sarg) <= 0) 231 &ndef_aux->val, ndef_aux->it, &sarg) <= 0)
228 return 0; 232 return 0;
229 233
230 derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); 234 derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);