Various const fixes

This commit is contained in:
Paul Bakker 2013-11-25 13:29:43 +01:00
parent 17d99fc6f2
commit 8fc30b178c
6 changed files with 26 additions and 26 deletions

View file

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

View file

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

View file

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

View file

@ -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 )
{

View file

@ -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 )
{

View file

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