Merge pull request #778 from Atheros1/pointMult-exception
handle OpenSSL.EC_KEY_get0_group() exception
This commit is contained in:
commit
0833938ea3
|
@ -40,6 +40,15 @@ def verify(msg,sig,hexPubkey):
|
||||||
|
|
||||||
# Does an EC point multiplication; turns a private key into a public key.
|
# Does an EC point multiplication; turns a private key into a public key.
|
||||||
def pointMult(secret):
|
def pointMult(secret):
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
"""
|
||||||
|
Evidently, this type of error can occur very rarely:
|
||||||
|
|
||||||
|
File "highlevelcrypto.py", line 54, in pointMult
|
||||||
|
group = OpenSSL.EC_KEY_get0_group(k)
|
||||||
|
WindowsError: exception: access violation reading 0x0000000000000008
|
||||||
|
"""
|
||||||
k = OpenSSL.EC_KEY_new_by_curve_name(OpenSSL.get_curve('secp256k1'))
|
k = OpenSSL.EC_KEY_new_by_curve_name(OpenSSL.get_curve('secp256k1'))
|
||||||
priv_key = OpenSSL.BN_bin2bn(secret, 32, None)
|
priv_key = OpenSSL.BN_bin2bn(secret, 32, None)
|
||||||
group = OpenSSL.EC_KEY_get0_group(k)
|
group = OpenSSL.EC_KEY_get0_group(k)
|
||||||
|
@ -57,3 +66,10 @@ def pointMult(secret):
|
||||||
OpenSSL.BN_free(priv_key)
|
OpenSSL.BN_free(priv_key)
|
||||||
OpenSSL.EC_KEY_free(k)
|
OpenSSL.EC_KEY_free(k)
|
||||||
return mb.raw
|
return mb.raw
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
import time
|
||||||
|
traceback.print_exc()
|
||||||
|
time.sleep(0.2)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user