Don't store debug func ptr cb + ctx in SSL config if !DEBUG_C

Note: This is an structure-API breaking change that we might
      not be able to upstream.
This commit is contained in:
Hanno Becker 2019-06-19 15:06:40 +01:00
parent 5455afd74e
commit 272063abfd
2 changed files with 8 additions and 0 deletions

View file

@ -898,9 +898,11 @@ struct mbedtls_ssl_config
const int *ciphersuite_list[4]; /*!< allowed ciphersuites per version */ const int *ciphersuite_list[4]; /*!< allowed ciphersuites per version */
#if defined(MBEDTLS_DEBUG_C)
/** Callback for printing debug output */ /** Callback for printing debug output */
void (*f_dbg)(void *, int, const char *, int, const char *); void (*f_dbg)(void *, int, const char *, int, const char *);
void *p_dbg; /*!< context for the debug function */ void *p_dbg; /*!< context for the debug function */
#endif /* MBEDTLS_DEBUG_C */
#if !defined(MBEDTLS_SSL_CONF_RNG) #if !defined(MBEDTLS_SSL_CONF_RNG)
/** Callback for getting (pseudo-)random numbers */ /** Callback for getting (pseudo-)random numbers */

View file

@ -8217,8 +8217,14 @@ void mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf,
void (*f_dbg)(void *, int, const char *, int, const char *), void (*f_dbg)(void *, int, const char *, int, const char *),
void *p_dbg ) void *p_dbg )
{ {
#if defined(MBEDTLS_DEBUG_C)
conf->f_dbg = f_dbg; conf->f_dbg = f_dbg;
conf->p_dbg = p_dbg; conf->p_dbg = p_dbg;
#else
((void) conf);
((void) f_dbg);
((void) p_dbg);
#endif /* MBEDTLS_DEBUG_C */
} }
#if !defined(MBEDTLS_SSL_CONF_RECV) && \ #if !defined(MBEDTLS_SSL_CONF_RECV) && \