Remove mysterious AES_Encrypt call

This commit is contained in:
Armel FAUVEAU
2024-08-15 05:07:20 +02:00
parent e008313170
commit 7c53df8d2b

View File

@@ -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;
}