mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-29 12:32:48 +00:00
tests: ssl_helpers: Rename rng_get to mbedtls_test_random
mbedtls_test_ as the prefix for test APIs _random like in mbedtls_ctr/hmac_drbg_random Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
aad9449146
commit
10b040fa6f
@ -193,7 +193,12 @@ typedef struct mbedtls_test_ssl_endpoint {
|
||||
|
||||
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
|
||||
|
||||
int rng_get(void *p_rng, unsigned char *output, size_t output_len);
|
||||
/*
|
||||
* Random number generator aimed for TLS unitary tests. Its main purpose is to
|
||||
* simplify the set-up of a random number generator for TLS
|
||||
* unitary tests: no need to set up a good entropy source for example.
|
||||
*/
|
||||
int mbedtls_test_random(void *p_rng, unsigned char *output, size_t output_len);
|
||||
|
||||
/*
|
||||
* This function can be passed to mbedtls to receive output logs from it. In
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "md_psa.h"
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
int rng_get(void *p_rng, unsigned char *output, size_t output_len)
|
||||
int mbedtls_test_random(void *p_rng, unsigned char *output, size_t output_len)
|
||||
{
|
||||
(void) p_rng;
|
||||
for (size_t i = 0; i < output_len; i++) {
|
||||
@ -754,7 +754,7 @@ int mbedtls_test_ssl_endpoint_init(
|
||||
|
||||
mbedtls_ssl_init(&(ep->ssl));
|
||||
mbedtls_ssl_config_init(&(ep->conf));
|
||||
mbedtls_ssl_conf_rng(&(ep->conf), rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&(ep->conf), mbedtls_test_random, NULL);
|
||||
|
||||
TEST_ASSERT(mbedtls_ssl_conf_get_user_data_p(&ep->conf) == NULL);
|
||||
TEST_EQUAL(mbedtls_ssl_conf_get_user_data_n(&ep->conf), 0);
|
||||
|
@ -66,7 +66,7 @@ void debug_print_msg_threshold(int threshold, int level, char *file,
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||
MBEDTLS_SSL_IS_CLIENT,
|
||||
@ -107,7 +107,7 @@ void mbedtls_debug_print_ret(char *file, int line, char *text, int value,
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||
MBEDTLS_SSL_IS_CLIENT,
|
||||
@ -145,7 +145,7 @@ void mbedtls_debug_print_buf(char *file, int line, char *text,
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||
MBEDTLS_SSL_IS_CLIENT,
|
||||
@ -185,7 +185,7 @@ void mbedtls_debug_print_crt(char *crt_file, char *file, int line,
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||
MBEDTLS_SSL_IS_CLIENT,
|
||||
@ -227,7 +227,7 @@ void mbedtls_debug_print_mpi(char *value, char *file, int line,
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||
MBEDTLS_SSL_IS_CLIENT,
|
||||
|
@ -1121,7 +1121,7 @@ void ssl_dtls_replay(data_t *prevs, data_t *new, int ret)
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_ASSERT(mbedtls_ssl_config_defaults(&conf,
|
||||
MBEDTLS_SSL_IS_CLIENT,
|
||||
@ -2894,7 +2894,7 @@ void conf_version(int endpoint, int transport,
|
||||
mbedtls_ssl_conf_transport(&conf, transport);
|
||||
mbedtls_ssl_conf_min_tls_version(&conf, min_tls_version);
|
||||
mbedtls_ssl_conf_max_tls_version(&conf, max_tls_version);
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == expected_ssl_setup_result);
|
||||
TEST_EQUAL(mbedtls_ssl_conf_get_endpoint(
|
||||
@ -2936,7 +2936,7 @@ void conf_curve()
|
||||
mbedtls_ssl_init(&ssl);
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
||||
|
||||
@ -2969,7 +2969,7 @@ void conf_group()
|
||||
mbedtls_ssl_config conf;
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
mbedtls_ssl_conf_max_tls_version(&conf, MBEDTLS_SSL_VERSION_TLS1_2);
|
||||
mbedtls_ssl_conf_min_tls_version(&conf, MBEDTLS_SSL_VERSION_TLS1_2);
|
||||
|
||||
@ -3075,7 +3075,7 @@ void cookie_parsing(data_t *cookie, int exp_ret)
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
USE_PSA_INIT();
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf, MBEDTLS_SSL_IS_SERVER,
|
||||
MBEDTLS_SSL_TRANSPORT_DATAGRAM,
|
||||
@ -3130,7 +3130,7 @@ void cid_sanity()
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_ASSERT(mbedtls_ssl_config_defaults(&conf,
|
||||
MBEDTLS_SSL_IS_CLIENT,
|
||||
@ -3390,7 +3390,7 @@ void ssl_ecjpake_set_password(int use_opaque_arg)
|
||||
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
|
||||
mbedtls_ssl_conf_rng(&conf, rng_get, NULL);
|
||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||
|
||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||
MBEDTLS_SSL_IS_CLIENT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user