mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Merge commit 'b2eaac1' into dtls
* commit 'b2eaac1': Stop assuming chars are signed Add tests for CBC record splitting Fix tests that were failing with record splitting Allow disabling record splitting at runtime Add 1/n-1 record splitting Enhance doc on ssl_write() Conflicts: include/polarssl/ssl.h programs/ssl/ssl_client2.c programs/ssl/ssl_server2.c
This commit is contained in:
@ -93,6 +93,7 @@ int main( int argc, char *argv[] )
|
||||
#define DFL_AUTH_MODE SSL_VERIFY_REQUIRED
|
||||
#define DFL_MFL_CODE SSL_MAX_FRAG_LEN_NONE
|
||||
#define DFL_TRUNC_HMAC 0
|
||||
#define DFL_RECSPLIT -1
|
||||
#define DFL_RECONNECT 0
|
||||
#define DFL_RECO_DELAY 0
|
||||
#define DFL_TICKETS SSL_SESSION_TICKETS_ENABLED
|
||||
@ -138,6 +139,7 @@ struct options
|
||||
int auth_mode; /* verify mode for connection */
|
||||
unsigned char mfl_code; /* code for maximum fragment length */
|
||||
int trunc_hmac; /* negotiate truncated hmac or not */
|
||||
int recsplit; /* enable record splitting? */
|
||||
int reconnect; /* attempt to resume session */
|
||||
int reco_delay; /* delay in seconds before resuming session */
|
||||
int tickets; /* enable / disable session tickets */
|
||||
@ -285,6 +287,13 @@ static int my_verify( void *data, x509_crt *crt, int depth, int *flags )
|
||||
#define USAGE_MAX_FRAG_LEN ""
|
||||
#endif /* POLARSSL_SSL_MAX_FRAGMENT_LENGTH */
|
||||
|
||||
#if defined(POLARSSL_SSL_CBC_RECORD_SPLITTING)
|
||||
#define USAGE_RECSPLIT \
|
||||
" recplit=%%d default: (library default)\n"
|
||||
#else
|
||||
#define USAGE_RECSPLIT
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_TIMING_C)
|
||||
#define USAGE_TIME \
|
||||
" reco_delay=%%d default: 0 seconds\n"
|
||||
@ -373,6 +382,7 @@ static int my_verify( void *data, x509_crt *crt, int depth, int *flags )
|
||||
USAGE_FALLBACK \
|
||||
USAGE_EMS \
|
||||
USAGE_ETM \
|
||||
USAGE_RECSPLIT \
|
||||
"\n" \
|
||||
" min_version=%%s default: \"\" (ssl3)\n" \
|
||||
" max_version=%%s default: \"\" (tls1_2)\n" \
|
||||
@ -471,6 +481,7 @@ int main( int argc, char *argv[] )
|
||||
opt.auth_mode = DFL_AUTH_MODE;
|
||||
opt.mfl_code = DFL_MFL_CODE;
|
||||
opt.trunc_hmac = DFL_TRUNC_HMAC;
|
||||
opt.recsplit = DFL_RECSPLIT;
|
||||
opt.reconnect = DFL_RECONNECT;
|
||||
opt.reco_delay = DFL_RECO_DELAY;
|
||||
opt.tickets = DFL_TICKETS;
|
||||
@ -743,6 +754,12 @@ int main( int argc, char *argv[] )
|
||||
if( opt.hs_to_min == 0 || opt.hs_to_max < opt.hs_to_min )
|
||||
goto usage;
|
||||
}
|
||||
else if( strcmp( p, "recsplit" ) == 0 )
|
||||
{
|
||||
opt.recsplit = atoi( q );
|
||||
if( opt.recsplit < 0 || opt.recsplit > 1 )
|
||||
goto usage;
|
||||
}
|
||||
else
|
||||
goto usage;
|
||||
}
|
||||
@ -1058,6 +1075,13 @@ int main( int argc, char *argv[] )
|
||||
ssl_set_encrypt_then_mac( &ssl, opt.etm );
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_SSL_CBC_RECORD_SPLITTING)
|
||||
if( opt.recsplit != DFL_RECSPLIT )
|
||||
ssl_set_cbc_record_splitting( &ssl, opt.recsplit
|
||||
? SSL_CBC_RECORD_SPLITTING_ENABLED
|
||||
: SSL_CBC_RECORD_SPLITTING_DISABLED );
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_SSL_ALPN)
|
||||
if( opt.alpn_string != NULL )
|
||||
if( ( ret = ssl_set_alpn_protocols( &ssl, alpn_list ) ) != 0 )
|
||||
|
Reference in New Issue
Block a user