aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorJulian Krause <julian.krause@gmail.com>2013-12-04 14:49:50 -0800
committerJulian Krause <julian.krause@gmail.com>2013-12-04 14:49:50 -0800
commit9c3088fe12d844a2007e0eff0eb947af53de7f60 (patch)
tree784f9cccd6c10d6313272fd4e3441816bffe3382 /docs
parent3029fe414a3dba0231a44e72ddfc398634c173de (diff)
downloadcryptography-9c3088fe12d844a2007e0eff0eb947af53de7f60.tar.gz
cryptography-9c3088fe12d844a2007e0eff0eb947af53de7f60.tar.bz2
cryptography-9c3088fe12d844a2007e0eff0eb947af53de7f60.zip
Beginnings of a constant_time module.
Diffstat (limited to 'docs')
-rw-r--r--docs/hazmat/primitives/constant-time.rst24
-rw-r--r--docs/hazmat/primitives/index.rst1
2 files changed, 25 insertions, 0 deletions
diff --git a/docs/hazmat/primitives/constant-time.rst b/docs/hazmat/primitives/constant-time.rst
new file mode 100644
index 00000000..2e8e26d7
--- /dev/null
+++ b/docs/hazmat/primitives/constant-time.rst
@@ -0,0 +1,24 @@
+.. hazmat::
+
+Constant time functions
+=======================
+
+.. currentmodule:: cryptography.hazmat.primitives.constant_time
+
+In order for cryptographic operations to not leak information through timing
+side channels, constant time operations need to be made available.
+
+.. function:: bytes_eq(a, b)
+
+ Compare ``a`` and ``b`` to one another in constant time.
+
+ .. doctest::
+
+ >>> from cryptography.hazmat.primitives import constant_time
+ >>> constant_time.bytes_eq(b"foo", b"foo")
+ True
+ >>> constant_time.bytes_eq(b"foo", b"bar")
+ False
+
+ :param a: ``bytes``.
+ :param b: ``bytes``.
diff --git a/docs/hazmat/primitives/index.rst b/docs/hazmat/primitives/index.rst
index 614c414a..b115fdbc 100644
--- a/docs/hazmat/primitives/index.rst
+++ b/docs/hazmat/primitives/index.rst
@@ -10,4 +10,5 @@ Primitives
hmac
symmetric-encryption
padding
+ constant-time
interfaces