Skip to content

Commit 911952a

Browse files
committed
Fix loading ssl library on MacOSX 10.15; Try to load libeay32 only on Win
Only relevant for historical signatures, as openssl is not used otherwise. But it is used, for example, when VerifyScript is called without specifyng any of _STRICT_ENCODING_FLAGS
1 parent fe72aac commit 911952a

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

bitcointx/core/key.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import struct
2424
import ctypes
2525
import ctypes.util
26+
import platform
2627
import hashlib
2728
import warnings
2829
from abc import abstractmethod
@@ -80,7 +81,21 @@ def _check_res_openssl_void_p(val, func, args): # type: ignore
8081
def load_openssl_library(path: Optional[str] = None) -> Optional[ctypes.CDLL]:
8182

8283
if path is None:
83-
path = ctypes.util.find_library('ssl') or 'libeay32'
84+
path_generic = ctypes.util.find_library('ssl')
85+
if platform.system() == 'Darwin':
86+
# Fix for bug in MacOSX 10.15 where libssl is not a real
87+
# library, and causes SIGABRT on load.
88+
# libssl.35 should be the most compatible lib available there.
89+
path = ctypes.util.find_library('ssl.35') or path_generic
90+
elif platform.system() == 'Windows':
91+
path = path_generic or 'libeay32'
92+
else:
93+
path = path_generic
94+
95+
if path is None:
96+
raise ImportError(
97+
"ssl library is required for non-strict signature "
98+
"verification, but it was not found")
8499

85100
try:
86101
handle: Optional[ctypes.CDLL] = ctypes.cdll.LoadLibrary(path)

release-notes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
## v1.1.1.dev0
44

5-
...
5+
Fixes for openssl loading (only relevant for historical signatures:
6+
- Fix issue with libssl on MacOSX 10.15. by trying to load `libssl.35` first
7+
- The `libeay32` library is only tried to be loaded on Windows platform
68

79
## v1.1.0
810

0 commit comments

Comments
 (0)