2 * Copyright 2004-2020 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
10 #include "internal/cryptlib.h"
11 #include <openssl/x509.h>
12 #include <openssl/x509v3.h>
14 #include "pcy_local.h"
16 DEFINE_STACK_OF(X509_POLICY_NODE)
18 /* accessor functions */
20 /* X509_POLICY_TREE stuff */
22 int X509_policy_tree_level_count(const X509_POLICY_TREE *tree)
29 X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree,
32 if (!tree || (i < 0) || (i >= tree->nlevel))
34 return tree->levels + i;
37 STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const
43 return tree->auth_policies;
46 STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const
52 if (tree->flags & POLICY_FLAG_ANY_POLICY)
53 return tree->auth_policies;
55 return tree->user_policies;
58 /* X509_POLICY_LEVEL stuff */
60 int X509_policy_level_node_count(X509_POLICY_LEVEL *level)
70 n += sk_X509_POLICY_NODE_num(level->nodes);
74 X509_POLICY_NODE *X509_policy_level_get0_node(const X509_POLICY_LEVEL *level, int i)
78 if (level->anyPolicy) {
80 return level->anyPolicy;
83 return sk_X509_POLICY_NODE_value(level->nodes, i);
86 /* X509_POLICY_NODE stuff */
88 const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node)
92 return node->data->valid_policy;
95 STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const
101 return node->data->qualifier_set;
104 const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE