diff options
author | Alex Stapleton <alex@ly.st> | 2015-03-05 16:15:02 +0000 |
---|---|---|
committer | Alex Stapleton <alex@ly.st> | 2015-03-06 11:49:09 +0000 |
commit | 3873dae7aacece2ec80c9a24f4885993eaa4c281 (patch) | |
tree | e6b5b2d8b5a1422d95c9d406de329f2d8bd1a7d9 | |
parent | 0be6ddcadda45177dc082f1714f2edf7c0e30993 (diff) | |
download | cryptography-3873dae7aacece2ec80c9a24f4885993eaa4c281.tar.gz cryptography-3873dae7aacece2ec80c9a24f4885993eaa4c281.tar.bz2 cryptography-3873dae7aacece2ec80c9a24f4885993eaa4c281.zip |
Stricter asserts on _bn_to_int and _int_to_bn
Helped me catch my terrible programming when working on DH
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/backend.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py index de653032..27d5e353 100644 --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -320,6 +320,7 @@ class Backend(object): ) def _bn_to_int(self, bn): + assert bn != self._ffi.NULL if six.PY3: # Python 3 has constant time from_bytes, so use that. @@ -346,6 +347,7 @@ class Backend(object): ownership of the object). Be sure to register it for GC if it will be discarded after use. """ + assert bn is None or bn != self._ffi.NULL if bn is None: bn = self._ffi.NULL |