Skip to content

Commit e90100e

Browse files
committed
Fix oscrypto support for libcrypto.35.dylib and libssl.35.dylib
It seems certain version pairs have to be used together, but Apple doesn't really publish this info, and it is harder to figure out now that system dylibs aren't show in the filesystem. The other known good pair is libcrypto.42.dylib and libssl.44.dylib.
1 parent 4197348 commit e90100e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

oscrypto/_openssl/_libssl.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ class LibsslConst():
9393
LibsslConst.SSL_R_DH_KEY_TOO_SMALL = 394
9494

9595

96+
error_code_version_info = libcrypto_version_info
9697
# The Apple version of libssl seems to have changed various codes for
9798
# some reason, but the rest of the API is still OpenSSL 1.0.1
98-
if sys.platform == 'darwin' and re.match(r'/usr/lib/libssl\.\d', _backend_config().get('libssl_path', '')):
99-
LibsslConst.SSL_F_TLS_PROCESS_SERVER_CERTIFICATE = 7
100-
LibsslConst.SSL_F_SSL3_GET_KEY_EXCHANGE = 9
101-
LibsslConst.SSL_F_SSL3_READ_BYTES = 4
102-
LibsslConst.SSL_F_SSL3_GET_RECORD = 4
103-
LibsslConst.SSL_F_SSL23_GET_SERVER_HELLO = 4
104-
error_code_version_info = (1, 1, 0)
105-
106-
else:
107-
error_code_version_info = libcrypto_version_info
99+
if sys.platform == 'darwin':
100+
libssl_abi_match = re.match(r'/usr/lib/libssl\.(\d+)', _backend_config().get('libssl_path', ''))
101+
if libssl_abi_match and int(libssl_abi_match.group(1)) >= 44:
102+
LibsslConst.SSL_F_TLS_PROCESS_SERVER_CERTIFICATE = 7
103+
LibsslConst.SSL_F_SSL3_GET_KEY_EXCHANGE = 9
104+
LibsslConst.SSL_F_SSL3_READ_BYTES = 4
105+
LibsslConst.SSL_F_SSL3_GET_RECORD = 4
106+
LibsslConst.SSL_F_SSL23_GET_SERVER_HELLO = 4
107+
error_code_version_info = (1, 1, 0)

0 commit comments

Comments
 (0)