Hello Ray,

> Try putting a breakpoint on the function to see if it's called without
> the right context? That's the only thing I can think of.
> mbedtls_ssl_conf_dbg doesn't have a return code so we have to assume
> it's always successful. Also you could ask in an mbedtls forum, maybe
> they know.

I tried that before, the breakpoint never got hit. But now I did the
obvious and read the mbedtls source code. And I found the reason: It is
not enough to enable debugging. The debug level also needs to be set. It
defaults 0 (disabling debugging). Find attached another patch which sets
the debug level to verbose and also explains in a comment in the source
code what needs to be done to enable it bot in mbedtls and curl.

Cheers,
        Thomas
>From d4596e8684ab1a800dcd61725ed97d632fc6b9c9 Mon Sep 17 00:00:00 2001
From: Thomas Glanzmann <[email protected]>
Date: Wed, 3 Aug 2016 08:20:16 +0200
Subject: [PATCH] Set mbedtls debug threshold to 4 (verbose) when MBEDTLS_DEBUG 
is defined

In order to make MBEDTLS_DEBUG work, the debug threshold must be unequal to 0.
This patch also adds a comment how mbedtls must be compiled in order to make
debugging work, and explains the possible debug levels.
---
 lib/vtls/mbedtls.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index 18c2d4f..8c0b229 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -420,7 +420,15 @@ mbed_connect_step1(struct connectdata *conn,
 #endif
 
 #ifdef MBEDTLS_DEBUG
+  /* In order to make that work in mbedtls MBEDTLS_DEBUG_C must be defined. */
   mbedtls_ssl_conf_dbg(&connssl->config, mbed_debug, data);
+  /* - 0 No debug
+   * - 1 Error
+   * - 2 State change
+   * - 3 Informational
+   * - 4 Verbose
+   */
+  mbedtls_debug_set_threshold(4);
 #endif
 
   connssl->connecting_state = ssl_connect_2;
-- 
2.1.4

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html

Reply via email to