Hi,
As a temporary workaround for the you can use:
ssl.MBEDTLS_PRIVATE(handshake).resume
But please be aware that this is something that could break with any
future release, so should only be used as a very temporary workaround.
We made these members private in 3.0.0, and thus need to know if
anyone's code paths have been broken as a result, so we can add
accessors or new methods as required. Regarding this, may I enquire the
reason for your needing to know if the session has been resumed - is
this only a debug thing, or do you have a requirement in your codebase
to know this?
Regards,
Paul.
On Mon, 2022-03-07 at 20:55 +0000, eoin.mcmahon.dev--- via mbed-tls
wrote:
> I am trying to modify the dtls_server.c example to keep track of
> whether session caching was used for a given connection.
>
> Ideally I would have an interget value i.e `session_resumed = #1 or
> 0`
>
> One way I tried to do this was by reading the value of the
> mbedtls_ssl_context struct `ssl`:
> ```
> /*
> * 5. Handshake
> */
> do ret = mbedtls_ssl_handshake( &ssl );
> while( ret == MBEDTLS_ERR_SSL_WANT_READ || ret ==
> MBEDTLS_ERR_SSL_WANT_WRITE );
>
> if( ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED ) {
> printf( " hello verification requested\n" );
> ret = 0;
> goto reset;
> }
> else if( ret != 0 ) {
> printf( " failed\n ! mbedtls_ssl_handshake returned -
> 0x%x\n\n", (unsigned int) -ret );
> goto reset;
> }
> printf( " session cache status: %d\n", ssl.handshake.resume );
> ```
>
> The issue with this is that the ssl struct is set to private, so the
> code fails to compile with the error: 'struct mbedtls_ssl_context'
> has no member named 'handshake'
>
> Can somebody help me with some example code that would make this
> possible?