From 607dad040b6566626c217d162eb96daa6230f543 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 11 Aug 2025 21:46:15 +0200 Subject: [PATCH] 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 Reviewed-by: Andreas Schneider --- src/threads/mbedtls.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/threads/mbedtls.c b/src/threads/mbedtls.c index 6cc3fa53..62e1db87 100644 --- a/src/threads/mbedtls.c +++ b/src/threads/mbedtls.c @@ -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 }