static void setup_dp(X509 *x, DIST_POINT *dp) { X509_NAME *iname = NULL; int i; if (dp->reasons) { if (dp->reasons->length > 0) dp->dp_reasons = dp->reasons->data[0]; if (dp->reasons->length > 1) dp->dp_reasons |= (dp->reasons->data[1] << 8); dp->dp_reasons &= CRLDP_ALL_REASONS; } else dp->dp_reasons = CRLDP_ALL_REASONS; if (!dp->distpoint || (dp->distpoint->type != 1)) return; for (i = 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++) { GENERAL_NAME *gen = sk_GENERAL_NAME_value(dp->CRLissuer, i); if (gen->type == GEN_DIRNAME) { iname = gen->d.directoryName; break; } } if (!iname) iname = X509_get_issuer_name(x); DIST_POINT_set_dpname(dp->distpoint, iname); }
static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp) { int idp_only = 0; /* Set various flags according to IDP */ crl->idp_flags |= IDP_PRESENT; if (idp->onlyuser > 0) { idp_only++; crl->idp_flags |= IDP_ONLYUSER; } if (idp->onlyCA > 0) { idp_only++; crl->idp_flags |= IDP_ONLYCA; } if (idp->onlyattr > 0) { idp_only++; crl->idp_flags |= IDP_ONLYATTR; } if (idp_only > 1) crl->idp_flags |= IDP_INVALID; if (idp->indirectCRL > 0) crl->idp_flags |= IDP_INDIRECT; if (idp->onlysomereasons) { crl->idp_flags |= IDP_REASONS; if (idp->onlysomereasons->length > 0) crl->idp_reasons = idp->onlysomereasons->data[0]; if (idp->onlysomereasons->length > 1) crl->idp_reasons |= (idp->onlysomereasons->data[1] << 8); crl->idp_reasons &= CRLDP_ALL_REASONS; } DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl)); }