[Bug 273506] main [so: 15] aarch64 kyua python use fails with: "RuntimeError: OpenSSL 3.0's legacy provider failed to load"

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 02 Sep 2023 00:58:29 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273506

            Bug ID: 273506
           Summary: main [so: 15] aarch64 kyua python use fails with:
                    "RuntimeError: OpenSSL 3.0's legacy provider failed to
                    load"
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: marklmi26-fbsd@yahoo.com

[openssl3 related failures are not clear to me for system vs. ports.
Pick Base System for this initially.]

On aarch64 [and armv7 via aarch64 chroot] after recent port progressions
to openssl3 kyua that invovles python gets:

# /usr/bin/kyua test -k /usr/tests/Kyuafile examples/test_examples.py
examples/test_examples.py:__test_cases_list__  ->  broken: Test program did not
exit cleanly  [0.002s]

[By contrast, amd64 worked fine.]

Doing this in a form that exposes the error report about
legacy support:

# env PYTHONPATH=/usr/tests /usr/local/bin/python3.9 /usr/local/bin/pytest -vv
-p no:cacheprovider -s --atf --confcutdir=/usr/tests
--atf-file=/tmp/kyua.dabz6H/2/result.atf
/usr/tests/examples/test_examples.py::TestExampleSimple::test_with_cleanup
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/lib/python3.9/site-packages/_pytest/main.py",
line 266, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1054,
in _do_configure
INTERNALERROR>    
self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/pluggy/_hooks.py", line 452, in
call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls, kwargs,
False)
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/pluggy/_manager.py", line 112, in
_hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs,
firstresult)
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/pluggy/_callers.py", line 116, in
_multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/pluggy/_callers.py", line 80, in
_multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/pytest_twisted.py", line 516, in
pytest_configure
INTERNALERROR>     reactor_installers[config.getoption("reactor")]()
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/pytest_twisted.py", line 435, in
init_default_reactor
INTERNALERROR>     import twisted.internet.default
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/twisted/internet/default.py", line 55,
in <module>
INTERNALERROR>     install = _getInstallFunction(platform)
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/twisted/internet/default.py", line 47,
in _getInstallFunction
INTERNALERROR>     from twisted.internet.pollreactor import install
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/twisted/internet/pollreactor.py", line
29, in <module>
INTERNALERROR>     from twisted.internet import posixbase
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/twisted/internet/posixbase.py", line
16, in <module>
INTERNALERROR>     from twisted.internet import error, tcp, udp
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/twisted/internet/tcp.py", line 38, in
<module>
INTERNALERROR>     from twisted.internet._newtls import (
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/twisted/internet/_newtls.py", line 18,
in <module>
INTERNALERROR>     from twisted.protocols.tls import TLSMemoryBIOFactory,
TLSMemoryBIOProtocol
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/twisted/protocols/tls.py", line 42, in
<module>
INTERNALERROR>     from OpenSSL.SSL import Connection, Error, SysCallError,
WantReadError, ZeroReturnError
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/OpenSSL/__init__.py", line 8, in
<module>
INTERNALERROR>     from OpenSSL import SSL, crypto
INTERNALERROR>   File "/usr/local/lib/python3.9/site-packages/OpenSSL/SSL.py",
line 9, in <module>
INTERNALERROR>     from OpenSSL._util import (
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/OpenSSL/_util.py", line 6, in <module>
INTERNALERROR>     from cryptography.hazmat.bindings.openssl.binding import
Binding
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.py",
line 167, in <module>
INTERNALERROR>     Binding.init_static_locks()
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.py",
line 134, in init_static_locks
INTERNALERROR>     cls._ensure_ffi_initialized()
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.py",
line 123, in _ensure_ffi_initialized
INTERNALERROR>     _legacy_provider_error(cls._legacy_provider_loaded)
INTERNALERROR>   File
"/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.py",
line 43, in _legacy_provider_error
INTERNALERROR>     raise RuntimeError(
INTERNALERROR> RuntimeError: OpenSSL 3.0's legacy provider failed to load. This
is a fatal error by default, but cryptography supports running without legacy
algorithms by setting the environment variable CRYPTOGRAPHY_OPENSSL_NO_LEGACY.
If you did not expect this error, you have likely made a mistake with your
OpenSSL configuration.

For reference:

# uname -apKU
FreeBSD CA78C-WDK23-ZFS 15.0-CURRENT FreeBSD 15.0-CURRENT aarch64 1500000 #13
main-n265027-2f06449d6429-dirty: Fri Aug 25 09:20:31 PDT 2023    
root@CA78C-WDK23-ZFS:/usr/obj/BUILDs/main-CA78C-nodbg-clang/usr/main-src/arm64.aarch64/sys/GENERIC-NODBG-CA78C
arm64 aarch64 1500000 1500000

# ~/fbsd-based-on-what-commit.sh -C /usr/ports/
8f7f59bbc250 (HEAD -> main, freebsd/main, freebsd/HEAD)
sysutils/bmd-plugin-hookcmd: add new ports.
Author:     Vanilla I. Shu <vanilla@FreeBSD.org>
Commit:     Vanilla I. Shu <vanilla@FreeBSD.org>
CommitDate: 2023-09-01 02:54:14 +0000
branch: main
merge-base: 8f7f59bbc2504672483c7840638c7fc171e1b9f5
merge-base: CommitDate: 2023-09-01 02:54:14 +0000
n632086 (--first-parent --count for merge-base)

-- 
You are receiving this mail because:
You are the assignee for the bug.