Explanation for SSL/TLS Error

2023-08-22 Thread jtv
I take it back, OpenSSL wasn't the issue, it was `-lc` (for `getaddrinfo` in particular) and `-ldl` (for `dlopen` itself). So calling either of these two functions in a static binary seems to result in the corresponding library being dlopened even if statically linked, at least according to the

Explanation for SSL/TLS Error

2023-08-22 Thread jtv
IIRC, that doesn't work for openssl 3, it still dlopens in all cases. There are other things like `getaddrinfo` and dlopen itself where Nim seems to require the dynamic library even if statically linking. It should be much easier to force static linking, and actually not have dynamic dependenci

Explanation for SSL/TLS Error

2023-08-22 Thread mratsim
you need --dynliboverride to avoid dlopen and only use static lib Or use `-Wl,-Bstatic -lssl -Wl,-Bdynamic`

Explanation for SSL/TLS Error

2023-08-22 Thread Isofruit
I don't think it'll massively help here, but on the off chance it does: I do use openssl with the smtp module for webdev in an alpine container, but only dynamically linked. I compile with ... --gcc.exe:"musl-gcc" --gcc.linkerexe:"musl-gcc" --define:ssl ...

Explanation for SSL/TLS Error

2023-08-22 Thread jtv
One should generally prefer OpenSSL3 to 1.1 anyway, but I agree it's painful. It also seems to be the case that OpenSSL must be dynamically linked w/ Nim due to it being dlopen()'d even if it's statically linked. We ended up doing some trickery to redirect the dlopen() call ourselves.

Explanation for SSL/TLS Error

2023-08-22 Thread Calonger
Smtp no standard library no longer now nimble package might have bugs fixed ...

Explanation for SSL/TLS Error

2023-08-22 Thread Akito
Yes, makes sense, as in Nim getting confused. In all my trials, I had the following scenarios. I cannot list all, because I spent too much time trying to figure out the problem. 1. Only OpenSSL 1.1 2. Only LibreSSL 1.1 3. Only OpenSSL 3 4. Only LibreSSL 3 5. OpenSSL & LibreSSL 1.1 6.

Explanation for SSL/TLS Error

2023-08-21 Thread jtv
Well, `SSL_get1_peer_certificate` only exists in OpenSSLv3. So it's likely that you somehow were compiling against OpenSSL 1.1 headers. It may be the case that you only have 1.1 installed; Nim can do either out of the box, but if you were looking for 3, but it wasn't installed, you'd get an err

Explanation for SSL/TLS Error

2023-08-21 Thread Akito
I think, I finally got to the point of being able to prove, that the standard library's `smtp` library is broken.

Explanation for SSL/TLS Error

2023-08-20 Thread Akito
For now, the issue does not appear anymore. My program worked. Then TLS stopped working in Alpine. A day later it stopped working on the dev machine, too. Been trying to figure out the solution, since then. I had created a backup of the non-working setup, which has worked before. Now, it starte

Explanation for SSL/TLS Error

2023-08-20 Thread Akito
Thanks for the suggestion. Wasn't easy to apply this fix, as it needed some adjustments. I'm getting this error, which I had seen before, along my journey to getting this fixed, at some point, already. @m..@s..@snim@slib@swrapp...@sopenssl.nim.c:52: undefined reference to `SSL_get

Explanation for SSL/TLS Error

2023-08-20 Thread janAkali
The easiest way to use SSL with musl (default alpine C library) is this repo: Just copy 'config.nims' file to your project directory. Then you could use musl task to build: nim musl foo.nim Run If you add -d:pcre, -d:openss

Explanation for SSL/TLS Error

2023-08-20 Thread Akito
/nim/lib/wrappers/openssl.nim(373) sslSymNullable /nim/lib/wrappers/openssl.nim(347) sslModule Error: unhandled exception: Could not load SSL using libssl.so(.3|.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.48|.47|.46|.45|.44|.43|.41|.39|.38|.10|) [LibraryError] Run I would