blob: 3eee631619687cf91332f58b61b45eafd69372c7 [file] [log] [blame]
Valerio Setti5beb2362024-06-24 13:13:17 +02001/**
2 * This is the base AUT that exectues all other AUTs meant to test PSA APIs
3 * through PSASIM.
4 */
5
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9 */
10
11/* First include Mbed TLS headers to get the Mbed TLS configuration and
12 * platform definitions that we'll use in this program. Also include
13 * standard C headers for functions we'll use here. */
14#include "mbedtls/build_info.h"
15
16#include "psa/crypto.h"
17
18#include <stdlib.h>
19#include <stdio.h>
20#include <string.h>
21
22int psa_hash_compute_main(void);
23int psa_hash_main(void);
24int psa_aead_main(char *cipher_name);
Valerio Setti25afdc12024-06-24 13:44:12 +020025int psa_random_main(void);
Valerio Settif79e17a2024-06-24 13:57:49 +020026int psa_mac_main(void);
Valerio Setti6d6fe8b2024-06-24 14:46:08 +020027int psa_key_agreement_main(void);
Valerio Settibb1502b2024-06-24 14:50:54 +020028int psa_sign_verify_main(void);
Valerio Setti5beb2362024-06-24 13:13:17 +020029
30#define TEST_MODULE(main_func) \
31 do { \
32 char title[128] = { 0 }; \
33 char separator[128] = { 0 }; \
34 int title_len = snprintf(title, sizeof(title), "=== Test: %s ===", #main_func); \
35 memset(separator, '=', title_len); \
36 printf("%s\n%s\n%s\n", separator, title, separator); \
37 ret = main_func; \
38 if (ret != 0) { \
39 goto exit; \
40 } \
41 } while (0)
42
43int main()
44{
45 int ret;
46
47 TEST_MODULE(psa_hash_compute_main());
48 TEST_MODULE(psa_hash_main());
49
50 TEST_MODULE(psa_aead_main("aes128-gcm"));
51 TEST_MODULE(psa_aead_main("aes256-gcm"));
52 TEST_MODULE(psa_aead_main("aes128-gcm_8"));
53 TEST_MODULE(psa_aead_main("chachapoly"));
54
Valerio Setti25afdc12024-06-24 13:44:12 +020055 TEST_MODULE(psa_random_main());
56
Valerio Settif79e17a2024-06-24 13:57:49 +020057 TEST_MODULE(psa_mac_main());
Valerio Setti6d6fe8b2024-06-24 14:46:08 +020058 TEST_MODULE(psa_key_agreement_main());
Valerio Settibb1502b2024-06-24 14:50:54 +020059 TEST_MODULE(psa_sign_verify_main());
Valerio Settif79e17a2024-06-24 13:57:49 +020060
Valerio Setti5beb2362024-06-24 13:13:17 +020061exit:
62 return (ret != 0) ? 1 : 0;
63}