aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/hazmat/primitives/constant_time.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-05-19 13:05:21 -0700
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-06-07 23:27:54 -0500
commit68b3b1ea8661b98c7afc3243e84c998601b70f18 (patch)
tree08ae523d4f6a76f005e53d4d06d30528fcd9b120 /src/cryptography/hazmat/primitives/constant_time.py
parentca820de5c681d5bb53cb8376eaf7bc85c4bbcdd3 (diff)
downloadcryptography-68b3b1ea8661b98c7afc3243e84c998601b70f18.tar.gz
cryptography-68b3b1ea8661b98c7afc3243e84c998601b70f18.tar.bz2
cryptography-68b3b1ea8661b98c7afc3243e84c998601b70f18.zip
convert to cffi 1.0 precompile system
Diffstat (limited to 'src/cryptography/hazmat/primitives/constant_time.py')
-rw-r--r--src/cryptography/hazmat/primitives/constant_time.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/cryptography/hazmat/primitives/constant_time.py b/src/cryptography/hazmat/primitives/constant_time.py
index bf85bde1..5a682ca9 100644
--- a/src/cryptography/hazmat/primitives/constant_time.py
+++ b/src/cryptography/hazmat/primitives/constant_time.py
@@ -5,20 +5,8 @@
from __future__ import absolute_import, division, print_function
import hmac
-import os
-from cryptography.hazmat.bindings.utils import LazyLibrary, build_ffi
-
-
-with open(os.path.join(os.path.dirname(__file__), "src/constant_time.h")) as f:
- TYPES = f.read()
-
-with open(os.path.join(os.path.dirname(__file__), "src/constant_time.c")) as f:
- FUNCTIONS = f.read()
-
-
-_ffi = build_ffi(cdef_source=TYPES, verify_source=FUNCTIONS)
-_lib = LazyLibrary(_ffi)
+from cryptography.hazmat.bindings._constant_time import lib
if hasattr(hmac, "compare_digest"):
@@ -33,6 +21,6 @@ else:
if not isinstance(a, bytes) or not isinstance(b, bytes):
raise TypeError("a and b must be bytes.")
- return _lib.Cryptography_constant_time_bytes_eq(
+ return lib.Cryptography_constant_time_bytes_eq(
a, len(a), b, len(b)
) == 1