Skip to content

core: support openssl 3 - #301

Merged
petertodd merged 1 commit into
petertodd:masterfrom
vincenzopalazzo:macros/support-openssl3
Aug 6, 2024
Merged

core: support openssl 3#301
petertodd merged 1 commit into
petertodd:masterfrom
vincenzopalazzo:macros/support-openssl3

Conversation

@vincenzopalazzo

Copy link
Copy Markdown
Contributor

In modern version of openssl (iirc from 1.1) the
library libeay32 is removed in favour of libcrypto.

See for more info openssl/openssl#10332

This commit adds the possibility to include libcrypto too

Fixing the following error on a nix shell

/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/_pytest/config/__init__.py:325: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown. Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: OSError: libeay32: cannot open shared object file: No such file or directory (from /home/vincent/gittea/work/lampo.rs/tests/lnprototest/tests/conftest.py) For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
config = pluginmanager.hook.pytest_cmdline_parse(
ImportError while loading conftest '/home/vincent/gittea/work/lampo.rs/tests/lnprototest/tests/conftest.py'.
tests/conftest.py:3: in <module>
import lnprototest
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/__init__.py:15: in <module>
from .event import (
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/event.py:16: in <module>
from .namespace import namespace
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/namespace.py:6: in <module>
from .signature import SigType
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/signature.py:5: in <module>
from .utils import check_hex, privkey_expand
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/utils/__init__.py:18: in <module>
from .bitcoin_utils import (
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/utils/bitcoin_utils.py:14: in <module>
from bitcoin.wallet import CBitcoinSecret
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/bitcoin/wallet.py:23: in <module>
import bitcoin.core.key
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/bitcoin/core/key.py:27: in <module>
_ssl = ctypes.cdll.LoadLibrary(
/nix/store/sxr2igfkwhxbagri49b8krmcqz168sim-python3-3.11.8/lib/python3.11/ctypes/__init__.py:454: in LoadLibrary
return self._dlltype(name)
/nix/store/sxr2igfkwhxbagri49b8krmcqz168sim-python3-3.11.8/lib/python3.11/ctypes/__init__.py:376: in __init__
self._handle = _dlopen(self._name, mode)
E OSError: libeay32: cannot open shared object file: No such file or directory
make[1]: *** [Makefile:11: check] Error 4

In modern version of openssl (iirc from 1.1) the
library `libeay32` is removed in favor of libcrypto.
See for more info openssl/openssl#10332
This commit is adding the possibility to include libcrypto too
Fixing the following error on a nix shell
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/_pytest/config/__init__.py:325: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: OSError: libeay32: cannot open shared object file: No such file or directory (from /home/vincent/gittea/work/lampo.rs/tests/lnprototest/tests/conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
config = pluginmanager.hook.pytest_cmdline_parse(
ImportError while loading conftest '/home/vincent/gittea/work/lampo.rs/tests/lnprototest/tests/conftest.py'.
tests/conftest.py:3: in <module>
import lnprototest
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/__init__.py:15: in <module>
from .event import (
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/event.py:16: in <module>
from .namespace import namespace
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/namespace.py:6: in <module>
from .signature import SigType
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/signature.py:5: in <module>
from .utils import check_hex, privkey_expand
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/utils/__init__.py:18: in <module>
from .bitcoin_utils import (
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/lnprototest/utils/bitcoin_utils.py:14: in <module>
from bitcoin.wallet import CBitcoinSecret
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/bitcoin/wallet.py:23: in <module>
import bitcoin.core.key
/home/vincent/.cache/pypoetry/virtualenvs/lampo-lnprototest-IQvPSNpc-py3.11/lib/python3.11/site-packages/bitcoin/core/key.py:27: in <module>
_ssl = ctypes.cdll.LoadLibrary(
/nix/store/sxr2igfkwhxbagri49b8krmcqz168sim-python3-3.11.8/lib/python3.11/ctypes/__init__.py:454: in LoadLibrary
return self._dlltype(name)
/nix/store/sxr2igfkwhxbagri49b8krmcqz168sim-python3-3.11.8/lib/python3.11/ctypes/__init__.py:376: in __init__
self._handle = _dlopen(self._name, mode)
E OSError: libeay32: cannot open shared object file: No such file or directory
make[1]: *** [Makefile:11: check] Error 4
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
@petertodd
petertodd merged commit 06e7289 into petertodd:masterAug 6, 2024
@petertodd

Copy link
Copy Markdown
Owner

Thanks!

@vincenzopalazzo
vincenzopalazzo deleted the macros/support-openssl3 branch August 6, 2024 14:02
aviv57 added a commit to aviv57/python-bitcoinlib that referenced this pull request Oct 30, 2024
Looks like the fix in petertodd#301 was not working.
I got the following error while trying to run "from bitcoin.rpc import Proxy" on my machine
```
File ~\venvs\1\Lib\site-packages\bitcoin\rpc.py:38
36 from bitcoin.core import COIN, x, lx, b2lx, CBlock, CBlockHeader, CTransaction, COutPoint, CTxOut
37 from bitcoin.core.script import CScript
---> 38 from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
40 DEFAULT_USER_AGENT = "AuthServiceProxy/0.1"
42 DEFAULT_HTTP_TIMEOUT = 30
File ~\venvs\1\Lib\site-packages\bitcoin\wallet.py:23
21 import bitcoin.bech32
22 import bitcoin.core
---> 23 import bitcoin.core.key
24 import bitcoin.core.script as script
27 class CBitcoinAddress(object):
File ~\venvs\1\Lib\site-packages\bitcoin\core\key.py:27
23 import bitcoin.signature
25 import bitcoin.core.script
---> 27 _ssl = ctypes.cdll.LoadLibrary(
28 ctypes.util.find_library('ssl.35') or ctypes.util.find_library('ssl') or ctypes.util.find_library('libeay32')
29 )
31 _libsecp256k1_path = ctypes.util.find_library('secp256k1')
32 _libsecp256k1_enable_signing = False
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:460, in LibraryLoader.LoadLibrary(self, name)
459 def LoadLibrary(self, name):
--> 460 return self._dlltype(name)
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:369, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
367 import nt
368 mode = nt._LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
--> 369 if '/' in name or '\\' in name:
370 self._name = nt._getfullpathname(self._name)
371 mode |= nt._LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
TypeError: argument of type 'NoneType' is not iterable
```
aviv57 added a commit to aviv57/python-bitcoinlib that referenced this pull request Oct 30, 2024
Looks like the fix in petertodd#301 was not working.
I got the following error while trying to run `from bitcoin.rpc import Proxy` on my machine
```
File ~\venvs\1\Lib\site-packages\bitcoin\rpc.py:38
36 from bitcoin.core import COIN, x, lx, b2lx, CBlock, CBlockHeader, CTransaction, COutPoint, CTxOut
37 from bitcoin.core.script import CScript
---> 38 from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
40 DEFAULT_USER_AGENT = "AuthServiceProxy/0.1"
42 DEFAULT_HTTP_TIMEOUT = 30
File ~\venvs\1\Lib\site-packages\bitcoin\wallet.py:23
21 import bitcoin.bech32
22 import bitcoin.core
---> 23 import bitcoin.core.key
24 import bitcoin.core.script as script
27 class CBitcoinAddress(object):
File ~\venvs\1\Lib\site-packages\bitcoin\core\key.py:27
23 import bitcoin.signature
25 import bitcoin.core.script
---> 27 _ssl = ctypes.cdll.LoadLibrary(
28 ctypes.util.find_library('ssl.35') or ctypes.util.find_library('ssl') or ctypes.util.find_library('libeay32')
29 )
31 _libsecp256k1_path = ctypes.util.find_library('secp256k1')
32 _libsecp256k1_enable_signing = False
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:460, in LibraryLoader.LoadLibrary(self, name)
459 def LoadLibrary(self, name):
--> 460 return self._dlltype(name)
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:369, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
367 import nt
368 mode = nt._LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
--> 369 if '/' in name or '\\' in name:
370 self._name = nt._getfullpathname(self._name)
371 mode |= nt._LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
TypeError: argument of type 'NoneType' is not iterable
```
aviv57 added a commit to aviv57/python-bitcoinlib that referenced this pull request Oct 30, 2024
Looks like the fix in petertodd#301 was not working.
I got the following error while trying to run `from bitcoin.rpc import Proxy` on my machine
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\rpc.py:38
36 from bitcoin.core import COIN, x, lx, b2lx, CBlock, CBlockHeader, CTransaction, COutPoint, CTxOut
37 from bitcoin.core.script import CScript
---> 38 from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
40 DEFAULT_USER_AGENT = "AuthServiceProxy/0.1"
42 DEFAULT_HTTP_TIMEOUT = 30
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\wallet.py:23
21 import bitcoin.bech32
22 import bitcoin.core
---> 23 import bitcoin.core.key
24 import bitcoin.core.script as script
27 class CBitcoinAddress(object):
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\core\key.py:27
23 import bitcoin.signature
25 import bitcoin.core.script
---> 27 _ssl = ctypes.cdll.LoadLibrary(
28 ctypes.util.find_library('ssl.35') or ctypes.util.find_library('ssl') or ctypes.util.find_library('libeay32')
29 or ctypes.cdll.LoadLibrary("libcrypto")
30 )
32 _libsecp256k1_path = ctypes.util.find_library('secp256k1')
33 _libsecp256k1_enable_signing = False
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:460, in LibraryLoader.LoadLibrary(self, name)
459 def LoadLibrary(self, name):
--> 460 return self._dlltype(name)
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:348, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
343 def __init__(self, name, mode=DEFAULT_MODE, handle=None,
344 use_errno=False,
345 use_last_error=False,
346 winmode=None):
347 if name:
--> 348 name = _os.fspath(name)
349 self._name = name
350 flags = self._func_flags_
TypeError: expected str, bytes or os.PathLike object, not CDLL
aviv57 added a commit to aviv57/python-bitcoinlib that referenced this pull request Oct 30, 2024
Looks like the fix in petertodd#301 was not working.
I got the following error while trying to run `from bitcoin.rpc import Proxy` on my machine
```File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\rpc.py:38
36 from bitcoin.core import COIN, x, lx, b2lx, CBlock, CBlockHeader, CTransaction, COutPoint, CTxOut
37 from bitcoin.core.script import CScript
---> 38 from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
40 DEFAULT_USER_AGENT = "AuthServiceProxy/0.1"
42 DEFAULT_HTTP_TIMEOUT = 30
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\wallet.py:23
21 import bitcoin.bech32
22 import bitcoin.core
---> 23 import bitcoin.core.key
24 import bitcoin.core.script as script
27 class CBitcoinAddress(object):
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\core\key.py:27
23 import bitcoin.signature
25 import bitcoin.core.script
---> 27 _ssl = ctypes.cdll.LoadLibrary(
28 ctypes.util.find_library('ssl.35') or ctypes.util.find_library('ssl') or ctypes.util.find_library('libeay32')
29 or ctypes.cdll.LoadLibrary("libcrypto")
30 )
32 _libsecp256k1_path = ctypes.util.find_library('secp256k1')
33 _libsecp256k1_enable_signing = False
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:460, in LibraryLoader.LoadLibrary(self, name)
459 def LoadLibrary(self, name):
--> 460 return self._dlltype(name)
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:348, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
343 def __init__(self, name, mode=DEFAULT_MODE, handle=None,
344 use_errno=False,
345 use_last_error=False,
346 winmode=None):
347 if name:
--> 348 name = _os.fspath(name)
349 self._name = name
350 flags = self._func_flags_
TypeError: expected str, bytes or os.PathLike object, not CDLL
aviv57 added a commit to aviv57/python-bitcoinlib that referenced this pull request Oct 30, 2024
Looks like the fix in petertodd#301 was not working.
I got the following error while trying to run `from bitcoin.rpc import Proxy` on my machine
```
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\rpc.py:38
36 from bitcoin.core import COIN, x, lx, b2lx, CBlock, CBlockHeader, CTransaction, COutPoint, CTxOut
37 from bitcoin.core.script import CScript
---> 38 from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
40 DEFAULT_USER_AGENT = "AuthServiceProxy/0.1"
42 DEFAULT_HTTP_TIMEOUT = 30
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\wallet.py:23
21 import bitcoin.bech32
22 import bitcoin.core
---> 23 import bitcoin.core.key
24 import bitcoin.core.script as script
27 class CBitcoinAddress(object):
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\core\key.py:27
23 import bitcoin.signature
25 import bitcoin.core.script
---> 27 _ssl = ctypes.cdll.LoadLibrary(
28 ctypes.util.find_library('ssl.35') or ctypes.util.find_library('ssl') or ctypes.util.find_library('libeay32')
29 or ctypes.cdll.LoadLibrary("libcrypto")
30 )
32 _libsecp256k1_path = ctypes.util.find_library('secp256k1')
33 _libsecp256k1_enable_signing = False
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:460, in LibraryLoader.LoadLibrary(self, name)
459 def LoadLibrary(self, name):
--> 460 return self._dlltype(name)
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:348, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
343 def __init__(self, name, mode=DEFAULT_MODE, handle=None,
344 use_errno=False,
345 use_last_error=False,
346 winmode=None):
347 if name:
--> 348 name = _os.fspath(name)
349 self._name = name
350 flags = self._func_flags_
TypeError: expected str, bytes or os.PathLike object, not CDLL
aviv57 added a commit to aviv57/python-bitcoinlib that referenced this pull request Oct 30, 2024
Looks like the fix in petertodd#301 was not working.
I got the following error while trying to run `from bitcoin.rpc import Proxy` on my machine
```
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\rpc.py:38
36 from bitcoin.core import COIN, x, lx, b2lx, CBlock, CBlockHeader, CTransaction, COutPoint, CTxOut
37 from bitcoin.core.script import CScript
---> 38 from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
40 DEFAULT_USER_AGENT = "AuthServiceProxy/0.1"
42 DEFAULT_HTTP_TIMEOUT = 30
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\wallet.py:23
21 import bitcoin.bech32
22 import bitcoin.core
---> 23 import bitcoin.core.key
24 import bitcoin.core.script as script
27 class CBitcoinAddress(object):
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\core\key.py:27
23 import bitcoin.signature
25 import bitcoin.core.script
---> 27 _ssl = ctypes.cdll.LoadLibrary(
28 ctypes.util.find_library('ssl.35') or ctypes.util.find_library('ssl') or ctypes.util.find_library('libeay32')
29 or ctypes.cdll.LoadLibrary("libcrypto")
30 )
32 _libsecp256k1_path = ctypes.util.find_library('secp256k1')
33 _libsecp256k1_enable_signing = False
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:460, in LibraryLoader.LoadLibrary(self, name)
459 def LoadLibrary(self, name):
--> 460 return self._dlltype(name)
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:348, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
343 def __init__(self, name, mode=DEFAULT_MODE, handle=None,
344 use_errno=False,
345 use_last_error=False,
346 winmode=None):
347 if name:
--> 348 name = _os.fspath(name)
349 self._name = name
350 flags = self._func_flags_
TypeError: expected str, bytes or os.PathLike object, not CDLL
petertodd added a commit that referenced this pull request Mar 9, 2025
d2fe2ad core: Fix a bug with loading libcrypto (aviv57)
Pull request description:
Looks like the fix in #301 was not working.
I got the following error while trying to run `from bitcoin.rpc import Proxy` on my machine
```
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\rpc.py:38
36 from bitcoin.core import COIN, x, lx, b2lx, CBlock, CBlockHeader, CTransaction, COutPoint, CTxOut
37 from bitcoin.core.script import CScript
---> 38 from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
40 DEFAULT_USER_AGENT = "AuthServiceProxy/0.1"
42 DEFAULT_HTTP_TIMEOUT = 30
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\wallet.py:23
21 import bitcoin.bech32
22 import bitcoin.core
---> 23 import bitcoin.core.key
24 import bitcoin.core.script as script
27 class CBitcoinAddress(object):
File ~\OneDrive\Documents\GitHub\python-bitcoinlib\bitcoin\core\key.py:27
23 import bitcoin.signature
25 import bitcoin.core.script
---> 27 _ssl = ctypes.cdll.LoadLibrary(
28 ctypes.util.find_library('ssl.35') or ctypes.util.find_library('ssl') or ctypes.util.find_library('libeay32')
29 or ctypes.cdll.LoadLibrary("libcrypto")
30 )
32 _libsecp256k1_path = ctypes.util.find_library('secp256k1')
33 _libsecp256k1_enable_signing = False
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:460, in LibraryLoader.LoadLibrary(self, name)
459 def LoadLibrary(self, name):
--> 460 return self._dlltype(name)
File ~\.pyenv\pyenv-win\versions\3.12.7\Lib\ctypes\__init__.py:348, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
343 def __init__(self, name, mode=DEFAULT_MODE, handle=None,
344 use_errno=False,
345 use_last_error=False,
346 winmode=None):
347 if name:
--> 348 name = _os.fspath(name)
349 self._name = name
350 flags = self._func_flags_
TypeError: expected str, bytes or os.PathLike object, not CDLL
Top commit has no ACKs.
Tree-SHA512: afb98bb333a8011c9074d537277610dff1a72083f6f8128f8a83fbd61f30b923a70341ab005d8adc0b6f269a4ca91e14a6bf4bbb44f8b08a5b86625c9f847593
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@vincenzopalazzo@petertodd