cryptsetup: use crypt_token_max if available

New API added upstream:

https://gitlab.com/cryptsetup/cryptsetup/-/commit/8a12f6dc2c75f8fd0c4969fbdc421895eb418072
This commit is contained in:
Luca Boccassi
2021-01-05 12:16:07 +00:00
committed by Luca Boccassi
parent 0a9fb9bad8
commit 3c2c8e62c9
9 changed files with 25 additions and 11 deletions
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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;