aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2015-01-18 17:15:47 +0000
committerAlex Stapleton <alex@ly.st>2015-01-22 16:38:13 +0000
commitd76aa47f9797b9bfa02e1f22b593f1c16a3edc13 (patch)
treea0a871dbd653a0d8c20107450f5c868d6d47ffc0 /src
parentf48f69d6654a10a46e34323747c54e0f0ccb7eef (diff)
downloadcryptography-d76aa47f9797b9bfa02e1f22b593f1c16a3edc13.tar.gz
cryptography-d76aa47f9797b9bfa02e1f22b593f1c16a3edc13.tar.bz2
cryptography-d76aa47f9797b9bfa02e1f22b593f1c16a3edc13.zip
Move around bits of the EC test suite to work around awful PyPy bug
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index 34efdce9..75d7e32f 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -985,9 +985,6 @@ class Backend(object):
"Invalid EC key. Both x and y must be non-negative."
)
- bn_x = self._int_to_bn(x)
- bn_y = self._int_to_bn(y)
-
set_func, get_func, group = (
self._ec_key_determine_group_get_set_funcs(ctx)
)
@@ -996,6 +993,9 @@ class Backend(object):
assert point != self._ffi.NULL
point = self._ffi.gc(point, self._lib.EC_POINT_free)
+ bn_x = self._int_to_bn(x)
+ bn_y = self._int_to_bn(y)
+
with self._tmp_bn_ctx() as bn_ctx:
check_x = self._lib.BN_CTX_get(bn_ctx)
check_y = self._lib.BN_CTX_get(bn_ctx)
@@ -1006,8 +1006,10 @@ class Backend(object):
res = get_func(group, point, check_x, check_y, bn_ctx)
assert res == 1
- assert self._lib.BN_cmp(bn_x, check_x) == 0
- assert self._lib.BN_cmp(bn_y, check_y) == 0
+ res = self._lib.BN_cmp(bn_x, check_x)
+ assert res == 0
+ res = self._lib.BN_cmp(bn_y, check_y)
+ assert res == 0
res = self._lib.EC_KEY_set_public_key(ctx, point)
assert res == 1