mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-27 06:35:22 +00:00
Merge pull request #5425 from gabor-mezei-arm/5181_tls_cipher_extend_testing_of_tickets
TLS Cipher 1a: extend testing of tickets
This commit is contained in:
commit
ff743a7f38
@ -120,6 +120,7 @@ int main( void )
|
||||
#define DFL_TRUNC_HMAC -1
|
||||
#define DFL_TICKETS MBEDTLS_SSL_SESSION_TICKETS_ENABLED
|
||||
#define DFL_TICKET_TIMEOUT 86400
|
||||
#define DFL_TICKET_AEAD MBEDTLS_CIPHER_AES_256_GCM
|
||||
#define DFL_CACHE_MAX -1
|
||||
#define DFL_CACHE_TIMEOUT -1
|
||||
#define DFL_SNI NULL
|
||||
@ -285,7 +286,8 @@ int main( void )
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||
#define USAGE_TICKETS \
|
||||
" tickets=%%d default: 1 (enabled)\n" \
|
||||
" ticket_timeout=%%d default: 86400 (one day)\n"
|
||||
" ticket_timeout=%%d default: 86400 (one day)\n" \
|
||||
" ticket_aead=%%s default: \"AES-256-GCM\"\n"
|
||||
#else
|
||||
#define USAGE_TICKETS ""
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
@ -612,6 +614,7 @@ struct options
|
||||
int trunc_hmac; /* accept truncated hmac? */
|
||||
int tickets; /* enable / disable session tickets */
|
||||
int ticket_timeout; /* session ticket lifetime */
|
||||
int ticket_aead; /* session ticket protection */
|
||||
int cache_max; /* max number of session cache entries */
|
||||
int cache_timeout; /* expiration delay of session cache entries */
|
||||
char *sni; /* string describing sni information */
|
||||
@ -1538,6 +1541,7 @@ int main( int argc, char *argv[] )
|
||||
opt.trunc_hmac = DFL_TRUNC_HMAC;
|
||||
opt.tickets = DFL_TICKETS;
|
||||
opt.ticket_timeout = DFL_TICKET_TIMEOUT;
|
||||
opt.ticket_aead = DFL_TICKET_AEAD;
|
||||
opt.cache_max = DFL_CACHE_MAX;
|
||||
opt.cache_timeout = DFL_CACHE_TIMEOUT;
|
||||
opt.sni = DFL_SNI;
|
||||
@ -1915,6 +1919,14 @@ int main( int argc, char *argv[] )
|
||||
if( opt.ticket_timeout < 0 )
|
||||
goto usage;
|
||||
}
|
||||
else if( strcmp( p, "ticket_aead" ) == 0 )
|
||||
{
|
||||
const mbedtls_cipher_info_t *ci = mbedtls_cipher_info_from_string( q );
|
||||
|
||||
if( ci == NULL )
|
||||
goto usage;
|
||||
opt.ticket_aead = mbedtls_cipher_info_get_type( ci );
|
||||
}
|
||||
else if( strcmp( p, "cache_max" ) == 0 )
|
||||
{
|
||||
opt.cache_max = atoi( q );
|
||||
@ -2708,7 +2720,7 @@ int main( int argc, char *argv[] )
|
||||
{
|
||||
if( ( ret = mbedtls_ssl_ticket_setup( &ticket_ctx,
|
||||
rng_get, &rng,
|
||||
MBEDTLS_CIPHER_AES_256_GCM,
|
||||
opt.ticket_aead,
|
||||
opt.ticket_timeout ) ) != 0 )
|
||||
{
|
||||
mbedtls_printf( " failed\n ! mbedtls_ssl_ticket_setup returned %d\n\n", ret );
|
||||
|
196
tests/ssl-opt.sh
196
tests/ssl-opt.sh
@ -2764,6 +2764,202 @@ run_test "Session resume using tickets: openssl client" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: AES-128-GCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=AES-128-GCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: AES-192-GCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=AES-192-GCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: AES-128-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=AES-128-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: AES-192-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=AES-192-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: AES-256-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=AES-256-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: CAMELLIA-128-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=CAMELLIA-128-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: CAMELLIA-192-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=CAMELLIA-192-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: CAMELLIA-256-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=CAMELLIA-256-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: ARIA-128-GCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=ARIA-128-GCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: ARIA-192-GCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=ARIA-192-GCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: ARIA-256-GCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=ARIA-256-GCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: ARIA-128-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=ARIA-128-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: ARIA-192-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=ARIA-192-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
run_test "Session resume using tickets: ARIA-256-CCM" \
|
||||
"$P_SRV debug_level=3 tickets=1 ticket_aead=ARIA-256-CCM" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
-s "found session ticket extension" \
|
||||
-s "server hello, adding session ticket extension" \
|
||||
-c "found session_ticket extension" \
|
||||
-c "parse new session ticket" \
|
||||
-S "session successfully restored from cache" \
|
||||
-s "session successfully restored from ticket" \
|
||||
-s "a session has been resumed" \
|
||||
-c "a session has been resumed"
|
||||
|
||||
# Tests for Session Tickets with DTLS
|
||||
|
||||
run_test "Session resume using tickets, DTLS: basic" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user