6 #include "sw/device/lib/base/status.h"
7 #include "sw/device/lib/crypto/drivers/entropy.h"
8 #include "sw/device/lib/testing/test_framework/check.h"
10 #include "sw/device/lib/testing/test_framework/ujson_ottf.h"
11 #include "sw/device/lib/ujson/ujson.h"
14 #include "sw/device/tests/penetrationtests/json/commands.h"
15 #include "sw/device/tests/penetrationtests/json/crypto_fi_commands.h"
16 #include "sw/device/tests/penetrationtests/json/ibex_fi_commands.h"
17 #include "sw/device/tests/penetrationtests/json/lc_ctrl_fi_commands.h"
18 #include "sw/device/tests/penetrationtests/json/otp_fi_commands.h"
19 #include "sw/device/tests/penetrationtests/json/pentest_lib_commands.h"
20 #include "sw/device/tests/penetrationtests/json/rng_fi_commands.h"
21 #include "sw/device/tests/penetrationtests/json/rom_fi_commands.h"
24 #include "fi/crypto_fi.h"
25 #include "fi/ibex_fi.h"
26 #include "fi/lc_ctrl_fi.h"
27 #include "fi/otp_fi.h"
28 #include "fi/rng_fi.h"
29 #include "fi/rom_fi.h"
30 #include "lib/extclk_sca_fi.h"
31 #include "lib/pentest_lib.h"
33 OTTF_DEFINE_TEST_CONFIG(.enable_uart_flow_control =
true);
37 penetrationtest_cmd_t cmd;
38 TRY(ujson_deserialize_penetrationtest_cmd_t(uj, &cmd));
40 case kPenetrationtestCommandAlertInfo:
41 RESP_ERR(uj, pentest_read_rstmgr_alert_info(uj));
43 case kPenetrationtestCommandCryptoFi:
44 RESP_ERR(uj, handle_crypto_fi(uj));
46 case kPenetrationtestCommandExtClkScaFi:
47 RESP_ERR(uj, handle_extclk_sca_fi(uj));
49 case kPenetrationtestCommandIbexFi:
50 RESP_ERR(uj, handle_ibex_fi(uj));
52 case kPenetrationtestCommandLCCtrlFi:
53 RESP_ERR(uj, handle_lc_ctrl_fi(uj));
55 case kPenetrationtestCommandOtpFi:
56 RESP_ERR(uj, handle_otp_fi(uj));
58 case kPenetrationtestCommandRngFi:
59 RESP_ERR(uj, handle_rng_fi(uj));
61 case kPenetrationtestCommandRomFi:
62 RESP_ERR(uj, handle_rom_fi(uj));
65 LOG_ERROR(
"Unrecognized command: %d", cmd);
66 RESP_ERR(uj, INVALID_ARGUMENT());
74 CHECK_STATUS_OK(entropy_complex_init());
75 ujson_t uj = ujson_ottf_console();
76 return status_ok(process_cmd(&uj));