Better name routine verifying any available digest.

also drop unused parameter from internal routine.
This commit is contained in:
Ondrej Kozina
2024-11-08 14:07:31 +01:00
parent a93921c226
commit 6506d324ee
3 changed files with 4 additions and 6 deletions

View File

@@ -314,8 +314,7 @@ void crypt_token_unload_external_all(struct crypt_device *cd);
/* /*
* Generic LUKS2 digest * Generic LUKS2 digest
*/ */
int LUKS2_digest_any_matching(struct crypt_device *cd, int LUKS2_digest_verify_by_any_matching(struct crypt_device *cd,
struct luks2_hdr *hdr,
const struct volume_key *vk); const struct volume_key *vk);
int LUKS2_digest_verify_by_segment(struct crypt_device *cd, int LUKS2_digest_verify_by_segment(struct crypt_device *cd,

View File

@@ -143,8 +143,7 @@ int LUKS2_digest_dump(struct crypt_device *cd, int digest)
return h->dump(cd, digest); return h->dump(cd, digest);
} }
int LUKS2_digest_any_matching(struct crypt_device *cd, int LUKS2_digest_verify_by_any_matching(struct crypt_device *cd,
struct luks2_hdr *hdr __attribute__((unused)),
const struct volume_key *vk) const struct volume_key *vk)
{ {
int digest; int digest;

View File

@@ -5556,7 +5556,7 @@ static int _verify_key(struct crypt_device *cd,
} }
if (segment == CRYPT_ANY_SEGMENT) if (segment == CRYPT_ANY_SEGMENT)
r = LUKS2_digest_any_matching(cd, &cd->u.luks2.hdr, vk); r = LUKS2_digest_verify_by_any_matching(cd, vk);
else { else {
r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, segment, vk); r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, segment, vk);
if (r == -EPERM || r == -ENOENT) if (r == -EPERM || r == -ENOENT)
@@ -7525,7 +7525,7 @@ static int keyslot_add_by_key(struct crypt_device *cd,
else { else {
/* if key matches any existing digest, do not create new digest */ /* if key matches any existing digest, do not create new digest */
if ((flags & CRYPT_VOLUME_KEY_DIGEST_REUSE)) if ((flags & CRYPT_VOLUME_KEY_DIGEST_REUSE))
digest = LUKS2_digest_any_matching(cd, &cd->u.luks2.hdr, vk); digest = LUKS2_digest_verify_by_any_matching(cd, vk);
/* no segment flag or new vk flag requires new key digest */ /* no segment flag or new vk flag requires new key digest */
if (flags & (CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_SET)) { if (flags & (CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_SET)) {