2 * Copyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 * Implementation of RFC 3779 section 3.2.
17 #include "internal/cryptlib.h"
18 #include <openssl/conf.h>
19 #include <openssl/asn1.h>
20 #include <openssl/asn1t.h>
21 #include <openssl/x509v3.h>
22 #include <openssl/x509.h>
23 #include "crypto/x509.h"
24 #include <openssl/bn.h>
26 #include "x509_local.h"
28 #ifndef OPENSSL_NO_RFC3779
31 * OpenSSL ASN.1 template translation of RFC 3779 3.2.3.
34 ASN1_SEQUENCE(ASRange) = {
35 ASN1_SIMPLE(ASRange, min, ASN1_INTEGER),
36 ASN1_SIMPLE(ASRange, max, ASN1_INTEGER)
37 } ASN1_SEQUENCE_END(ASRange)
39 ASN1_CHOICE(ASIdOrRange) = {
40 ASN1_SIMPLE(ASIdOrRange, u.id, ASN1_INTEGER),
41 ASN1_SIMPLE(ASIdOrRange, u.range, ASRange)
42 } ASN1_CHOICE_END(ASIdOrRange)
44 ASN1_CHOICE(ASIdentifierChoice) = {
45 ASN1_SIMPLE(ASIdentifierChoice, u.inherit, ASN1_NULL),
46 ASN1_SEQUENCE_OF(ASIdentifierChoice, u.asIdsOrRanges, ASIdOrRange)
47 } ASN1_CHOICE_END(ASIdentifierChoice)
49 ASN1_SEQUENCE(ASIdentifiers) = {
50 ASN1_EXP_OPT(ASIdentifiers, asnum, ASIdentifierChoice, 0),
51 ASN1_EXP_OPT(ASIdentifiers, rdi, ASIdentifierChoice, 1)
52 } ASN1_SEQUENCE_END(ASIdentifiers)
54 IMPLEMENT_ASN1_FUNCTIONS(ASRange)
55 IMPLEMENT_ASN1_FUNCTIONS(ASIdOrRange)
56 IMPLEMENT_ASN1_FUNCTIONS(ASIdentifierChoice)
57 IMPLEMENT_ASN1_FUNCTIONS(ASIdentifiers)
60 * i2r method for an ASIdentifierChoice.
62 static int i2r_ASIdentifierChoice(BIO *out,
63 ASIdentifierChoice *choice,
64 int indent, const char *msg)
70 BIO_printf(out, "%*s%s:\n", indent, "", msg);
71 switch (choice->type) {
72 case ASIdentifierChoice_inherit:
73 BIO_printf(out, "%*sinherit\n", indent + 2, "");
75 case ASIdentifierChoice_asIdsOrRanges:
76 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges); i++) {
78 sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
81 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL)
83 BIO_printf(out, "%*s%s\n", indent + 2, "", s);
86 case ASIdOrRange_range:
87 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL)
89 BIO_printf(out, "%*s%s-", indent + 2, "", s);
91 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL)
93 BIO_printf(out, "%s\n", s);
108 * i2r method for an ASIdentifier extension.
110 static int i2r_ASIdentifiers(const X509V3_EXT_METHOD *method,
111 void *ext, BIO *out, int indent)
113 ASIdentifiers *asid = ext;
114 return (i2r_ASIdentifierChoice(out, asid->asnum, indent,
115 "Autonomous System Numbers") &&
116 i2r_ASIdentifierChoice(out, asid->rdi, indent,
117 "Routing Domain Identifiers"));
121 * Sort comparison function for a sequence of ASIdOrRange elements.
123 static int ASIdOrRange_cmp(const ASIdOrRange *const *a_,
124 const ASIdOrRange *const *b_)
126 const ASIdOrRange *a = *a_, *b = *b_;
128 assert((a->type == ASIdOrRange_id && a->u.id != NULL) ||
129 (a->type == ASIdOrRange_range && a->u.range != NULL &&
130 a->u.range->min != NULL && a->u.range->max != NULL));
132 assert((b->type == ASIdOrRange_id && b->u.id != NULL) ||
133 (b->type == ASIdOrRange_range && b->u.range != NULL &&
134 b->u.range->min != NULL && b->u.range->max != NULL));
136 if (a->type == ASIdOrRange_id && b->type == ASIdOrRange_id)
137 return ASN1_INTEGER_cmp(a->u.id, b->u.id);
139 if (a->type == ASIdOrRange_range && b->type == ASIdOrRange_range) {
140 int r = ASN1_INTEGER_cmp(a->u.range->min, b->u.range->min);
141 return r != 0 ? r : ASN1_INTEGER_cmp(a->u.range->max,
145 if (a->type == ASIdOrRange_id)
146 return ASN1_INTEGER_cmp(a->u.id, b->u.range->min);
148 return ASN1_INTEGER_cmp(a->u.range->min, b->u.id);
152 * Add an inherit element.
154 int X509v3_asid_add_inherit(ASIdentifiers *asid, int which)
156 ASIdentifierChoice **choice;
161 choice = &asid->asnum;
169 if (*choice == NULL) {
170 if ((*choice = ASIdentifierChoice_new()) == NULL)
172 if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL) {
173 ASIdentifierChoice_free(*choice);
177 (*choice)->type = ASIdentifierChoice_inherit;
179 return (*choice)->type == ASIdentifierChoice_inherit;
183 * Add an ID or range to an ASIdentifierChoice.
185 int X509v3_asid_add_id_or_range(ASIdentifiers *asid,
186 int which, ASN1_INTEGER *min, ASN1_INTEGER *max)
188 ASIdentifierChoice **choice;
194 choice = &asid->asnum;
202 if (*choice != NULL && (*choice)->type != ASIdentifierChoice_asIdsOrRanges)
204 if (*choice == NULL) {
205 if ((*choice = ASIdentifierChoice_new()) == NULL)
207 (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp);
208 if ((*choice)->u.asIdsOrRanges == NULL) {
209 ASIdentifierChoice_free(*choice);
213 (*choice)->type = ASIdentifierChoice_asIdsOrRanges;
215 if ((aor = ASIdOrRange_new()) == NULL)
217 if (!sk_ASIdOrRange_reserve((*choice)->u.asIdsOrRanges, 1))
220 aor->type = ASIdOrRange_id;
223 aor->type = ASIdOrRange_range;
224 if ((aor->u.range = ASRange_new()) == NULL)
226 ASN1_INTEGER_free(aor->u.range->min);
227 aor->u.range->min = min;
228 ASN1_INTEGER_free(aor->u.range->max);
229 aor->u.range->max = max;
231 /* Cannot fail due to the reservation above */
232 if (!ossl_assert(sk_ASIdOrRange_push((*choice)->u.asIdsOrRanges, aor)))
237 ASIdOrRange_free(aor);
242 * Extract min and max values from an ASIdOrRange.
244 static int extract_min_max(ASIdOrRange *aor,
245 ASN1_INTEGER **min, ASN1_INTEGER **max)
247 if (!ossl_assert(aor != NULL))
254 case ASIdOrRange_range:
255 *min = aor->u.range->min;
256 *max = aor->u.range->max;
264 * Check whether an ASIdentifierChoice is in canonical form.
266 static int ASIdentifierChoice_is_canonical(ASIdentifierChoice *choice)
268 ASN1_INTEGER *a_max_plus_one = NULL;
274 * Empty element or inheritance is canonical.
276 if (choice == NULL || choice->type == ASIdentifierChoice_inherit)
280 * If not a list, or if empty list, it's broken.
282 if (choice->type != ASIdentifierChoice_asIdsOrRanges ||
283 sk_ASIdOrRange_num(choice->u.asIdsOrRanges) == 0)
287 * It's a list, check it.
289 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1; i++) {
290 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
291 ASIdOrRange *b = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i + 1);
292 ASN1_INTEGER *a_min = NULL, *a_max = NULL, *b_min = NULL, *b_max =
295 if (!extract_min_max(a, &a_min, &a_max)
296 || !extract_min_max(b, &b_min, &b_max))
300 * Punt misordered list, overlapping start, or inverted range.
302 if (ASN1_INTEGER_cmp(a_min, b_min) >= 0 ||
303 ASN1_INTEGER_cmp(a_min, a_max) > 0 ||
304 ASN1_INTEGER_cmp(b_min, b_max) > 0)
308 * Calculate a_max + 1 to check for adjacency.
310 if ((bn == NULL && (bn = BN_new()) == NULL) ||
311 ASN1_INTEGER_to_BN(a_max, bn) == NULL ||
312 !BN_add_word(bn, 1)) {
313 ERR_raise(ERR_LIB_X509V3, ERR_R_BN_LIB);
317 if ((a_max_plus_one =
318 BN_to_ASN1_INTEGER(bn, orig = a_max_plus_one)) == NULL) {
319 a_max_plus_one = orig;
320 ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
325 * Punt if adjacent or overlapping.
327 if (ASN1_INTEGER_cmp(a_max_plus_one, b_min) >= 0)
332 * Check for inverted range.
334 i = sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1;
336 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
337 ASN1_INTEGER *a_min, *a_max;
338 if (a != NULL && a->type == ASIdOrRange_range) {
339 if (!extract_min_max(a, &a_min, &a_max)
340 || ASN1_INTEGER_cmp(a_min, a_max) > 0)
348 ASN1_INTEGER_free(a_max_plus_one);
354 * Check whether an ASIdentifier extension is in canonical form.
356 int X509v3_asid_is_canonical(ASIdentifiers *asid)
358 return (asid == NULL ||
359 (ASIdentifierChoice_is_canonical(asid->asnum) &&
360 ASIdentifierChoice_is_canonical(asid->rdi)));
364 * Whack an ASIdentifierChoice into canonical form.
366 static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice)
368 ASN1_INTEGER *a_max_plus_one = NULL;
374 * Nothing to do for empty element or inheritance.
376 if (choice == NULL || choice->type == ASIdentifierChoice_inherit)
380 * If not a list, or if empty list, it's broken.
382 if (choice->type != ASIdentifierChoice_asIdsOrRanges ||
383 sk_ASIdOrRange_num(choice->u.asIdsOrRanges) == 0) {
384 ERR_raise(ERR_LIB_X509V3, X509V3_R_EXTENSION_VALUE_ERROR);
389 * We have a non-empty list. Sort it.
391 sk_ASIdOrRange_sort(choice->u.asIdsOrRanges);
394 * Now check for errors and suboptimal encoding, rejecting the
395 * former and fixing the latter.
397 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1; i++) {
398 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
399 ASIdOrRange *b = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i + 1);
400 ASN1_INTEGER *a_min = NULL, *a_max = NULL, *b_min = NULL, *b_max =
403 if (!extract_min_max(a, &a_min, &a_max)
404 || !extract_min_max(b, &b_min, &b_max))
408 * Make sure we're properly sorted (paranoia).
410 if (!ossl_assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0))
414 * Punt inverted ranges.
416 if (ASN1_INTEGER_cmp(a_min, a_max) > 0 ||
417 ASN1_INTEGER_cmp(b_min, b_max) > 0)
421 * Check for overlaps.
423 if (ASN1_INTEGER_cmp(a_max, b_min) >= 0) {
424 ERR_raise(ERR_LIB_X509V3, X509V3_R_EXTENSION_VALUE_ERROR);
429 * Calculate a_max + 1 to check for adjacency.
431 if ((bn == NULL && (bn = BN_new()) == NULL) ||
432 ASN1_INTEGER_to_BN(a_max, bn) == NULL ||
433 !BN_add_word(bn, 1)) {
434 ERR_raise(ERR_LIB_X509V3, ERR_R_BN_LIB);
438 if ((a_max_plus_one =
439 BN_to_ASN1_INTEGER(bn, orig = a_max_plus_one)) == NULL) {
440 a_max_plus_one = orig;
441 ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
446 * If a and b are adjacent, merge them.
448 if (ASN1_INTEGER_cmp(a_max_plus_one, b_min) == 0) {
452 if ((r = OPENSSL_malloc(sizeof(*r))) == NULL)
456 a->type = ASIdOrRange_range;
459 case ASIdOrRange_range:
460 ASN1_INTEGER_free(a->u.range->max);
461 a->u.range->max = b_max;
468 case ASIdOrRange_range:
469 b->u.range->max = NULL;
473 (void)sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1);
480 * Check for final inverted range.
482 i = sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1;
484 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
485 ASN1_INTEGER *a_min, *a_max;
486 if (a != NULL && a->type == ASIdOrRange_range) {
487 if (!extract_min_max(a, &a_min, &a_max)
488 || ASN1_INTEGER_cmp(a_min, a_max) > 0)
494 if (!ossl_assert(ASIdentifierChoice_is_canonical(choice)))
500 ASN1_INTEGER_free(a_max_plus_one);
506 * Whack an ASIdentifier extension into canonical form.
508 int X509v3_asid_canonize(ASIdentifiers *asid)
510 return (asid == NULL ||
511 (ASIdentifierChoice_canonize(asid->asnum) &&
512 ASIdentifierChoice_canonize(asid->rdi)));
516 * v2i method for an ASIdentifier extension.
518 static void *v2i_ASIdentifiers(const struct v3_ext_method *method,
519 struct v3_ext_ctx *ctx,
520 STACK_OF(CONF_VALUE) *values)
522 ASN1_INTEGER *min = NULL, *max = NULL;
523 ASIdentifiers *asid = NULL;
526 if ((asid = ASIdentifiers_new()) == NULL) {
527 ERR_raise(ERR_LIB_X509V3, ERR_R_X509V3_LIB);
531 for (i = 0; i < sk_CONF_VALUE_num(values); i++) {
532 CONF_VALUE *val = sk_CONF_VALUE_value(values, i);
533 int i1 = 0, i2 = 0, i3 = 0, is_range = 0, which = 0;
536 * Figure out whether this is an AS or an RDI.
538 if (!ossl_v3_name_cmp(val->name, "AS")) {
539 which = V3_ASID_ASNUM;
540 } else if (!ossl_v3_name_cmp(val->name, "RDI")) {
543 ERR_raise(ERR_LIB_X509V3, X509V3_R_EXTENSION_NAME_ERROR);
544 X509V3_conf_add_error_name_value(val);
548 if (val->value == NULL) {
549 ERR_raise(ERR_LIB_X509V3, X509V3_R_EXTENSION_VALUE_ERROR);
554 * Handle inheritance.
556 if (strcmp(val->value, "inherit") == 0) {
557 if (X509v3_asid_add_inherit(asid, which))
559 ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_INHERITANCE);
560 X509V3_conf_add_error_name_value(val);
565 * Number, range, or mistake, pick it apart and figure out which.
567 i1 = strspn(val->value, "0123456789");
568 if (val->value[i1] == '\0') {
572 i2 = i1 + strspn(val->value + i1, " \t");
573 if (val->value[i2] != '-') {
574 ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_ASNUMBER);
575 X509V3_conf_add_error_name_value(val);
579 i2 = i2 + strspn(val->value + i2, " \t");
580 i3 = i2 + strspn(val->value + i2, "0123456789");
581 if (val->value[i3] != '\0') {
582 ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_ASRANGE);
583 X509V3_conf_add_error_name_value(val);
589 * Syntax is ok, read and add it.
592 if (!X509V3_get_value_int(val, &min)) {
593 ERR_raise(ERR_LIB_X509V3, ERR_R_X509V3_LIB);
597 char *s = OPENSSL_strdup(val->value);
601 min = s2i_ASN1_INTEGER(NULL, s);
602 max = s2i_ASN1_INTEGER(NULL, s + i2);
604 if (min == NULL || max == NULL) {
605 ERR_raise(ERR_LIB_X509V3, ERR_R_X509V3_LIB);
608 if (ASN1_INTEGER_cmp(min, max) > 0) {
609 ERR_raise(ERR_LIB_X509V3, X509V3_R_EXTENSION_VALUE_ERROR);
613 if (!X509v3_asid_add_id_or_range(asid, which, min, max)) {
614 ERR_raise(ERR_LIB_X509V3, ERR_R_X509V3_LIB);
621 * Canonize the result, then we're done.
623 if (!X509v3_asid_canonize(asid))
628 ASIdentifiers_free(asid);
629 ASN1_INTEGER_free(min);
630 ASN1_INTEGER_free(max);
637 const X509V3_EXT_METHOD ossl_v3_asid = {
638 NID_sbgp_autonomousSysNum, /* nid */
640 ASN1_ITEM_ref(ASIdentifiers), /* template */
641 0, 0, 0, 0, /* old functions, ignored */
645 v2i_ASIdentifiers, /* v2i */
646 i2r_ASIdentifiers, /* i2r */
648 NULL /* extension-specific data */
652 * Figure out whether extension uses inheritance.
654 int X509v3_asid_inherits(ASIdentifiers *asid)
656 return (asid != NULL &&
657 ((asid->asnum != NULL &&
658 asid->asnum->type == ASIdentifierChoice_inherit) ||
659 (asid->rdi != NULL &&
660 asid->rdi->type == ASIdentifierChoice_inherit)));
664 * Figure out whether parent contains child.
666 static int asid_contains(ASIdOrRanges *parent, ASIdOrRanges *child)
668 ASN1_INTEGER *p_min = NULL, *p_max = NULL, *c_min = NULL, *c_max = NULL;
671 if (child == NULL || parent == child)
677 for (c = 0; c < sk_ASIdOrRange_num(child); c++) {
678 if (!extract_min_max(sk_ASIdOrRange_value(child, c), &c_min, &c_max))
681 if (p >= sk_ASIdOrRange_num(parent))
683 if (!extract_min_max(sk_ASIdOrRange_value(parent, p), &p_min,
686 if (ASN1_INTEGER_cmp(p_max, c_max) < 0)
688 if (ASN1_INTEGER_cmp(p_min, c_min) > 0)
698 * Test whether a is a subset of b.
700 int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b)
704 if (a == NULL || a == b)
710 if (X509v3_asid_inherits(a) || X509v3_asid_inherits(b))
713 subset = a->asnum == NULL
715 && asid_contains(b->asnum->u.asIdsOrRanges,
716 a->asnum->u.asIdsOrRanges));
720 return a->rdi == NULL
722 && asid_contains(b->rdi->u.asIdsOrRanges,
723 a->rdi->u.asIdsOrRanges));
727 * Validation error handling via callback.
729 #define validation_err(_err_) \
732 ctx->error = _err_; \
733 ctx->error_depth = i; \
734 ctx->current_cert = x; \
735 ret = ctx->verify_cb(0, ctx); \
744 * Core code for RFC 3779 3.3 path validation.
746 static int asid_validate_path_internal(X509_STORE_CTX *ctx,
747 STACK_OF(X509) *chain,
750 ASIdOrRanges *child_as = NULL, *child_rdi = NULL;
751 int i, ret = 1, inherit_as = 0, inherit_rdi = 0;
754 if (!ossl_assert(chain != NULL && sk_X509_num(chain) > 0)
755 || !ossl_assert(ctx != NULL || ext != NULL)
756 || !ossl_assert(ctx == NULL || ctx->verify_cb != NULL)) {
758 ctx->error = X509_V_ERR_UNSPECIFIED;
764 * Figure out where to start. If we don't have an extension to
765 * check, we're done. Otherwise, check canonical form and
766 * set up for walking up the chain.
773 x = sk_X509_value(chain, i);
774 if ((ext = x->rfc3779_asid) == NULL)
777 if (!X509v3_asid_is_canonical(ext))
778 validation_err(X509_V_ERR_INVALID_EXTENSION);
779 if (ext->asnum != NULL) {
780 switch (ext->asnum->type) {
781 case ASIdentifierChoice_inherit:
784 case ASIdentifierChoice_asIdsOrRanges:
785 child_as = ext->asnum->u.asIdsOrRanges;
789 if (ext->rdi != NULL) {
790 switch (ext->rdi->type) {
791 case ASIdentifierChoice_inherit:
794 case ASIdentifierChoice_asIdsOrRanges:
795 child_rdi = ext->rdi->u.asIdsOrRanges;
801 * Now walk up the chain. Extensions must be in canonical form, no
802 * cert may list resources that its parent doesn't list.
804 for (i++; i < sk_X509_num(chain); i++) {
805 x = sk_X509_value(chain, i);
806 if (!ossl_assert(x != NULL)) {
808 ctx->error = X509_V_ERR_UNSPECIFIED;
811 if (x->rfc3779_asid == NULL) {
812 if (child_as != NULL || child_rdi != NULL)
813 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
816 if (!X509v3_asid_is_canonical(x->rfc3779_asid))
817 validation_err(X509_V_ERR_INVALID_EXTENSION);
818 if (x->rfc3779_asid->asnum == NULL && child_as != NULL) {
819 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
823 if (x->rfc3779_asid->asnum != NULL &&
824 x->rfc3779_asid->asnum->type ==
825 ASIdentifierChoice_asIdsOrRanges) {
827 || asid_contains(x->rfc3779_asid->asnum->u.asIdsOrRanges,
829 child_as = x->rfc3779_asid->asnum->u.asIdsOrRanges;
832 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
835 if (x->rfc3779_asid->rdi == NULL && child_rdi != NULL) {
836 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
840 if (x->rfc3779_asid->rdi != NULL &&
841 x->rfc3779_asid->rdi->type == ASIdentifierChoice_asIdsOrRanges) {
843 asid_contains(x->rfc3779_asid->rdi->u.asIdsOrRanges,
845 child_rdi = x->rfc3779_asid->rdi->u.asIdsOrRanges;
848 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
854 * Trust anchor can't inherit.
856 if (!ossl_assert(x != NULL)) {
858 ctx->error = X509_V_ERR_UNSPECIFIED;
861 if (x->rfc3779_asid != NULL) {
862 if (x->rfc3779_asid->asnum != NULL &&
863 x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit)
864 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
865 if (x->rfc3779_asid->rdi != NULL &&
866 x->rfc3779_asid->rdi->type == ASIdentifierChoice_inherit)
867 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
874 #undef validation_err
877 * RFC 3779 3.3 path validation -- called from X509_verify_cert().
879 int X509v3_asid_validate_path(X509_STORE_CTX *ctx)
881 if (ctx->chain == NULL
882 || sk_X509_num(ctx->chain) == 0
883 || ctx->verify_cb == NULL) {
884 ctx->error = X509_V_ERR_UNSPECIFIED;
887 return asid_validate_path_internal(ctx, ctx->chain, NULL);
891 * RFC 3779 3.3 path validation of an extension.
892 * Test whether chain covers extension.
894 int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain,
895 ASIdentifiers *ext, int allow_inheritance)
899 if (chain == NULL || sk_X509_num(chain) == 0)
901 if (!allow_inheritance && X509v3_asid_inherits(ext))
903 return asid_validate_path_internal(NULL, chain, ext);
906 #endif /* OPENSSL_NO_RFC3779 */