diff options
Diffstat (limited to 'src/lib/libcrypto/x509v3/pcy_lib.c')
| -rw-r--r-- | src/lib/libcrypto/x509v3/pcy_lib.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/src/lib/libcrypto/x509v3/pcy_lib.c b/src/lib/libcrypto/x509v3/pcy_lib.c index 93bfd92703..de26a8f7e4 100644 --- a/src/lib/libcrypto/x509v3/pcy_lib.c +++ b/src/lib/libcrypto/x509v3/pcy_lib.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * are met: | 10 | * are met: |
| 11 | * | 11 | * |
| 12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * | 14 | * |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
| @@ -67,44 +67,46 @@ | |||
| 67 | 67 | ||
| 68 | /* X509_POLICY_TREE stuff */ | 68 | /* X509_POLICY_TREE stuff */ |
| 69 | 69 | ||
| 70 | int X509_policy_tree_level_count(const X509_POLICY_TREE *tree) | 70 | int |
| 71 | { | 71 | X509_policy_tree_level_count(const X509_POLICY_TREE *tree) |
| 72 | { | ||
| 72 | if (!tree) | 73 | if (!tree) |
| 73 | return 0; | 74 | return 0; |
| 74 | return tree->nlevel; | 75 | return tree->nlevel; |
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | X509_POLICY_LEVEL * | 78 | X509_POLICY_LEVEL * |
| 78 | X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i) | 79 | X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i) |
| 79 | { | 80 | { |
| 80 | if (!tree || (i < 0) || (i >= tree->nlevel)) | 81 | if (!tree || (i < 0) || (i >= tree->nlevel)) |
| 81 | return NULL; | 82 | return NULL; |
| 82 | return tree->levels + i; | 83 | return tree->levels + i; |
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | STACK_OF(X509_POLICY_NODE) * | 86 | STACK_OF(X509_POLICY_NODE) * |
| 86 | X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree) | 87 | X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree) |
| 87 | { | 88 | { |
| 88 | if (!tree) | 89 | if (!tree) |
| 89 | return NULL; | 90 | return NULL; |
| 90 | return tree->auth_policies; | 91 | return tree->auth_policies; |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | STACK_OF(X509_POLICY_NODE) * | 94 | STACK_OF(X509_POLICY_NODE) * |
| 94 | X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree) | 95 | X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree) |
| 95 | { | 96 | { |
| 96 | if (!tree) | 97 | if (!tree) |
| 97 | return NULL; | 98 | return NULL; |
| 98 | if (tree->flags & POLICY_FLAG_ANY_POLICY) | 99 | if (tree->flags & POLICY_FLAG_ANY_POLICY) |
| 99 | return tree->auth_policies; | 100 | return tree->auth_policies; |
| 100 | else | 101 | else |
| 101 | return tree->user_policies; | 102 | return tree->user_policies; |
| 102 | } | 103 | } |
| 103 | 104 | ||
| 104 | /* X509_POLICY_LEVEL stuff */ | 105 | /* X509_POLICY_LEVEL stuff */ |
| 105 | 106 | ||
| 106 | int X509_policy_level_node_count(X509_POLICY_LEVEL *level) | 107 | int |
| 107 | { | 108 | X509_policy_level_node_count(X509_POLICY_LEVEL *level) |
| 109 | { | ||
| 108 | int n; | 110 | int n; |
| 109 | if (!level) | 111 | if (!level) |
| 110 | return 0; | 112 | return 0; |
| @@ -115,53 +117,53 @@ int X509_policy_level_node_count(X509_POLICY_LEVEL *level) | |||
| 115 | if (level->nodes) | 117 | if (level->nodes) |
| 116 | n += sk_X509_POLICY_NODE_num(level->nodes); | 118 | n += sk_X509_POLICY_NODE_num(level->nodes); |
| 117 | return n; | 119 | return n; |
| 118 | } | 120 | } |
| 119 | 121 | ||
| 120 | X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i) | 122 | X509_POLICY_NODE * |
| 121 | { | 123 | X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i) |
| 124 | { | ||
| 122 | if (!level) | 125 | if (!level) |
| 123 | return NULL; | 126 | return NULL; |
| 124 | if (level->anyPolicy) | 127 | if (level->anyPolicy) { |
| 125 | { | ||
| 126 | if (i == 0) | 128 | if (i == 0) |
| 127 | return level->anyPolicy; | 129 | return level->anyPolicy; |
| 128 | i--; | 130 | i--; |
| 129 | } | ||
| 130 | return sk_X509_POLICY_NODE_value(level->nodes, i); | ||
| 131 | } | 131 | } |
| 132 | return sk_X509_POLICY_NODE_value(level->nodes, i); | ||
| 133 | } | ||
| 132 | 134 | ||
| 133 | /* X509_POLICY_NODE stuff */ | 135 | /* X509_POLICY_NODE stuff */ |
| 134 | 136 | ||
| 135 | const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node) | 137 | const ASN1_OBJECT * |
| 136 | { | 138 | X509_policy_node_get0_policy(const X509_POLICY_NODE *node) |
| 139 | { | ||
| 137 | if (!node) | 140 | if (!node) |
| 138 | return NULL; | 141 | return NULL; |
| 139 | return node->data->valid_policy; | 142 | return node->data->valid_policy; |
| 140 | } | 143 | } |
| 141 | 144 | ||
| 142 | #if 0 | 145 | #if 0 |
| 143 | int X509_policy_node_get_critical(const X509_POLICY_NODE *node) | 146 | int |
| 144 | { | 147 | X509_policy_node_get_critical(const X509_POLICY_NODE *node) |
| 148 | { | ||
| 145 | if (node_critical(node)) | 149 | if (node_critical(node)) |
| 146 | return 1; | 150 | return 1; |
| 147 | return 0; | 151 | return 0; |
| 148 | } | 152 | } |
| 149 | #endif | 153 | #endif |
| 150 | 154 | ||
| 151 | STACK_OF(POLICYQUALINFO) * | 155 | STACK_OF(POLICYQUALINFO) * |
| 152 | X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node) | 156 | X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node) |
| 153 | { | 157 | { |
| 154 | if (!node) | 158 | if (!node) |
| 155 | return NULL; | 159 | return NULL; |
| 156 | return node->data->qualifier_set; | 160 | return node->data->qualifier_set; |
| 157 | } | 161 | } |
| 158 | 162 | ||
| 159 | const X509_POLICY_NODE * | 163 | const X509_POLICY_NODE * |
| 160 | X509_policy_node_get0_parent(const X509_POLICY_NODE *node) | 164 | X509_policy_node_get0_parent(const X509_POLICY_NODE *node) |
| 161 | { | 165 | { |
| 162 | if (!node) | 166 | if (!node) |
| 163 | return NULL; | 167 | return NULL; |
| 164 | return node->parent; | 168 | return node->parent; |
| 165 | } | 169 | } |
| 166 | |||
| 167 | |||
