2c76a4cb41
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
51 lines
1.5 KiB
Diff
51 lines
1.5 KiB
Diff
From 2e3e3c0b0f4e0c19e411fd46358930bf158ad3f5 Mon Sep 17 00:00:00 2001
|
|
From: Jonathan McDowell <noodles@earth.li>
|
|
Date: Wed, 1 Feb 2023 09:29:58 +0000
|
|
Subject: [PATCH] Gracefully fail FAPI init when it's not compiled in
|
|
|
|
Instead of emitting:
|
|
|
|
WARNING: Getting tokens from fapi backend failed.
|
|
|
|
errors when FAPI support is not compiled in gracefully fail the FAPI
|
|
init and don't log any warnings. We'll still produce a message
|
|
indicating this is what's happened in verbose mode, but normal operation
|
|
no longer gets an unnecessary message.
|
|
|
|
Fixes #792
|
|
|
|
Signed-off-by: Jonathan McDowell <noodles@earth.li>
|
|
---
|
|
src/lib/backend.c | 4 +++-
|
|
src/lib/backend_fapi.c | 3 ++-
|
|
2 files changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/lib/backend.c b/src/lib/backend.c
|
|
index ca5e2ccf..128f58b9 100644
|
|
--- a/src/lib/backend.c
|
|
+++ b/src/lib/backend.c
|
|
@@ -53,7 +53,9 @@ CK_RV backend_init(void) {
|
|
LOGE(msg);
|
|
return rv;
|
|
}
|
|
- LOGW(msg);
|
|
+ if (rv != CKR_FUNCTION_NOT_SUPPORTED) {
|
|
+ LOGW(msg);
|
|
+ }
|
|
} else {
|
|
fapi_init = true;
|
|
}
|
|
diff --git a/src/lib/backend_fapi.c b/src/lib/backend_fapi.c
|
|
index fe594f0e..3a203632 100644
|
|
--- a/src/lib/backend_fapi.c
|
|
+++ b/src/lib/backend_fapi.c
|
|
@@ -977,7 +977,8 @@ CK_RV backend_fapi_token_changeauth(token *tok, bool user, twist toldpin, twist
|
|
|
|
CK_RV backend_fapi_init(void) {
|
|
|
|
- return CKR_OK;
|
|
+ LOGV("FAPI not enabled, failing init");
|
|
+ return CKR_FUNCTION_NOT_SUPPORTED;
|
|
}
|
|
|
|
CK_RV backend_fapi_destroy(void) {
|