bytestring.c, catacomb/__init__.py: Compare for equality in constant time.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 12 Apr 2017 21:02:15 +0000 (22:02 +0100)
commit54ecf9dd37fb6fac413c9545b2788edb54e20bff
tree5bbbfea1439fbb141c5b2efa19db53e08cd5d1ee
parentad84d8c2d6ff5e1285ecca5a2c3e015d8b4dc14e
bytestring.c, catacomb/__init__.py: Compare for equality in constant time.

There's an explicit `ctstreq' function which just does what you wanted.
Also, `ByteString' objects now have a rich-compare method which always
compares for equality in constant time.  Ordering comparisons are
variable time still.

There's a little chicanery to retain the hash function from `str'.

Also add a simple `check' method to `GHash' and `Poly1305Hash' which
compares a hsah or MAC tag in constant time and returns a boolean
result.
catacomb-python.h