Add test for TLS-Exporter in TLS 1.3

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
This commit is contained in:
Max Fillinger
2024-08-09 19:46:15 +02:00
parent 29f79ea7f4
commit d3d7ff4c6b
2 changed files with 36 additions and 0 deletions

View File

@@ -1964,6 +1964,37 @@ exit:
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3 */
void ssl_tls13_exporter(int hash_alg,
data_t *secret,
char *label,
char *context_value,
int desired_length,
data_t *expected)
{
unsigned char dst[100];
/* Check sanity of test parameters. */
TEST_ASSERT((size_t) desired_length <= sizeof(dst));
TEST_ASSERT((size_t) desired_length == expected->len);
PSA_INIT();
TEST_ASSERT(mbedtls_ssl_tls13_exporter(
(psa_algorithm_t) hash_alg,
secret->x, secret->len,
(unsigned char *)label, strlen(label),
(unsigned char *)context_value, strlen(context_value),
dst, desired_length) == 0);
TEST_MEMORY_COMPARE(dst, desired_length,
expected->x, desired_length);
exit:
PSA_DONE();
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3 */
void ssl_tls13_derive_early_secrets(int hash_alg,
data_t *secret,