From 5420b04f84d99e15aaf5371c4c50e6e95dd045b9 Mon Sep 17 00:00:00 2001 From: Eero Nurkkala Date: Mon, 13 Nov 2023 13:08:49 +0200 Subject: [PATCH] risc-v/mpfs: tamper: refine tests Use only tests that will trigger a tamper event. Leave other tests outside. Signed-off-by: Eero Nurkkala --- arch/risc-v/src/mpfs/mpfs_tamper.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/arch/risc-v/src/mpfs/mpfs_tamper.c b/arch/risc-v/src/mpfs/mpfs_tamper.c index 4729854ac0283..0a268a722f2f5 100644 --- a/arch/risc-v/src/mpfs/mpfs_tamper.c +++ b/arch/risc-v/src/mpfs/mpfs_tamper.c @@ -277,33 +277,27 @@ static int mpfs_tamper_interrupt(int irq, void *context, void *arg) ****************************************************************************/ #ifdef TAMPER_TESTS -extern int mpfs_systemservice_init(); -extern int mpfs_sys_get_serial_number(uint8_t *out_sn, uint16_t mb_offset); -extern int mpfs_sys_query_security(uint8_t *out_security_resp, - uint16_t mb_offset); -extern int mpfs_sys_query_design_information(uint8_t *out_security_resp, - uint16_t mb_offset); -extern int mpfs_sys_query_device_certificate(uint8_t *out_security_resp, - uint16_t mb_offset); extern uint16_t mpfs_sys_unlock_debug_passcode(uint8_t *cmd_data, uint16_t mb_offset, uint16_t resp_offset); -extern void test_ecdsa(void); +extern uint16_t mpfs_sys_authenticate_iap_image(uint32_t spi_idx); static void mpfs_tamper_tests(void) { - uint8_t buf[1024 + 4]; + /* MPFS_SYS_UNLOCK_DEBUG_PASSCODE_DATA_LEN = 32 */ - mpfs_systemservice_init(); + uint8_t buf[32]; - /* Some of the functions do not exist */ + /* Looks like the buf needs to be gargabed first */ + + memset(buf, 0xaa, sizeof(buf)); + + /* Issue: */ - mpfs_sys_get_serial_number(buf, 0); - mpfs_sys_query_security(buf, 0); - mpfs_sys_query_design_information(buf, 0); - mpfs_sys_query_device_certificate(buf, 0); mpfs_sys_unlock_debug_passcode(buf, 0, 0); - test_ecdsa(); + + /* Issue: */ + mpfs_sys_authenticate_iap_image(0); } #endif