Add api exposing external token handlers support.

This commit is contained in:
Ondrej Kozina
2021-05-12 11:15:13 +02:00
parent c40be6cc7a
commit db44e9de22
3 changed files with 17 additions and 0 deletions

View File

@@ -2254,6 +2254,13 @@ typedef struct {
*/
int crypt_token_register(const crypt_token_handler *handler);
/**
* Report external token handlers (plugins) support
* @return @e 0 when enabled or negative errno value otherwise.
*/
int crypt_token_external_support(void);
/** ABI version for external token in libcryptsetup-token-<name>.so */
#define CRYPT_TOKEN_ABI_VERSION1 "CRYPTSETUP_TOKEN_1.0"

View File

@@ -142,4 +142,5 @@ CRYPTSETUP_2.4 {
crypt_activate_by_token_pin;
crypt_dump_json;
crypt_format;
crypt_token_external_support;
} CRYPTSETUP_2.0;

View File

@@ -38,6 +38,15 @@ static struct crypt_token_handler_internal token_handlers[LUKS2_TOKENS_MAX] = {
}
};
int crypt_token_external_support(void)
{
#if USE_EXTERNAL_TOKENS
return 0;
#else
return -ENOTSUP;
#endif
}
#if USE_EXTERNAL_TOKENS
static void *token_dlvsym(struct crypt_device *cd,
void *handle,