diff --git a/library/pk_wrap.c b/library/pk_wrap.c index 6f22b095f..eb87d3c60 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -57,7 +57,7 @@ static int rsa_can_do( pk_type_t type ) #if defined(POLARSSL_RSA_C) static size_t rsa_get_size( const void *ctx ) { - return( 8 * ((rsa_context *) ctx)->len ); + return( 8 * ((const rsa_context *) ctx)->len ); } static int rsa_verify_wrap( void *ctx, md_type_t md_alg, @@ -346,7 +346,7 @@ const pk_info_t ecdsa_info = { static size_t rsa_alt_get_size( const void *ctx ) { - rsa_alt_context *rsa_alt = (rsa_alt_context *) ctx; + const rsa_alt_context *rsa_alt = (const rsa_alt_context *) ctx; return( rsa_alt->key_len_func( rsa_alt->key ) ); } diff --git a/programs/pkey/ecdsa.c b/programs/pkey/ecdsa.c index 948066a10..3cba7e820 100644 --- a/programs/pkey/ecdsa.c +++ b/programs/pkey/ecdsa.c @@ -60,7 +60,7 @@ int main( int argc, char *argv[] ) #else #if defined(VERBOSE) -static void dump_buf( char *title, unsigned char *buf, size_t len ) +static void dump_buf( const char *title, unsigned char *buf, size_t len ) { size_t i; @@ -71,7 +71,7 @@ static void dump_buf( char *title, unsigned char *buf, size_t len ) printf( "\n" ); } -static void dump_pubkey( char *title, ecdsa_context *key ) +static void dump_pubkey( const char *title, ecdsa_context *key ) { unsigned char buf[300]; size_t len; diff --git a/programs/util/pem2der.c b/programs/util/pem2der.c index 9364356dd..f3726843d 100644 --- a/programs/util/pem2der.c +++ b/programs/util/pem2der.c @@ -50,8 +50,8 @@ int main( int argc, char *argv[] ) */ struct options { - char *filename; /* filename of the input file */ - char *output_file; /* where to store the output */ + const char *filename; /* filename of the input file */ + const char *output_file; /* where to store the output */ } opt; int convert_pem_to_der( const unsigned char *input, size_t ilen, @@ -61,11 +61,11 @@ int convert_pem_to_der( const unsigned char *input, size_t ilen, const unsigned char *s1, *s2, *end = input + ilen; size_t len = 0; - s1 = (unsigned char *) strstr( (char *) input, "-----BEGIN" ); + s1 = (unsigned char *) strstr( (const char *) input, "-----BEGIN" ); if( s1 == NULL ) return( -1 ); - s2 = (unsigned char *) strstr( (char *) input, "-----END" ); + s2 = (unsigned char *) strstr( (const char *) input, "-----END" ); if( s2 == NULL ) return( -1 ); diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c index dc45f9496..2388dc9fc 100644 --- a/programs/x509/cert_req.c +++ b/programs/x509/cert_req.c @@ -62,15 +62,15 @@ int main( int argc, char *argv[] ) */ struct options { - char *filename; /* filename of the key file */ + const char *filename; /* filename of the key file */ int debug_level; /* level of debugging */ - char *output_file; /* where to store the constructed key file */ - char *subject_name; /* subject name for certificate request */ + const char *output_file; /* where to store the constructed key file */ + const char *subject_name; /* subject name for certificate request */ unsigned char key_usage; /* key usage flags */ unsigned char ns_cert_type; /* NS cert type */ } opt; -int write_certificate_request( x509write_csr *req, char *output_file, +int write_certificate_request( x509write_csr *req, const char *output_file, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng ) { diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c index f72f62379..beac089b7 100644 --- a/programs/x509/cert_write.c +++ b/programs/x509/cert_write.c @@ -75,18 +75,18 @@ int main( int argc, char *argv[] ) */ struct options { - char *issuer_crt; /* filename of the issuer certificate */ - char *request_file; /* filename of the certificate request */ - char *subject_key; /* filename of the subject key file */ - char *issuer_key; /* filename of the issuer key file */ - char *subject_pwd; /* password for the subject key file */ - char *issuer_pwd; /* password for the issuer key file */ - char *output_file; /* where to store the constructed key file */ - char *subject_name; /* subject name for certificate */ - char *issuer_name; /* issuer name for certificate */ - char *not_before; /* validity period not before */ - char *not_after; /* validity period not after */ - char *serial; /* serial number string */ + const char *issuer_crt; /* filename of the issuer certificate */ + const char *request_file; /* filename of the certificate request */ + const char *subject_key; /* filename of the subject key file */ + const char *issuer_key; /* filename of the issuer key file */ + const char *subject_pwd; /* password for the subject key file */ + const char *issuer_pwd; /* password for the issuer key file */ + const char *output_file; /* where to store the constructed key file */ + const char *subject_name; /* subject name for certificate */ + const char *issuer_name; /* issuer name for certificate */ + const char *not_before; /* validity period not before */ + const char *not_after; /* validity period not after */ + const char *serial; /* serial number string */ int selfsign; /* selfsign the certificate */ int is_ca; /* is a CA certificate */ int max_pathlen; /* maximum CA path length */ @@ -94,7 +94,7 @@ struct options unsigned char ns_cert_type; /* NS cert type */ } opt; -int write_certificate( x509write_cert *crt, char *output_file, +int write_certificate( x509write_cert *crt, const char *output_file, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng ) { diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function index c64d9be8a..67fb3949d 100644 --- a/tests/suites/main_test.function +++ b/tests/suites/main_test.function @@ -6,7 +6,7 @@ static int test_errors = 0; SUITE_PRE_DEP #define TEST_SUITE_ACTIVE -static int test_assert( int correct, char *test ) +static int test_assert( int correct, const char *test ) { if( correct ) return( 0 );