summaryrefslogtreecommitdiff
path: root/trust/token.c
diff options
context:
space:
mode:
Diffstat (limited to 'trust/token.c')
-rw-r--r--trust/token.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/trust/token.c b/trust/token.c
index e0c2089..b562788 100644
--- a/trust/token.c
+++ b/trust/token.c
@@ -56,8 +56,6 @@
#include <stdlib.h>
#include <string.h>
-#define ELEMS(x) (sizeof (x) / sizeof (x[0]))
-
struct _p11_token {
p11_parser *parser;
p11_index *index;
@@ -68,18 +66,6 @@ struct _p11_token {
int loaded;
};
-static void
-on_parser_object (CK_ATTRIBUTE *attrs,
- void *user_data)
-{
- p11_token *token = user_data;
-
- return_if_fail (attrs != NULL);
-
- if (p11_index_take (token->index, attrs, NULL) != CKR_OK)
- return_if_reached ();
-}
-
static int
loader_load_file (p11_token *token,
const char *filename,
@@ -211,6 +197,7 @@ load_builtin_objects (p11_token *token)
CK_OBJECT_CLASS builtin = CKO_NSS_BUILTIN_ROOT_LIST;
CK_BBOOL vtrue = CK_TRUE;
CK_BBOOL vfalse = CK_FALSE;
+ CK_RV rv;
const char *trust_anchor_roots = "Trust Anchor Roots";
CK_ATTRIBUTE builtin_root_list[] = {
@@ -219,10 +206,12 @@ load_builtin_objects (p11_token *token)
{ CKA_PRIVATE, &vfalse, sizeof (vfalse) },
{ CKA_MODIFIABLE, &vfalse, sizeof (vfalse) },
{ CKA_LABEL, (void *)trust_anchor_roots, strlen (trust_anchor_roots) },
+ { CKA_INVALID },
};
p11_index_batch (token->index);
- on_parser_object (p11_attrs_buildn (NULL, builtin_root_list, ELEMS (builtin_root_list)), token);
+ rv = p11_index_take (token->index, p11_attrs_dup (builtin_root_list), NULL);
+ return_val_if_fail (rv == CKR_OK, 0);
p11_index_finish (token->index);
return 1;
}