2 * Contributed to the OpenSSL Project by the American Registry for
3 * Internet Numbers ("ARIN").
5 /* ====================================================================
6 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
34 * 6. Redistributions of any form whatsoever must retain the following
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
59 * Implementation of RFC 3779 section 3.2.
65 #include <openssl/conf.h>
66 #include <openssl/asn1.h>
67 #include <openssl/asn1t.h>
68 #include <openssl/x509v3.h>
69 #include <openssl/x509.h>
70 #include <openssl/bn.h>
72 #ifndef OPENSSL_NO_RFC3779
75 * OpenSSL ASN.1 template translation of RFC 3779 3.2.3.
78 ASN1_SEQUENCE(ASRange) = {
79 ASN1_SIMPLE(ASRange, min, ASN1_INTEGER),
80 ASN1_SIMPLE(ASRange, max, ASN1_INTEGER)
81 } ASN1_SEQUENCE_END(ASRange)
83 ASN1_CHOICE(ASIdOrRange) = {
84 ASN1_SIMPLE(ASIdOrRange, u.id, ASN1_INTEGER),
85 ASN1_SIMPLE(ASIdOrRange, u.range, ASRange)
86 } ASN1_CHOICE_END(ASIdOrRange)
88 ASN1_CHOICE(ASIdentifierChoice) = {
89 ASN1_SIMPLE(ASIdentifierChoice, u.inherit, ASN1_NULL),
90 ASN1_SEQUENCE_OF(ASIdentifierChoice, u.asIdsOrRanges, ASIdOrRange)
91 } ASN1_CHOICE_END(ASIdentifierChoice)
93 ASN1_SEQUENCE(ASIdentifiers) = {
94 ASN1_EXP_OPT(ASIdentifiers, asnum, ASIdentifierChoice, 0),
95 ASN1_EXP_OPT(ASIdentifiers, rdi, ASIdentifierChoice, 1)
96 } ASN1_SEQUENCE_END(ASIdentifiers)
98 IMPLEMENT_ASN1_FUNCTIONS(ASRange)
99 IMPLEMENT_ASN1_FUNCTIONS(ASIdOrRange)
100 IMPLEMENT_ASN1_FUNCTIONS(ASIdentifierChoice)
101 IMPLEMENT_ASN1_FUNCTIONS(ASIdentifiers)
104 * i2r method for an ASIdentifierChoice.
106 static int i2r_ASIdentifierChoice(BIO *out,
107 ASIdentifierChoice *choice,
115 BIO_printf(out, "%*s%s:\n", indent, "", msg);
116 switch (choice->type) {
117 case ASIdentifierChoice_inherit:
118 BIO_printf(out, "%*sinherit\n", indent + 2, "");
120 case ASIdentifierChoice_asIdsOrRanges:
121 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges); i++) {
122 ASIdOrRange *aor = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
125 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL)
127 BIO_printf(out, "%*s%s\n", indent + 2, "", s);
130 case ASIdOrRange_range:
131 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL)
133 BIO_printf(out, "%*s%s-", indent + 2, "", s);
135 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL)
137 BIO_printf(out, "%s\n", s);
152 * i2r method for an ASIdentifier extension.
154 static int i2r_ASIdentifiers(const X509V3_EXT_METHOD *method,
159 ASIdentifiers *asid = ext;
160 return (i2r_ASIdentifierChoice(out, asid->asnum, indent,
161 "Autonomous System Numbers") &&
162 i2r_ASIdentifierChoice(out, asid->rdi, indent,
163 "Routing Domain Identifiers"));
167 * Sort comparision function for a sequence of ASIdOrRange elements.
169 static int ASIdOrRange_cmp(const ASIdOrRange * const *a_,
170 const ASIdOrRange * const *b_)
172 const ASIdOrRange *a = *a_, *b = *b_;
174 OPENSSL_assert((a->type == ASIdOrRange_id && a->u.id != NULL) ||
175 (a->type == ASIdOrRange_range && a->u.range != NULL &&
176 a->u.range->min != NULL && a->u.range->max != NULL));
178 OPENSSL_assert((b->type == ASIdOrRange_id && b->u.id != NULL) ||
179 (b->type == ASIdOrRange_range && b->u.range != NULL &&
180 b->u.range->min != NULL && b->u.range->max != NULL));
182 if (a->type == ASIdOrRange_id && b->type == ASIdOrRange_id)
183 return ASN1_INTEGER_cmp(a->u.id, b->u.id);
185 if (a->type == ASIdOrRange_range && b->type == ASIdOrRange_range) {
186 int r = ASN1_INTEGER_cmp(a->u.range->min, b->u.range->min);
187 return r != 0 ? r : ASN1_INTEGER_cmp(a->u.range->max, b->u.range->max);
190 if (a->type == ASIdOrRange_id)
191 return ASN1_INTEGER_cmp(a->u.id, b->u.range->min);
193 return ASN1_INTEGER_cmp(a->u.range->min, b->u.id);
197 * Add an inherit element.
199 int v3_asid_add_inherit(ASIdentifiers *asid, int which)
201 ASIdentifierChoice **choice;
206 choice = &asid->asnum;
214 if (*choice == NULL) {
215 if ((*choice = ASIdentifierChoice_new()) == NULL)
217 OPENSSL_assert((*choice)->u.inherit == NULL);
218 if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL)
220 (*choice)->type = ASIdentifierChoice_inherit;
222 return (*choice)->type == ASIdentifierChoice_inherit;
226 * Add an ID or range to an ASIdentifierChoice.
228 int v3_asid_add_id_or_range(ASIdentifiers *asid,
233 ASIdentifierChoice **choice;
239 choice = &asid->asnum;
247 if (*choice != NULL && (*choice)->type == ASIdentifierChoice_inherit)
249 if (*choice == NULL) {
250 if ((*choice = ASIdentifierChoice_new()) == NULL)
252 OPENSSL_assert((*choice)->u.asIdsOrRanges == NULL);
253 (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp);
254 if ((*choice)->u.asIdsOrRanges == NULL)
256 (*choice)->type = ASIdentifierChoice_asIdsOrRanges;
258 if ((aor = ASIdOrRange_new()) == NULL)
261 aor->type = ASIdOrRange_id;
264 aor->type = ASIdOrRange_range;
265 if ((aor->u.range = ASRange_new()) == NULL)
267 ASN1_INTEGER_free(aor->u.range->min);
268 aor->u.range->min = min;
269 ASN1_INTEGER_free(aor->u.range->max);
270 aor->u.range->max = max;
272 if (!(sk_ASIdOrRange_push((*choice)->u.asIdsOrRanges, aor)))
277 ASIdOrRange_free(aor);
282 * Extract min and max values from an ASIdOrRange.
284 static void extract_min_max(ASIdOrRange *aor,
288 OPENSSL_assert(aor != NULL && min != NULL && max != NULL);
294 case ASIdOrRange_range:
295 *min = aor->u.range->min;
296 *max = aor->u.range->max;
302 * Check whether an ASIdentifierChoice is in canonical form.
304 static int ASIdentifierChoice_is_canonical(ASIdentifierChoice *choice)
306 ASN1_INTEGER *a_max_plus_one = NULL;
311 * Empty element or inheritance is canonical.
313 if (choice == NULL || choice->type == ASIdentifierChoice_inherit)
317 * If not a list, or if empty list, it's broken.
319 if (choice->type != ASIdentifierChoice_asIdsOrRanges ||
320 sk_ASIdOrRange_num(choice->u.asIdsOrRanges) == 0)
324 * It's a list, check it.
326 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1; i++) {
327 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
328 ASIdOrRange *b = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i + 1);
329 ASN1_INTEGER *a_min, *a_max, *b_min, *b_max;
331 extract_min_max(a, &a_min, &a_max);
332 extract_min_max(b, &b_min, &b_max);
335 * Punt misordered list, overlapping start, or inverted range.
337 if (ASN1_INTEGER_cmp(a_min, b_min) >= 0 ||
338 ASN1_INTEGER_cmp(a_min, a_max) > 0 ||
339 ASN1_INTEGER_cmp(b_min, b_max) > 0)
343 * Calculate a_max + 1 to check for adjacency.
345 if ((bn == NULL && (bn = BN_new()) == NULL) ||
346 ASN1_INTEGER_to_BN(a_max, bn) == NULL ||
347 !BN_add_word(bn, 1) ||
348 (a_max_plus_one = BN_to_ASN1_INTEGER(bn, a_max_plus_one)) == NULL) {
349 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL,
350 ERR_R_MALLOC_FAILURE);
355 * Punt if adjacent or overlapping.
357 if (ASN1_INTEGER_cmp(a_max_plus_one, b_min) >= 0)
364 ASN1_INTEGER_free(a_max_plus_one);
370 * Check whether an ASIdentifier extension is in canonical form.
372 int v3_asid_is_canonical(ASIdentifiers *asid)
374 return (asid == NULL ||
375 (ASIdentifierChoice_is_canonical(asid->asnum) &&
376 ASIdentifierChoice_is_canonical(asid->rdi)));
380 * Whack an ASIdentifierChoice into canonical form.
382 static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice)
384 ASN1_INTEGER *a_max_plus_one = NULL;
389 * Nothing to do for empty element or inheritance.
391 if (choice == NULL || choice->type == ASIdentifierChoice_inherit)
395 * We have a list. Sort it.
397 OPENSSL_assert(choice->type == ASIdentifierChoice_asIdsOrRanges);
398 sk_ASIdOrRange_sort(choice->u.asIdsOrRanges);
401 * Now check for errors and suboptimal encoding, rejecting the
402 * former and fixing the latter.
404 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1; i++) {
405 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
406 ASIdOrRange *b = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i + 1);
407 ASN1_INTEGER *a_min, *a_max, *b_min, *b_max;
409 extract_min_max(a, &a_min, &a_max);
410 extract_min_max(b, &b_min, &b_max);
413 * Make sure we're properly sorted (paranoia).
415 OPENSSL_assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0);
418 * Check for overlaps.
420 if (ASN1_INTEGER_cmp(a_max, b_min) >= 0) {
421 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE,
422 X509V3_R_EXTENSION_VALUE_ERROR);
427 * Calculate a_max + 1 to check for adjacency.
429 if ((bn == NULL && (bn = BN_new()) == NULL) ||
430 ASN1_INTEGER_to_BN(a_max, bn) == NULL ||
431 !BN_add_word(bn, 1) ||
432 (a_max_plus_one = BN_to_ASN1_INTEGER(bn, a_max_plus_one)) == NULL) {
433 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, ERR_R_MALLOC_FAILURE);
438 * If a and b are adjacent, merge them.
440 if (ASN1_INTEGER_cmp(a_max_plus_one, b_min) == 0) {
444 if ((r = OPENSSL_malloc(sizeof(ASRange))) == NULL) {
445 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE,
446 ERR_R_MALLOC_FAILURE);
451 a->type = ASIdOrRange_range;
454 case ASIdOrRange_range:
455 ASN1_INTEGER_free(a->u.range->max);
456 a->u.range->max = b_max;
463 case ASIdOrRange_range:
464 b->u.range->max = NULL;
468 sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1);
474 OPENSSL_assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */
479 ASN1_INTEGER_free(a_max_plus_one);
485 * Whack an ASIdentifier extension into canonical form.
487 int v3_asid_canonize(ASIdentifiers *asid)
489 return (asid == NULL ||
490 (ASIdentifierChoice_canonize(asid->asnum) &&
491 ASIdentifierChoice_canonize(asid->rdi)));
495 * v2i method for an ASIdentifier extension.
497 static void *v2i_ASIdentifiers(const struct v3_ext_method *method,
498 struct v3_ext_ctx *ctx,
499 STACK_OF(CONF_VALUE) *values)
501 ASIdentifiers *asid = NULL;
504 if ((asid = ASIdentifiers_new()) == NULL) {
505 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
509 for (i = 0; i < sk_CONF_VALUE_num(values); i++) {
510 CONF_VALUE *val = sk_CONF_VALUE_value(values, i);
511 ASN1_INTEGER *min = NULL, *max = NULL;
512 int i1, i2, i3, is_range, which;
515 * Figure out whether this is an AS or an RDI.
517 if ( !name_cmp(val->name, "AS")) {
518 which = V3_ASID_ASNUM;
519 } else if (!name_cmp(val->name, "RDI")) {
522 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_EXTENSION_NAME_ERROR);
523 X509V3_conf_err(val);
528 * Handle inheritance.
530 if (!strcmp(val->value, "inherit")) {
531 if (v3_asid_add_inherit(asid, which))
533 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_INHERITANCE);
534 X509V3_conf_err(val);
539 * Number, range, or mistake, pick it apart and figure out which.
541 i1 = strspn(val->value, "0123456789");
542 if (val->value[i1] == '\0') {
546 i2 = i1 + strspn(val->value + i1, " \t");
547 if (val->value[i2] != '-') {
548 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_ASNUMBER);
549 X509V3_conf_err(val);
553 i2 = i2 + strspn(val->value + i2, " \t");
554 i3 = i2 + strspn(val->value + i2, "0123456789");
555 if (val->value[i3] != '\0') {
556 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_ASRANGE);
557 X509V3_conf_err(val);
563 * Syntax is ok, read and add it.
566 if (!X509V3_get_value_int(val, &min)) {
567 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
571 char *s = BUF_strdup(val->value);
573 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
577 min = s2i_ASN1_INTEGER(NULL, s);
578 max = s2i_ASN1_INTEGER(NULL, s + i2);
580 if (min == NULL || max == NULL) {
581 ASN1_INTEGER_free(min);
582 ASN1_INTEGER_free(max);
583 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
587 if (!v3_asid_add_id_or_range(asid, which, min, max)) {
588 ASN1_INTEGER_free(min);
589 ASN1_INTEGER_free(max);
590 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
596 * Canonize the result, then we're done.
598 if (!v3_asid_canonize(asid))
603 ASIdentifiers_free(asid);
610 const X509V3_EXT_METHOD v3_asid = {
611 NID_sbgp_autonomousSysNum, /* nid */
613 ASN1_ITEM_ref(ASIdentifiers), /* template */
614 0, 0, 0, 0, /* old functions, ignored */
618 v2i_ASIdentifiers, /* v2i */
619 i2r_ASIdentifiers, /* i2r */
621 NULL /* extension-specific data */
625 * Figure out whether extension uses inheritance.
627 int v3_asid_inherits(ASIdentifiers *asid)
629 return (asid != NULL &&
630 ((asid->asnum != NULL &&
631 asid->asnum->type == ASIdentifierChoice_inherit) ||
632 (asid->rdi != NULL &&
633 asid->rdi->type == ASIdentifierChoice_inherit)));
637 * Figure out whether parent contains child.
639 static int asid_contains(ASIdOrRanges *parent, ASIdOrRanges *child)
641 ASN1_INTEGER *p_min, *p_max, *c_min, *c_max;
644 if (child == NULL || parent == child)
650 for (c = 0; c < sk_ASIdOrRange_num(child); c++) {
651 extract_min_max(sk_ASIdOrRange_value(child, c), &c_min, &c_max);
653 if (p >= sk_ASIdOrRange_num(parent))
655 extract_min_max(sk_ASIdOrRange_value(parent, p), &p_min, &p_max);
656 if (ASN1_INTEGER_cmp(p_max, c_max) < 0)
658 if (ASN1_INTEGER_cmp(p_min, c_min) > 0)
668 * Test whether a is a subet of b.
670 int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b)
675 !v3_asid_inherits(a) &&
676 !v3_asid_inherits(b) &&
677 asid_contains(b->asnum->u.asIdsOrRanges,
678 a->asnum->u.asIdsOrRanges) &&
679 asid_contains(b->rdi->u.asIdsOrRanges,
680 a->rdi->u.asIdsOrRanges)));
684 * Validation error handling via callback.
686 #define validation_err(_err_) \
689 ctx->error = _err_; \
690 ctx->error_depth = i; \
691 ctx->current_cert = x; \
692 ret = ctx->verify_cb(0, ctx); \
701 * Core code for RFC 3779 3.3 path validation.
703 static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx,
704 STACK_OF(X509) *chain,
707 ASIdOrRanges *child_as = NULL, *child_rdi = NULL;
708 int i, ret = 1, inherit_as = 0, inherit_rdi = 0;
711 OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0);
712 OPENSSL_assert(ctx != NULL || ext != NULL);
713 OPENSSL_assert(ctx == NULL || ctx->verify_cb != NULL);
716 * Figure out where to start. If we don't have an extension to
717 * check, we're done. Otherwise, check canonical form and
718 * set up for walking up the chain.
725 x = sk_X509_value(chain, i);
726 OPENSSL_assert(x != NULL);
727 if ((ext = x->rfc3779_asid) == NULL)
730 if (!v3_asid_is_canonical(ext))
731 validation_err(X509_V_ERR_INVALID_EXTENSION);
732 if (ext->asnum != NULL) {
733 switch (ext->asnum->type) {
734 case ASIdentifierChoice_inherit:
737 case ASIdentifierChoice_asIdsOrRanges:
738 child_as = ext->asnum->u.asIdsOrRanges;
742 if (ext->rdi != NULL) {
743 switch (ext->rdi->type) {
744 case ASIdentifierChoice_inherit:
747 case ASIdentifierChoice_asIdsOrRanges:
748 child_rdi = ext->rdi->u.asIdsOrRanges;
754 * Now walk up the chain. Extensions must be in canonical form, no
755 * cert may list resources that its parent doesn't list.
757 for (i++; i < sk_X509_num(chain); i++) {
758 x = sk_X509_value(chain, i);
759 OPENSSL_assert(x != NULL);
760 if (x->rfc3779_asid == NULL) {
761 if (child_as != NULL || child_rdi != NULL)
762 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
765 if (!v3_asid_is_canonical(x->rfc3779_asid))
766 validation_err(X509_V_ERR_INVALID_EXTENSION);
767 if (x->rfc3779_asid->asnum == NULL && child_as != NULL) {
768 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
772 if (x->rfc3779_asid->asnum != NULL &&
773 x->rfc3779_asid->asnum->type == ASIdentifierChoice_asIdsOrRanges) {
775 asid_contains(x->rfc3779_asid->asnum->u.asIdsOrRanges, child_as)) {
776 child_as = x->rfc3779_asid->asnum->u.asIdsOrRanges;
779 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
782 if (x->rfc3779_asid->rdi == NULL && child_rdi != NULL) {
783 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
787 if (x->rfc3779_asid->rdi != NULL &&
788 x->rfc3779_asid->rdi->type == ASIdentifierChoice_asIdsOrRanges) {
790 asid_contains(x->rfc3779_asid->rdi->u.asIdsOrRanges, child_rdi)) {
791 child_rdi = x->rfc3779_asid->rdi->u.asIdsOrRanges;
794 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
800 * Trust anchor can't inherit.
802 OPENSSL_assert(x != NULL);
803 if (x->rfc3779_asid != NULL) {
804 if (x->rfc3779_asid->asnum != NULL &&
805 x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit)
806 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
807 if (x->rfc3779_asid->rdi != NULL &&
808 x->rfc3779_asid->rdi->type == ASIdentifierChoice_inherit)
809 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
816 #undef validation_err
819 * RFC 3779 3.3 path validation -- called from X509_verify_cert().
821 int v3_asid_validate_path(X509_STORE_CTX *ctx)
823 return v3_asid_validate_path_internal(ctx, ctx->chain, NULL);
827 * RFC 3779 3.3 path validation of an extension.
828 * Test whether chain covers extension.
830 int v3_asid_validate_resource_set(STACK_OF(X509) *chain,
832 int allow_inheritance)
836 if (chain == NULL || sk_X509_num(chain) == 0)
838 if (!allow_inheritance && v3_asid_inherits(ext))
840 return v3_asid_validate_path_internal(NULL, chain, ext);
843 #endif /* OPENSSL_NO_RFC3779 */