From 1772c9fac5b24f700e2335bce34be4d36922534d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 2 Jul 2019 15:18:36 +0200 Subject: [PATCH] Move code to reduce probability of conflicts There are a number of PRs in flight that are going to append to the list of getter functions for harcodeable SSL conf items, so leave that list at the end in order to avoid conflicts between this PR and the SSL conf ones. --- include/mbedtls/ssl_internal.h | 54 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/include/mbedtls/ssl_internal.h b/include/mbedtls/ssl_internal.h index a8aa75b8e..8803e8322 100644 --- a/include/mbedtls/ssl_internal.h +++ b/include/mbedtls/ssl_internal.h @@ -1082,6 +1082,33 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context *ssl, mbedtls_record *rec ); +/* + * Accessor functions for optional fields of various structures + */ + +static inline int mbedtls_ssl_handshake_get_resume( + const mbedtls_ssl_handshake_params *handshake ) +{ +#if !defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION) + return( handshake->resume ); +#else + (void) handshake; + return( 0 ); +#endif +} + +static inline int mbedtls_ssl_get_renego_status( + const mbedtls_ssl_context *ssl ) +{ +#if defined(MBEDTLS_SSL_RENEGOTIATION) + return( ssl->renego_status ); +#else + (void) ssl; + return( MBEDTLS_SSL_INITIAL_HANDSHAKE ); +#endif +} + + /* * Getter functions for fields in mbedtls_ssl_config which may * be fixed at compile time via one of MBEDTLS_SSL_SSL_CONF_XXX. @@ -1111,31 +1138,4 @@ static inline unsigned int mbedtls_ssl_conf_get_ems_enforced( } #endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */ - -/* - * Accessor functions for optional fields of various structures - */ - -static inline int mbedtls_ssl_handshake_get_resume( - const mbedtls_ssl_handshake_params *handshake ) -{ -#if !defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION) - return( handshake->resume ); -#else - (void) handshake; - return( 0 ); -#endif -} - -static inline int mbedtls_ssl_get_renego_status( - const mbedtls_ssl_context *ssl ) -{ -#if defined(MBEDTLS_SSL_RENEGOTIATION) - return( ssl->renego_status ); -#else - (void) ssl; - return( MBEDTLS_SSL_INITIAL_HANDSHAKE ); -#endif -} - #endif /* ssl_internal.h */