Browse Source

Fix OpenSSL dll/so location find patcher

pull/2635/merge
Tamas Kocsis 2 years ago
parent
commit
c515e26cd6
  1. 2
      src/Crypt/CryptBitcoin.py
  2. 22
      src/util/OpensslFindPatch.py

2
src/Crypt/CryptBitcoin.py

@ -7,6 +7,8 @@ import hashlib
from util.Electrum import dbl_format
from Config import config
import util.OpensslFindPatch
lib_verify_best = "sslcrypto"
from lib import sslcrypto

22
src/util/OpensslFindPatch.py

@ -1,11 +1,12 @@
import logging
import os
import sys
from ctypes.util import find_library
from lib.sslcrypto.openssl import discovery
import ctypes.util
from Config import config
find_library_original = ctypes.util.find_library
def getOpensslPath():
if config.openssl_lib_file:
@ -47,11 +48,22 @@ def getOpensslPath():
logging.debug("OpenSSL lib not found in: %s (%s)" % (path, err))
lib_path = (
find_library('ssl.so') or find_library('ssl') or
find_library('crypto') or find_library('libcrypto') or 'libeay32'
ctypes.util.find_library('ssl.so') or ctypes.util.find_library('ssl') or
ctypes.util.find_library('crypto') or ctypes.util.find_library('libcrypto') or 'libeay32'
)
return lib_path
discovery.discover = getOpensslPath
def patchCtypesOpensslFindLibrary():
def findLibraryPatched(name):
if name in ("ssl", "crypto", "libeay32"):
lib_path = getOpensslPath()
return lib_path
else:
return find_library_original(name)
ctypes.util.find_library = findLibraryPatched
patchCtypesOpensslFindLibrary()

Loading…
Cancel
Save