Understanding error messages in web server library


I am building an HTTP server on Intel SGX, using mbedtls as my TLS library.

I can serve content as expected using HTTP, but when switching over to TLS/SSL using mbedtls I am getting some more complex issues and the error messages are difficult to understand.

Concretely, when I access my site using the “https://” prefix, I can tell that mongoose/mbedtls goes out and reads cert.pem and key.pem, and then makes a recv call on “/”. During that recv call it coughs up the following error:
mg_ssl_if_mbed_err 0x7f9e8c023060 mbedTLS error: -0x7780

From mbedtls src I can read:
#define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780 /**< A fatal alert message was received from our peer. */

My starting point is the simplest_web_server_ssl.

  1. How do I enable mg and mbedtls debug logging?
  2. How do I interpret these errors?

Sincerely grateful for any hints :slight_smile: