summaryrefslogtreecommitdiff
path: root/trust/module.c
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-12-25 07:32:01 +0100
committerDaiki Ueno <ueno@gnu.org>2019-01-04 15:12:04 +0100
commiteb503f3a1467f21a5ecc9ae84ae23b216afc102f (patch)
treef47577c78dfdabb6cf805eea0cba328ba6a47f4b /trust/module.c
parent0dd62395788ae566d3adef967611bce214a04435 (diff)
trust: Fail if trust anchors are not loaded from a file
If the trust path is a file, treat parse error as fatal and abort the C_FindObjectsInit call.
Diffstat (limited to 'trust/module.c')
-rw-r--r--trust/module.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/trust/module.c b/trust/module.c
index 0c16a39..1722340 100644
--- a/trust/module.c
+++ b/trust/module.c
@@ -1198,11 +1198,16 @@ sys_C_FindObjectsInit (CK_SESSION_HANDLE handle,
indices[n++] = session->index;
if (want_token_objects) {
if (!session->loaded)
- p11_token_load (session->token);
- session->loaded = CK_TRUE;
- indices[n++] = p11_token_index (session->token);
+ if (p11_token_load (session->token) < 0)
+ rv = CKR_FUNCTION_FAILED;
+ if (rv == CKR_OK) {
+ session->loaded = CK_TRUE;
+ indices[n++] = p11_token_index (session->token);
+ }
}
+ }
+ if (rv == CKR_OK) {
find = calloc (1, sizeof (FindObjects));
warn_if_fail (find != NULL);