cryptsetup: use crypt_token_max if available
New API added upstream: https://gitlab.com/cryptsetup/cryptsetup/-/commit/8a12f6dc2c75f8fd0c4969fbdc421895eb418072
This commit is contained in:
committed by
Luca Boccassi
parent
0a9fb9bad8
commit
3c2c8e62c9
@@ -37,7 +37,7 @@ int list_enrolled(struct crypt_device *cd) {
|
||||
|
||||
/* Second step, enumerate through all tokens, and update the slot table, indicating what kind of
|
||||
* token they are assigned to */
|
||||
for (int token = 0; token < LUKS2_TOKENS_MAX; token++) {
|
||||
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
const char *type;
|
||||
JsonVariant *w, *z;
|
||||
|
||||
@@ -20,7 +20,7 @@ static int search_policy_hash(
|
||||
if (hash_size == 0)
|
||||
return 0;
|
||||
|
||||
for (int token = 0; token < LUKS2_TOKENS_MAX; token ++) {
|
||||
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token ++) {
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
_cleanup_free_ void *thash = NULL;
|
||||
size_t thash_size = 0;
|
||||
|
||||
@@ -99,7 +99,7 @@ static int find_slots_by_mask(
|
||||
|
||||
/* Find all slots that are associated with a token of a type in the specified token type mask */
|
||||
|
||||
for (int token = 0; token < LUKS2_TOKENS_MAX; token++) {
|
||||
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
JsonVariant *w, *z;
|
||||
EnrollType t;
|
||||
@@ -199,7 +199,7 @@ static int find_slot_tokens(struct crypt_device *cd, Set *wipe_slots, Set *keep_
|
||||
/* Find all tokens matching the slots we want to wipe, so that we can wipe them too. Also, for update
|
||||
* the slots sets according to the token data: add any other slots listed in the tokens we act on. */
|
||||
|
||||
for (int token = 0; token < LUKS2_TOKENS_MAX; token++) {
|
||||
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
bool shall_wipe = false;
|
||||
JsonVariant *w, *z;
|
||||
|
||||
Reference in New Issue
Block a user