dlitz/pycrypto — pull request #52 by tesdal (2013-07-09 09:48:49+00:00)
Title: Constant time comparison utility function for signature verification

I added a constant time comparison utility function ``Crypto.Util.comparison.constant_time_comparison``, to be used for signature verifications. The most relevant code is the 9 last lines of ``Util/comparison.py``.

The constant comparison code is the same as in [#33](https://github.com/dlitz/pycrypto/pull/33/files#L4R604) and [numerous](http://codahale.com/a-lesson-in-timing-attacks/) other places.

Some basic tests are included. Note that there is no type checking of the inputs, the comparison function expects two iterable of characters.

In this pull request, the constant comparison is introduced in the two PKCS1 signature verify methods, but it is probably useful in some of the PublicKey classes as well.