mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Add constant time memcmp and use it for comparing keys.
There is perhaps no problem now, but it is a good practise to use constant time for key comaprison to avoid possible side channel issues.
This commit is contained in:
@@ -2401,7 +2401,7 @@ static int _compare_volume_keys(struct volume_key *svk, unsigned skeyring_only,
|
||||
return 1;
|
||||
|
||||
if (!skeyring_only && !tkeyring_only)
|
||||
return memcmp(svk->key, tvk->key, svk->keylength);
|
||||
return crypt_backend_memeq(svk->key, tvk->key, svk->keylength);
|
||||
|
||||
if (svk->key_description && tvk->key_description)
|
||||
return strcmp(svk->key_description, tvk->key_description);
|
||||
|
||||
Reference in New Issue
Block a user