1a8e1175bSopenharmony_ci/*
2a8e1175bSopenharmony_ci *  Common code for SSL test programs
3a8e1175bSopenharmony_ci *
4a8e1175bSopenharmony_ci *  Copyright The Mbed TLS Contributors
5a8e1175bSopenharmony_ci *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
6a8e1175bSopenharmony_ci */
7a8e1175bSopenharmony_ci
8a8e1175bSopenharmony_ci#ifndef MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H
9a8e1175bSopenharmony_ci#define MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H
10a8e1175bSopenharmony_ci
11a8e1175bSopenharmony_ci#include "mbedtls/build_info.h"
12a8e1175bSopenharmony_ci
13a8e1175bSopenharmony_ci#include "mbedtls/platform.h"
14a8e1175bSopenharmony_ci#include "mbedtls/md.h"
15a8e1175bSopenharmony_ci
16a8e1175bSopenharmony_ci#undef HAVE_RNG
17a8e1175bSopenharmony_ci#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) &&         \
18a8e1175bSopenharmony_ci    (defined(MBEDTLS_USE_PSA_CRYPTO) ||                \
19a8e1175bSopenharmony_ci    defined(MBEDTLS_TEST_USE_PSA_CRYPTO_RNG))
20a8e1175bSopenharmony_ci#define HAVE_RNG
21a8e1175bSopenharmony_ci#elif defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C)
22a8e1175bSopenharmony_ci#define HAVE_RNG
23a8e1175bSopenharmony_ci#elif defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_HMAC_DRBG_C) &&     \
24a8e1175bSopenharmony_ci    (defined(MBEDTLS_MD_CAN_SHA256) || defined(MBEDTLS_MD_CAN_SHA512))
25a8e1175bSopenharmony_ci#define HAVE_RNG
26a8e1175bSopenharmony_ci#endif
27a8e1175bSopenharmony_ci
28a8e1175bSopenharmony_ci#if !defined(MBEDTLS_NET_C) ||                              \
29a8e1175bSopenharmony_ci    !defined(MBEDTLS_SSL_TLS_C)
30a8e1175bSopenharmony_ci#define MBEDTLS_SSL_TEST_IMPOSSIBLE                         \
31a8e1175bSopenharmony_ci    "MBEDTLS_NET_C and/or "                                 \
32a8e1175bSopenharmony_ci    "MBEDTLS_SSL_TLS_C not defined."
33a8e1175bSopenharmony_ci#elif !defined(HAVE_RNG)
34a8e1175bSopenharmony_ci#define MBEDTLS_SSL_TEST_IMPOSSIBLE                         \
35a8e1175bSopenharmony_ci    "No random generator is available.\n"
36a8e1175bSopenharmony_ci#else
37a8e1175bSopenharmony_ci#undef MBEDTLS_SSL_TEST_IMPOSSIBLE
38a8e1175bSopenharmony_ci
39a8e1175bSopenharmony_ci#undef HAVE_RNG
40a8e1175bSopenharmony_ci
41a8e1175bSopenharmony_ci#include <stdio.h>
42a8e1175bSopenharmony_ci#include <stdlib.h>
43a8e1175bSopenharmony_ci#include <string.h>
44a8e1175bSopenharmony_ci
45a8e1175bSopenharmony_ci#include "mbedtls/net_sockets.h"
46a8e1175bSopenharmony_ci#include "mbedtls/ssl.h"
47a8e1175bSopenharmony_ci#include "mbedtls/ssl_ciphersuites.h"
48a8e1175bSopenharmony_ci#include "mbedtls/entropy.h"
49a8e1175bSopenharmony_ci#include "mbedtls/ctr_drbg.h"
50a8e1175bSopenharmony_ci#include "mbedtls/hmac_drbg.h"
51a8e1175bSopenharmony_ci#include "mbedtls/x509.h"
52a8e1175bSopenharmony_ci#include "mbedtls/error.h"
53a8e1175bSopenharmony_ci#include "mbedtls/debug.h"
54a8e1175bSopenharmony_ci#include "mbedtls/timing.h"
55a8e1175bSopenharmony_ci#include "mbedtls/base64.h"
56a8e1175bSopenharmony_ci#include "test/certs.h"
57a8e1175bSopenharmony_ci
58a8e1175bSopenharmony_ci#if defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_TEST_USE_PSA_CRYPTO_RNG)
59a8e1175bSopenharmony_ci#include "psa/crypto.h"
60a8e1175bSopenharmony_ci#include "mbedtls/psa_util.h"
61a8e1175bSopenharmony_ci#endif
62a8e1175bSopenharmony_ci
63a8e1175bSopenharmony_ci#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
64a8e1175bSopenharmony_ci#include "mbedtls/memory_buffer_alloc.h"
65a8e1175bSopenharmony_ci#endif
66a8e1175bSopenharmony_ci
67a8e1175bSopenharmony_ci#include <test/helpers.h>
68a8e1175bSopenharmony_ci
69a8e1175bSopenharmony_ci#include "../test/query_config.h"
70a8e1175bSopenharmony_ci
71a8e1175bSopenharmony_ci#define ALPN_LIST_SIZE    10
72a8e1175bSopenharmony_ci#define GROUP_LIST_SIZE   25
73a8e1175bSopenharmony_ci#define SIG_ALG_LIST_SIZE  5
74a8e1175bSopenharmony_ci
75a8e1175bSopenharmony_citypedef struct eap_tls_keys {
76a8e1175bSopenharmony_ci    unsigned char master_secret[48];
77a8e1175bSopenharmony_ci    unsigned char randbytes[64];
78a8e1175bSopenharmony_ci    mbedtls_tls_prf_types tls_prf_type;
79a8e1175bSopenharmony_ci} eap_tls_keys;
80a8e1175bSopenharmony_ci
81a8e1175bSopenharmony_ci#if defined(MBEDTLS_SSL_DTLS_SRTP)
82a8e1175bSopenharmony_ci
83a8e1175bSopenharmony_ci/* Supported SRTP mode needs a maximum of :
84a8e1175bSopenharmony_ci * - 16 bytes for key (AES-128)
85a8e1175bSopenharmony_ci * - 14 bytes SALT
86a8e1175bSopenharmony_ci * One for sender, one for receiver context
87a8e1175bSopenharmony_ci */
88a8e1175bSopenharmony_ci#define MBEDTLS_TLS_SRTP_MAX_KEY_MATERIAL_LENGTH    60
89a8e1175bSopenharmony_ci
90a8e1175bSopenharmony_citypedef struct dtls_srtp_keys {
91a8e1175bSopenharmony_ci    unsigned char master_secret[48];
92a8e1175bSopenharmony_ci    unsigned char randbytes[64];
93a8e1175bSopenharmony_ci    mbedtls_tls_prf_types tls_prf_type;
94a8e1175bSopenharmony_ci} dtls_srtp_keys;
95a8e1175bSopenharmony_ci
96a8e1175bSopenharmony_ci#endif /* MBEDTLS_SSL_DTLS_SRTP */
97a8e1175bSopenharmony_ci
98a8e1175bSopenharmony_citypedef struct {
99a8e1175bSopenharmony_ci    mbedtls_ssl_context *ssl;
100a8e1175bSopenharmony_ci    mbedtls_net_context *net;
101a8e1175bSopenharmony_ci} io_ctx_t;
102a8e1175bSopenharmony_ci
103a8e1175bSopenharmony_civoid my_debug(void *ctx, int level,
104a8e1175bSopenharmony_ci              const char *file, int line,
105a8e1175bSopenharmony_ci              const char *str);
106a8e1175bSopenharmony_ci
107a8e1175bSopenharmony_ci#if defined(MBEDTLS_HAVE_TIME)
108a8e1175bSopenharmony_cimbedtls_time_t dummy_constant_time(mbedtls_time_t *time);
109a8e1175bSopenharmony_ci#endif
110a8e1175bSopenharmony_ci
111a8e1175bSopenharmony_ci#if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_TEST_USE_PSA_CRYPTO_RNG)
112a8e1175bSopenharmony_ci/* If MBEDTLS_TEST_USE_PSA_CRYPTO_RNG is defined, the SSL test programs will use
113a8e1175bSopenharmony_ci * mbedtls_psa_get_random() rather than entropy+DRBG as a random generator.
114a8e1175bSopenharmony_ci *
115a8e1175bSopenharmony_ci * The constraints are:
116a8e1175bSopenharmony_ci * - Without the entropy module, the PSA RNG is the only option.
117a8e1175bSopenharmony_ci * - Without at least one of the DRBG modules, the PSA RNG is the only option.
118a8e1175bSopenharmony_ci * - The PSA RNG does not support explicit seeding, so it is incompatible with
119a8e1175bSopenharmony_ci *   the reproducible mode used by test programs.
120a8e1175bSopenharmony_ci * - For good overall test coverage, there should be at least one configuration
121a8e1175bSopenharmony_ci *   where the test programs use the PSA RNG while the PSA RNG is itself based
122a8e1175bSopenharmony_ci *   on entropy+DRBG, and at least one configuration where the test programs
123a8e1175bSopenharmony_ci *   do not use the PSA RNG even though it's there.
124a8e1175bSopenharmony_ci *
125a8e1175bSopenharmony_ci * A simple choice that meets the constraints is to use the PSA RNG whenever
126a8e1175bSopenharmony_ci * MBEDTLS_USE_PSA_CRYPTO is enabled. There's no real technical reason the
127a8e1175bSopenharmony_ci * choice to use the PSA RNG in the test programs and the choice to use
128a8e1175bSopenharmony_ci * PSA crypto when TLS code needs crypto have to be tied together, but it
129a8e1175bSopenharmony_ci * happens to be a good match. It's also a good match from an application
130a8e1175bSopenharmony_ci * perspective: either PSA is preferred for TLS (both for crypto and for
131a8e1175bSopenharmony_ci * random generation) or it isn't.
132a8e1175bSopenharmony_ci */
133a8e1175bSopenharmony_ci#define MBEDTLS_TEST_USE_PSA_CRYPTO_RNG
134a8e1175bSopenharmony_ci#endif
135a8e1175bSopenharmony_ci
136a8e1175bSopenharmony_ci/** A context for random number generation (RNG).
137a8e1175bSopenharmony_ci */
138a8e1175bSopenharmony_citypedef struct {
139a8e1175bSopenharmony_ci#if defined(MBEDTLS_TEST_USE_PSA_CRYPTO_RNG)
140a8e1175bSopenharmony_ci    unsigned char dummy;
141a8e1175bSopenharmony_ci#else /* MBEDTLS_TEST_USE_PSA_CRYPTO_RNG */
142a8e1175bSopenharmony_ci    mbedtls_entropy_context entropy;
143a8e1175bSopenharmony_ci#if defined(MBEDTLS_CTR_DRBG_C)
144a8e1175bSopenharmony_ci    mbedtls_ctr_drbg_context drbg;
145a8e1175bSopenharmony_ci#elif defined(MBEDTLS_HMAC_DRBG_C)
146a8e1175bSopenharmony_ci    mbedtls_hmac_drbg_context drbg;
147a8e1175bSopenharmony_ci#else
148a8e1175bSopenharmony_ci#error "No DRBG available"
149a8e1175bSopenharmony_ci#endif
150a8e1175bSopenharmony_ci#endif /* MBEDTLS_TEST_USE_PSA_CRYPTO_RNG */
151a8e1175bSopenharmony_ci} rng_context_t;
152a8e1175bSopenharmony_ci
153a8e1175bSopenharmony_ci/** Initialize the RNG.
154a8e1175bSopenharmony_ci *
155a8e1175bSopenharmony_ci * This function only initializes the memory used by the RNG context.
156a8e1175bSopenharmony_ci * Before using the RNG, it must be seeded with rng_seed().
157a8e1175bSopenharmony_ci */
158a8e1175bSopenharmony_civoid rng_init(rng_context_t *rng);
159a8e1175bSopenharmony_ci
160a8e1175bSopenharmony_ci/* Seed the random number generator.
161a8e1175bSopenharmony_ci *
162a8e1175bSopenharmony_ci * \param rng           The RNG context to use. It must have been initialized
163a8e1175bSopenharmony_ci *                      with rng_init().
164a8e1175bSopenharmony_ci * \param reproducible  If zero, seed the RNG from entropy.
165a8e1175bSopenharmony_ci *                      If nonzero, use a fixed seed, so that the program
166a8e1175bSopenharmony_ci *                      will produce the same sequence of random numbers
167a8e1175bSopenharmony_ci *                      each time it is invoked.
168a8e1175bSopenharmony_ci * \param pers          A null-terminated string. Different values for this
169a8e1175bSopenharmony_ci *                      string cause the RNG to emit different output for
170a8e1175bSopenharmony_ci *                      the same seed.
171a8e1175bSopenharmony_ci *
172a8e1175bSopenharmony_ci * return 0 on success, a negative value on error.
173a8e1175bSopenharmony_ci */
174a8e1175bSopenharmony_ciint rng_seed(rng_context_t *rng, int reproducible, const char *pers);
175a8e1175bSopenharmony_ci
176a8e1175bSopenharmony_ci/** Deinitialize the RNG. Free any embedded resource.
177a8e1175bSopenharmony_ci *
178a8e1175bSopenharmony_ci * \param rng           The RNG context to deinitialize. It must have been
179a8e1175bSopenharmony_ci *                      initialized with rng_init().
180a8e1175bSopenharmony_ci */
181a8e1175bSopenharmony_civoid rng_free(rng_context_t *rng);
182a8e1175bSopenharmony_ci
183a8e1175bSopenharmony_ci/** Generate random data.
184a8e1175bSopenharmony_ci *
185a8e1175bSopenharmony_ci * This function is suitable for use as the \c f_rng argument to Mbed TLS
186a8e1175bSopenharmony_ci * library functions.
187a8e1175bSopenharmony_ci *
188a8e1175bSopenharmony_ci * \param p_rng         The random generator context. This must be a pointer to
189a8e1175bSopenharmony_ci *                      a #rng_context_t structure.
190a8e1175bSopenharmony_ci * \param output        The buffer to fill.
191a8e1175bSopenharmony_ci * \param output_len    The length of the buffer in bytes.
192a8e1175bSopenharmony_ci *
193a8e1175bSopenharmony_ci * \return              \c 0 on success.
194a8e1175bSopenharmony_ci * \return              An Mbed TLS error code on error.
195a8e1175bSopenharmony_ci */
196a8e1175bSopenharmony_ciint rng_get(void *p_rng, unsigned char *output, size_t output_len);
197a8e1175bSopenharmony_ci
198a8e1175bSopenharmony_ci/** Parse command-line option: key_opaque_algs
199a8e1175bSopenharmony_ci *
200a8e1175bSopenharmony_ci *
201a8e1175bSopenharmony_ci * \param arg           String value of key_opaque_algs
202a8e1175bSopenharmony_ci *                      Coma-separated pair of values among the following:
203a8e1175bSopenharmony_ci *                      - "rsa-sign-pkcs1"
204a8e1175bSopenharmony_ci *                      - "rsa-sign-pss"
205a8e1175bSopenharmony_ci *                      - "rsa-decrypt"
206a8e1175bSopenharmony_ci *                      - "ecdsa-sign"
207a8e1175bSopenharmony_ci *                      - "ecdh"
208a8e1175bSopenharmony_ci *                      - "none" (only acceptable for the second value).
209a8e1175bSopenharmony_ci * \param alg1          Address of pointer to alg #1
210a8e1175bSopenharmony_ci * \param alg2          Address of pointer to alg #2
211a8e1175bSopenharmony_ci *
212a8e1175bSopenharmony_ci * \return              \c 0 on success.
213a8e1175bSopenharmony_ci * \return              \c 1 on parse failure.
214a8e1175bSopenharmony_ci */
215a8e1175bSopenharmony_ciint key_opaque_alg_parse(const char *arg, const char **alg1, const char **alg2);
216a8e1175bSopenharmony_ci
217a8e1175bSopenharmony_ci#if defined(MBEDTLS_USE_PSA_CRYPTO)
218a8e1175bSopenharmony_ci/** Parse given opaque key algorithms to obtain psa algs and usage
219a8e1175bSopenharmony_ci *  that will be passed to mbedtls_pk_wrap_as_opaque().
220a8e1175bSopenharmony_ci *
221a8e1175bSopenharmony_ci *
222a8e1175bSopenharmony_ci * \param alg1          input string opaque key algorithm #1
223a8e1175bSopenharmony_ci * \param alg2          input string opaque key algorithm #2
224a8e1175bSopenharmony_ci * \param psa_alg1      output PSA algorithm #1
225a8e1175bSopenharmony_ci * \param psa_alg2      output PSA algorithm #2
226a8e1175bSopenharmony_ci * \param usage         output key usage
227a8e1175bSopenharmony_ci * \param key_type      key type used to set default psa algorithm/usage
228a8e1175bSopenharmony_ci *                      when alg1 in "none"
229a8e1175bSopenharmony_ci *
230a8e1175bSopenharmony_ci * \return              \c 0 on success.
231a8e1175bSopenharmony_ci * \return              \c 1 on parse failure.
232a8e1175bSopenharmony_ci */
233a8e1175bSopenharmony_ciint key_opaque_set_alg_usage(const char *alg1, const char *alg2,
234a8e1175bSopenharmony_ci                             psa_algorithm_t *psa_alg1,
235a8e1175bSopenharmony_ci                             psa_algorithm_t *psa_alg2,
236a8e1175bSopenharmony_ci                             psa_key_usage_t *usage,
237a8e1175bSopenharmony_ci                             mbedtls_pk_type_t key_type);
238a8e1175bSopenharmony_ci
239a8e1175bSopenharmony_ci#if defined(MBEDTLS_PK_C)
240a8e1175bSopenharmony_ci/** Turn a non-opaque PK context into an opaque one with folowing steps:
241a8e1175bSopenharmony_ci * - extract the key data and attributes from the PK context.
242a8e1175bSopenharmony_ci * - import the key material into PSA.
243a8e1175bSopenharmony_ci * - free the provided PK context and re-initilize it as an opaque PK context
244a8e1175bSopenharmony_ci *   wrapping the PSA key imported in the above step.
245a8e1175bSopenharmony_ci *
246a8e1175bSopenharmony_ci * \param[in/out] pk    On input the non-opaque PK context which contains the
247a8e1175bSopenharmony_ci *                      key to be wrapped. On output the re-initialized PK
248a8e1175bSopenharmony_ci *                      context which represents the opaque version of the one
249a8e1175bSopenharmony_ci *                      provided as input.
250a8e1175bSopenharmony_ci * \param[in] psa_alg   The primary algorithm that will be associated to the
251a8e1175bSopenharmony_ci *                      PSA key.
252a8e1175bSopenharmony_ci * \param[in] psa_alg2  The enrollment algorithm that will be associated to the
253a8e1175bSopenharmony_ci *                      PSA key.
254a8e1175bSopenharmony_ci * \param[in] psa_usage The PSA key usage policy.
255a8e1175bSopenharmony_ci * \param[out] key_id   The PSA key identifier of the imported key.
256a8e1175bSopenharmony_ci *
257a8e1175bSopenharmony_ci * \return              \c 0 on sucess.
258a8e1175bSopenharmony_ci * \return              \c -1 on failure.
259a8e1175bSopenharmony_ci */
260a8e1175bSopenharmony_ciint pk_wrap_as_opaque(mbedtls_pk_context *pk, psa_algorithm_t psa_alg, psa_algorithm_t psa_alg2,
261a8e1175bSopenharmony_ci                      psa_key_usage_t psa_usage, mbedtls_svc_key_id_t *key_id);
262a8e1175bSopenharmony_ci#endif /* MBEDTLS_PK_C */
263a8e1175bSopenharmony_ci#endif /* MBEDTLS_USE_PSA_CRYPTO */
264a8e1175bSopenharmony_ci
265a8e1175bSopenharmony_ci#if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
266a8e1175bSopenharmony_ci/* The test implementation of the PSA external RNG is insecure. When
267a8e1175bSopenharmony_ci * MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled, before using any PSA crypto
268a8e1175bSopenharmony_ci * function that makes use of an RNG, you must call
269a8e1175bSopenharmony_ci * mbedtls_test_enable_insecure_external_rng(). */
270a8e1175bSopenharmony_ci#include <test/fake_external_rng_for_test.h>
271a8e1175bSopenharmony_ci#endif
272a8e1175bSopenharmony_ci
273a8e1175bSopenharmony_ci#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
274a8e1175bSopenharmony_ciint ca_callback(void *data, mbedtls_x509_crt const *child,
275a8e1175bSopenharmony_ci                mbedtls_x509_crt **candidates);
276a8e1175bSopenharmony_ci#endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
277a8e1175bSopenharmony_ci
278a8e1175bSopenharmony_ci/*
279a8e1175bSopenharmony_ci * Test recv/send functions that make sure each try returns
280a8e1175bSopenharmony_ci * WANT_READ/WANT_WRITE at least once before succeeding
281a8e1175bSopenharmony_ci */
282a8e1175bSopenharmony_ciint delayed_recv(void *ctx, unsigned char *buf, size_t len);
283a8e1175bSopenharmony_ciint delayed_send(void *ctx, const unsigned char *buf, size_t len);
284a8e1175bSopenharmony_ci
285a8e1175bSopenharmony_ci/*
286a8e1175bSopenharmony_ci * Wait for an event from the underlying transport or the timer
287a8e1175bSopenharmony_ci * (Used in event-driven IO mode).
288a8e1175bSopenharmony_ci */
289a8e1175bSopenharmony_ciint idle(mbedtls_net_context *fd,
290a8e1175bSopenharmony_ci#if defined(MBEDTLS_TIMING_C)
291a8e1175bSopenharmony_ci         mbedtls_timing_delay_context *timer,
292a8e1175bSopenharmony_ci#endif
293a8e1175bSopenharmony_ci         int idle_reason);
294a8e1175bSopenharmony_ci
295a8e1175bSopenharmony_ci#if defined(MBEDTLS_TEST_HOOKS)
296a8e1175bSopenharmony_ci/** Initialize whatever test hooks are enabled by the compile-time
297a8e1175bSopenharmony_ci * configuration and make sense for the TLS test programs. */
298a8e1175bSopenharmony_civoid test_hooks_init(void);
299a8e1175bSopenharmony_ci
300a8e1175bSopenharmony_ci/** Check if any test hooks detected a problem.
301a8e1175bSopenharmony_ci *
302a8e1175bSopenharmony_ci * If a problem was detected, it's ok for the calling program to keep going,
303a8e1175bSopenharmony_ci * but it should ultimately exit with an error status.
304a8e1175bSopenharmony_ci *
305a8e1175bSopenharmony_ci * \note When implementing a test hook that detects errors on its own
306a8e1175bSopenharmony_ci *       (as opposed to e.g. leaving the error for a memory sanitizer to
307a8e1175bSopenharmony_ci *       report), make sure to print a message to standard error either at
308a8e1175bSopenharmony_ci *       the time the problem is detected or during the execution of this
309a8e1175bSopenharmony_ci *       function. This function does not indicate what problem was detected,
310a8e1175bSopenharmony_ci *       so printing a message is the only way to provide feedback in the
311a8e1175bSopenharmony_ci *       logs of the calling program.
312a8e1175bSopenharmony_ci *
313a8e1175bSopenharmony_ci * \return Nonzero if a problem was detected.
314a8e1175bSopenharmony_ci *         \c 0 if no problem was detected.
315a8e1175bSopenharmony_ci */
316a8e1175bSopenharmony_ciint test_hooks_failure_detected(void);
317a8e1175bSopenharmony_ci
318a8e1175bSopenharmony_ci/** Free any resources allocated for the sake of test hooks.
319a8e1175bSopenharmony_ci *
320a8e1175bSopenharmony_ci * Call this at the end of the program so that resource leak analyzers
321a8e1175bSopenharmony_ci * don't complain.
322a8e1175bSopenharmony_ci */
323a8e1175bSopenharmony_civoid test_hooks_free(void);
324a8e1175bSopenharmony_ci
325a8e1175bSopenharmony_ci#endif /* !MBEDTLS_TEST_HOOKS */
326a8e1175bSopenharmony_ci
327a8e1175bSopenharmony_ci/* Helper functions for FFDH groups. */
328a8e1175bSopenharmony_ciint parse_groups(const char *groups, uint16_t *group_list, size_t group_list_len);
329a8e1175bSopenharmony_ci
330a8e1175bSopenharmony_ci#endif /* MBEDTLS_SSL_TEST_IMPOSSIBLE conditions: else */
331a8e1175bSopenharmony_ci#endif /* MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H */
332