72 #ifndef OPENSSL_NO_RFC3779
106 static
int i2r_ASIdentifierChoice(
BIO *out,
116 switch (choice->type) {
118 BIO_printf(out,
"%*sinherit\n", indent + 2,
"");
127 BIO_printf(out,
"%*s%s\n", indent + 2,
"", s);
160 return (i2r_ASIdentifierChoice(out, asid->
asnum, indent,
161 "Autonomous System Numbers") &&
162 i2r_ASIdentifierChoice(out, asid->
rdi, indent,
163 "Routing Domain Identifiers"));
169 static int ASIdOrRange_cmp(
const ASIdOrRange *
const *a_,
180 b->u.range->min != NULL && b->u.range->max != NULL));
206 choice = &asid->
asnum;
214 if (*choice == NULL) {
215 if ((*choice = ASIdentifierChoice_new()) == NULL)
218 if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL)
239 choice = &asid->
asnum;
249 if (*choice == NULL) {
250 if ((*choice = ASIdentifierChoice_new()) == NULL)
254 if ((*choice)->u.asIdsOrRanges == NULL)
258 if ((aor = ASIdOrRange_new()) == NULL)
265 if ((aor->
u.
range = ASRange_new()) == NULL)
277 ASIdOrRange_free(aor);
331 extract_min_max(a, &a_min, &a_max);
332 extract_min_max(b, &b_min, &b_max);
345 if ((bn == NULL && (bn =
BN_new()) == NULL) ||
369 extract_min_max(a, &a_min, &a_max);
378 ASN1_INTEGER_free(a_max_plus_one);
388 return (asid == NULL ||
389 (ASIdentifierChoice_is_canonical(asid->
asnum) &&
390 ASIdentifierChoice_is_canonical(asid->
rdi)));
432 extract_min_max(a, &a_min, &a_max);
433 extract_min_max(b, &b_min, &b_max);
459 if ((bn == NULL && (bn =
BN_new()) == NULL) ||
512 extract_min_max(a, &a_min, &a_max);
523 ASN1_INTEGER_free(a_max_plus_one);
533 return (asid == NULL ||
534 (ASIdentifierChoice_canonize(asid->
asnum) &&
535 ASIdentifierChoice_canonize(asid->
rdi)));
541 static void *v2i_ASIdentifiers(
const struct v3_ext_method *method,
549 if ((asid = ASIdentifiers_new()) == NULL) {
556 int i1, i2, i3, is_range, which;
574 if (!strcmp(val->
value,
"inherit")) {
585 i1 = strspn(val->
value,
"0123456789");
586 if (val->
value[i1] ==
'\0') {
590 i2 = i1 + strspn(val->
value + i1,
" \t");
591 if (val->
value[i2] !=
'-') {
597 i2 = i2 + strspn(val->
value + i2,
" \t");
598 i3 = i2 + strspn(val->
value + i2,
"0123456789");
599 if (val->
value[i3] !=
'\0') {
624 if (min == NULL || max == NULL) {
648 ASIdentifiers_free(asid);
649 ASN1_INTEGER_free(min);
650 ASN1_INTEGER_free(max);
676 return (asid != NULL &&
677 ((asid->
asnum != NULL &&
679 (asid->
rdi != NULL &&
686 static int asid_contains(ASIdOrRanges *parent, ASIdOrRanges *child)
691 if (child == NULL || parent == child)
733 #define validation_err(_err_) \
736 ctx->error = _err_; \
737 ctx->error_depth = i; \
738 ctx->current_cert = x; \
739 ret = ctx->verify_cb(0, ctx); \
754 ASIdOrRanges *child_as = NULL, *child_rdi = NULL;
755 int i, ret = 1, inherit_as = 0, inherit_rdi = 0;
779 if (ext->
asnum != NULL) {
789 if (ext->
rdi != NULL) {
808 if (child_as != NULL || child_rdi != NULL)
863 #undef validation_err
870 return v3_asid_validate_path_internal(ctx, ctx->chain, NULL);
879 int allow_inheritance)
887 return v3_asid_validate_path_internal(NULL, chain, ext);