mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 08:35:28 +00:00
Fixed const correctness issues in programs and tests
This commit is contained in:
parent
eae09db9e5
commit
e0225e4d7f
|
@ -70,7 +70,7 @@ int main( int argc, char *argv[] )
|
|||
unsigned char *p, *end;
|
||||
unsigned char buf[2048];
|
||||
unsigned char hash[20];
|
||||
char *pers = "dh_client";
|
||||
const char *pers = "dh_client";
|
||||
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
|
@ -92,7 +92,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -62,7 +62,7 @@ int main( int argc, char *argv[] )
|
|||
mpi G, P, Q;
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
char *pers = "dh_genprime";
|
||||
const char *pers = "dh_genprime";
|
||||
FILE *fout;
|
||||
|
||||
((void) argc);
|
||||
|
@ -83,7 +83,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -71,7 +71,7 @@ int main( int argc, char *argv[] )
|
|||
unsigned char buf[2048];
|
||||
unsigned char hash[20];
|
||||
unsigned char buf2[2];
|
||||
char *pers = "dh_server";
|
||||
const char *pers = "dh_server";
|
||||
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
|
@ -93,7 +93,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -53,9 +53,9 @@
|
|||
struct options
|
||||
{
|
||||
int mode; /* the mode to run the application in */
|
||||
char *filename; /* filename of the key file */
|
||||
char *password; /* password for the private key */
|
||||
char *password_file; /* password_file for the private key */
|
||||
const char *filename; /* filename of the key file */
|
||||
const char *password; /* password for the private key */
|
||||
const char *password_file; /* password_file for the private key */
|
||||
int debug_level; /* level of debugging */
|
||||
} opt;
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@
|
|||
struct options
|
||||
{
|
||||
int mode; /* the mode to run the application in */
|
||||
char *filename; /* filename of the key file */
|
||||
const char *filename; /* filename of the key file */
|
||||
int debug_level; /* level of debugging */
|
||||
int output_mode; /* the output mode to use */
|
||||
char *output_file; /* where to store the constructed key file */
|
||||
const char *output_file; /* where to store the constructed key file */
|
||||
} opt;
|
||||
|
||||
void my_debug( void *ctx, int level, const char *str )
|
||||
|
@ -74,7 +74,7 @@ void my_debug( void *ctx, int level, const char *str )
|
|||
}
|
||||
}
|
||||
|
||||
void write_public_key( rsa_context *rsa, char *output_file )
|
||||
void write_public_key( rsa_context *rsa, const char *output_file )
|
||||
{
|
||||
FILE *f;
|
||||
unsigned char output_buf[16000];
|
||||
|
@ -111,7 +111,7 @@ void write_public_key( rsa_context *rsa, char *output_file )
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
void write_private_key( rsa_context *rsa, char *output_file )
|
||||
void write_private_key( rsa_context *rsa, const char *output_file )
|
||||
{
|
||||
FILE *f;
|
||||
unsigned char output_buf[16000];
|
||||
|
|
|
@ -60,7 +60,7 @@ int main( int argc, char *argv[] )
|
|||
ctr_drbg_context ctr_drbg;
|
||||
unsigned char input[1024];
|
||||
unsigned char buf[512];
|
||||
char *pers = "rsa_encrypt";
|
||||
const char *pers = "rsa_encrypt";
|
||||
|
||||
ret = 1;
|
||||
|
||||
|
@ -80,7 +80,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -62,7 +62,7 @@ int main( int argc, char *argv[] )
|
|||
ctr_drbg_context ctr_drbg;
|
||||
FILE *fpub = NULL;
|
||||
FILE *fpriv = NULL;
|
||||
char *pers = "rsa_genkey";
|
||||
const char *pers = "rsa_genkey";
|
||||
|
||||
((void) argc);
|
||||
((void) argv);
|
||||
|
@ -72,7 +72,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -69,7 +69,7 @@ int main( int argc, char *argv[] )
|
|||
unsigned char hash[20];
|
||||
unsigned char buf[POLARSSL_MPI_MAX_SIZE];
|
||||
char filename[512];
|
||||
char *pers = "rsa_sign_pss";
|
||||
const char *pers = "rsa_sign_pss";
|
||||
|
||||
ret = 1;
|
||||
|
||||
|
@ -89,7 +89,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -61,7 +61,7 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
|
||||
entropy_init( &entropy );
|
||||
ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy, (unsigned char *) "RANDOM_GEN", 10 );
|
||||
ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy, (const unsigned char *) "RANDOM_GEN", 10 );
|
||||
if( ret != 0 )
|
||||
{
|
||||
printf( "failed in ctr_drbg_init: %d\n", ret );
|
||||
|
|
|
@ -74,7 +74,7 @@ int main( int argc, char *argv[] )
|
|||
{
|
||||
int ret, len, server_fd;
|
||||
unsigned char buf[1024];
|
||||
char *pers = "ssl_client1";
|
||||
const char *pers = "ssl_client1";
|
||||
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
|
@ -95,7 +95,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
@ -110,7 +111,7 @@ int main( int argc, char *argv[] )
|
|||
fflush( stdout );
|
||||
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt,
|
||||
ret = x509parse_crt( &cacert, (const unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
#else
|
||||
ret = 1;
|
||||
|
|
|
@ -63,14 +63,14 @@
|
|||
*/
|
||||
struct options
|
||||
{
|
||||
char *server_name; /* hostname of the server (client only) */
|
||||
const char *server_name; /* hostname of the server (client only) */
|
||||
int server_port; /* port on which the ssl service runs */
|
||||
int debug_level; /* level of debugging */
|
||||
char *request_page; /* page on server to request */
|
||||
char *ca_file; /* the file with the CA certificate(s) */
|
||||
char *ca_path; /* the path with the CA certificate(s) reside */
|
||||
char *crt_file; /* the file with the client certificate */
|
||||
char *key_file; /* the file with the client key */
|
||||
const char *request_page; /* page on server to request */
|
||||
const char *ca_file; /* the file with the CA certificate(s) */
|
||||
const char *ca_path; /* the path with the CA certificate(s) reside */
|
||||
const char *crt_file; /* the file with the client certificate */
|
||||
const char *key_file; /* the file with the client key */
|
||||
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
|
||||
int renegotiation; /* enable / disable renegotiation */
|
||||
int allow_legacy; /* allow legacy renegotiation */
|
||||
|
@ -182,7 +182,7 @@ int main( int argc, char *argv[] )
|
|||
{
|
||||
int ret = 0, len, server_fd;
|
||||
unsigned char buf[1024];
|
||||
char *pers = "ssl_client2";
|
||||
const char *pers = "ssl_client2";
|
||||
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
|
@ -365,7 +365,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned -0x%x\n", -ret );
|
||||
goto exit;
|
||||
|
@ -387,7 +388,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt,
|
||||
ret = x509parse_crt( &cacert, (const unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
#else
|
||||
{
|
||||
|
@ -417,7 +418,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &clicert, (unsigned char *) test_cli_crt,
|
||||
ret = x509parse_crt( &clicert, (const unsigned char *) test_cli_crt,
|
||||
strlen( test_cli_crt ) );
|
||||
#else
|
||||
{
|
||||
|
@ -437,7 +438,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_key( &rsa, (unsigned char *) test_cli_key,
|
||||
ret = x509parse_key( &rsa, (const unsigned char *) test_cli_key,
|
||||
strlen( test_cli_key ), NULL, 0 );
|
||||
#else
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ int main( int argc, char *argv[] )
|
|||
int listen_fd;
|
||||
int client_fd;
|
||||
unsigned char buf[1024];
|
||||
char *pers = "ssl_fork_server";
|
||||
const char *pers = "ssl_fork_server";
|
||||
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
|
@ -117,7 +117,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
@ -138,7 +139,7 @@ int main( int argc, char *argv[] )
|
|||
* Instead, you may want to use x509parse_crtfile() to read the
|
||||
* server and CA certificates, as well as x509parse_keyfile().
|
||||
*/
|
||||
ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt,
|
||||
ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt,
|
||||
strlen( test_srv_crt ) );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
@ -146,7 +147,7 @@ int main( int argc, char *argv[] )
|
|||
goto exit;
|
||||
}
|
||||
|
||||
ret = x509parse_crt( &srvcert, (unsigned char *) test_ca_crt,
|
||||
ret = x509parse_crt( &srvcert, (const unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
@ -155,7 +156,7 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
|
||||
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||
ret = x509parse_key( &rsa, (unsigned char *) test_srv_key,
|
||||
ret = x509parse_key( &rsa, (const unsigned char *) test_srv_key,
|
||||
strlen( test_srv_key ), NULL, 0 );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
@ -218,7 +219,8 @@ int main( int argc, char *argv[] )
|
|||
if( pid != 0 )
|
||||
{
|
||||
if( ( ret = ctr_drbg_reseed( &ctr_drbg,
|
||||
(unsigned char* ) "parent", 6 ) ) != 0 )
|
||||
(const unsigned char *) "parent",
|
||||
6 ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_reseed returned %d\n", ret );
|
||||
goto exit;
|
||||
|
@ -237,7 +239,8 @@ int main( int argc, char *argv[] )
|
|||
fflush( stdout );
|
||||
|
||||
if( ( ret = ctr_drbg_reseed( &ctr_drbg,
|
||||
(unsigned char *) "child", 5 ) ) != 0 )
|
||||
(const unsigned char *) "child",
|
||||
5 ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_reseed returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -77,18 +77,18 @@
|
|||
*/
|
||||
struct options
|
||||
{
|
||||
char *server_name; /* hostname of the server (client only) */
|
||||
const char *server_name; /* hostname of the server (client only) */
|
||||
int server_port; /* port on which the ssl service runs */
|
||||
int debug_level; /* level of debugging */
|
||||
int authentication; /* if authentication is required */
|
||||
int mode; /* SSL/TLS (0) or STARTTLS (1) */
|
||||
char *user_name; /* username to use for authentication */
|
||||
char *user_pwd; /* password to use for authentication */
|
||||
char *mail_from; /* E-Mail address to use as sender */
|
||||
char *mail_to; /* E-Mail address to use as recipient */
|
||||
char *ca_file; /* the file with the CA certificate(s) */
|
||||
char *crt_file; /* the file with the client certificate */
|
||||
char *key_file; /* the file with the client key */
|
||||
const char *user_name; /* username to use for authentication */
|
||||
const char *user_pwd; /* password to use for authentication */
|
||||
const char *mail_from; /* E-Mail address to use as sender */
|
||||
const char *mail_to; /* E-Mail address to use as recipient */
|
||||
const char *ca_file; /* the file with the CA certificate(s) */
|
||||
const char *crt_file; /* the file with the client certificate */
|
||||
const char *key_file; /* the file with the client key */
|
||||
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
|
||||
} opt;
|
||||
|
||||
|
@ -344,7 +344,7 @@ int main( int argc, char *argv[] )
|
|||
unsigned char base[1024];
|
||||
#endif
|
||||
char hostname[32];
|
||||
char *pers = "ssl_mail_client";
|
||||
const char *pers = "ssl_mail_client";
|
||||
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
|
@ -464,7 +464,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
@ -484,7 +485,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt,
|
||||
ret = x509parse_crt( &cacert, (const unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
#else
|
||||
{
|
||||
|
@ -514,7 +515,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &clicert, (unsigned char *) test_cli_crt,
|
||||
ret = x509parse_crt( &clicert, (const unsigned char *) test_cli_crt,
|
||||
strlen( test_cli_crt ) );
|
||||
#else
|
||||
{
|
||||
|
@ -534,7 +535,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_key( &rsa, (unsigned char *) test_cli_key,
|
||||
ret = x509parse_key( &rsa, (const unsigned char *) test_cli_key,
|
||||
strlen( test_cli_key ), NULL, 0 );
|
||||
#else
|
||||
{
|
||||
|
@ -691,7 +692,8 @@ int main( int argc, char *argv[] )
|
|||
fflush( stdout );
|
||||
|
||||
n = sizeof( buf );
|
||||
len = base64_encode( base, &n, (unsigned char *) opt.user_name, strlen( opt.user_name ) );
|
||||
len = base64_encode( base, &n, (const unsigned char *) opt.user_name,
|
||||
strlen( opt.user_name ) );
|
||||
len = sprintf( (char *) buf, "%s\n", base );
|
||||
ret = write_ssl_and_get_response( &ssl, buf, len );
|
||||
if( ret < 300 || ret > 399 )
|
||||
|
@ -705,7 +707,8 @@ int main( int argc, char *argv[] )
|
|||
printf( " > Write password to server: %s", opt.user_pwd );
|
||||
fflush( stdout );
|
||||
|
||||
len = base64_encode( base, &n, (unsigned char *) opt.user_pwd, strlen( opt.user_pwd ) );
|
||||
len = base64_encode( base, &n, (const unsigned char *) opt.user_pwd,
|
||||
strlen( opt.user_pwd ) );
|
||||
len = sprintf( (char *) buf, "%s\n", base );
|
||||
ret = write_ssl_and_get_response( &ssl, buf, len );
|
||||
if( ret < 200 || ret > 399 )
|
||||
|
|
|
@ -87,7 +87,7 @@ int main( int argc, char *argv[] )
|
|||
int listen_fd;
|
||||
int client_fd = -1;
|
||||
unsigned char buf[1024];
|
||||
char *pers = "ssl_server";
|
||||
const char *pers = "ssl_server";
|
||||
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
|
@ -118,7 +118,7 @@ int main( int argc, char *argv[] )
|
|||
* Instead, you may want to use x509parse_crtfile() to read the
|
||||
* server and CA certificates, as well as x509parse_keyfile().
|
||||
*/
|
||||
ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt,
|
||||
ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt,
|
||||
strlen( test_srv_crt ) );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ int main( int argc, char *argv[] )
|
|||
goto exit;
|
||||
}
|
||||
|
||||
ret = x509parse_crt( &srvcert, (unsigned char *) test_ca_crt,
|
||||
ret = x509parse_crt( &srvcert, (const unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
|
||||
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||
ret = x509parse_key( &rsa, (unsigned char *) test_srv_key,
|
||||
ret = x509parse_key( &rsa, (const unsigned char *) test_srv_key,
|
||||
strlen( test_srv_key ), NULL, 0 );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
@ -167,7 +167,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -74,10 +74,10 @@ struct options
|
|||
{
|
||||
int server_port; /* port on which the ssl service runs */
|
||||
int debug_level; /* level of debugging */
|
||||
char *ca_file; /* the file with the CA certificate(s) */
|
||||
char *ca_path; /* the path with the CA certificate(s) reside */
|
||||
char *crt_file; /* the file with the client certificate */
|
||||
char *key_file; /* the file with the client key */
|
||||
const char *ca_file; /* the file with the CA certificate(s) */
|
||||
const char *ca_path; /* the path with the CA certificate(s) reside */
|
||||
const char *crt_file; /* the file with the client certificate */
|
||||
const char *key_file; /* the file with the client key */
|
||||
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
|
||||
int renegotiation; /* enable / disable renegotiation */
|
||||
int allow_legacy; /* allow legacy renegotiation */
|
||||
|
@ -236,7 +236,7 @@ int main( int argc, char *argv[] )
|
|||
int listen_fd;
|
||||
int client_fd = -1;
|
||||
unsigned char buf[1024];
|
||||
char *pers = "ssl_server2";
|
||||
const char *pers = "ssl_server2";
|
||||
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
|
@ -380,7 +380,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned -0x%x\n", -ret );
|
||||
goto exit;
|
||||
|
@ -402,7 +403,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt,
|
||||
ret = x509parse_crt( &cacert, (const unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
#else
|
||||
{
|
||||
|
@ -430,7 +431,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt,
|
||||
ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt,
|
||||
strlen( test_srv_crt ) );
|
||||
#else
|
||||
{
|
||||
|
@ -450,7 +451,7 @@ int main( int argc, char *argv[] )
|
|||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_key( &rsa, (unsigned char *) test_srv_key,
|
||||
ret = x509parse_key( &rsa, (const unsigned char *) test_srv_key,
|
||||
strlen( test_srv_key ), NULL, 0 );
|
||||
#else
|
||||
{
|
||||
|
|
|
@ -63,11 +63,12 @@ int main( int argc, char *argv[] )
|
|||
unsigned char o_priv_encrypted[512];
|
||||
unsigned char p_priv_decrypted[512];
|
||||
unsigned char o_priv_decrypted[512];
|
||||
char *pers = "o_p_test_example";
|
||||
const char *pers = "o_p_test_example";
|
||||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#define MAX_CLIENT_CERTS 8
|
||||
|
||||
char *client_certificates[MAX_CLIENT_CERTS] =
|
||||
const char *client_certificates[MAX_CLIENT_CERTS] =
|
||||
{
|
||||
"client1.crt",
|
||||
"client2.crt",
|
||||
|
@ -53,7 +53,7 @@ char *client_certificates[MAX_CLIENT_CERTS] =
|
|||
"cert_sha512.crt"
|
||||
};
|
||||
|
||||
char *client_private_keys[MAX_CLIENT_CERTS] =
|
||||
const char *client_private_keys[MAX_CLIENT_CERTS] =
|
||||
{
|
||||
"client1.key",
|
||||
"client2.key",
|
||||
|
|
|
@ -68,8 +68,8 @@
|
|||
/*
|
||||
* server-specific data
|
||||
*/
|
||||
char *dhm_G = "4";
|
||||
char *dhm_P =
|
||||
const char *dhm_G = "4";
|
||||
const char *dhm_P =
|
||||
"E4004C1F94182000103D883A448B3F802CE4B44A83301270002C20D0321CFD00" \
|
||||
"11CCEF784C26A400F43DFB901BCA7538F2C6B176001CF5A0FD16D2C48B1D0C1C" \
|
||||
"F6AC8E1DA6BCC3B4E1F96B0564965300FFA1D0B601EB2800F489AA512C4B248C" \
|
||||
|
@ -84,7 +84,7 @@ struct options
|
|||
{
|
||||
int opmode; /* operation mode (client or server) */
|
||||
int iomode; /* I/O mode (blocking or non-blocking) */
|
||||
char *server_name; /* hostname of the server (client only) */
|
||||
const char *server_name; /* hostname of the server (client only) */
|
||||
int server_port; /* port on which the ssl service runs */
|
||||
int command; /* what to do: read or write operation */
|
||||
int buffer_size; /* size of the send/receive buffer */
|
||||
|
@ -161,7 +161,7 @@ static int ssl_test( struct options *opt )
|
|||
unsigned char *read_buf = NULL;
|
||||
unsigned char *write_buf = NULL;
|
||||
|
||||
char *pers = "ssl_test";
|
||||
const char *pers = "ssl_test";
|
||||
|
||||
struct hr_time t;
|
||||
entropy_context entropy;
|
||||
|
@ -174,7 +174,8 @@ static int ssl_test( struct options *opt )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
@ -212,7 +213,7 @@ static int ssl_test( struct options *opt )
|
|||
printf("POLARSSL_CERTS_C not defined.\n");
|
||||
goto exit;
|
||||
#else
|
||||
ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt,
|
||||
ret = x509parse_crt( &srvcert, (const unsigned char *) test_srv_crt,
|
||||
strlen( test_srv_crt ) );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
@ -220,7 +221,7 @@ static int ssl_test( struct options *opt )
|
|||
goto exit;
|
||||
}
|
||||
|
||||
ret = x509parse_crt( &srvcert, (unsigned char *) test_ca_crt,
|
||||
ret = x509parse_crt( &srvcert, (const unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
@ -228,7 +229,7 @@ static int ssl_test( struct options *opt )
|
|||
goto exit;
|
||||
}
|
||||
|
||||
ret = x509parse_key( &rsa, (unsigned char *) test_srv_key,
|
||||
ret = x509parse_key( &rsa, (const unsigned char *) test_srv_key,
|
||||
strlen( test_srv_key ), NULL, 0 );
|
||||
if( ret != 0 )
|
||||
{
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
struct options
|
||||
{
|
||||
int mode; /* the mode to run the application in */
|
||||
char *filename; /* filename of the certificate file */
|
||||
char *server_name; /* hostname of the server (client only) */
|
||||
const char *filename; /* filename of the certificate file */
|
||||
const char *server_name; /* hostname of the server (client only) */
|
||||
int server_port; /* port on which the ssl service runs */
|
||||
int debug_level; /* level of debugging */
|
||||
int permissive; /* permissive parsing */
|
||||
|
@ -112,7 +112,7 @@ int main( int argc, char *argv[] )
|
|||
rsa_context rsa;
|
||||
int i, j, n;
|
||||
char *p, *q;
|
||||
char *pers = "cert_app";
|
||||
const char *pers = "cert_app";
|
||||
|
||||
/*
|
||||
* Set to sane values
|
||||
|
@ -247,7 +247,8 @@ int main( int argc, char *argv[] )
|
|||
|
||||
entropy_init( &entropy );
|
||||
if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) ) != 0 )
|
||||
(const unsigned char *) pers,
|
||||
strlen( pers ) ) ) != 0 )
|
||||
{
|
||||
printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
*/
|
||||
struct options
|
||||
{
|
||||
char *filename; /* filename of the certificate file */
|
||||
const char *filename; /* filename of the certificate file */
|
||||
int debug_level; /* level of debugging */
|
||||
} opt;
|
||||
|
||||
|
|
|
@ -542,11 +542,11 @@ rsa_gen_key:nrbits:exponent:result
|
|||
rsa_context ctx;
|
||||
entropy_context entropy;
|
||||
ctr_drbg_context ctr_drbg;
|
||||
char *pers = "test_suite_rsa";
|
||||
const char *pers = "test_suite_rsa";
|
||||
|
||||
entropy_init( &entropy );
|
||||
TEST_ASSERT( ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
|
||||
(unsigned char *) pers, strlen( pers ) ) == 0 );
|
||||
(const unsigned char *) pers, strlen( pers ) ) == 0 );
|
||||
|
||||
rsa_init( &ctx, 0, 0 );
|
||||
|
||||
|
|
Loading…
Reference in a new issue