• Home
  • Raw
  • Download

Lines Matching refs:tree

54                        char *str, X509_POLICY_TREE *tree,  in tree_print()  argument
60 curr = tree->levels + tree->nlevel; in tree_print()
66 (long)(curr - tree->levels)); in tree_print()
67 for (plev = tree->levels; plev != curr; plev++) { in tree_print()
71 (long)(plev - tree->levels), plev->flags); in tree_print()
85 #define TREE_PRINT(str, tree, curr) \ argument
87 tree_print(trc_out, "before tree_prune()", tree, curr); \
100 X509_POLICY_TREE *tree; in tree_init() local
174 if ((tree = OPENSSL_zalloc(sizeof(*tree))) == NULL) { in tree_init()
180 tree->node_maximum = OPENSSL_POLICY_TREE_NODES_MAX; in tree_init()
189 if ((tree->levels = OPENSSL_zalloc(sizeof(*tree->levels)*(n+1))) == NULL) { in tree_init()
190 OPENSSL_free(tree); in tree_init()
194 tree->nlevel = n+1; in tree_init()
195 level = tree->levels; in tree_init()
199 if (ossl_policy_level_add_node(level, data, NULL, tree, 1) == NULL) { in tree_init()
246 *ptree = tree; in tree_init()
250 X509_policy_tree_free(tree); in tree_init()
259 X509_POLICY_TREE *tree) in tree_link_matching_nodes() argument
269 if (ossl_policy_level_add_node(curr, data, node, tree, 0) == NULL) in tree_link_matching_nodes()
275 if (ossl_policy_level_add_node(curr, data, last->anyPolicy, tree, 0) == NULL) in tree_link_matching_nodes()
289 X509_POLICY_TREE *tree) in tree_link_nodes() argument
297 if (!tree_link_matching_nodes(curr, data, tree)) in tree_link_nodes()
312 X509_POLICY_NODE *node, X509_POLICY_TREE *tree) in tree_add_unmatched() argument
328 if (ossl_policy_level_add_node(curr, data, node, tree, 1) == NULL) { in tree_add_unmatched()
340 X509_POLICY_NODE *node, X509_POLICY_TREE *tree) in tree_link_unmatched() argument
350 if (!tree_add_unmatched(curr, cache, NULL, node, tree)) in tree_link_unmatched()
363 if (!tree_add_unmatched(curr, cache, oid, node, tree)) in tree_link_unmatched()
376 X509_POLICY_TREE *tree) in tree_link_any() argument
385 if (!tree_link_unmatched(curr, cache, node, tree)) in tree_link_any()
391 last->anyPolicy, tree, 0) == NULL) in tree_link_any()
406 static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) in tree_prune() argument
441 if (curr == tree->levels) { in tree_prune()
481 static int tree_calculate_authority_set(X509_POLICY_TREE *tree, in tree_calculate_authority_set() argument
488 curr = tree->levels + tree->nlevel - 1; in tree_calculate_authority_set()
492 if (!tree_add_auth_node(&tree->auth_policies, curr->anyPolicy)) in tree_calculate_authority_set()
497 addnodes = &tree->auth_policies; in tree_calculate_authority_set()
499 curr = tree->levels; in tree_calculate_authority_set()
500 for (i = 1; i < tree->nlevel; i++) { in tree_calculate_authority_set()
523 *pnodes = tree->auth_policies; in tree_calculate_authority_set()
530 static int tree_calculate_user_set(X509_POLICY_TREE *tree, in tree_calculate_user_set() argument
547 anyPolicy = tree->levels[tree->nlevel - 1].anyPolicy; in tree_calculate_user_set()
552 tree->flags |= POLICY_FLAG_ANY_POLICY; in tree_calculate_user_set()
574 tree, 1); in tree_calculate_user_set()
580 if (!tree->user_policies) { in tree_calculate_user_set()
581 tree->user_policies = sk_X509_POLICY_NODE_new_null(); in tree_calculate_user_set()
582 if (!tree->user_policies) { in tree_calculate_user_set()
587 if (!sk_X509_POLICY_NODE_push(tree->user_policies, node)) { in tree_calculate_user_set()
601 static int tree_evaluate(X509_POLICY_TREE *tree) in tree_evaluate() argument
604 X509_POLICY_LEVEL *curr = tree->levels + 1; in tree_evaluate()
607 for (i = 1; i < tree->nlevel; i++, curr++) { in tree_evaluate()
609 if (!tree_link_nodes(curr, cache, tree)) in tree_evaluate()
613 && !tree_link_any(curr, cache, tree)) in tree_evaluate()
615 TREE_PRINT("before tree_prune()", tree, curr); in tree_evaluate()
616 ret = tree_prune(tree, curr); in tree_evaluate()
629 void X509_policy_tree_free(X509_POLICY_TREE *tree) in X509_policy_tree_free() argument
634 if (!tree) in X509_policy_tree_free()
637 sk_X509_POLICY_NODE_free(tree->auth_policies); in X509_policy_tree_free()
638 sk_X509_POLICY_NODE_pop_free(tree->user_policies, exnode_free); in X509_policy_tree_free()
640 for (i = 0, curr = tree->levels; i < tree->nlevel; i++, curr++) { in X509_policy_tree_free()
646 sk_X509_POLICY_DATA_pop_free(tree->extra_data, ossl_policy_data_free); in X509_policy_tree_free()
647 OPENSSL_free(tree->levels); in X509_policy_tree_free()
648 OPENSSL_free(tree); in X509_policy_tree_free()
667 X509_POLICY_TREE *tree = NULL; in X509_policy_check() local
672 init_ret = tree_init(&tree, certs, flags); in X509_policy_check()
679 X509_policy_tree_free(tree); in X509_policy_check()
689 ret = tree_evaluate(tree); in X509_policy_check()
690 TREE_PRINT("tree_evaluate()", tree, NULL); in X509_policy_check()
695 X509_policy_tree_free(tree); in X509_policy_check()
703 if ((calc_ret = tree_calculate_authority_set(tree, &auth_nodes)) == 0) in X509_policy_check()
705 ret = tree_calculate_user_set(tree, policy_oids, auth_nodes); in X509_policy_check()
711 *ptree = tree; in X509_policy_check()
714 nodes = X509_policy_tree_get0_user_policies(tree); in X509_policy_check()
721 X509_policy_tree_free(tree); in X509_policy_check()