Lines Matching refs:ca
91 struct cafile_parser *ca = ctx; in append_dn() local
93 if(ca->err != CURLE_OK || !ca->in_cert) in append_dn()
95 if(sizeof(ca->dn) - ca->dn_len < len) { in append_dn()
96 ca->err = CURLE_FAILED_INIT; in append_dn()
99 memcpy(ca->dn + ca->dn_len, buf, len); in append_dn()
100 ca->dn_len += len; in append_dn()
105 struct cafile_parser *ca = ctx; in x509_push() local
107 if(ca->in_cert) in x509_push()
108 br_x509_decoder_push(&ca->xc, buf, len); in x509_push()
115 struct cafile_parser ca; in load_cafile() local
140 ca.err = CURLE_OK; in load_cafile()
141 ca.in_cert = FALSE; in load_cafile()
142 ca.anchors = NULL; in load_cafile()
143 ca.anchors_len = 0; in load_cafile()
145 br_pem_decoder_setdest(&pc, x509_push, &ca); in load_cafile()
159 if(ca.err) in load_cafile()
171 br_x509_decoder_init(&ca.xc, append_dn, &ca); in load_cafile()
172 ca.in_cert = TRUE; in load_cafile()
173 ca.dn_len = 0; in load_cafile()
176 if(!ca.in_cert) in load_cafile()
178 ca.in_cert = FALSE; in load_cafile()
179 if(br_x509_decoder_last_error(&ca.xc)) { in load_cafile()
180 ca.err = CURLE_SSL_CACERT_BADFILE; in load_cafile()
184 if(ca.anchors_len == SIZE_MAX / sizeof(ca.anchors[0])) { in load_cafile()
185 ca.err = CURLE_OUT_OF_MEMORY; in load_cafile()
188 new_anchors_len = ca.anchors_len + 1; in load_cafile()
189 new_anchors = realloc(ca.anchors, in load_cafile()
190 new_anchors_len * sizeof(ca.anchors[0])); in load_cafile()
192 ca.err = CURLE_OUT_OF_MEMORY; in load_cafile()
195 ca.anchors = new_anchors; in load_cafile()
196 ca.anchors_len = new_anchors_len; in load_cafile()
197 ta = &ca.anchors[ca.anchors_len - 1]; in load_cafile()
200 if(br_x509_decoder_isCA(&ca.xc)) in load_cafile()
202 pkey = br_x509_decoder_get_pkey(&ca.xc); in load_cafile()
204 ca.err = CURLE_SSL_CACERT_BADFILE; in load_cafile()
210 ta_size = ca.dn_len; in load_cafile()
219 ca.err = CURLE_FAILED_INIT; in load_cafile()
226 ca.err = CURLE_OUT_OF_MEMORY; in load_cafile()
229 memcpy(ta->dn.data, ca.dn, ca.dn_len); in load_cafile()
230 ta->dn.len = ca.dn_len; in load_cafile()
245 ca.err = CURLE_SSL_CACERT_BADFILE; in load_cafile()
251 ca.err = CURLE_READ_ERROR; in load_cafile()
252 else if(ca.in_cert) in load_cafile()
253 ca.err = CURLE_SSL_CACERT_BADFILE; in load_cafile()
258 if(ca.err == CURLE_OK) { in load_cafile()
259 *anchors = ca.anchors; in load_cafile()
260 *anchors_len = ca.anchors_len; in load_cafile()
263 for(i = 0; i < ca.anchors_len; ++i) in load_cafile()
264 free(ca.anchors[i].dn.data); in load_cafile()
265 free(ca.anchors); in load_cafile()
268 return ca.err; in load_cafile()