Fix missing-prototype errors in sample programs
Signed-off-by: Michael Schuster <michael@schuster.ms>
diff --git a/programs/test/metatest.c b/programs/test/metatest.c
index 75829ec..9d90d8c 100644
--- a/programs/test/metatest.c
+++ b/programs/test/metatest.c
@@ -76,13 +76,13 @@
/* Test framework features */
/****************************************************************/
-void meta_test_fail(const char *name)
+static void meta_test_fail(const char *name)
{
(void) name;
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 right = 10;
@@ -94,7 +94,7 @@
;
}
-void meta_test_not_le_s(const char *name)
+static void meta_test_not_le_s(const char *name)
{
int left = 20;
int right = 10;
@@ -106,7 +106,7 @@
;
}
-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 right = 10;
@@ -122,7 +122,7 @@
/* Platform features */
/****************************************************************/
-void null_pointer_dereference(const char *name)
+static void null_pointer_dereference(const char *name)
{
(void) name;
volatile char *volatile p;
@@ -131,7 +131,7 @@
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;
unsigned(*volatile p)(void);
@@ -148,7 +148,7 @@
/* Memory */
/****************************************************************/
-void read_after_free(const char *name)
+static void read_after_free(const char *name)
{
(void) name;
volatile char *p = calloc_but_the_compiler_does_not_know(1, 1);
@@ -158,7 +158,7 @@
mbedtls_printf("%u\n", (unsigned) *p);
}
-void double_free(const char *name)
+static void double_free(const char *name)
{
(void) name;
volatile char *p = calloc_but_the_compiler_does_not_know(1, 1);
@@ -168,7 +168,7 @@
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;
char buf[1];
@@ -182,7 +182,7 @@
}
}
-void memory_leak(const char *name)
+static void memory_leak(const char *name)
{
(void) name;
volatile char *p = calloc_but_the_compiler_does_not_know(1, 1);
@@ -196,7 +196,7 @@
* %(start), %(offset) and %(count) are decimal integers.
* %(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;
char direction = 'r';
@@ -254,7 +254,7 @@
/* Threading */
/****************************************************************/
-void mutex_lock_not_initialized(const char *name)
+static void mutex_lock_not_initialized(const char *name)
{
(void) name;
#if defined(MBEDTLS_THREADING_C)
@@ -270,7 +270,7 @@
#endif
}
-void mutex_unlock_not_initialized(const char *name)
+static void mutex_unlock_not_initialized(const char *name)
{
(void) name;
#if defined(MBEDTLS_THREADING_C)
@@ -286,7 +286,7 @@
#endif
}
-void mutex_free_not_initialized(const char *name)
+static void mutex_free_not_initialized(const char *name)
{
(void) name;
#if defined(MBEDTLS_THREADING_C)
@@ -300,7 +300,7 @@
#endif
}
-void mutex_double_init(const char *name)
+static void mutex_double_init(const char *name)
{
(void) name;
#if defined(MBEDTLS_THREADING_C)
@@ -315,7 +315,7 @@
#endif
}
-void mutex_double_free(const char *name)
+static void mutex_double_free(const char *name)
{
(void) name;
#if defined(MBEDTLS_THREADING_C)
@@ -330,7 +330,7 @@
#endif
}
-void mutex_leak(const char *name)
+static void mutex_leak(const char *name)
{
(void) name;
#if defined(MBEDTLS_THREADING_C)
diff --git a/programs/test/selftest.c b/programs/test/selftest.c
index 043209b..e72386f 100644
--- a/programs/test/selftest.c
+++ b/programs/test/selftest.c
@@ -241,7 +241,7 @@
}
#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)
create_entropy_seed_file();
@@ -252,7 +252,7 @@
#if defined(MBEDTLS_SELF_TEST)
#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 defined(MBEDTLS_MEMORY_DEBUG)
diff --git a/programs/test/udp_proxy.c b/programs/test/udp_proxy.c
index beaa8bd..bf06871 100644
--- a/programs/test/udp_proxy.c
+++ b/programs/test/udp_proxy.c
@@ -483,7 +483,7 @@
} packet;
/* 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 (why == NULL) {
@@ -527,7 +527,7 @@
static inject_clihlo_state_t inject_clihlo_state;
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;
mbedtls_net_context *dst = p->dst;
@@ -616,13 +616,13 @@
static size_t prev_len;
static packet prev[MAX_DELAYED_MSG];
-void clear_pending(void)
+static void clear_pending(void)
{
memset(&prev, 0, sizeof(prev));
prev_len = 0;
}
-void delay_packet(packet *delay)
+static void delay_packet(packet *delay)
{
if (prev_len == MAX_DELAYED_MSG) {
return;
@@ -631,7 +631,7 @@
memcpy(&prev[prev_len++], delay, sizeof(packet));
}
-int send_delayed(void)
+static int send_delayed(void)
{
uint8_t offset;
int ret;
@@ -663,7 +663,7 @@
static unsigned char held[2048] = { 0 };
#define HOLD_MAX 2
-int handle_message(const char *way,
+static int handle_message(const char *way,
mbedtls_net_context *dst,
mbedtls_net_context *src)
{
diff --git a/programs/test/zeroize.c b/programs/test/zeroize.c
index 1e9b98d..c1cee0d 100644
--- a/programs/test/zeroize.c
+++ b/programs/test/zeroize.c
@@ -23,7 +23,7 @@
#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("the mbedtls_platform_zeroize() function by using the\n");