mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-30 19:25:59 +01:00
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
This commit is contained in:
parent
3c2122ff9d
commit
ef3f8c747e
21 changed files with 112 additions and 93 deletions
|
|
@ -75,11 +75,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",
|
||||
|
|
|
|||
|
|
@ -74,7 +74,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 */
|
||||
|
|
@ -153,7 +153,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;
|
||||
|
|
@ -166,7 +166,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;
|
||||
|
|
@ -204,7 +205,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 )
|
||||
{
|
||||
|
|
@ -212,7 +213,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 )
|
||||
{
|
||||
|
|
@ -220,7 +221,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 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue