*
*/
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
#include <openssl/x509.h>
#include <openssl/x509v3.h>
/* If we get this far initialize the tree */
- tree = OPENSSL_malloc(sizeof(X509_POLICY_TREE));
+ tree = OPENSSL_malloc(sizeof(*tree));
if (!tree)
return 0;
tree->flags = 0;
- tree->levels = OPENSSL_malloc(sizeof(X509_POLICY_LEVEL) * n);
+ tree->levels = OPENSSL_malloc(sizeof(*tree->levels) * n);
tree->nlevel = 0;
tree->extra_data = NULL;
tree->auth_policies = NULL;
return 0;
}
- memset(tree->levels, 0, n * sizeof(X509_POLICY_LEVEL));
-
+ memset(tree->levels, 0, sizeof(*tree->levels) * n);
tree->nlevel = n;
-
level = tree->levels;
/* Root data: initialize to anyPolicy */
-
data = policy_data_new(NULL, OBJ_nid2obj(NID_any_policy), 0);
if (!data || !level_add_node(level, data, NULL, tree))
level++;
x = sk_X509_value(certs, i);
cache = policy_cache_set(x);
- CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
+ X509_up_ref(x);
level->cert = x;
if (!cache->anyPolicy)
* If no anyPolicy node on this this level it can't appear on lower
* levels so end search.
*/
- if (!(anyptr = curr->anyPolicy))
+ if ((anyptr = curr->anyPolicy) == NULL)
break;
curr++;
for (j = 0; j < sk_X509_POLICY_NODE_num(curr->nodes); j++) {
for (i = 0, curr = tree->levels; i < tree->nlevel; i++, curr++) {
X509_free(curr->cert);
sk_X509_POLICY_NODE_pop_free(curr->nodes, policy_node_free);
- if (curr->anyPolicy)
- policy_node_free(curr->anyPolicy);
+ policy_node_free(curr->anyPolicy);
}
sk_X509_POLICY_DATA_pop_free(tree->extra_data, policy_data_free);