void hx509_ca_tbs_free(hx509_ca_tbs *tbs) { if (tbs == NULL || *tbs == NULL) return; free_SubjectPublicKeyInfo(&(*tbs)->spki); free_GeneralNames(&(*tbs)->san); free_ExtKeyUsage(&(*tbs)->eku); der_free_heim_integer(&(*tbs)->serial); free_CRLDistributionPoints(&(*tbs)->crldp); hx509_name_free(&(*tbs)->subject); memset(*tbs, 0, sizeof(**tbs)); free(*tbs); *tbs = NULL; }
void hx509_ca_tbs_free(hx509_ca_tbs *tbs) { if (tbs == NULL || *tbs == NULL) return; free_SubjectPublicKeyInfo(&(*tbs)->spki); free_GeneralNames(&(*tbs)->san); free_ExtKeyUsage(&(*tbs)->eku); der_free_heim_integer(&(*tbs)->serial); free_CRLDistributionPoints(&(*tbs)->crldp); der_free_bit_string(&(*tbs)->subjectUniqueID); der_free_bit_string(&(*tbs)->issuerUniqueID); hx509_name_free(&(*tbs)->subject); if ((*tbs)->sigalg) { free_AlgorithmIdentifier((*tbs)->sigalg); free((*tbs)->sigalg); } memset(*tbs, 0, sizeof(**tbs)); free(*tbs); *tbs = NULL; }
static int check_CRLDistributionPoints(hx509_validate_ctx ctx, struct cert_status *status, enum critical_flag cf, const Extension *e) { CRLDistributionPoints dp; size_t size; int ret, i; check_Null(ctx, status, cf, e); ret = decode_CRLDistributionPoints(e->extnValue.data, e->extnValue.length, &dp, &size); if (ret) { validate_print(ctx, HX509_VALIDATE_F_VALIDATE, "Decoding CRL Distribution Points failed: %d\n", ret); return 1; } validate_print(ctx, HX509_VALIDATE_F_VERBOSE, "CRL Distribution Points:\n"); for (i = 0 ; i < dp.len; i++) { if (dp.val[i].distributionPoint) { DistributionPointName dpname; heim_any *data = dp.val[i].distributionPoint; int j; ret = decode_DistributionPointName(data->data, data->length, &dpname, NULL); if (ret) { validate_print(ctx, HX509_VALIDATE_F_VALIDATE, "Failed to parse CRL Distribution Point Name: %d\n", ret); continue; } switch (dpname.element) { case choice_DistributionPointName_fullName: validate_print(ctx, HX509_VALIDATE_F_VERBOSE, "Fullname:\n"); for (j = 0 ; j < dpname.u.fullName.len; j++) { char *s; GeneralName *name = &dpname.u.fullName.val[j]; ret = hx509_general_name_unparse(name, &s); if (ret == 0 && s != NULL) { validate_print(ctx, HX509_VALIDATE_F_VERBOSE, " %s\n", s); free(s); } } break; case choice_DistributionPointName_nameRelativeToCRLIssuer: validate_print(ctx, HX509_VALIDATE_F_VERBOSE, "Unknown nameRelativeToCRLIssuer"); break; default: validate_print(ctx, HX509_VALIDATE_F_VALIDATE, "Unknown DistributionPointName"); break; } free_DistributionPointName(&dpname); } } free_CRLDistributionPoints(&dp); status->haveCRLDP = 1; return 0; }