Fixed const correctness issues in programs and tests

(cherry picked from commit e0225e4d7f)

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:
Paul Bakker 2013-06-24 13:01:08 +02:00
parent 3c2122ff9d
commit ef3f8c747e
21 changed files with 112 additions and 93 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -72,10 +72,10 @@ int main( int argc, char *argv[] )
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 )
@ -87,7 +87,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];
@ -124,7 +124,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];

View file

@ -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;

View file

@ -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;

View file

@ -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;