Make encrypt service decrypt faster by not doing constant time equal

This commit is contained in:
Bernd Schoolmann 2024-01-17 14:06:13 +01:00
parent 5906a36335
commit 6ed3fdfa4d
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -92,7 +92,8 @@ export class EncryptServiceImplementation implements EncryptService {
fastParams.macKey,
"sha256",
);
const macsEqual = await this.cryptoFunctionService.compareFast(fastParams.mac, computedMac);
/// no constant time comparison, because there is no backchannel for timing attacks
const macsEqual = fastParams.mac === computedMac;
if (!macsEqual) {
this.logMacFailed("mac failed.");
return null;