diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/bio_ndef.c')
-rw-r--r-- | src/lib/libcrypto/asn1/bio_ndef.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c index 60f324bdae..b8dc80a7b2 100644 --- a/src/lib/libcrypto/asn1/bio_ndef.c +++ b/src/lib/libcrypto/asn1/bio_ndef.c | |||
@@ -79,7 +79,7 @@ | |||
79 | /* BIO support data stored in the ASN1 BIO ex_arg */ | 79 | /* BIO support data stored in the ASN1 BIO ex_arg */ |
80 | 80 | ||
81 | typedef struct ndef_aux_st | 81 | typedef struct ndef_aux_st |
82 | { | 82 | { |
83 | /* ASN1 structure this BIO refers to */ | 83 | /* ASN1 structure this BIO refers to */ |
84 | ASN1_VALUE *val; | 84 | ASN1_VALUE *val; |
85 | const ASN1_ITEM *it; | 85 | const ASN1_ITEM *it; |
@@ -91,7 +91,7 @@ typedef struct ndef_aux_st | |||
91 | unsigned char **boundary; | 91 | unsigned char **boundary; |
92 | /* DER buffer start */ | 92 | /* DER buffer start */ |
93 | unsigned char *derbuf; | 93 | unsigned char *derbuf; |
94 | } NDEF_SUPPORT; | 94 | } NDEF_SUPPORT; |
95 | 95 | ||
96 | static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg); | 96 | static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg); |
97 | static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg); | 97 | static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg); |
@@ -99,17 +99,17 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg); | |||
99 | static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg); | 99 | static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg); |
100 | 100 | ||
101 | BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | 101 | BIO *BIO_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; |
105 | const ASN1_AUX *aux = it->funcs; | 105 | const ASN1_AUX *aux = it->funcs; |
106 | ASN1_STREAM_ARG sarg; | 106 | ASN1_STREAM_ARG sarg; |
107 | 107 | ||
108 | if (!aux || !aux->asn1_cb) | 108 | if (!aux || !aux->asn1_cb) |
109 | { | 109 | { |
110 | ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED); | 110 | ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED); |
111 | return NULL; | 111 | return NULL; |
112 | } | 112 | } |
113 | ndef_aux = malloc(sizeof(NDEF_SUPPORT)); | 113 | ndef_aux = malloc(sizeof(NDEF_SUPPORT)); |
114 | asn_bio = BIO_new(BIO_f_asn1()); | 114 | asn_bio = BIO_new(BIO_f_asn1()); |
115 | 115 | ||
@@ -150,10 +150,10 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
150 | if (ndef_aux) | 150 | if (ndef_aux) |
151 | free(ndef_aux); | 151 | free(ndef_aux); |
152 | return NULL; | 152 | return NULL; |
153 | } | 153 | } |
154 | 154 | ||
155 | static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg) | 155 | static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg) |
156 | { | 156 | { |
157 | NDEF_SUPPORT *ndef_aux; | 157 | NDEF_SUPPORT *ndef_aux; |
158 | unsigned char *p; | 158 | unsigned char *p; |
159 | int derlen; | 159 | int derlen; |
@@ -175,10 +175,10 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
175 | *plen = *ndef_aux->boundary - *pbuf; | 175 | *plen = *ndef_aux->boundary - *pbuf; |
176 | 176 | ||
177 | return 1; | 177 | return 1; |
178 | } | 178 | } |
179 | 179 | ||
180 | static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | 180 | static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) |
181 | { | 181 | { |
182 | NDEF_SUPPORT *ndef_aux; | 182 | NDEF_SUPPORT *ndef_aux; |
183 | 183 | ||
184 | if (!parg) | 184 | if (!parg) |
@@ -193,20 +193,20 @@ static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
193 | *pbuf = NULL; | 193 | *pbuf = NULL; |
194 | *plen = 0; | 194 | *plen = 0; |
195 | return 1; | 195 | return 1; |
196 | } | 196 | } |
197 | 197 | ||
198 | static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | 198 | static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) |
199 | { | 199 | { |
200 | NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg; | 200 | NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg; |
201 | if (!ndef_prefix_free(b, pbuf, plen, parg)) | 201 | if (!ndef_prefix_free(b, pbuf, plen, parg)) |
202 | return 0; | 202 | return 0; |
203 | free(*pndef_aux); | 203 | free(*pndef_aux); |
204 | *pndef_aux = NULL; | 204 | *pndef_aux = NULL; |
205 | return 1; | 205 | return 1; |
206 | } | 206 | } |
207 | 207 | ||
208 | static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg) | 208 | static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg) |
209 | { | 209 | { |
210 | NDEF_SUPPORT *ndef_aux; | 210 | NDEF_SUPPORT *ndef_aux; |
211 | unsigned char *p; | 211 | unsigned char *p; |
212 | int derlen; | 212 | int derlen; |
@@ -240,4 +240,4 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
240 | *plen = derlen - (*ndef_aux->boundary - ndef_aux->derbuf); | 240 | *plen = derlen - (*ndef_aux->boundary - ndef_aux->derbuf); |
241 | 241 | ||
242 | return 1; | 242 | return 1; |
243 | } | 243 | } |