mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-05-11 06:28:17 +02:00
Allow compile-time configuration of legacy renegotiation
Introduces MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION allowing to configure enforcing secure renegotiation at compile-time. Impact on code-size: | | GCC | ARMC5 | ARMC6 | | --- | --- | --- | --- | | `libmbedtls.a` after | 23379 | 23929 | 27727 | | `libmbedtls.a` before | 23307 | 23865 | 27615 | | gain in Bytes | 72 | 64 | 112 |
This commit is contained in:
@@ -3450,6 +3450,8 @@
|
||||
* \{
|
||||
*/
|
||||
|
||||
//#define MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION
|
||||
|
||||
//#define MBEDTLS_SSL_CONF_AUTHMODE MBEDTLS_SSL_VERIFY_REQUIRED
|
||||
|
||||
/* DTLS-specific settings */
|
||||
|
||||
@@ -1052,8 +1052,10 @@ struct mbedtls_ssl_config
|
||||
#if !defined(MBEDTLS_SSL_CONF_AUTHMODE)
|
||||
unsigned int authmode : 2; /*!< MBEDTLS_SSL_VERIFY_XXX */
|
||||
#endif /* !MBEDTLS_SSL_CONF_AUTHMODE */
|
||||
#if !defined(MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION)
|
||||
/* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */
|
||||
unsigned int allow_legacy_renegotiation : 2 ; /*!< MBEDTLS_LEGACY_XXX */
|
||||
#endif /* !MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION */
|
||||
#if defined(MBEDTLS_ARC4_C)
|
||||
unsigned int arc4_disabled : 1; /*!< blacklist RC4 ciphersuites? */
|
||||
#endif
|
||||
@@ -3047,6 +3049,7 @@ void mbedtls_ssl_conf_session_tickets( mbedtls_ssl_config *conf, int use_tickets
|
||||
void mbedtls_ssl_conf_renegotiation( mbedtls_ssl_config *conf, int renegotiation );
|
||||
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
||||
|
||||
#if !defined(MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION)
|
||||
/**
|
||||
* \brief Prevent or allow legacy renegotiation.
|
||||
* (Default: MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION)
|
||||
@@ -3073,8 +3076,14 @@ void mbedtls_ssl_conf_renegotiation( mbedtls_ssl_config *conf, int renegotiation
|
||||
* \param allow_legacy Prevent or allow (SSL_NO_LEGACY_RENEGOTIATION,
|
||||
* SSL_ALLOW_LEGACY_RENEGOTIATION or
|
||||
* MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE)
|
||||
*
|
||||
*
|
||||
* \note On constrained systems, this option can also be
|
||||
* fixed at compile-time by defining the constant
|
||||
* MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION.
|
||||
*/
|
||||
void mbedtls_ssl_conf_legacy_renegotiation( mbedtls_ssl_config *conf, int allow_legacy );
|
||||
#endif /* !MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION */
|
||||
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
/**
|
||||
|
||||
@@ -1085,6 +1085,21 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context *ssl,
|
||||
* be fixed at compile time via one of MBEDTLS_SSL_SSL_CONF_XXX.
|
||||
*/
|
||||
|
||||
#if !defined(MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION)
|
||||
static inline unsigned int mbedtls_ssl_conf_get_allow_legacy_renegotiation(
|
||||
mbedtls_ssl_config const *conf )
|
||||
{
|
||||
return( conf->allow_legacy_renegotiation );
|
||||
}
|
||||
#else /* !MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION */
|
||||
static inline unsigned int mbedtls_ssl_conf_get_allow_legacy_renegotiation(
|
||||
mbedtls_ssl_config const *conf )
|
||||
{
|
||||
((void) conf);
|
||||
return( MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION );
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_CONF_ALLOW_LEGACY_RENEGOTIATION */
|
||||
|
||||
#if !defined(MBEDTLS_SSL_CONF_AUTHMODE)
|
||||
static inline int mbedtls_ssl_conf_get_authmode(
|
||||
mbedtls_ssl_config const *conf )
|
||||
|
||||
Reference in New Issue
Block a user