1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-05-12 09:54:38 +08:00

Fix missing-prototype errors in sample programs

Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
Michael Schuster 2024-06-01 21:15:02 +02:00 committed by Minos Galanakis
parent e708e86a9b
commit 8db8d6182f
16 changed files with 75 additions and 75 deletions

View File

@ -79,7 +79,7 @@ const unsigned char key_bytes[32] = { 0 };
* This function demonstrates computation of the HMAC of two messages using * This function demonstrates computation of the HMAC of two messages using
* the multipart API. * the multipart API.
*/ */
int hmac_demo(void) static int hmac_demo(void)
{ {
int ret; int ret;
const mbedtls_md_type_t alg = MBEDTLS_MD_SHA256; const mbedtls_md_type_t alg = MBEDTLS_MD_SHA256;

View File

@ -39,7 +39,7 @@ int main(void)
#define DEV_RANDOM_THRESHOLD 32 #define DEV_RANDOM_THRESHOLD 32
int dev_random_entropy_poll(void *data, unsigned char *output, static int dev_random_entropy_poll(void *data, unsigned char *output,
size_t len, size_t *olen) size_t len, size_t *olen)
{ {
FILE *file; FILE *file;

View File

@ -82,7 +82,7 @@ const unsigned char key_bytes[32] = { 0 };
* This function demonstrates computation of the HMAC of two messages using * This function demonstrates computation of the HMAC of two messages using
* the multipart API. * the multipart API.
*/ */
psa_status_t hmac_demo(void) static psa_status_t hmac_demo(void)
{ {
psa_status_t status; psa_status_t status;
const psa_algorithm_t alg = PSA_ALG_HMAC(PSA_ALG_SHA_256); const psa_algorithm_t alg = PSA_ALG_HMAC(PSA_ALG_SHA_256);

View File

@ -192,7 +192,7 @@ typedef enum {
TYPE_STATUS, TYPE_STATUS,
} signed_value_type; } signed_value_type;
int process_signed(signed_value_type type, long min, long max, char **argp) static int process_signed(signed_value_type type, long min, long max, char **argp)
{ {
for (; *argp != NULL; argp++) { for (; *argp != NULL; argp++) {
char buffer[200]; char buffer[200];
@ -231,7 +231,7 @@ typedef enum {
TYPE_KEY_USAGE, TYPE_KEY_USAGE,
} unsigned_value_type; } unsigned_value_type;
int process_unsigned(unsigned_value_type type, unsigned long max, char **argp) static int process_unsigned(unsigned_value_type type, unsigned long max, char **argp)
{ {
for (; *argp != NULL; argp++) { for (; *argp != NULL; argp++) {
char buffer[200]; char buffer[200];

View File

@ -597,7 +597,7 @@ static int my_verify(void *data, mbedtls_x509_crt *crt,
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */ #endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
int report_cid_usage(mbedtls_ssl_context *ssl, static int report_cid_usage(mbedtls_ssl_context *ssl,
const char *additional_description) const char *additional_description)
{ {
int ret; int ret;

View File

@ -111,12 +111,12 @@ const char buf_ln_err[] = "Buffer does not have enough data to complete the pars
/* /*
* Basic printing functions * Basic printing functions
*/ */
void print_version(void) static void print_version(void)
{ {
printf("%s v%d.%d\n", PROG_NAME, VER_MAJOR, VER_MINOR); printf("%s v%d.%d\n", PROG_NAME, VER_MAJOR, VER_MINOR);
} }
void print_usage(void) static void print_usage(void)
{ {
print_version(); print_version();
printf("\nThis program is used to deserialize an Mbed TLS SSL session from the base64 code provided\n" printf("\nThis program is used to deserialize an Mbed TLS SSL session from the base64 code provided\n"
@ -138,7 +138,7 @@ void print_usage(void)
); );
} }
void printf_dbg(const char *str, ...) static void printf_dbg(const char *str, ...)
{ {
if (debug) { if (debug) {
va_list args; va_list args;
@ -151,7 +151,7 @@ void printf_dbg(const char *str, ...)
} }
MBEDTLS_PRINTF_ATTRIBUTE(1, 2) MBEDTLS_PRINTF_ATTRIBUTE(1, 2)
void printf_err(const char *str, ...) static void printf_err(const char *str, ...)
{ {
va_list args; va_list args;
va_start(args, str); va_start(args, str);
@ -165,7 +165,7 @@ void printf_err(const char *str, ...)
/* /*
* Exit from the program in case of error * Exit from the program in case of error
*/ */
void error_exit(void) static void error_exit(void)
{ {
if (NULL != b64_file) { if (NULL != b64_file) {
fclose(b64_file); fclose(b64_file);
@ -176,7 +176,7 @@ void error_exit(void)
/* /*
* This function takes the input arguments of this program * This function takes the input arguments of this program
*/ */
void parse_arguments(int argc, char *argv[]) static void parse_arguments(int argc, char *argv[])
{ {
int i = 1; int i = 1;
@ -223,7 +223,7 @@ void parse_arguments(int argc, char *argv[])
/* /*
* This function prints base64 code to the stdout * This function prints base64 code to the stdout
*/ */
void print_b64(const uint8_t *b, size_t len) static void print_b64(const uint8_t *b, size_t len)
{ {
size_t i = 0; size_t i = 0;
const uint8_t *end = b + len; const uint8_t *end = b + len;
@ -247,7 +247,7 @@ void print_b64(const uint8_t *b, size_t len)
* /p in_line number of bytes in one line * /p in_line number of bytes in one line
* /p prefix prefix for the new lines * /p prefix prefix for the new lines
*/ */
void print_hex(const uint8_t *b, size_t len, static void print_hex(const uint8_t *b, size_t len,
const size_t in_line, const char *prefix) const size_t in_line, const char *prefix)
{ {
size_t i = 0; size_t i = 0;
@ -271,7 +271,7 @@ void print_hex(const uint8_t *b, size_t len,
/* /*
* Print the value of time_t in format e.g. 2020-01-23 13:05:59 * Print the value of time_t in format e.g. 2020-01-23 13:05:59
*/ */
void print_time(const uint64_t *time) static void print_time(const uint64_t *time)
{ {
#if defined(MBEDTLS_HAVE_TIME) #if defined(MBEDTLS_HAVE_TIME)
char buf[20]; char buf[20];
@ -292,7 +292,7 @@ void print_time(const uint64_t *time)
/* /*
* Print the input string if the bit is set in the value * Print the input string if the bit is set in the value
*/ */
void print_if_bit(const char *str, int bit, int val) static void print_if_bit(const char *str, int bit, int val)
{ {
if (bit & val) { if (bit & val) {
printf("\t%s\n", str); printf("\t%s\n", str);
@ -302,7 +302,7 @@ void print_if_bit(const char *str, int bit, int val)
/* /*
* Return pointer to hardcoded "enabled" or "disabled" depending on the input value * Return pointer to hardcoded "enabled" or "disabled" depending on the input value
*/ */
const char *get_enabled_str(int is_en) static const char *get_enabled_str(int is_en)
{ {
return (is_en) ? "enabled" : "disabled"; return (is_en) ? "enabled" : "disabled";
} }
@ -310,7 +310,7 @@ const char *get_enabled_str(int is_en)
/* /*
* Return pointer to hardcoded MFL string value depending on the MFL code at the input * Return pointer to hardcoded MFL string value depending on the MFL code at the input
*/ */
const char *get_mfl_str(int mfl_code) static const char *get_mfl_str(int mfl_code)
{ {
switch (mfl_code) { switch (mfl_code) {
case MBEDTLS_SSL_MAX_FRAG_LEN_NONE: case MBEDTLS_SSL_MAX_FRAG_LEN_NONE:
@ -343,7 +343,7 @@ const char *get_mfl_str(int mfl_code)
* \retval number of bytes written in to the b64 buffer or 0 in case no more * \retval number of bytes written in to the b64 buffer or 0 in case no more
* data was found * data was found
*/ */
size_t read_next_b64_code(uint8_t **b64, size_t *max_len) static size_t read_next_b64_code(uint8_t **b64, size_t *max_len)
{ {
int valid_balance = 0; /* balance between valid and invalid characters */ int valid_balance = 0; /* balance between valid and invalid characters */
size_t len = 0; size_t len = 0;
@ -443,7 +443,7 @@ size_t read_next_b64_code(uint8_t **b64, size_t *max_len)
* /p ssl pointer to serialized certificate * /p ssl pointer to serialized certificate
* /p len number of bytes in the buffer * /p len number of bytes in the buffer
*/ */
void print_deserialized_ssl_cert(const uint8_t *ssl, uint32_t len) static void print_deserialized_ssl_cert(const uint8_t *ssl, uint32_t len)
{ {
enum { STRLEN = 4096 }; enum { STRLEN = 4096 };
mbedtls_x509_crt crt; mbedtls_x509_crt crt;
@ -509,7 +509,7 @@ void print_deserialized_ssl_cert(const uint8_t *ssl, uint32_t len)
* /p len number of bytes in the buffer * /p len number of bytes in the buffer
* /p session_cfg_flag session configuration flags * /p session_cfg_flag session configuration flags
*/ */
void print_deserialized_ssl_session(const uint8_t *ssl, uint32_t len, static void print_deserialized_ssl_session(const uint8_t *ssl, uint32_t len,
int session_cfg_flag) int session_cfg_flag)
{ {
const struct mbedtls_ssl_ciphersuite_t *ciphersuite_info; const struct mbedtls_ssl_ciphersuite_t *ciphersuite_info;
@ -746,7 +746,7 @@ void print_deserialized_ssl_session(const uint8_t *ssl, uint32_t len,
* /p ssl pointer to serialized session * /p ssl pointer to serialized session
* /p len number of bytes in the buffer * /p len number of bytes in the buffer
*/ */
void print_deserialized_ssl_context(const uint8_t *ssl, size_t len) static void print_deserialized_ssl_context(const uint8_t *ssl, size_t len)
{ {
const uint8_t *end = ssl + len; const uint8_t *end = ssl + len;
uint32_t session_len; uint32_t session_len;

View File

@ -756,7 +756,7 @@ struct _sni_entry {
sni_entry *next; sni_entry *next;
}; };
void sni_free(sni_entry *head) static void sni_free(sni_entry *head)
{ {
sni_entry *cur = head, *next; sni_entry *cur = head, *next;
@ -786,7 +786,7 @@ void sni_free(sni_entry *head)
* *
* Modifies the input string! This is not production quality! * Modifies the input string! This is not production quality!
*/ */
sni_entry *sni_parse(char *sni_string) static sni_entry *sni_parse(char *sni_string)
{ {
sni_entry *cur = NULL, *new = NULL; sni_entry *cur = NULL, *new = NULL;
char *p = sni_string; char *p = sni_string;
@ -878,7 +878,7 @@ error:
/* /*
* SNI callback. * SNI callback.
*/ */
int sni_callback(void *p_info, mbedtls_ssl_context *ssl, static int sni_callback(void *p_info, mbedtls_ssl_context *ssl,
const unsigned char *name, size_t name_len) const unsigned char *name, size_t name_len)
{ {
const sni_entry *cur = (const sni_entry *) p_info; const sni_entry *cur = (const sni_entry *) p_info;
@ -909,7 +909,7 @@ int sni_callback(void *p_info, mbedtls_ssl_context *ssl,
/* /*
* server certificate selection callback. * server certificate selection callback.
*/ */
int cert_callback(mbedtls_ssl_context *ssl) static int cert_callback(mbedtls_ssl_context *ssl)
{ {
const sni_entry *cur = (sni_entry *) mbedtls_ssl_get_user_data_p(ssl); const sni_entry *cur = (sni_entry *) mbedtls_ssl_get_user_data_p(ssl);
if (cur != NULL) { if (cur != NULL) {
@ -954,7 +954,7 @@ struct _psk_entry {
/* /*
* Free a list of psk_entry's * Free a list of psk_entry's
*/ */
int psk_free(psk_entry *head) static int psk_free(psk_entry *head)
{ {
psk_entry *next; psk_entry *next;
@ -985,7 +985,7 @@ int psk_free(psk_entry *head)
* *
* Modifies the input string! This is not production quality! * Modifies the input string! This is not production quality!
*/ */
psk_entry *psk_parse(char *psk_string) static psk_entry *psk_parse(char *psk_string)
{ {
psk_entry *cur = NULL, *new = NULL; psk_entry *cur = NULL, *new = NULL;
char *p = psk_string; char *p = psk_string;
@ -1027,7 +1027,7 @@ error:
/* /*
* PSK callback * PSK callback
*/ */
int psk_callback(void *p_info, mbedtls_ssl_context *ssl, static int psk_callback(void *p_info, mbedtls_ssl_context *ssl,
const unsigned char *name, size_t name_len) const unsigned char *name, size_t name_len)
{ {
psk_entry *cur = (psk_entry *) p_info; psk_entry *cur = (psk_entry *) p_info;
@ -1055,7 +1055,7 @@ static mbedtls_net_context listen_fd, client_fd;
/* Interruption handler to ensure clean exit (for valgrind testing) */ /* Interruption handler to ensure clean exit (for valgrind testing) */
#if !defined(_WIN32) #if !defined(_WIN32)
static int received_sigterm = 0; static int received_sigterm = 0;
void term_handler(int sig) static void term_handler(int sig)
{ {
((void) sig); ((void) sig);
received_sigterm = 1; received_sigterm = 1;
@ -1105,7 +1105,7 @@ typedef struct {
void *p_rng; void *p_rng;
} ssl_async_key_context_t; } ssl_async_key_context_t;
int ssl_async_set_key(ssl_async_key_context_t *ctx, static int ssl_async_set_key(ssl_async_key_context_t *ctx,
mbedtls_x509_crt *cert, mbedtls_x509_crt *cert,
mbedtls_pk_context *pk, mbedtls_pk_context *pk,
int pk_take_ownership, int pk_take_ownership,
@ -1332,7 +1332,7 @@ static psa_status_t psa_setup_psk_key_slot(mbedtls_svc_key_id_t *slot,
#endif /* MBEDTLS_USE_PSA_CRYPTO */ #endif /* MBEDTLS_USE_PSA_CRYPTO */
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
int report_cid_usage(mbedtls_ssl_context *ssl, static int report_cid_usage(mbedtls_ssl_context *ssl,
const char *additional_description) const char *additional_description)
{ {
int ret; int ret;
@ -1383,7 +1383,7 @@ static inline void put_unaligned_uint32(void *p, uint32_t x)
} }
/* Functions for session ticket tests */ /* Functions for session ticket tests */
int dummy_ticket_write(void *p_ticket, const mbedtls_ssl_session *session, static int dummy_ticket_write(void *p_ticket, const mbedtls_ssl_session *session,
unsigned char *start, const unsigned char *end, unsigned char *start, const unsigned char *end,
size_t *tlen, uint32_t *ticket_lifetime) size_t *tlen, uint32_t *ticket_lifetime)
{ {
@ -1410,7 +1410,7 @@ int dummy_ticket_write(void *p_ticket, const mbedtls_ssl_session *session,
return 0; return 0;
} }
int dummy_ticket_parse(void *p_ticket, mbedtls_ssl_session *session, static int dummy_ticket_parse(void *p_ticket, mbedtls_ssl_session *session,
unsigned char *buf, size_t len) unsigned char *buf, size_t len)
{ {
int ret; int ret;
@ -1469,7 +1469,7 @@ int dummy_ticket_parse(void *p_ticket, mbedtls_ssl_session *session,
} }
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_HAVE_TIME */ #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_HAVE_TIME */
int parse_cipher(char *buf) static int parse_cipher(char *buf)
{ {
if (strcmp(buf, "AES-128-CCM")) { if (strcmp(buf, "AES-128-CCM")) {
return MBEDTLS_CIPHER_AES_128_CCM; return MBEDTLS_CIPHER_AES_128_CCM;

View File

@ -12,7 +12,7 @@
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/ */
void eap_tls_key_derivation(void *p_expkey, static void eap_tls_key_derivation(void *p_expkey,
mbedtls_ssl_key_export_type secret_type, mbedtls_ssl_key_export_type secret_type,
const unsigned char *secret, const unsigned char *secret,
size_t secret_len, size_t secret_len,
@ -36,7 +36,7 @@ void eap_tls_key_derivation(void *p_expkey,
keys->tls_prf_type = tls_prf_type; keys->tls_prf_type = tls_prf_type;
} }
void nss_keylog_export(void *p_expkey, static void nss_keylog_export(void *p_expkey,
mbedtls_ssl_key_export_type secret_type, mbedtls_ssl_key_export_type secret_type,
const unsigned char *secret, const unsigned char *secret,
size_t secret_len, size_t secret_len,
@ -106,7 +106,7 @@ exit:
} }
#if defined(MBEDTLS_SSL_DTLS_SRTP) #if defined(MBEDTLS_SSL_DTLS_SRTP)
void dtls_srtp_key_derivation(void *p_expkey, static void dtls_srtp_key_derivation(void *p_expkey,
mbedtls_ssl_key_export_type secret_type, mbedtls_ssl_key_export_type secret_type,
const unsigned char *secret, const unsigned char *secret,
size_t secret_len, size_t secret_len,
@ -131,7 +131,7 @@ void dtls_srtp_key_derivation(void *p_expkey,
} }
#endif /* MBEDTLS_SSL_DTLS_SRTP */ #endif /* MBEDTLS_SSL_DTLS_SRTP */
int ssl_check_record(mbedtls_ssl_context const *ssl, static int ssl_check_record(mbedtls_ssl_context const *ssl,
unsigned char const *buf, size_t len) unsigned char const *buf, size_t len)
{ {
int my_ret = 0, ret_cr1, ret_cr2; int my_ret = 0, ret_cr1, ret_cr2;
@ -195,7 +195,7 @@ cleanup:
return my_ret; return my_ret;
} }
int recv_cb(void *ctx, unsigned char *buf, size_t len) static int recv_cb(void *ctx, unsigned char *buf, size_t len)
{ {
io_ctx_t *io_ctx = (io_ctx_t *) ctx; io_ctx_t *io_ctx = (io_ctx_t *) ctx;
size_t recv_len; size_t recv_len;
@ -223,7 +223,7 @@ int recv_cb(void *ctx, unsigned char *buf, size_t len)
return (int) recv_len; return (int) recv_len;
} }
int recv_timeout_cb(void *ctx, unsigned char *buf, size_t len, static int recv_timeout_cb(void *ctx, unsigned char *buf, size_t len,
uint32_t timeout) uint32_t timeout)
{ {
io_ctx_t *io_ctx = (io_ctx_t *) ctx; io_ctx_t *io_ctx = (io_ctx_t *) ctx;
@ -248,7 +248,7 @@ int recv_timeout_cb(void *ctx, unsigned char *buf, size_t len,
return (int) recv_len; return (int) recv_len;
} }
int send_cb(void *ctx, unsigned char const *buf, size_t len) static int send_cb(void *ctx, unsigned char const *buf, size_t len)
{ {
io_ctx_t *io_ctx = (io_ctx_t *) ctx; io_ctx_t *io_ctx = (io_ctx_t *) ctx;
@ -319,7 +319,7 @@ uint16_t ssl_sig_algs_for_test[] = {
/** Functionally equivalent to mbedtls_x509_crt_verify_info, see that function /** Functionally equivalent to mbedtls_x509_crt_verify_info, see that function
* for more info. * for more info.
*/ */
int x509_crt_verify_info(char *buf, size_t size, const char *prefix, static int x509_crt_verify_info(char *buf, size_t size, const char *prefix,
uint32_t flags) uint32_t flags)
{ {
#if !defined(MBEDTLS_X509_REMOVE_INFO) #if !defined(MBEDTLS_X509_REMOVE_INFO)
@ -352,7 +352,7 @@ int x509_crt_verify_info(char *buf, size_t size, const char *prefix,
} }
#endif /* MBEDTLS_X509_CRT_PARSE_C */ #endif /* MBEDTLS_X509_CRT_PARSE_C */
void mbedtls_print_supported_sig_algs(void) static void mbedtls_print_supported_sig_algs(void)
{ {
mbedtls_printf("supported signature algorithms:\n"); mbedtls_printf("supported signature algorithms:\n");
mbedtls_printf("\trsa_pkcs1_sha256 "); mbedtls_printf("\trsa_pkcs1_sha256 ");

View File

@ -76,13 +76,13 @@ void(*volatile do_nothing_with_object_but_the_compiler_does_not_know)(void *) =
/* Test framework features */ /* Test framework features */
/****************************************************************/ /****************************************************************/
void meta_test_fail(const char *name) static void meta_test_fail(const char *name)
{ {
(void) name; (void) name;
mbedtls_test_fail("Forced test failure", __LINE__, __FILE__); mbedtls_test_fail("Forced test failure", __LINE__, __FILE__);
} }
void meta_test_not_equal(const char *name) static void meta_test_not_equal(const char *name)
{ {
int left = 20; int left = 20;
int right = 10; int right = 10;
@ -94,7 +94,7 @@ exit:
; ;
} }
void meta_test_not_le_s(const char *name) static void meta_test_not_le_s(const char *name)
{ {
int left = 20; int left = 20;
int right = 10; int right = 10;
@ -106,7 +106,7 @@ exit:
; ;
} }
void meta_test_not_le_u(const char *name) static void meta_test_not_le_u(const char *name)
{ {
size_t left = 20; size_t left = 20;
size_t right = 10; size_t right = 10;
@ -122,7 +122,7 @@ exit:
/* Platform features */ /* Platform features */
/****************************************************************/ /****************************************************************/
void null_pointer_dereference(const char *name) static void null_pointer_dereference(const char *name)
{ {
(void) name; (void) name;
volatile char *volatile p; volatile char *volatile p;
@ -131,7 +131,7 @@ void null_pointer_dereference(const char *name)
mbedtls_printf("%p -> %u\n", p, (unsigned) *p); mbedtls_printf("%p -> %u\n", p, (unsigned) *p);
} }
void null_pointer_call(const char *name) static void null_pointer_call(const char *name)
{ {
(void) name; (void) name;
unsigned(*volatile p)(void); unsigned(*volatile p)(void);
@ -148,7 +148,7 @@ void null_pointer_call(const char *name)
/* Memory */ /* Memory */
/****************************************************************/ /****************************************************************/
void read_after_free(const char *name) static void read_after_free(const char *name)
{ {
(void) name; (void) name;
volatile char *p = calloc_but_the_compiler_does_not_know(1, 1); volatile char *p = calloc_but_the_compiler_does_not_know(1, 1);
@ -158,7 +158,7 @@ void read_after_free(const char *name)
mbedtls_printf("%u\n", (unsigned) *p); mbedtls_printf("%u\n", (unsigned) *p);
} }
void double_free(const char *name) static void double_free(const char *name)
{ {
(void) name; (void) name;
volatile char *p = calloc_but_the_compiler_does_not_know(1, 1); volatile char *p = calloc_but_the_compiler_does_not_know(1, 1);
@ -168,7 +168,7 @@ void double_free(const char *name)
free_but_the_compiler_does_not_know((void *) p); free_but_the_compiler_does_not_know((void *) p);
} }
void read_uninitialized_stack(const char *name) static void read_uninitialized_stack(const char *name)
{ {
(void) name; (void) name;
char buf[1]; char buf[1];
@ -182,7 +182,7 @@ void read_uninitialized_stack(const char *name)
} }
} }
void memory_leak(const char *name) static void memory_leak(const char *name)
{ {
(void) name; (void) name;
volatile char *p = calloc_but_the_compiler_does_not_know(1, 1); volatile char *p = calloc_but_the_compiler_does_not_know(1, 1);
@ -196,7 +196,7 @@ void memory_leak(const char *name)
* %(start), %(offset) and %(count) are decimal integers. * %(start), %(offset) and %(count) are decimal integers.
* %(direction) is either the character 'r' for read or 'w' for write. * %(direction) is either the character 'r' for read or 'w' for write.
*/ */
void test_memory_poison(const char *name) static void test_memory_poison(const char *name)
{ {
size_t start = 0, offset = 0, count = 0; size_t start = 0, offset = 0, count = 0;
char direction = 'r'; char direction = 'r';
@ -254,7 +254,7 @@ void test_memory_poison(const char *name)
/* Threading */ /* Threading */
/****************************************************************/ /****************************************************************/
void mutex_lock_not_initialized(const char *name) static void mutex_lock_not_initialized(const char *name)
{ {
(void) name; (void) name;
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)
@ -270,7 +270,7 @@ exit:
#endif #endif
} }
void mutex_unlock_not_initialized(const char *name) static void mutex_unlock_not_initialized(const char *name)
{ {
(void) name; (void) name;
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)
@ -286,7 +286,7 @@ exit:
#endif #endif
} }
void mutex_free_not_initialized(const char *name) static void mutex_free_not_initialized(const char *name)
{ {
(void) name; (void) name;
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)
@ -300,7 +300,7 @@ void mutex_free_not_initialized(const char *name)
#endif #endif
} }
void mutex_double_init(const char *name) static void mutex_double_init(const char *name)
{ {
(void) name; (void) name;
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)
@ -315,7 +315,7 @@ void mutex_double_init(const char *name)
#endif #endif
} }
void mutex_double_free(const char *name) static void mutex_double_free(const char *name)
{ {
(void) name; (void) name;
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)
@ -330,7 +330,7 @@ void mutex_double_free(const char *name)
#endif #endif
} }
void mutex_leak(const char *name) static void mutex_leak(const char *name)
{ {
(void) name; (void) name;
#if defined(MBEDTLS_THREADING_C) #if defined(MBEDTLS_THREADING_C)

View File

@ -241,7 +241,7 @@ static void create_entropy_seed_file(void)
} }
#endif #endif
int mbedtls_entropy_self_test_wrapper(int verbose) static int mbedtls_entropy_self_test_wrapper(int verbose)
{ {
#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_NO_PLATFORM_ENTROPY) #if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
create_entropy_seed_file(); create_entropy_seed_file();
@ -252,7 +252,7 @@ int mbedtls_entropy_self_test_wrapper(int verbose)
#if defined(MBEDTLS_SELF_TEST) #if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
int mbedtls_memory_buffer_alloc_free_and_self_test(int verbose) static int mbedtls_memory_buffer_alloc_free_and_self_test(int verbose)
{ {
if (verbose != 0) { if (verbose != 0) {
#if defined(MBEDTLS_MEMORY_DEBUG) #if defined(MBEDTLS_MEMORY_DEBUG)

View File

@ -483,7 +483,7 @@ typedef struct {
} packet; } packet;
/* Print packet. Outgoing packets come with a reason (forward, dupl, etc.) */ /* Print packet. Outgoing packets come with a reason (forward, dupl, etc.) */
void print_packet(const packet *p, const char *why) static void print_packet(const packet *p, const char *why)
{ {
#if defined(MBEDTLS_TIMING_C) #if defined(MBEDTLS_TIMING_C)
if (why == NULL) { if (why == NULL) {
@ -527,7 +527,7 @@ typedef enum {
static inject_clihlo_state_t inject_clihlo_state; static inject_clihlo_state_t inject_clihlo_state;
static packet initial_clihlo; static packet initial_clihlo;
int send_packet(const packet *p, const char *why) static int send_packet(const packet *p, const char *why)
{ {
int ret; int ret;
mbedtls_net_context *dst = p->dst; mbedtls_net_context *dst = p->dst;
@ -616,13 +616,13 @@ int send_packet(const packet *p, const char *why)
static size_t prev_len; static size_t prev_len;
static packet prev[MAX_DELAYED_MSG]; static packet prev[MAX_DELAYED_MSG];
void clear_pending(void) static void clear_pending(void)
{ {
memset(&prev, 0, sizeof(prev)); memset(&prev, 0, sizeof(prev));
prev_len = 0; prev_len = 0;
} }
void delay_packet(packet *delay) static void delay_packet(packet *delay)
{ {
if (prev_len == MAX_DELAYED_MSG) { if (prev_len == MAX_DELAYED_MSG) {
return; return;
@ -631,7 +631,7 @@ void delay_packet(packet *delay)
memcpy(&prev[prev_len++], delay, sizeof(packet)); memcpy(&prev[prev_len++], delay, sizeof(packet));
} }
int send_delayed(void) static int send_delayed(void)
{ {
uint8_t offset; uint8_t offset;
int ret; int ret;
@ -663,7 +663,7 @@ int send_delayed(void)
static unsigned char held[2048] = { 0 }; static unsigned char held[2048] = { 0 };
#define HOLD_MAX 2 #define HOLD_MAX 2
int handle_message(const char *way, static int handle_message(const char *way,
mbedtls_net_context *dst, mbedtls_net_context *dst,
mbedtls_net_context *src) mbedtls_net_context *src)
{ {

View File

@ -23,7 +23,7 @@
#define BUFFER_LEN 1024 #define BUFFER_LEN 1024
void usage(void) static void usage(void)
{ {
mbedtls_printf("Zeroize is a simple program to assist with testing\n"); mbedtls_printf("Zeroize is a simple program to assist with testing\n");
mbedtls_printf("the mbedtls_platform_zeroize() function by using the\n"); mbedtls_printf("the mbedtls_platform_zeroize() function by using the\n");

View File

@ -45,7 +45,7 @@ struct options {
const char *output_file; /* where to store the output */ const char *output_file; /* where to store the output */
} opt; } opt;
int convert_pem_to_der(const unsigned char *input, size_t ilen, static int convert_pem_to_der(const unsigned char *input, size_t ilen,
unsigned char *output, size_t *olen) unsigned char *output, size_t *olen)
{ {
int ret; int ret;

View File

@ -107,7 +107,7 @@ struct options {
mbedtls_md_type_t md_alg; /* Hash algorithm used for signature. */ mbedtls_md_type_t md_alg; /* Hash algorithm used for signature. */
} opt; } opt;
int write_certificate_request(mbedtls_x509write_csr *req, const char *output_file, static int write_certificate_request(mbedtls_x509write_csr *req, const char *output_file,
int (*f_rng)(void *, unsigned char *, size_t), int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng) void *p_rng)
{ {

View File

@ -204,7 +204,7 @@ struct options {
int format; /* format */ int format; /* format */
} opt; } opt;
int write_certificate(mbedtls_x509write_cert *crt, const char *output_file, static int write_certificate(mbedtls_x509write_cert *crt, const char *output_file,
int (*f_rng)(void *, unsigned char *, size_t), int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng) void *p_rng)
{ {
@ -249,7 +249,7 @@ int write_certificate(mbedtls_x509write_cert *crt, const char *output_file,
return 0; return 0;
} }
int parse_serial_decimal_format(unsigned char *obuf, size_t obufmax, static int parse_serial_decimal_format(unsigned char *obuf, size_t obufmax,
const char *ibuf, size_t *len) const char *ibuf, size_t *len)
{ {
unsigned long long int dec; unsigned long long int dec;

View File

@ -48,7 +48,7 @@ struct options {
} opt; } opt;
int read_certificates(const char *const *filenames) static int read_certificates(const char *const *filenames)
{ {
mbedtls_x509_crt cas; mbedtls_x509_crt cas;
int ret = 0; int ret = 0;