chiark / gitweb /
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)
commitbfb450ccb248489a622c7dcb51ed5e150eb8f3b6
tree4e41eb13fd6623f7011415d80a01c04430257c28
parent69e137681fb60aa4acc6d9fd5b56b7adeba0b625
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.
bytestring.c
catacomb-python.h
catacomb/__init__.py