diff --git a/ChangeLog.d/ssl_context-user_data.txt b/ChangeLog.d/ssl_context-user_data.txt index 81df94aa6..119884796 100644 --- a/ChangeLog.d/ssl_context-user_data.txt +++ b/ChangeLog.d/ssl_context-user_data.txt @@ -1,3 +1,5 @@ Features * The structures mbedtls_ssl_config and mbedtls_ssl_context have an extra field user_data which is reserved for the application. + * Add an accessor function to get the configuration associated with + an SSL context. diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index afbebfea1..ecfcfc63d 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -1850,6 +1850,22 @@ void mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf, void (*f_dbg)(void *, int, const char *, int, const char *), void *p_dbg ); +/** + * \brief Return the SSL configuration structure associated + * with the given SSL context. + * + * \note The pointer returned by this function is guaranteed to + * remain valid until the context is freed. + * + * \param ssl The SSL context to query. + * \return Pointer to the SSL configuration associated with \p ssl. + */ +static inline const mbedtls_ssl_config *mbedtls_ssl_context_get_config( + const mbedtls_ssl_context *ssl ) +{ + return( ssl->MBEDTLS_PRIVATE( conf ) ); +} + /** * \brief Set the underlying BIO callbacks for write, read and * read-with-timeout.