Lines Matching refs:crl

20 static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
28 static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r);
29 static int def_crl_lookup(X509_CRL *crl,
82 static int crl_set_issuers(X509_CRL *crl)
89 revoked = X509_CRL_get_REVOKED(crl);
101 crl->flags |= EXFLAG_INVALID;
106 if (crl->issuers == NULL) {
107 crl->issuers = sk_GENERAL_NAMES_new_null();
108 if (crl->issuers == NULL) {
113 if (!sk_GENERAL_NAMES_push(crl->issuers, gtmp)) {
123 crl->flags |= EXFLAG_INVALID;
143 crl->flags |= EXFLAG_CRITICAL;
161 X509_CRL *crl = (X509_CRL *)*pval; in crl_cb() local
168 if (crl->meth->crl_free) { in crl_cb()
169 if (!crl->meth->crl_free(crl)) in crl_cb()
172 AUTHORITY_KEYID_free(crl->akid); in crl_cb()
173 ISSUING_DIST_POINT_free(crl->idp); in crl_cb()
174 ASN1_INTEGER_free(crl->crl_number); in crl_cb()
175 ASN1_INTEGER_free(crl->base_crl_number); in crl_cb()
176 sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free); in crl_cb()
180 crl->idp = NULL; in crl_cb()
181 crl->akid = NULL; in crl_cb()
182 crl->flags = 0; in crl_cb()
183 crl->idp_flags = 0; in crl_cb()
184 crl->idp_reasons = CRLDP_ALL_REASONS; in crl_cb()
185 crl->meth = default_crl_method; in crl_cb()
186 crl->meth_data = NULL; in crl_cb()
187 crl->issuers = NULL; in crl_cb()
188 crl->crl_number = NULL; in crl_cb()
189 crl->base_crl_number = NULL; in crl_cb()
193 if (!X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL)) in crl_cb()
194 crl->flags |= EXFLAG_NO_FINGERPRINT; in crl_cb()
195 crl->idp = X509_CRL_get_ext_d2i(crl, in crl_cb()
198 if (crl->idp != NULL) { in crl_cb()
199 if (!setup_idp(crl, crl->idp)) in crl_cb()
200 crl->flags |= EXFLAG_INVALID; in crl_cb()
203 crl->flags |= EXFLAG_INVALID; in crl_cb()
206 crl->akid = X509_CRL_get_ext_d2i(crl, in crl_cb()
209 if (crl->akid == NULL && i != -1) in crl_cb()
210 crl->flags |= EXFLAG_INVALID; in crl_cb()
212 crl->crl_number = X509_CRL_get_ext_d2i(crl, in crl_cb()
214 if (crl->crl_number == NULL && i != -1) in crl_cb()
215 crl->flags |= EXFLAG_INVALID; in crl_cb()
217 crl->base_crl_number = X509_CRL_get_ext_d2i(crl, in crl_cb()
220 if (crl->base_crl_number == NULL && i != -1) in crl_cb()
221 crl->flags |= EXFLAG_INVALID; in crl_cb()
223 if (crl->base_crl_number && !crl->crl_number) in crl_cb()
224 crl->flags |= EXFLAG_INVALID; in crl_cb()
233 exts = crl->crl.extensions; in crl_cb()
240 crl->flags |= EXFLAG_FRESHEST; in crl_cb()
247 crl->flags |= EXFLAG_CRITICAL; in crl_cb()
252 if (!crl_set_issuers(crl)) in crl_cb()
255 if (crl->meth->crl_init) { in crl_cb()
256 if (crl->meth->crl_init(crl) == 0) in crl_cb()
260 crl->flags |= EXFLAG_SET; in crl_cb()
264 if (crl->meth != NULL && crl->meth->crl_free != NULL) { in crl_cb()
265 if (!crl->meth->crl_free(crl)) in crl_cb()
268 AUTHORITY_KEYID_free(crl->akid); in crl_cb()
269 ISSUING_DIST_POINT_free(crl->idp); in crl_cb()
270 ASN1_INTEGER_free(crl->crl_number); in crl_cb()
271 ASN1_INTEGER_free(crl->base_crl_number); in crl_cb()
272 sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free); in crl_cb()
273 OPENSSL_free(crl->propq); in crl_cb()
279 if (!ossl_x509_crl_set0_libctx(crl, old->libctx, old->propq)) in crl_cb()
289 static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp) in setup_idp() argument
294 crl->idp_flags |= IDP_PRESENT; in setup_idp()
297 crl->idp_flags |= IDP_ONLYUSER; in setup_idp()
301 crl->idp_flags |= IDP_ONLYCA; in setup_idp()
305 crl->idp_flags |= IDP_ONLYATTR; in setup_idp()
309 crl->idp_flags |= IDP_INVALID; in setup_idp()
312 crl->idp_flags |= IDP_INDIRECT; in setup_idp()
315 crl->idp_flags |= IDP_REASONS; in setup_idp()
317 crl->idp_reasons = idp->onlysomereasons->data[0]; in setup_idp()
319 crl->idp_reasons |= (idp->onlysomereasons->data[1] << 8); in setup_idp()
320 crl->idp_reasons &= CRLDP_ALL_REASONS; in setup_idp()
323 return DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl)); in setup_idp()
327 ASN1_EMBED(X509_CRL, crl, X509_CRL_INFO),
351 X509_CRL *crl = NULL; in X509_CRL_new_ex() local
353 crl = (X509_CRL *)ASN1_item_new((X509_CRL_it())); in X509_CRL_new_ex()
354 if (!ossl_x509_crl_set0_libctx(crl, libctx, propq)) { in X509_CRL_new_ex()
355 X509_CRL_free(crl); in X509_CRL_new_ex()
356 crl = NULL; in X509_CRL_new_ex()
358 return crl; in X509_CRL_new_ex()
361 int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) in X509_CRL_add0_revoked() argument
365 inf = &crl->crl; in X509_CRL_add0_revoked()
376 int X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r) in X509_CRL_verify() argument
378 if (crl->meth->crl_verify) in X509_CRL_verify()
379 return crl->meth->crl_verify(crl, r); in X509_CRL_verify()
383 int X509_CRL_get0_by_serial(X509_CRL *crl, in X509_CRL_get0_by_serial() argument
386 if (crl->meth->crl_lookup) in X509_CRL_get0_by_serial()
387 return crl->meth->crl_lookup(crl, ret, serial, NULL); in X509_CRL_get0_by_serial()
391 int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x) in X509_CRL_get0_by_cert() argument
393 if (crl->meth->crl_lookup) in X509_CRL_get0_by_cert()
394 return crl->meth->crl_lookup(crl, ret, in X509_CRL_get0_by_cert()
400 static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r) in def_crl_verify() argument
403 &crl->sig_alg, &crl->signature, &crl->crl, NULL, in def_crl_verify()
404 r, crl->libctx, crl->propq); in def_crl_verify()
407 static int crl_revoked_issuer_match(X509_CRL *crl, const X509_NAME *nm, in crl_revoked_issuer_match() argument
415 if (!X509_NAME_cmp(nm, X509_CRL_get_issuer(crl))) in crl_revoked_issuer_match()
421 nm = X509_CRL_get_issuer(crl); in crl_revoked_issuer_match()
434 static int def_crl_lookup(X509_CRL *crl, in def_crl_lookup() argument
441 if (crl->crl.revoked == NULL) in def_crl_lookup()
448 if (!sk_X509_REVOKED_is_sorted(crl->crl.revoked)) { in def_crl_lookup()
449 if (!CRYPTO_THREAD_write_lock(crl->lock)) in def_crl_lookup()
451 sk_X509_REVOKED_sort(crl->crl.revoked); in def_crl_lookup()
452 CRYPTO_THREAD_unlock(crl->lock); in def_crl_lookup()
455 idx = sk_X509_REVOKED_find(crl->crl.revoked, &rtmp); in def_crl_lookup()
459 for (num = sk_X509_REVOKED_num(crl->crl.revoked); idx < num; idx++) { in def_crl_lookup()
460 rev = sk_X509_REVOKED_value(crl->crl.revoked, idx); in def_crl_lookup()
463 if (crl_revoked_issuer_match(crl, issuer, rev)) { in def_crl_lookup()
482 X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), in X509_CRL_METHOD_new() argument
483 int (*crl_free) (X509_CRL *crl), in X509_CRL_METHOD_new()
484 int (*crl_lookup) (X509_CRL *crl, in X509_CRL_METHOD_new()
488 int (*crl_verify) (X509_CRL *crl, in X509_CRL_METHOD_new()
510 void X509_CRL_set_meth_data(X509_CRL *crl, void *dat) in X509_CRL_set_meth_data() argument
512 crl->meth_data = dat; in X509_CRL_set_meth_data()
515 void *X509_CRL_get_meth_data(X509_CRL *crl) in X509_CRL_get_meth_data() argument
517 return crl->meth_data; in X509_CRL_get_meth_data()