From 7c53df8d2b88ef769fac3ea46f16f9d4644402d1 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 15 Aug 2024 05:07:20 +0200 Subject: [PATCH] Remove mysterious AES_Encrypt call --- app/uart.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/app/uart.c b/app/uart.c index 8d8feac..a1b1fc5 100644 --- a/app/uart.c +++ b/app/uart.c @@ -42,6 +42,7 @@ #include "sram-overlay.h" #endif +#define UNUSED(x) (void)(x) #define DMA_INDEX(x, y) (((x) + (y)) % sizeof(UART_DMA_Buffer)) @@ -211,20 +212,25 @@ static void SendVersion(void) static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse) { - unsigned int i; - uint32_t IV[4]; + #ifdef ENABLE_FEAT_F4HWN + UNUSED(pKey); + UNUSED(pIn); + UNUSED(pResponse); + #else + unsigned int i; + uint32_t IV[4]; - IV[0] = 0; - IV[1] = 0; - IV[2] = 0; - IV[3] = 0; + IV[0] = 0; + IV[1] = 0; + IV[2] = 0; + IV[3] = 0; - AES_Encrypt(pKey, IV, pIn, IV, true); - - for (i = 0; i < 4; i++) - if (IV[i] != pResponse[i]) - return true; + AES_Encrypt(pKey, IV, pIn, IV, true); + for (i = 0; i < 4; i++) + if (IV[i] != pResponse[i]) + return true; + #endif return false; }