• Home
  • Raw
  • Download

Lines Matching refs:tree

103 static void tree_print(char *str, X509_POLICY_TREE *tree,  in tree_print()  argument
112 curr = tree->levels + tree->nlevel; in tree_print()
116 BIO_printf(err, "Printing Up to Level %ld\n", curr - tree->levels); in tree_print()
117 for (plev = tree->levels; plev != curr; plev++) { in tree_print()
119 plev - tree->levels, plev->flags); in tree_print()
152 X509_POLICY_TREE *tree; in tree_init() local
228 tree = OPENSSL_malloc(sizeof(X509_POLICY_TREE)); in tree_init()
230 if (!tree) in tree_init()
233 tree->flags = 0; in tree_init()
234 tree->levels = OPENSSL_malloc(sizeof(X509_POLICY_LEVEL) * n); in tree_init()
235 tree->nlevel = 0; in tree_init()
236 tree->extra_data = NULL; in tree_init()
237 tree->auth_policies = NULL; in tree_init()
238 tree->user_policies = NULL; in tree_init()
240 if (!tree->levels) { in tree_init()
241 OPENSSL_free(tree); in tree_init()
245 OPENSSL_memset(tree->levels, 0, n * sizeof(X509_POLICY_LEVEL)); in tree_init()
247 tree->nlevel = n; in tree_init()
249 level = tree->levels; in tree_init()
255 if (!data || !level_add_node(level, data, NULL, tree)) in tree_init()
296 *ptree = tree; in tree_init()
305 X509_policy_tree_free(tree); in tree_init()
375 X509_POLICY_NODE *node, X509_POLICY_TREE *tree) in tree_add_unmatched() argument
391 if (!level_add_node(curr, data, node, tree)) { in tree_add_unmatched()
401 X509_POLICY_NODE *node, X509_POLICY_TREE *tree) in tree_link_unmatched() argument
411 if (!tree_add_unmatched(curr, cache, NULL, node, tree)) in tree_link_unmatched()
424 if (!tree_add_unmatched(curr, cache, oid, node, tree)) in tree_link_unmatched()
436 X509_POLICY_TREE *tree) in tree_link_any() argument
448 if (!tree_link_unmatched(curr, cache, node, tree)) in tree_link_any()
473 if (!level_add_node(curr, data, node, tree)) { in tree_link_any()
494 static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) in tree_prune() argument
529 if (curr == tree->levels) { in tree_prune()
565 static int tree_calculate_authority_set(X509_POLICY_TREE *tree, in tree_calculate_authority_set() argument
573 curr = tree->levels + tree->nlevel - 1; in tree_calculate_authority_set()
577 if (!tree_add_auth_node(&tree->auth_policies, curr->anyPolicy)) in tree_calculate_authority_set()
582 addnodes = &tree->auth_policies; in tree_calculate_authority_set()
584 curr = tree->levels; in tree_calculate_authority_set()
585 for (i = 1; i < tree->nlevel; i++) { in tree_calculate_authority_set()
604 *pnodes = tree->auth_policies; in tree_calculate_authority_set()
609 static int tree_calculate_user_set(X509_POLICY_TREE *tree, in tree_calculate_user_set() argument
628 anyPolicy = tree->levels[tree->nlevel - 1].anyPolicy; in tree_calculate_user_set()
633 tree->flags |= POLICY_FLAG_ANY_POLICY; in tree_calculate_user_set()
654 node = level_add_node(NULL, extra, anyPolicy->parent, tree); in tree_calculate_user_set()
656 if (!tree->user_policies) { in tree_calculate_user_set()
657 tree->user_policies = sk_X509_POLICY_NODE_new_null(); in tree_calculate_user_set()
658 if (!tree->user_policies) in tree_calculate_user_set()
661 if (!sk_X509_POLICY_NODE_push(tree->user_policies, node)) in tree_calculate_user_set()
668 static int tree_evaluate(X509_POLICY_TREE *tree) in tree_evaluate() argument
671 X509_POLICY_LEVEL *curr = tree->levels + 1; in tree_evaluate()
674 for (i = 1; i < tree->nlevel; i++, curr++) { in tree_evaluate()
680 && !tree_link_any(curr, cache, tree)) in tree_evaluate()
682 tree_print("before tree_prune()", tree, curr); in tree_evaluate()
683 ret = tree_prune(tree, curr); in tree_evaluate()
698 void X509_policy_tree_free(X509_POLICY_TREE *tree) in X509_policy_tree_free() argument
703 if (!tree) in X509_policy_tree_free()
706 sk_X509_POLICY_NODE_free(tree->auth_policies); in X509_policy_tree_free()
707 sk_X509_POLICY_NODE_pop_free(tree->user_policies, exnode_free); in X509_policy_tree_free()
709 for (i = 0, curr = tree->levels; i < tree->nlevel; i++, curr++) { in X509_policy_tree_free()
718 if (tree->extra_data) in X509_policy_tree_free()
719 sk_X509_POLICY_DATA_pop_free(tree->extra_data, policy_data_free); in X509_policy_tree_free()
721 OPENSSL_free(tree->levels); in X509_policy_tree_free()
722 OPENSSL_free(tree); in X509_policy_tree_free()
741 X509_POLICY_TREE *tree = NULL; in X509_policy_check() local
746 ret = tree_init(&tree, certs, flags); in X509_policy_check()
776 if (!tree) in X509_policy_check()
789 if (!tree) in X509_policy_check()
791 ret = tree_evaluate(tree); in X509_policy_check()
793 tree_print("tree_evaluate()", tree, NULL); in X509_policy_check()
800 X509_policy_tree_free(tree); in X509_policy_check()
809 calc_ret = tree_calculate_authority_set(tree, &auth_nodes); in X509_policy_check()
814 ret = tree_calculate_user_set(tree, policy_oids, auth_nodes); in X509_policy_check()
823 if (tree) in X509_policy_check()
824 *ptree = tree; in X509_policy_check()
827 nodes = X509_policy_tree_get0_user_policies(tree); in X509_policy_check()
836 X509_policy_tree_free(tree); in X509_policy_check()