Skip to content

Conversation

RokasPuzonas
Copy link
Contributor

Because of the LIBSSH2_CRYPTO_C ifdef at the top of src/openssl.c, src/mbedtls.c, src/libgcrypt.c, src/wincng.c these crypto backends couldn't be used.

It would fail with these kinds of error:

error: undefined symbol: _libssh2_mbedtls_random
    note: referenced by .zig-cache/o/11843e63979650ec3e09dac0b545db56/libssh2.a(.zig-cache/o/2cb63cf0ca6e9aa751f1df0888da2261/channel.o/):.text
    note: referenced by .zig-cache/o/11843e63979650ec3e09dac0b545db56/libssh2.a(.zig-cache/o/28a72c5e23a642bd413157731ed57289/kex.o/):.text
    note: referenced by .zig-cache/o/11843e63979650ec3e09dac0b545db56/libssh2.a(.zig-cache/o/ae98866eb50c1eab86ef8af28da13486/transport.o/):.text
error: undefined symbol: _libssh2_mbedtls_cipher_init
    note: referenced by .zig-cache/o/11843e63979650ec3e09dac0b545db56/libssh2.a(.zig-cache/o/8e6643d4a607c887ad66270bdc2bb433/crypt.o/):.text
error: undefined symbol: _libssh2_mbedtls_cipher_crypt
    note: referenced by .zig-cache/o/11843e63979650ec3e09dac0b545db56/libssh2.a(.zig-cache/o/8e6643d4a607c887ad66270bdc2bb433/crypt.o/):.text
error: undefined symbol: _libssh2_mbedtls_cipher_dtor
    note: referenced by .zig-cache/o/11843e63979650ec3e09dac0b545db56/libssh2.a(.zig-cache/o/8e6643d4a607c887ad66270bdc2bb433/crypt.o/):.text
error: undefined symbol: _libssh2_mbedtls_init
    note: referenced by .zig-cache/o/11843e63979650ec3e09dac0b545db56/libssh2.a(.zig-cache/o/a97e21cd704e51c71c5c9fc294fe88b6/global.o/):.text
error: undefined symbol: _libssh2_mbedtls_free
    note: referenced by .zig-cache/o/11843e63979650ec3e09dac0b545db56/libssh2.a(.zig-cache/o/a97e21cd704e51c71c5c9fc294fe88b6/global.o/):.text

...

FYI. After some additional investigating I noticed that this LIBSSH2_CRYPTO_C ifdef doesn't exist in the master branch of libssh2. Because it was removed with this commit libssh2/libssh2@e0681cd. So when upgrading past libssh2-1.11.1 this part will need to be updated again.

Maybe as a future improvement CI/CD needs to be setup for this, so this kind of bug doesn't reoccur?

Copy link
Contributor

@hamptokr hamptokr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I had pinned the upstream to 1.11.1 and then used master's cmake as a guide, which led to the error here. In future versions crypto.c will be removed and we will have to add this back 💡

@hamptokr hamptokr merged commit 9de45c3 into allyourcodebase:main Sep 30, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants