dlitz/pycrypto — pull request #44 by Legrandin (2013-05-14 06:39:14+00:00)
Title: HMAC can securely validate if a MAC is correct.

In the current implementation, it is left up to the caller
to assess if the locally computed MAC matches the MAC associated
to the received message.

However, the most natural way to do that (use == operator)
is also deepy unsecure, see here:

http://seb.dbzteam.org/crypto/python-oauth-timing-hmac.pdf

With this patch, the HMAC.digest() method can optionally accept
the given MAC and perform the check on behalf of the caller.
The method will use constant-time code (still dependent on the length
of the MAC, but not on the actual content).