Skip to content

Commit 8ee393d

Browse files
committed
Merge pull request #59
2b0c91a raise Exception when secp256k1 not supported (Kirill Fomichev)
2 parents 6a0a2b9 + 2b0c91a commit 8ee393d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

bitcoin/core/key.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@
2828
# this specifies the curve used with ECDSA.
2929
_NID_secp256k1 = 714 # from openssl/obj_mac.h
3030

31+
# test that openssl support secp256k1
32+
if _ssl.EC_KEY_new_by_curve_name(_NID_secp256k1) == 0:
33+
errno = _ssl.ERR_get_error()
34+
errmsg = ctypes.create_string_buffer(120)
35+
_ssl.ERR_error_string_n(errno, errmsg, 120)
36+
raise RuntimeError('openssl error: %s' % errmsg.value)
37+
3138
# Thx to Sam Devlin for the ctypes magic 64-bit fix.
3239
def _check_result (val, func, args):
3340
if val == 0:

0 commit comments

Comments
 (0)