Fixed const correctness issues in programs and tests
(cherry picked from commit e0225e4d7f18f4565224f4997af537533d06a80d)
Conflicts:
programs/ssl/ssl_client2.c
programs/ssl/ssl_server2.c
programs/test/ssl_test.c
programs/x509/cert_app.c
diff --git a/programs/test/ssl_test.c b/programs/test/ssl_test.c
index 5d829e5..34fd9c2 100644
--- a/programs/test/ssl_test.c
+++ b/programs/test/ssl_test.c
@@ -74,7 +74,7 @@
{
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 */
@@ -153,7 +153,7 @@
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;
@@ -166,7 +166,8 @@
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;
@@ -204,7 +205,7 @@
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 )
{
@@ -212,7 +213,7 @@
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 )
{
@@ -220,7 +221,7 @@
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 )
{