Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with OpenSSL 3.2 #161

Closed
zorael opened this issue Dec 18, 2023 · 5 comments
Closed

Not compatible with OpenSSL 3.2 #161

zorael opened this issue Dec 18, 2023 · 5 comments

Comments

@zorael
Copy link
Contributor

zorael commented Dec 18, 2023

EndeavourOS/Arch Linux x86_64, openssl is version 3.2.0-1.

object.Exception@/home/zorael/.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
----------------
/home/zorael/.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d:204 void requests.ssl_adapter._sharedStaticCtor_L64_C1() [0x5614a90bfc77]
??:? void requests.ssl_adapter.__modsharedctor() [0x5614a90bfcb8]
??:? void rt.minfo.runModuleFuncs!(rt.minfo.ModuleGroup.runCtors().__lambda2).runModuleFuncs(const(immutable(object.ModuleInfo)*)[]) [0x5614a9120b12]
??:? void rt.minfo.ModuleGroup.runCtors() [0x5614a912075b]
??:? int rt.minfo.rt_moduleCtor().__foreachbody1(ref rt.sections_elf_shared.DSO) [0x5614a9120a11]
??:? int rt.sections_elf_shared.DSO.opApply(scope int delegate(ref rt.sections_elf_shared.DSO)) [0x5614a90df5b1]
??:? rt_moduleCtor [0x5614a91209e0]
??:? rt_init [0x5614a911e529]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).runAll() [0x5614a90da487]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x5614a90da425]
??:? _d_run_main2 [0x5614a90da38e]
??:? _d_run_main [0x5614a90da177]
/usr/include/dlang/dmd/core/internal/entrypoint.d:29 main [0x5614a8d421c5]
??:? [0x7f14d92afccf]
??:? __libc_start_main [0x7f14d92afd89]
??:? _start [0x5614a8cf4c04]

Adding the definition for 3.2 fixes things, but then it'll break on 3.3, then 3.4.

diff --git a/source/requests/ssl_adapter.d b/source/requests/ssl_adapter.d
index 91a20fb..9c7fb07 100755
--- a/source/requests/ssl_adapter.d
+++ b/source/requests/ssl_adapter.d
@@ -199,6 +199,7 @@ shared static this() {
     init_matrix[Version(0,3)] = &openssl.init1_1; // libressl >= 3.0.0
     init_matrix[Version(3,0)] = &openssl.init1_1; // 3.0.0
     init_matrix[Version(3,1)] = &openssl.init1_1; // 3.1
+    init_matrix[Version(3,2)] = &openssl.init1_1; // 3.2
     auto init = init_matrix.get(openssl._ver, null);
     if ( init is null ) {
         throw new Exception("loading openssl: unknown version %s for init".format(openssl._ver));
@ikod
Copy link
Owner

ikod commented Dec 18, 2023

thanks, will check

@WebFreak001
Copy link
Contributor

I'd suggest for major == 3 && minor >= 0 to just always call init1_1 - unless the initialization there is still old code that was actually not meant for the latest OpenSSL 3.x versions

@ikod ikod closed this as completed in 5f677b0 Dec 21, 2023
ikod added a commit that referenced this issue Dec 21, 2023
fix init_matrix for all OpenSSL 3.x versions, fix #161
@kassane
Copy link

kassane commented Dec 23, 2023

The error persist on serve-d 0.8.0-beta.15+commit.7.g6ceec8a:

object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:51] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:51] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:51] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:51] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
Server crashed 10 times in the last minute. The server will not be restarted.
[Error - 11:03:52] Connection to server got closed. Server will not be restarted.

cc: @WebFreak001

@kassane
Copy link

kassane commented Dec 23, 2023

cc: @ikod

running ssl_adapter.d test:

$>ldc2 -Oz ssltest.d -L-lcrypto -L-lssl

$>  ~ ./ssltest 
openSSL v.3.2
InitSSL - ok
SSL_CTX_new = 557fe7cdedf0
SSL_CTX_set_default_verify_paths = 1(ok)
SSL_CTX_load_verify_locations - ok
SSL_CTX_set_verify - ok
SSL_new = 557fe7df43b0
167.99.xxx.xxx.xx (edited)
SSL_set_fd = 1(ok)
SSL_connect = -1(fail)
code: 1
SSL_write = -1
SSL_read = -1

Note: removed ssl.SSL_library_init(). Why?

ldc2 -Oz ssltest.d -L-lcrypto -L-lssl  
ssltest.d(402): Error: no property `SSL_library_init` for `openssl` of type `immutable(requests.ssl_adapter.OpenSSL)`
ssltest.d(214):        struct `OpenSSL` defined here

@kassane
Copy link

kassane commented Dec 23, 2023

The error persist on serve-d 0.8.0-beta.15+commit.7.g6ceec8a:

object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:51] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:51] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:51] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:51] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
[Info  - 11:03:52] Connection to server got closed. Server will restart.
object.Exception@../../../.dub/packages/requests/2.1.1/requests/source/requests/ssl_adapter.d(204): loading openssl: unknown version Tuple!(int, "major", int, "minor")(3, 2) for init
Server crashed 10 times in the last minute. The server will not be restarted.
[Error - 11:03:52] Connection to server got closed. Server will not be restarted.

fixed: thx Pure-D/code-d#467 (comment)
I didn't understand why code-d not keep with the custom-path added, returning the old [stable] version in ~/.local/share/code-d/bin/. I'll leave stable for nightly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants