Add mbedtls_ssl_get_session_pointer()

Avoid useless copy with mbedtls_ssl_get_session() before serialising.

Used in ssl_client2 for testing and demonstrating usage, but unfortunately
that means mbedtls_ssl_get_session() is no longer tested, which will be fixed
in the next commit.
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 342ecdd..36db80d 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -2442,14 +2442,7 @@
         mbedtls_printf("  . Saving session for reuse..." );
         fflush( stdout );
 
-        if( ( ret = mbedtls_ssl_get_session( &ssl, &saved_session ) ) != 0 )
-        {
-            mbedtls_printf( " failed\n  ! mbedtls_ssl_get_session returned -0x%x\n\n",
-                            -ret );
-            goto exit;
-        }
-
-        if( ( ret = mbedtls_ssl_session_save( &saved_session,
+        if( ( ret = mbedtls_ssl_session_save( mbedtls_ssl_get_session_pointer( &ssl ),
                                               session_data, sizeof( session_data ),
                                               &session_data_len ) ) != 0 )
         {
@@ -2458,10 +2451,6 @@
             goto exit;
         }
 
-        /* Simulate that serialised state can have a larger lifetime than a
-         * structure: keep the serialised data but not the structure. */
-        mbedtls_ssl_session_free( &saved_session );
-
         mbedtls_printf( " ok\n" );
     }