mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 06:45:38 +01:00
Strict C99: don't use extremely large string literals
Don't use string literals that are longer than 4095 bytes, which is the minimum that C99 compilers are required to support. Compilers are extremely likely to support longer literals, but `gcc -std=c99 -pedantic` complains. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
3aba3f48f8
commit
63d92c6633
@ -239,7 +239,9 @@ int main( void )
|
|||||||
#define USAGE_ECJPAKE ""
|
#define USAGE_ECJPAKE ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USAGE \
|
/* USAGE is arbitrarily split to stay under the portable string literal
|
||||||
|
* length limit: 4095 bytes in C99. */
|
||||||
|
#define USAGE1 \
|
||||||
"\n usage: ssl_client2 param=<>...\n" \
|
"\n usage: ssl_client2 param=<>...\n" \
|
||||||
"\n acceptable parameters:\n" \
|
"\n acceptable parameters:\n" \
|
||||||
" server_name=%%s default: localhost\n" \
|
" server_name=%%s default: localhost\n" \
|
||||||
@ -260,14 +262,16 @@ int main( void )
|
|||||||
" skip_close_notify=%%d default: 0 (send close_notify)\n" \
|
" skip_close_notify=%%d default: 0 (send close_notify)\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
USAGE_DTLS \
|
USAGE_DTLS \
|
||||||
"\n" \
|
"\n"
|
||||||
|
#define USAGE2 \
|
||||||
" auth_mode=%%s default: (library default: none)\n" \
|
" auth_mode=%%s default: (library default: none)\n" \
|
||||||
" options: none, optional, required\n" \
|
" options: none, optional, required\n" \
|
||||||
USAGE_IO \
|
USAGE_IO \
|
||||||
"\n" \
|
"\n" \
|
||||||
USAGE_PSK \
|
USAGE_PSK \
|
||||||
USAGE_ECJPAKE \
|
USAGE_ECJPAKE \
|
||||||
"\n" \
|
"\n"
|
||||||
|
#define USAGE3 \
|
||||||
" allow_legacy=%%d default: (library default: no)\n" \
|
" allow_legacy=%%d default: (library default: no)\n" \
|
||||||
USAGE_RENEGO \
|
USAGE_RENEGO \
|
||||||
" exchanges=%%d default: 1\n" \
|
" exchanges=%%d default: 1\n" \
|
||||||
@ -284,7 +288,8 @@ int main( void )
|
|||||||
USAGE_CURVES \
|
USAGE_CURVES \
|
||||||
USAGE_RECSPLIT \
|
USAGE_RECSPLIT \
|
||||||
USAGE_DHMLEN \
|
USAGE_DHMLEN \
|
||||||
"\n" \
|
"\n"
|
||||||
|
#define USAGE4 \
|
||||||
" arc4=%%d default: (library default: 0)\n" \
|
" arc4=%%d default: (library default: 0)\n" \
|
||||||
" allow_sha1=%%d default: 0\n" \
|
" allow_sha1=%%d default: 0\n" \
|
||||||
" min_version=%%s default: (library default: tls1)\n" \
|
" min_version=%%s default: (library default: tls1)\n" \
|
||||||
@ -507,7 +512,10 @@ int main( int argc, char *argv[] )
|
|||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
mbedtls_printf( USAGE );
|
mbedtls_printf( USAGE1 );
|
||||||
|
mbedtls_printf( USAGE2 );
|
||||||
|
mbedtls_printf( USAGE3 );
|
||||||
|
mbedtls_printf( USAGE4 );
|
||||||
|
|
||||||
list = mbedtls_ssl_list_ciphersuites();
|
list = mbedtls_ssl_list_ciphersuites();
|
||||||
while( *list )
|
while( *list )
|
||||||
|
@ -338,7 +338,9 @@ int main( void )
|
|||||||
#define USAGE_CURVES ""
|
#define USAGE_CURVES ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USAGE \
|
/* USAGE is arbitrarily split to stay under the portable string literal
|
||||||
|
* length limit: 4095 bytes in C99. */
|
||||||
|
#define USAGE1 \
|
||||||
"\n usage: ssl_server2 param=<>...\n" \
|
"\n usage: ssl_server2 param=<>...\n" \
|
||||||
"\n acceptable parameters:\n" \
|
"\n acceptable parameters:\n" \
|
||||||
" server_addr=%%s default: (all interfaces)\n" \
|
" server_addr=%%s default: (all interfaces)\n" \
|
||||||
@ -357,7 +359,8 @@ int main( void )
|
|||||||
USAGE_COOKIES \
|
USAGE_COOKIES \
|
||||||
USAGE_ANTI_REPLAY \
|
USAGE_ANTI_REPLAY \
|
||||||
USAGE_BADMAC_LIMIT \
|
USAGE_BADMAC_LIMIT \
|
||||||
"\n" \
|
"\n"
|
||||||
|
#define USAGE2 \
|
||||||
" auth_mode=%%s default: (library default: none)\n" \
|
" auth_mode=%%s default: (library default: none)\n" \
|
||||||
" options: none, optional, required\n" \
|
" options: none, optional, required\n" \
|
||||||
" cert_req_ca_list=%%d default: 1 (send ca list)\n" \
|
" cert_req_ca_list=%%d default: 1 (send ca list)\n" \
|
||||||
@ -367,7 +370,8 @@ int main( void )
|
|||||||
"\n" \
|
"\n" \
|
||||||
USAGE_PSK \
|
USAGE_PSK \
|
||||||
USAGE_ECJPAKE \
|
USAGE_ECJPAKE \
|
||||||
"\n" \
|
"\n"
|
||||||
|
#define USAGE3 \
|
||||||
" allow_legacy=%%d default: (library default: no)\n" \
|
" allow_legacy=%%d default: (library default: no)\n" \
|
||||||
USAGE_RENEGO \
|
USAGE_RENEGO \
|
||||||
" exchanges=%%d default: 1\n" \
|
" exchanges=%%d default: 1\n" \
|
||||||
@ -380,7 +384,8 @@ int main( void )
|
|||||||
USAGE_EMS \
|
USAGE_EMS \
|
||||||
USAGE_ETM \
|
USAGE_ETM \
|
||||||
USAGE_CURVES \
|
USAGE_CURVES \
|
||||||
"\n" \
|
"\n"
|
||||||
|
#define USAGE4 \
|
||||||
" arc4=%%d default: (library default: 0)\n" \
|
" arc4=%%d default: (library default: 0)\n" \
|
||||||
" allow_sha1=%%d default: 0\n" \
|
" allow_sha1=%%d default: 0\n" \
|
||||||
" min_version=%%s default: (library default: tls1)\n" \
|
" min_version=%%s default: (library default: tls1)\n" \
|
||||||
@ -979,7 +984,10 @@ int main( int argc, char *argv[] )
|
|||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
mbedtls_printf( USAGE );
|
mbedtls_printf( USAGE1 );
|
||||||
|
mbedtls_printf( USAGE2 );
|
||||||
|
mbedtls_printf( USAGE3 );
|
||||||
|
mbedtls_printf( USAGE4 );
|
||||||
|
|
||||||
list = mbedtls_ssl_list_ciphersuites();
|
list = mbedtls_ssl_list_ciphersuites();
|
||||||
while( *list )
|
while( *list )
|
||||||
|
Loading…
Reference in New Issue
Block a user