Add accessor function from mbedtls_ssl_context to the configuration

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/ChangeLog.d/ssl_context-user_data.txt b/ChangeLog.d/ssl_context-user_data.txt
index 81df94a..1198847 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 afbebfe..ecfcfc6 100644
--- a/include/mbedtls/ssl.h
+++ b/include/mbedtls/ssl.h
@@ -1851,6 +1851,22 @@
                   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.
  *