Fix missing-prototype errors in tests/suites

Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
Michael Schuster 2024-06-04 02:30:22 +02:00 committed by Minos Galanakis
parent 87825ab1b2
commit 54300d4a4e
23 changed files with 64 additions and 63 deletions

View File

@ -950,7 +950,7 @@ int mbedtls_test_move_handshake_to_state(mbedtls_ssl_context *ssl,
/* /*
* Write application data. Increase write counter if necessary. * Write application data. Increase write counter if necessary.
*/ */
int mbedtls_ssl_write_fragment(mbedtls_ssl_context *ssl, static int mbedtls_ssl_write_fragment(mbedtls_ssl_context *ssl,
unsigned char *buf, int buf_len, unsigned char *buf, int buf_len,
int *written, int *written,
const int expected_fragments) const int expected_fragments)
@ -997,7 +997,7 @@ exit:
* Read application data and increase read counter and fragments counter * Read application data and increase read counter and fragments counter
* if necessary. * if necessary.
*/ */
int mbedtls_ssl_read_fragment(mbedtls_ssl_context *ssl, static int mbedtls_ssl_read_fragment(mbedtls_ssl_context *ssl,
unsigned char *buf, int buf_len, unsigned char *buf, int buf_len,
int *read, int *fragments, int *read, int *fragments,
const int expected_fragments) const int expected_fragments)

View File

@ -9,7 +9,7 @@ struct buffer_data {
char *ptr; char *ptr;
}; };
void string_debug(void *data, int level, const char *file, int line, const char *str) static void string_debug(void *data, int level, const char *file, int line, const char *str)
{ {
struct buffer_data *buffer = (struct buffer_data *) data; struct buffer_data *buffer = (struct buffer_data *) data;
char *p = buffer->ptr; char *p = buffer->ptr;

View File

@ -17,7 +17,7 @@
* END_DEPENDENCIES * END_DEPENDENCIES
*/ */
/* BEGIN_SUITE_HELPERS */ /* BEGIN_SUITE_HELPERS */
int pkcs7_parse_buffer(unsigned char *pkcs7_buf, int buflen) static int pkcs7_parse_buffer(unsigned char *pkcs7_buf, int buflen)
{ {
int res; int res;
mbedtls_pkcs7 pkcs7; mbedtls_pkcs7 pkcs7;

View File

@ -60,7 +60,7 @@ const mbedtls_x509_crt_profile profile_sha512 =
1024, 1024,
}; };
int verify_none(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags) static int verify_none(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
{ {
((void) data); ((void) data);
((void) crt); ((void) crt);
@ -70,7 +70,7 @@ int verify_none(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32
return 0; return 0;
} }
int verify_all(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags) static int verify_all(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
{ {
((void) data); ((void) data);
((void) crt); ((void) crt);
@ -81,7 +81,7 @@ int verify_all(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_
} }
#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK) #if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
int ca_callback_fail(void *data, mbedtls_x509_crt const *child, mbedtls_x509_crt **candidates) static int ca_callback_fail(void *data, mbedtls_x509_crt const *child, mbedtls_x509_crt **candidates)
{ {
((void) data); ((void) data);
((void) child); ((void) child);
@ -90,7 +90,7 @@ int ca_callback_fail(void *data, mbedtls_x509_crt const *child, mbedtls_x509_crt
return -1; return -1;
} }
#if defined(MBEDTLS_X509_CRT_PARSE_C) #if defined(MBEDTLS_X509_CRT_PARSE_C)
int ca_callback(void *data, mbedtls_x509_crt const *child, static int ca_callback(void *data, mbedtls_x509_crt const *child,
mbedtls_x509_crt **candidates) mbedtls_x509_crt **candidates)
{ {
int ret = 0; int ret = 0;
@ -141,7 +141,7 @@ exit:
#endif /* MBEDTLS_X509_CRT_PARSE_C */ #endif /* MBEDTLS_X509_CRT_PARSE_C */
#endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */ #endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
int verify_fatal(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags) static int verify_fatal(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
{ {
int *levels = (int *) data; int *levels = (int *) data;
@ -158,7 +158,7 @@ int verify_fatal(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint3
} }
/* strsep() not available on Windows */ /* strsep() not available on Windows */
char *mystrsep(char **stringp, const char *delim) static char *mystrsep(char **stringp, const char *delim)
{ {
const char *p; const char *p;
char *ret = *stringp; char *ret = *stringp;
@ -192,13 +192,13 @@ typedef struct {
char *p; char *p;
} verify_print_context; } verify_print_context;
void verify_print_init(verify_print_context *ctx) static void verify_print_init(verify_print_context *ctx)
{ {
memset(ctx, 0, sizeof(verify_print_context)); memset(ctx, 0, sizeof(verify_print_context));
ctx->p = ctx->buf; ctx->p = ctx->buf;
} }
int verify_print(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags) static int verify_print(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
{ {
int ret; int ret;
verify_print_context *ctx = (verify_print_context *) data; verify_print_context *ctx = (verify_print_context *) data;
@ -226,7 +226,7 @@ int verify_print(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint3
return 0; return 0;
} }
int verify_parse_san(mbedtls_x509_subject_alternative_name *san, static int verify_parse_san(mbedtls_x509_subject_alternative_name *san,
char **buf, size_t *size) char **buf, size_t *size)
{ {
int ret; int ret;
@ -317,7 +317,7 @@ int verify_parse_san(mbedtls_x509_subject_alternative_name *san,
return 0; return 0;
} }
int parse_crt_ext_cb(void *p_ctx, mbedtls_x509_crt const *crt, mbedtls_x509_buf const *oid, static int parse_crt_ext_cb(void *p_ctx, mbedtls_x509_crt const *crt, mbedtls_x509_buf const *oid,
int critical, const unsigned char *cp, const unsigned char *end) int critical, const unsigned char *cp, const unsigned char *end)
{ {
(void) crt; (void) crt;
@ -417,7 +417,7 @@ int parse_crt_ext_cb(void *p_ctx, mbedtls_x509_crt const *crt, mbedtls_x509_buf
#endif /* MBEDTLS_X509_CRT_PARSE_C */ #endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_X509_CSR_PARSE_C) #if defined(MBEDTLS_X509_CSR_PARSE_C)
int parse_csr_ext_accept_cb(void *p_ctx, mbedtls_x509_csr const *csr, mbedtls_x509_buf const *oid, static int parse_csr_ext_accept_cb(void *p_ctx, mbedtls_x509_csr const *csr, mbedtls_x509_buf const *oid,
int critical, const unsigned char *cp, const unsigned char *end) int critical, const unsigned char *cp, const unsigned char *end)
{ {
(void) p_ctx; (void) p_ctx;
@ -430,7 +430,7 @@ int parse_csr_ext_accept_cb(void *p_ctx, mbedtls_x509_csr const *csr, mbedtls_x5
return 0; return 0;
} }
int parse_csr_ext_reject_cb(void *p_ctx, mbedtls_x509_csr const *csr, mbedtls_x509_buf const *oid, static int parse_csr_ext_reject_cb(void *p_ctx, mbedtls_x509_csr const *csr, mbedtls_x509_buf const *oid,
int critical, const unsigned char *cp, const unsigned char *end) int critical, const unsigned char *cp, const unsigned char *end)
{ {
(void) p_ctx; (void) p_ctx;

View File

@ -11,14 +11,14 @@
#include "mbedtls/psa_util.h" #include "mbedtls/psa_util.h"
#if defined(MBEDTLS_RSA_C) #if defined(MBEDTLS_RSA_C)
int mbedtls_rsa_decrypt_func(void *ctx, size_t *olen, static int mbedtls_rsa_decrypt_func(void *ctx, size_t *olen,
const unsigned char *input, unsigned char *output, const unsigned char *input, unsigned char *output,
size_t output_max_len) size_t output_max_len)
{ {
return mbedtls_rsa_pkcs1_decrypt((mbedtls_rsa_context *) ctx, NULL, NULL, return mbedtls_rsa_pkcs1_decrypt((mbedtls_rsa_context *) ctx, NULL, NULL,
olen, input, output, output_max_len); olen, input, output, output_max_len);
} }
int mbedtls_rsa_sign_func(void *ctx, static int mbedtls_rsa_sign_func(void *ctx,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
mbedtls_md_type_t md_alg, unsigned int hashlen, mbedtls_md_type_t md_alg, unsigned int hashlen,
const unsigned char *hash, unsigned char *sig) const unsigned char *hash, unsigned char *sig)
@ -26,7 +26,7 @@ int mbedtls_rsa_sign_func(void *ctx,
return mbedtls_rsa_pkcs1_sign((mbedtls_rsa_context *) ctx, f_rng, p_rng, return mbedtls_rsa_pkcs1_sign((mbedtls_rsa_context *) ctx, f_rng, p_rng,
md_alg, hashlen, hash, sig); md_alg, hashlen, hash, sig);
} }
size_t mbedtls_rsa_key_len_func(void *ctx) static size_t mbedtls_rsa_key_len_func(void *ctx)
{ {
return ((const mbedtls_rsa_context *) ctx)->len; return ((const mbedtls_rsa_context *) ctx)->len;
} }

View File

@ -8,7 +8,7 @@
* *
* \return 0 if success else 1 * \return 0 if success else 1
*/ */
int verify_string(char **str) static int verify_string(char **str)
{ {
if ((*str)[0] != '"' || if ((*str)[0] != '"' ||
(*str)[strlen(*str) - 1] != '"') { (*str)[strlen(*str) - 1] != '"') {
@ -32,7 +32,7 @@ int verify_string(char **str)
* *
* \return 0 if success else 1 * \return 0 if success else 1
*/ */
int verify_int(char *str, intmax_t *p_value) static int verify_int(char *str, intmax_t *p_value)
{ {
char *end = NULL; char *end = NULL;
errno = 0; errno = 0;
@ -80,7 +80,7 @@ int verify_int(char *str, intmax_t *p_value)
* *
* \return 0 if success else -1 * \return 0 if success else -1
*/ */
int get_line(FILE *f, char *buf, size_t len) static int get_line(FILE *f, char *buf, size_t len)
{ {
char *ret; char *ret;
int i = 0, str_len = 0, has_string = 0; int i = 0, str_len = 0, has_string = 0;
@ -485,7 +485,7 @@ static void try_chdir_if_supported(const char *argv0)
* *
* \return Program exit status. * \return Program exit status.
*/ */
int execute_tests(int argc, const char **argv) static int execute_tests(int argc, const char **argv)
{ {
/* Local Configurations and options */ /* Local Configurations and options */
const char *default_filename = "DATA_FILE"; const char *default_filename = "DATA_FILE";

View File

@ -69,7 +69,7 @@ __MBEDTLS_TEST_TEMPLATE__FUNCTIONS_CODE
* *
* \return 0 if exp_id is found. 1 otherwise. * \return 0 if exp_id is found. 1 otherwise.
*/ */
int get_expression(int32_t exp_id, intmax_t *out_value) static int get_expression(int32_t exp_id, intmax_t *out_value)
{ {
int ret = KEY_VALUE_MAPPING_FOUND; int ret = KEY_VALUE_MAPPING_FOUND;
@ -100,7 +100,7 @@ int get_expression(int32_t exp_id, intmax_t *out_value)
* *
* \return DEPENDENCY_SUPPORTED if set else DEPENDENCY_NOT_SUPPORTED * \return DEPENDENCY_SUPPORTED if set else DEPENDENCY_NOT_SUPPORTED
*/ */
int dep_check(int dep_id) static int dep_check(int dep_id)
{ {
int ret = DEPENDENCY_NOT_SUPPORTED; int ret = DEPENDENCY_NOT_SUPPORTED;
@ -155,7 +155,7 @@ TestWrapper_t test_funcs[] =
* DISPATCH_TEST_FN_NOT_FOUND if not found * DISPATCH_TEST_FN_NOT_FOUND if not found
* DISPATCH_UNSUPPORTED_SUITE if not compile time enabled. * DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
*/ */
int dispatch_test(size_t func_idx, void **params) static int dispatch_test(size_t func_idx, void **params)
{ {
int ret = DISPATCH_TEST_SUCCESS; int ret = DISPATCH_TEST_SUCCESS;
TestWrapper_t fp = NULL; TestWrapper_t fp = NULL;
@ -193,7 +193,7 @@ int dispatch_test(size_t func_idx, void **params)
* DISPATCH_TEST_FN_NOT_FOUND if not found * DISPATCH_TEST_FN_NOT_FOUND if not found
* DISPATCH_UNSUPPORTED_SUITE if not compile time enabled. * DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
*/ */
int check_test(size_t func_idx) static int check_test(size_t func_idx)
{ {
int ret = DISPATCH_TEST_SUCCESS; int ret = DISPATCH_TEST_SUCCESS;
TestWrapper_t fp = NULL; TestWrapper_t fp = NULL;

View File

@ -10,7 +10,7 @@
/* /*
* Convert a string of the form "abcd" (case-insensitive) to a uint64_t. * Convert a string of the form "abcd" (case-insensitive) to a uint64_t.
*/ */
int parse_hex_string(char *hex_string, uint64_t *result) static int parse_hex_string(char *hex_string, uint64_t *result)
{ {
uint8_t raw[8] = { 0 }; uint8_t raw[8] = { 0 };
size_t olen; size_t olen;

View File

@ -122,7 +122,7 @@ exit:
return ERR_PARSE_INCONSISTENCY; return ERR_PARSE_INCONSISTENCY;
} }
int get_len_step(const data_t *input, size_t buffer_size, static int get_len_step(const data_t *input, size_t buffer_size,
size_t actual_length) size_t actual_length)
{ {
unsigned char *buf = NULL; unsigned char *buf = NULL;

View File

@ -12,7 +12,7 @@ typedef struct {
size_t size; size_t size;
} generic_write_data_t; } generic_write_data_t;
int generic_write_start_step(generic_write_data_t *data) static int generic_write_start_step(generic_write_data_t *data)
{ {
mbedtls_test_set_step(data->size); mbedtls_test_set_step(data->size);
mbedtls_free(data->output); mbedtls_free(data->output);
@ -26,7 +26,7 @@ exit:
return 0; return 0;
} }
int generic_write_finish_step(generic_write_data_t *data, static int generic_write_finish_step(generic_write_data_t *data,
const data_t *expected, int ret) const data_t *expected, int ret)
{ {
int ok = 0; int ok = 0;

View File

@ -44,7 +44,7 @@ typedef struct mbedtls_test_mpi_random {
* test) are stored in the data member of the state structure. Each number is in * test) are stored in the data member of the state structure. Each number is in
* the format that mbedtls_mpi_read_string understands and is chunk_len long. * the format that mbedtls_mpi_read_string understands and is chunk_len long.
*/ */
int mbedtls_test_mpi_miller_rabin_determinizer(void *state, static int mbedtls_test_mpi_miller_rabin_determinizer(void *state,
unsigned char *buf, unsigned char *buf,
size_t len) size_t len)
{ {

View File

@ -129,7 +129,7 @@ exit:
* return 1 if it is, * return 1 if it is,
* 0 if it isn't. * 0 if it isn't.
*/ */
int buffer_is_all_zero(const uint8_t *buf, size_t size) static int buffer_is_all_zero(const uint8_t *buf, size_t size)
{ {
for (size_t i = 0; i < size; i++) { for (size_t i = 0; i < size; i++) {
if (buf[i] != 0) { if (buf[i] != 0) {

View File

@ -1,7 +1,7 @@
/* BEGIN_HEADER */ /* BEGIN_HEADER */
#include "common.h" #include "common.h"
void fill_arrays(unsigned char *a, unsigned char *b, unsigned char *r1, unsigned char *r2, size_t n) static void fill_arrays(unsigned char *a, unsigned char *b, unsigned char *r1, unsigned char *r2, size_t n)
{ {
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
a[i] = (unsigned char) i * 3; a[i] = (unsigned char) i * 3;

View File

@ -96,6 +96,7 @@ exit:
} }
static const int thread_random_reps = 10; static const int thread_random_reps = 10;
void *thread_random_function(void *ctx); /* only used conditionally in ctr_drbg_threads */
void *thread_random_function(void *ctx) void *thread_random_function(void *ctx)
{ {
unsigned char out[16]; unsigned char out[16];

View File

@ -1,7 +1,7 @@
/* BEGIN_HEADER */ /* BEGIN_HEADER */
#include "mbedtls/dhm.h" #include "mbedtls/dhm.h"
int check_get_value(const mbedtls_dhm_context *ctx, static int check_get_value(const mbedtls_dhm_context *ctx,
mbedtls_dhm_parameter param, mbedtls_dhm_parameter param,
const mbedtls_mpi *expected) const mbedtls_mpi *expected)
{ {

View File

@ -65,7 +65,7 @@ static void entropy_clear_sources(mbedtls_entropy_context *ctx)
*/ */
static unsigned char buffer_seed[MBEDTLS_ENTROPY_BLOCK_SIZE]; static unsigned char buffer_seed[MBEDTLS_ENTROPY_BLOCK_SIZE];
int buffer_nv_seed_read(unsigned char *buf, size_t buf_len) static int buffer_nv_seed_read(unsigned char *buf, size_t buf_len)
{ {
if (buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE) { if (buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE) {
return -1; return -1;
@ -75,7 +75,7 @@ int buffer_nv_seed_read(unsigned char *buf, size_t buf_len)
return 0; return 0;
} }
int buffer_nv_seed_write(unsigned char *buf, size_t buf_len) static int buffer_nv_seed_write(unsigned char *buf, size_t buf_len)
{ {
if (buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE) { if (buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE) {
return -1; return -1;
@ -111,7 +111,7 @@ static int write_nv_seed(unsigned char *buf, size_t buf_len)
return 0; return 0;
} }
int read_nv_seed(unsigned char *buf, size_t buf_len) static int read_nv_seed(unsigned char *buf, size_t buf_len)
{ {
FILE *f; FILE *f;

View File

@ -3,7 +3,7 @@
#include "mbedtls/lms.h" #include "mbedtls/lms.h"
#if defined(MBEDTLS_TEST_HOOKS) #if defined(MBEDTLS_TEST_HOOKS)
int check_lmots_private_key_for_leak(unsigned char *sig) static int check_lmots_private_key_for_leak(unsigned char *sig)
{ {
size_t idx; size_t idx;

View File

@ -221,7 +221,7 @@ exit:
} }
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) #if defined(MBEDTLS_PSA_CRYPTO_CLIENT)
psa_status_t pk_psa_import_key(const unsigned char *key_data, size_t key_len, static psa_status_t pk_psa_import_key(const unsigned char *key_data, size_t key_len,
psa_key_type_t type, psa_key_usage_t usage, psa_key_type_t type, psa_key_usage_t usage,
psa_algorithm_t alg, mbedtls_svc_key_id_t *key) psa_algorithm_t alg, mbedtls_svc_key_id_t *key)
{ {
@ -320,7 +320,7 @@ exit:
* for volatile keys. * for volatile keys.
* \param[out] key Identifier of the "generated" (actually imported) PSA key. * \param[out] key Identifier of the "generated" (actually imported) PSA key.
*/ */
psa_status_t pk_psa_setup(psa_key_type_t type, size_t bits, static psa_status_t pk_psa_setup(psa_key_type_t type, size_t bits,
psa_key_usage_t usage, psa_algorithm_t alg, psa_key_usage_t usage, psa_algorithm_t alg,
psa_algorithm_t enrollment_alg, psa_algorithm_t enrollment_alg,
mbedtls_svc_key_id_t persistent_key_id, mbedtls_svc_key_id_t persistent_key_id,
@ -468,7 +468,7 @@ exit:
#endif /* MBEDTLS_PSA_CRYPTO_CLIENT */ #endif /* MBEDTLS_PSA_CRYPTO_CLIENT */
#if defined(MBEDTLS_RSA_C) #if defined(MBEDTLS_RSA_C)
int mbedtls_rsa_decrypt_func(void *ctx, size_t *olen, static int mbedtls_rsa_decrypt_func(void *ctx, size_t *olen,
const unsigned char *input, unsigned char *output, const unsigned char *input, unsigned char *output,
size_t output_max_len) size_t output_max_len)
{ {
@ -476,7 +476,7 @@ int mbedtls_rsa_decrypt_func(void *ctx, size_t *olen,
mbedtls_test_rnd_std_rand, NULL, mbedtls_test_rnd_std_rand, NULL,
olen, input, output, output_max_len); olen, input, output, output_max_len);
} }
int mbedtls_rsa_sign_func(void *ctx, static int mbedtls_rsa_sign_func(void *ctx,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
mbedtls_md_type_t md_alg, unsigned int hashlen, mbedtls_md_type_t md_alg, unsigned int hashlen,
const unsigned char *hash, unsigned char *sig) const unsigned char *hash, unsigned char *sig)
@ -487,7 +487,7 @@ int mbedtls_rsa_sign_func(void *ctx,
mbedtls_test_rnd_std_rand, NULL, mbedtls_test_rnd_std_rand, NULL,
md_alg, hashlen, hash, sig); md_alg, hashlen, hash, sig);
} }
size_t mbedtls_rsa_key_len_func(void *ctx) static size_t mbedtls_rsa_key_len_func(void *ctx)
{ {
return ((const mbedtls_rsa_context *) ctx)->len; return ((const mbedtls_rsa_context *) ctx)->len;
} }
@ -618,7 +618,7 @@ exit:
/* Create a copy of a PSA key with same usage and algorithm policy and destroy /* Create a copy of a PSA key with same usage and algorithm policy and destroy
* the original one. */ * the original one. */
mbedtls_svc_key_id_t psa_copy_and_destroy(mbedtls_svc_key_id_t orig_key_id) static mbedtls_svc_key_id_t psa_copy_and_destroy(mbedtls_svc_key_id_t orig_key_id)
{ {
psa_key_attributes_t orig_attr = PSA_KEY_ATTRIBUTES_INIT; psa_key_attributes_t orig_attr = PSA_KEY_ATTRIBUTES_INIT;
psa_key_attributes_t new_attr = PSA_KEY_ATTRIBUTES_INIT; psa_key_attributes_t new_attr = PSA_KEY_ATTRIBUTES_INIT;

View File

@ -18,7 +18,7 @@
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
void sleep_ms(int milliseconds) static void sleep_ms(int milliseconds)
{ {
#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \ #if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \
defined(__MINGW32__) || defined(_WIN64) defined(__MINGW32__) || defined(_WIN64)

View File

@ -153,7 +153,7 @@ static int construct_fake_rsa_key(unsigned char *buffer,
} }
#endif /* MBEDTLS_ASN1_WRITE_C */ #endif /* MBEDTLS_ASN1_WRITE_C */
int exercise_mac_setup(psa_key_type_t key_type, static int exercise_mac_setup(psa_key_type_t key_type,
const unsigned char *key_bytes, const unsigned char *key_bytes,
size_t key_length, size_t key_length,
psa_algorithm_t alg, psa_algorithm_t alg,
@ -185,7 +185,7 @@ exit:
return 0; return 0;
} }
int exercise_cipher_setup(psa_key_type_t key_type, static int exercise_cipher_setup(psa_key_type_t key_type,
const unsigned char *key_bytes, const unsigned char *key_bytes,
size_t key_length, size_t key_length,
psa_algorithm_t alg, psa_algorithm_t alg,
@ -1308,7 +1308,7 @@ same_key_context;
/* Attempt to import the key in ctx. This handles any valid error codes /* Attempt to import the key in ctx. This handles any valid error codes
* and reports an error for any invalid codes. This function also insures * and reports an error for any invalid codes. This function also insures
* that once imported by some thread, all threads can use the key. */ * that once imported by some thread, all threads can use the key. */
void *thread_import_key(void *ctx) static void *thread_import_key(void *ctx)
{ {
mbedtls_svc_key_id_t returned_key_id; mbedtls_svc_key_id_t returned_key_id;
same_key_context *skc = (struct same_key_context *) ctx; same_key_context *skc = (struct same_key_context *) ctx;
@ -1382,7 +1382,7 @@ exit:
return NULL; return NULL;
} }
void *thread_use_and_destroy_key(void *ctx) static void *thread_use_and_destroy_key(void *ctx)
{ {
same_key_context *skc = (struct same_key_context *) ctx; same_key_context *skc = (struct same_key_context *) ctx;
@ -1422,7 +1422,7 @@ typedef struct generate_key_context {
int reps; int reps;
} }
generate_key_context; generate_key_context;
void *thread_generate_key(void *ctx) static void *thread_generate_key(void *ctx)
{ {
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT; mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT; psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT;

View File

@ -106,7 +106,7 @@
* The expected parity is even so that 0 is considered a valid encoding. * The expected parity is even so that 0 is considered a valid encoding.
* *
* Return a nonzero value if value has even parity and 0 otherwise. */ * Return a nonzero value if value has even parity and 0 otherwise. */
int has_even_parity(uint32_t value) static int has_even_parity(uint32_t value)
{ {
value ^= value >> 16; value ^= value >> 16;
value ^= value >> 8; value ^= value >> 8;
@ -116,7 +116,7 @@ int has_even_parity(uint32_t value)
#define TEST_PARITY(value) \ #define TEST_PARITY(value) \
TEST_ASSERT(has_even_parity(value)) TEST_ASSERT(has_even_parity(value))
void algorithm_classification(psa_algorithm_t alg, unsigned flags) static void algorithm_classification(psa_algorithm_t alg, unsigned flags)
{ {
unsigned classification_flags_tested = 0; unsigned classification_flags_tested = 0;
TEST_CLASSIFICATION_MACRO(1, ALG_IS_VENDOR_DEFINED, alg, flags); TEST_CLASSIFICATION_MACRO(1, ALG_IS_VENDOR_DEFINED, alg, flags);
@ -155,7 +155,7 @@ void algorithm_classification(psa_algorithm_t alg, unsigned flags)
exit:; exit:;
} }
void key_type_classification(psa_key_type_t type, unsigned flags) static void key_type_classification(psa_key_type_t type, unsigned flags)
{ {
unsigned classification_flags_tested = 0; unsigned classification_flags_tested = 0;
@ -192,7 +192,7 @@ void key_type_classification(psa_key_type_t type, unsigned flags)
exit:; exit:;
} }
void mac_algorithm_core(psa_algorithm_t alg, int classification_flags, static void mac_algorithm_core(psa_algorithm_t alg, int classification_flags,
psa_key_type_t key_type, size_t key_bits, psa_key_type_t key_type, size_t key_bits,
size_t length) size_t length)
{ {
@ -218,7 +218,7 @@ void mac_algorithm_core(psa_algorithm_t alg, int classification_flags,
exit:; exit:;
} }
void aead_algorithm_core(psa_algorithm_t alg, int classification_flags, static void aead_algorithm_core(psa_algorithm_t alg, int classification_flags,
psa_key_type_t key_type, size_t key_bits, psa_key_type_t key_type, size_t key_bits,
size_t tag_length) size_t tag_length)
{ {

View File

@ -599,7 +599,7 @@ exit:
* If this changes, the storage format version must change. * If this changes, the storage format version must change.
* See psa_get_se_driver_its_file_uid() in psa_crypto_se.c. * See psa_get_se_driver_its_file_uid() in psa_crypto_se.c.
*/ */
psa_storage_uid_t file_uid_for_location(psa_key_location_t location) static psa_storage_uid_t file_uid_for_location(psa_key_location_t location)
{ {
if (location > PSA_MAX_SE_LOCATION) { if (location > PSA_MAX_SE_LOCATION) {
return 0; return 0;

View File

@ -162,7 +162,7 @@ static psa_status_t mock_import(psa_drv_se_context_t *drv_context,
return mock_import_data.return_value; return mock_import_data.return_value;
} }
psa_status_t mock_export(psa_drv_se_context_t *context, static psa_status_t mock_export(psa_drv_se_context_t *context,
psa_key_slot_number_t slot_number, psa_key_slot_number_t slot_number,
uint8_t *p_data, uint8_t *p_data,
size_t data_size, size_t data_size,
@ -179,7 +179,7 @@ psa_status_t mock_export(psa_drv_se_context_t *context,
return mock_export_data.return_value; return mock_export_data.return_value;
} }
psa_status_t mock_export_public(psa_drv_se_context_t *context, static psa_status_t mock_export_public(psa_drv_se_context_t *context,
psa_key_slot_number_t slot_number, psa_key_slot_number_t slot_number,
uint8_t *p_data, uint8_t *p_data,
size_t data_size, size_t data_size,
@ -196,7 +196,7 @@ psa_status_t mock_export_public(psa_drv_se_context_t *context,
return mock_export_public_data.return_value; return mock_export_public_data.return_value;
} }
psa_status_t mock_sign(psa_drv_se_context_t *context, static psa_status_t mock_sign(psa_drv_se_context_t *context,
psa_key_slot_number_t key_slot, psa_key_slot_number_t key_slot,
psa_algorithm_t alg, psa_algorithm_t alg,
const uint8_t *p_hash, const uint8_t *p_hash,
@ -219,7 +219,7 @@ psa_status_t mock_sign(psa_drv_se_context_t *context,
return mock_sign_data.return_value; return mock_sign_data.return_value;
} }
psa_status_t mock_verify(psa_drv_se_context_t *context, static psa_status_t mock_verify(psa_drv_se_context_t *context,
psa_key_slot_number_t key_slot, psa_key_slot_number_t key_slot,
psa_algorithm_t alg, psa_algorithm_t alg,
const uint8_t *p_hash, const uint8_t *p_hash,
@ -240,7 +240,7 @@ psa_status_t mock_verify(psa_drv_se_context_t *context,
return mock_verify_data.return_value; return mock_verify_data.return_value;
} }
psa_status_t mock_allocate(psa_drv_se_context_t *drv_context, static psa_status_t mock_allocate(psa_drv_se_context_t *drv_context,
void *persistent_data, void *persistent_data,
const psa_key_attributes_t *attributes, const psa_key_attributes_t *attributes,
psa_key_creation_method_t method, psa_key_creation_method_t method,
@ -258,7 +258,7 @@ psa_status_t mock_allocate(psa_drv_se_context_t *drv_context,
return mock_allocate_data.return_value; return mock_allocate_data.return_value;
} }
psa_status_t mock_destroy(psa_drv_se_context_t *context, static psa_status_t mock_destroy(psa_drv_se_context_t *context,
void *persistent_data, void *persistent_data,
psa_key_slot_number_t slot_number) psa_key_slot_number_t slot_number)
{ {