altcp_tls_mbedtls: implement mbedTLS debug output, comment fixes

This commit is contained in:
Simon Goldschmidt 2018-11-08 20:48:31 +01:00
parent 4aa6df7633
commit 422623a87b

View File

@ -40,8 +40,10 @@
* track of the ratio of application data and TLS overhead would be too much. * track of the ratio of application data and TLS overhead would be too much.
* *
* Mandatory security-related configuration: * Mandatory security-related configuration:
* - define ALTCP_MBEDTLS_RNG_FN to a custom GOOD rng function returning 0 on success: * - define ALTCP_MBEDTLS_RNG_FN to mbedtls_entropy_func to use the standard mbedTLS
* int my_rng_fn(void *ctx, unsigned char *buffer , size_t len) * entropy and ensure to add at least one strong entropy source to your mbedtls port
* (implement mbedtls_platform_entropy_poll or mbedtls_hardware_poll providing strong
* entropy)
* - define ALTCP_MBEDTLS_ENTROPY_PTR and ALTCP_MBEDTLS_ENTROPY_LEN to something providing * - define ALTCP_MBEDTLS_ENTROPY_PTR and ALTCP_MBEDTLS_ENTROPY_LEN to something providing
* GOOD custom entropy * GOOD custom entropy
* *
@ -638,12 +640,13 @@ altcp_tls_context(struct altcp_pcb *conn)
static void static void
altcp_mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) altcp_mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str)
{ {
LWIP_UNUSED_ARG(str); LWIP_UNUSED_ARG(ctx);
LWIP_UNUSED_ARG(level); LWIP_UNUSED_ARG(level);
LWIP_UNUSED_ARG(file); LWIP_UNUSED_ARG(file);
LWIP_UNUSED_ARG(line); LWIP_UNUSED_ARG(line);
LWIP_UNUSED_ARG(ctx); LWIP_UNUSED_ARG(str);
/* @todo: output debug string :-) */
LWIP_DEBUGF(ALTCP_MBEDTLS_DEBUG, ("%s:%04d: %s", file, line, str));
} }
#endif #endif
@ -676,7 +679,7 @@ altcp_tls_create_config(int is_server, int have_cert, int have_pkey, int have_ca
if (TCP_WND < MBEDTLS_SSL_MAX_CONTENT_LEN) { if (TCP_WND < MBEDTLS_SSL_MAX_CONTENT_LEN) {
LWIP_DEBUGF(ALTCP_MBEDTLS_DEBUG|LWIP_DBG_LEVEL_SERIOUS, LWIP_DEBUGF(ALTCP_MBEDTLS_DEBUG|LWIP_DBG_LEVEL_SERIOUS,
("altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!\n")); ("altcp_tls: TCP_WND is smaller than the RX decryption buffer, connection RX might stall!\n"));
} }
altcp_mbedtls_mem_init(); altcp_mbedtls_mem_init();