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:
@@ -78,7 +78,7 @@ static int PBKDF2_digest_verify(struct crypt_device *cd,
|
||||
mkDigestIterations, 0, 0) < 0) {
|
||||
r = -EINVAL;
|
||||
} else {
|
||||
if (memcmp(checkHashBuf, mkDigest, len) == 0)
|
||||
if (crypt_backend_memeq(checkHashBuf, mkDigest, len) == 0)
|
||||
r = 0;
|
||||
}
|
||||
out:
|
||||
|
||||
Reference in New Issue
Block a user