-
Description:I looked around in
The following article explains these two, and also notices that (1) should be used if it is available. So, my thought is that the double HMAC could be skipped, improving performance and readability (which is very important in cryptographic implementations). This would make the protected function validMac(array $payload)
{
return hash_equals(
$this->hash($payload['iv'], $payload['value']),
$payload['mac']
);
} Input from a cryptographic expert would be much appreciated here. Perhaps I have misunderstood the real reason for the randomized double HMAC. Making these changes is non-breaking, since it only changes the validation-side. I'm prepared to make a PR if this is a wanted change. What is a timing attack?For readers unfamiliar with the term, a timing attack is a so-called side-channel attack where a cryptographic operation is leaking information about the contents through a "side-channel" such as time, heat, sound or similar. In this case, a normal === check between two strings would be faster when the strings differ more and slower when they differ only in the last byte, which enables for a cryptographic attack. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Merged in 2aa0563, can be marked as answered. |
Beta Was this translation helpful? Give feedback.
Merged in 2aa0563, can be marked as answered.