mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-04 13:45:05 +01:00
Cleanup up non-prototyped functions (static) and const-correctness in programs
This commit is contained in:
parent
b6c5d2e1a6
commit
3c5ef71322
12 changed files with 34 additions and 88 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* SSL client demonstration program
|
||||
*
|
||||
* Copyright (C) 2006-2011, Brainspark B.V.
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
#define DEBUG_LEVEL 1
|
||||
|
||||
void my_debug( void *ctx, int level, const char *str )
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < DEBUG_LEVEL )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* SSL client with certificate authentication
|
||||
*
|
||||
* Copyright (C) 2006-2011, Brainspark B.V.
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
|
|
@ -83,7 +83,7 @@ struct options
|
|||
int auth_mode; /* verify mode for connection */
|
||||
} opt;
|
||||
|
||||
void my_debug( void *ctx, int level, const char *str )
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < opt.debug_level )
|
||||
{
|
||||
|
|
@ -96,7 +96,7 @@ void my_debug( void *ctx, int level, const char *str )
|
|||
/*
|
||||
* Enabled if debug_level > 1 in code below
|
||||
*/
|
||||
int my_verify( void *data, x509_cert *crt, int depth, int *flags )
|
||||
static int my_verify( void *data, x509_cert *crt, int depth, int *flags )
|
||||
{
|
||||
char buf[1024];
|
||||
((void) data);
|
||||
|
|
@ -595,7 +595,7 @@ int main( int argc, char *argv[] )
|
|||
#endif
|
||||
|
||||
#if defined(POLARSSL_KEY_EXCHANGE_PSK_ENABLED)
|
||||
ssl_set_psk( &ssl, psk, psk_len, (unsigned char *) opt.psk_identity,
|
||||
ssl_set_psk( &ssl, psk, psk_len, (const unsigned char *) opt.psk_identity,
|
||||
strlen( opt.psk_identity ) );
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* SSL server demonstration program using fork() for handling multiple clients
|
||||
*
|
||||
* Copyright (C) 2006-2011, Brainspark B.V.
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
|
|
@ -82,7 +82,7 @@ int main( int argc, char *argv[] )
|
|||
|
||||
#define DEBUG_LEVEL 0
|
||||
|
||||
void my_debug( void *ctx, int level, const char *str )
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < DEBUG_LEVEL )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* SSL client for SMTP servers
|
||||
*
|
||||
* Copyright (C) 2006-2011, Brainspark B.V.
|
||||
* Copyright (C) 2006-2012, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
|
|
@ -92,7 +92,7 @@ struct options
|
|||
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
|
||||
} opt;
|
||||
|
||||
void my_debug( void *ctx, int level, const char *str )
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < opt.debug_level )
|
||||
{
|
||||
|
|
@ -118,7 +118,7 @@ int main( int argc, char *argv[] )
|
|||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int do_handshake( ssl_context *ssl, struct options *opt )
|
||||
static int do_handshake( ssl_context *ssl, struct options *opt )
|
||||
{
|
||||
int ret;
|
||||
unsigned char buf[1024];
|
||||
|
|
@ -179,7 +179,7 @@ int do_handshake( ssl_context *ssl, struct options *opt )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
int write_ssl_data( ssl_context *ssl, unsigned char *buf, size_t len )
|
||||
static int write_ssl_data( ssl_context *ssl, unsigned char *buf, size_t len )
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ int write_ssl_data( ssl_context *ssl, unsigned char *buf, size_t len )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
int write_ssl_and_get_response( ssl_context *ssl, unsigned char *buf, size_t len )
|
||||
static int write_ssl_and_get_response( ssl_context *ssl, unsigned char *buf, size_t len )
|
||||
{
|
||||
int ret;
|
||||
unsigned char data[128];
|
||||
|
|
@ -247,14 +247,14 @@ int write_ssl_and_get_response( ssl_context *ssl, unsigned char *buf, size_t len
|
|||
code[3] = '\0';
|
||||
return atoi( code );
|
||||
}
|
||||
|
||||
|
||||
idx = 0;
|
||||
}
|
||||
}
|
||||
while( 1 );
|
||||
}
|
||||
|
||||
int write_and_get_response( int sock_fd, unsigned char *buf, size_t len )
|
||||
static int write_and_get_response( int sock_fd, unsigned char *buf, size_t len )
|
||||
{
|
||||
int ret;
|
||||
unsigned char data[128];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* SSL server demonstration program
|
||||
*
|
||||
* Copyright (C) 2006-2011, Brainspark B.V.
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
#define DEBUG_LEVEL 0
|
||||
|
||||
void my_debug( void *ctx, int level, const char *str )
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < DEBUG_LEVEL )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* SSL client with options
|
||||
*
|
||||
* Copyright (C) 2006-2012, Brainspark B.V.
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
|
|
@ -89,7 +89,7 @@ struct options
|
|||
int auth_mode; /* verify mode for connection */
|
||||
} opt;
|
||||
|
||||
void my_debug( void *ctx, int level, const char *str )
|
||||
static void my_debug( void *ctx, int level, const char *str )
|
||||
{
|
||||
if( level < opt.debug_level )
|
||||
{
|
||||
|
|
@ -514,7 +514,7 @@ int main( int argc, char *argv[] )
|
|||
#endif
|
||||
|
||||
#if defined(POLARSSL_KEY_EXCHANGE_PSK_ENABLED)
|
||||
ssl_set_psk( &ssl, psk, psk_len, (unsigned char *) opt.psk_identity,
|
||||
ssl_set_psk( &ssl, psk, psk_len, (const unsigned char *) opt.psk_identity,
|
||||
strlen( opt.psk_identity ) );
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue