blob: c4940c339a448e70205369699a1f84189ce45ed5 [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 Setti5beb2362024-06-24 13:13:17 +020026
27#define TEST_MODULE(main_func) \
28 do { \
29 char title[128] = { 0 }; \
30 char separator[128] = { 0 }; \
31 int title_len = snprintf(title, sizeof(title), "=== Test: %s ===", #main_func); \
32 memset(separator, '=', title_len); \
33 printf("%s\n%s\n%s\n", separator, title, separator); \
34 ret = main_func; \
35 if (ret != 0) { \
36 goto exit; \
37 } \
38 } while (0)
39
40int main()
41{
42 int ret;
43
44 TEST_MODULE(psa_hash_compute_main());
45 TEST_MODULE(psa_hash_main());
46
47 TEST_MODULE(psa_aead_main("aes128-gcm"));
48 TEST_MODULE(psa_aead_main("aes256-gcm"));
49 TEST_MODULE(psa_aead_main("aes128-gcm_8"));
50 TEST_MODULE(psa_aead_main("chachapoly"));
51
Valerio Setti25afdc12024-06-24 13:44:12 +020052 TEST_MODULE(psa_random_main());
53
Valerio Setti5beb2362024-06-24 13:13:17 +020054exit:
55 return (ret != 0) ? 1 : 0;
56}