File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1919import ctypes .util
2020import hashlib
2121import sys
22+ from os import urandom
2223import bitcoin
2324import bitcoin .signature
2425
@@ -227,8 +228,15 @@ def use_libsecp256k1_for_signing(do_use):
227228 _libsecp256k1 = ctypes .cdll .LoadLibrary (_libsecp256k1_path )
228229 _libsecp256k1 .secp256k1_context_create .restype = ctypes .c_void_p
229230 _libsecp256k1 .secp256k1_context_create .errcheck = _check_res_void_p
231+ _libsecp256k1 .secp256k1_context_randomize .restype = ctypes .c_int
232+ _libsecp256k1 .secp256k1_context_randomize .argtypes = [ctypes .c_void_p , ctypes .c_char_p ]
230233 _libsecp256k1_context = _libsecp256k1 .secp256k1_context_create (SECP256K1_CONTEXT_SIGN )
231234 assert (_libsecp256k1_context is not None )
235+ seed = urandom (32 )
236+ result = _libsecp256k1 .secp256k1_context_randomize (_libsecp256k1_context , seed )
237+ assert 1 == result
238+
239+
232240
233241 _libsecp256k1_enable_signing = True
234242
You can’t perform that action at this time.
0 commit comments