Skip to content

Commit

Permalink
Gracefully fail FAPI init when it's not compiled in
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
u1f35c authored and williamcroberts committed Sep 5, 2024
1 parent bb95e3a commit 10750c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/lib/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/backend_fapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 10750c8

Please sign in to comment.