1 From 2e3e3c0b0f4e0c19e411fd46358930bf158ad3f5 Mon Sep 17 00:00:00 2001
2 From: Jonathan McDowell <noodles@earth.li>
3 Date: Wed, 1 Feb 2023 09:29:58 +0000
4 Subject: [PATCH] Gracefully fail FAPI init when it's not compiled in
8 WARNING: Getting tokens from fapi backend failed.
10 errors when FAPI support is not compiled in gracefully fail the FAPI
11 init and don't log any warnings. We'll still produce a message
12 indicating this is what's happened in verbose mode, but normal operation
13 no longer gets an unnecessary message.
17 Signed-off-by: Jonathan McDowell <noodles@earth.li>
19 src/lib/backend.c | 4 +++-
20 src/lib/backend_fapi.c | 3 ++-
21 2 files changed, 5 insertions(+), 2 deletions(-)
23 diff --git a/src/lib/backend.c b/src/lib/backend.c
24 index ca5e2ccf..128f58b9 100644
25 --- a/src/lib/backend.c
26 +++ b/src/lib/backend.c
27 @@ -53,7 +53,9 @@ CK_RV backend_init(void) {
32 + if (rv != CKR_FUNCTION_NOT_SUPPORTED) {
38 diff --git a/src/lib/backend_fapi.c b/src/lib/backend_fapi.c
39 index fe594f0e..3a203632 100644
40 --- a/src/lib/backend_fapi.c
41 +++ b/src/lib/backend_fapi.c
42 @@ -977,7 +977,8 @@ CK_RV backend_fapi_token_changeauth(token *tok, bool user, twist toldpin, twist
44 CK_RV backend_fapi_init(void) {
47 + LOGV("FAPI not enabled, failing init");
48 + return CKR_FUNCTION_NOT_SUPPORTED;
51 CK_RV backend_fapi_destroy(void) {