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