aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-10-19 17:52:02 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-10-19 18:12:12 -0700
commiteccf37f6fe6b3af4c75ac6f2f432947c858fddcb (patch)
tree8b646fc6b5f490e0e5605c3fcab14f0e643e24d3 /cryptography
parent0123d4ca3c4a6b2da4a577b9943ec5bf4544246c (diff)
downloadcryptography-eccf37f6fe6b3af4c75ac6f2f432947c858fddcb.tar.gz
cryptography-eccf37f6fe6b3af4c75ac6f2f432947c858fddcb.tar.bz2
cryptography-eccf37f6fe6b3af4c75ac6f2f432947c858fddcb.zip
Fixes #1416 -- replaced assertions with error checking in EC key from numbers.
Includes tests.
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 567f1648..f1cf908a 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -1005,8 +1005,11 @@ 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
+ if self._lib.BN_cmp(bn_x, check_x) != 0:
+ raise ValueError("Invalid EC key.")
+
+ if self._lib.BN_cmp(bn_y, check_y) != 0:
+ raise ValueError("Invalid EC key.")
res = self._lib.EC_KEY_set_public_key(ctx, point)
assert res == 1