Implement external tokens unload.

This commit is contained in:
Ondrej Kozina
2020-03-05 12:20:47 +01:00
committed by Milan Broz
parent 05c997da1f
commit c9ff83bfa3
2 changed files with 17 additions and 0 deletions

View File

@@ -273,6 +273,8 @@ int LUKS2_token_keyring_get(struct crypt_device *cd,
int LUKS2_token_keyring_json(char *buffer, size_t buffer_size,
const struct crypt_token_params_luks2_keyring *keyring_params);
void crypt_token_unload_external_all(struct crypt_device *cd);
/*
* Generic LUKS2 digest
*/

View File

@@ -131,6 +131,21 @@ int crypt_token_load(const char *name)
return crypt_token_load_external(name, &token_handlers[i]);
}
void crypt_token_unload_external_all(struct crypt_device *cd)
{
int i;
for (i = LUKS2_TOKENS_MAX - 1; i >= 0; i--) {
if (!token_handlers[i].dlhandle)
continue;
log_dbg(cd, "Unloading %s token handler.", token_handlers[i].h->name);
if (dlclose(CONST_CAST(void *)token_handlers[i].dlhandle))
log_dbg(cd, "%s", dlerror());
}
}
static const crypt_token_handler
*LUKS2_token_handler_type(struct crypt_device *cd, const char *type)
{