Allow compile-time configuration of authentication mode
Introduces MBEDTLS_SSL_CONF_AUTHMODE to fix the authentication mode (none, optional, mandatory) at compile-time. Impact on code-size: | | GCC | ARMC5 | ARMC6 | | --- | --- | --- | --- | | `libmbedtls.a` before | 23487 | 24025 | 27885 | | `libmbedtls.a` after | 23379 | 23929 | 27727 | | gain in Bytes | 108 | 96 | 157 |
This commit is contained in:
parent
de67154658
commit
acd4fc0ac9
10 changed files with 82 additions and 8 deletions
|
@ -3450,6 +3450,8 @@
|
|||
* \{
|
||||
*/
|
||||
|
||||
//#define MBEDTLS_SSL_CONF_AUTHMODE MBEDTLS_SSL_VERIFY_REQUIRED
|
||||
|
||||
/* DTLS-specific settings */
|
||||
//#define MBEDTLS_SSL_CONF_ANTI_REPLAY MBEDTLS_SSL_ANTI_REPLAY_ENABLED
|
||||
//#define MBEDTLS_SSL_CONF_BADMAC_LIMIT 0
|
||||
|
|
|
@ -1049,7 +1049,9 @@ struct mbedtls_ssl_config
|
|||
|
||||
unsigned int endpoint : 1; /*!< 0: client, 1: server */
|
||||
unsigned int transport : 1; /*!< stream (TLS) or datagram (DTLS) */
|
||||
#if !defined(MBEDTLS_SSL_CONF_AUTHMODE)
|
||||
unsigned int authmode : 2; /*!< MBEDTLS_SSL_VERIFY_XXX */
|
||||
#endif /* !MBEDTLS_SSL_CONF_AUTHMODE */
|
||||
/* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */
|
||||
unsigned int allow_legacy_renegotiation : 2 ; /*!< MBEDTLS_LEGACY_XXX */
|
||||
#if defined(MBEDTLS_ARC4_C)
|
||||
|
|
|
@ -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_AUTHMODE)
|
||||
static inline int mbedtls_ssl_conf_get_authmode(
|
||||
mbedtls_ssl_config const *conf )
|
||||
{
|
||||
return( conf->authmode );
|
||||
}
|
||||
#else /* !MBEDTLS_SSL_CONF_AUTHMODE */
|
||||
static inline int mbedtls_ssl_conf_get_authmode(
|
||||
mbedtls_ssl_config const *conf )
|
||||
{
|
||||
((void) conf);
|
||||
return( MBEDTLS_SSL_CONF_AUTHMODE );
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_CONF_AUTHMODE */
|
||||
|
||||
#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
|
||||
#if !defined(MBEDTLS_SSL_CONF_BADMAC_LIMIT)
|
||||
static inline unsigned int mbedtls_ssl_conf_get_badmac_limit(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue