mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 13:20:11 +01:00
Partially revert few changes.
This commit is contained in:
committed by
Milan Broz
parent
7d475266b6
commit
d438151f25
@@ -164,6 +164,11 @@ typedef struct {
|
|||||||
digest_dump_func dump;
|
digest_dump_func dump;
|
||||||
} digest_handler;
|
} digest_handler;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* public token handler */
|
||||||
|
const crypt_token_handler *h;
|
||||||
|
} token_handler;
|
||||||
|
|
||||||
int LUKS2_find_area_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
|
int LUKS2_find_area_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
|
||||||
size_t keylength, uint64_t *area_offset, uint64_t *area_length);
|
size_t keylength, uint64_t *area_offset, uint64_t *area_length);
|
||||||
int LUKS2_find_area_max_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
|
int LUKS2_find_area_max_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
|
||||||
|
|||||||
@@ -26,10 +26,11 @@
|
|||||||
/* Builtin tokens */
|
/* Builtin tokens */
|
||||||
extern const crypt_token_handler keyring_handler;
|
extern const crypt_token_handler keyring_handler;
|
||||||
|
|
||||||
static const crypt_token_handler *token_handlers[LUKS2_TOKENS_MAX] = {
|
static token_handler token_handlers[LUKS2_TOKENS_MAX] = {
|
||||||
/* keyring builtin token */
|
/* keyring builtin token */
|
||||||
&keyring_handler,
|
{
|
||||||
NULL
|
.h = &keyring_handler
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int is_builtin_candidate(const char *type)
|
static int is_builtin_candidate(const char *type)
|
||||||
@@ -46,8 +47,8 @@ int crypt_token_register(const crypt_token_handler *handler)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < LUKS2_TOKENS_MAX && token_handlers[i]; i++) {
|
for (i = 0; i < LUKS2_TOKENS_MAX && token_handlers[i].h; i++) {
|
||||||
if (!strcmp(token_handlers[i]->name, handler->name)) {
|
if (!strcmp(token_handlers[i].h->name, handler->name)) {
|
||||||
log_dbg(NULL, "Keyslot handler %s is already registered.", handler->name);
|
log_dbg(NULL, "Keyslot handler %s is already registered.", handler->name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -56,7 +57,7 @@ int crypt_token_register(const crypt_token_handler *handler)
|
|||||||
if (i == LUKS2_TOKENS_MAX)
|
if (i == LUKS2_TOKENS_MAX)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
token_handlers[i] = handler;
|
token_handlers[i].h = handler;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,9 +66,9 @@ static const crypt_token_handler
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < LUKS2_TOKENS_MAX && token_handlers[i]; i++)
|
for (i = 0; i < LUKS2_TOKENS_MAX && token_handlers[i].h; i++)
|
||||||
if (!strcmp(token_handlers[i]->name, type))
|
if (!strcmp(token_handlers[i].h->name, type))
|
||||||
return token_handlers[i];
|
return token_handlers[i].h;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user