mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 23:25:44 +01:00
Add test for session resumption
This commit is contained in:
parent
7e89c17788
commit
19c62f90e4
@ -2861,10 +2861,7 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
|
|||||||
|
|
||||||
if( ssl->handshake->retransmit_state != MBEDTLS_SSL_RETRANS_SENDING )
|
if( ssl->handshake->retransmit_state != MBEDTLS_SSL_RETRANS_SENDING )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "initialise fligh transmission" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "initialise flight transmission" ) );
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "max handshake fragment length: %u",
|
|
||||||
max_hs_fragment_len ) );
|
|
||||||
|
|
||||||
ssl->handshake->cur_msg = ssl->handshake->flight;
|
ssl->handshake->cur_msg = ssl->handshake->flight;
|
||||||
ssl->handshake->cur_msg_p = ssl->handshake->flight->p + 12;
|
ssl->handshake->cur_msg_p = ssl->handshake->flight->p + 12;
|
||||||
@ -2906,7 +2903,11 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
|
|||||||
? max_hs_fragment_len : rem_len;
|
? max_hs_fragment_len : rem_len;
|
||||||
|
|
||||||
if( frag_off == 0 && frag_len != hs_len )
|
if( frag_off == 0 && frag_len != hs_len )
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "fragmenting handshake message" ) );
|
{
|
||||||
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "fragmenting handshake message (%u > %u)",
|
||||||
|
(unsigned) hs_len,
|
||||||
|
(unsigned) max_hs_fragment_len ) );
|
||||||
|
}
|
||||||
|
|
||||||
/* Messages are stored with handshake headers as if not fragmented,
|
/* Messages are stored with handshake headers as if not fragmented,
|
||||||
* copy beginning of headers then fill fragmentation fields.
|
* copy beginning of headers then fill fragmentation fields.
|
||||||
|
@ -5068,6 +5068,32 @@ run_test "DTLS fragmenting: proxy MTU, simple handshake" \
|
|||||||
-c "found fragmented DTLS handshake message" \
|
-c "found fragmented DTLS handshake message" \
|
||||||
-C "error"
|
-C "error"
|
||||||
|
|
||||||
|
# This ensures things still work after session_reset(),
|
||||||
|
# for example it would have caught #1941.
|
||||||
|
# It also exercises the "resumed hanshake" flow.
|
||||||
|
# Since we don't support reading fragmented ClientHello yet,
|
||||||
|
# up the MTU to 1450 (larger than ClientHello with session ticket,
|
||||||
|
# but still smaller than client's Certificate to ensure fragmentation).
|
||||||
|
requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
|
||||||
|
requires_config_enabled MBEDTLS_RSA_C
|
||||||
|
requires_config_enabled MBEDTLS_ECDSA_C
|
||||||
|
run_test "DTLS fragmenting: proxy MTU, resumed handshake" \
|
||||||
|
-p "$P_PXY mtu=1450" \
|
||||||
|
"$P_SRV dtls=1 debug_level=2 auth_mode=required \
|
||||||
|
crt_file=data_files/server7_int-ca.crt \
|
||||||
|
key_file=data_files/server7.key \
|
||||||
|
mtu=1450" \
|
||||||
|
"$P_CLI dtls=1 debug_level=2 \
|
||||||
|
crt_file=data_files/server8_int-ca2.crt \
|
||||||
|
key_file=data_files/server8.key \
|
||||||
|
mtu=1450 reconnect=1" \
|
||||||
|
0 \
|
||||||
|
-S "resend" \
|
||||||
|
-C "resend" \
|
||||||
|
-s "found fragmented DTLS handshake message" \
|
||||||
|
-c "found fragmented DTLS handshake message" \
|
||||||
|
-C "error"
|
||||||
|
|
||||||
requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
|
requires_config_enabled MBEDTLS_SSL_PROTO_DTLS
|
||||||
requires_config_enabled MBEDTLS_RSA_C
|
requires_config_enabled MBEDTLS_RSA_C
|
||||||
requires_config_enabled MBEDTLS_ECDSA_C
|
requires_config_enabled MBEDTLS_ECDSA_C
|
||||||
|
Loading…
Reference in New Issue
Block a user