mbedtls: Warn about missing featues of mbedTLS build

The libssh requires mbedTLS to have support for threading. Given the
way how the mbedTLS builds are configured (at least to my limited
understanding), by modifying mbedtls_config.h header file, this
changes the silent failure to a message on stderr pointing the
user in the right direction.

Fixes: #304

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2025-08-11 21:46:15 +02:00
parent 55bb909252
commit 607dad040b

View File

@@ -52,6 +52,12 @@ int crypto_thread_init(struct ssh_threads_callbacks_struct *user_callbacks)
#elif defined MBEDTLS_THREADING_PTHREAD
return SSH_OK;
#else
fprintf(stderr,
"MbedTLS needs to have threading enabled with "
"MBEDTLS_THREADING_PTHREAD or MBEDTLS_THREADING_ALT "
"in mbedtls_config.h\n");
#warn "MbedTLS needs to have threading enabled with " \
"MBEDTLS_THREADING_PTHREAD or MBEDTLS_THREADING_ALT in mbedtls_config.h"
return SSH_ERROR;
#endif
}