Remove strange CMD_052D (and save 148 bytes)

This commit is contained in:
Armel FAUVEAU
2025-02-11 02:51:16 +01:00
parent 367d9d4683
commit 7558d95267
2 changed files with 34 additions and 31 deletions

View File

@@ -210,29 +210,26 @@ static void SendVersion(void)
SendReply(&Reply, sizeof(Reply)); SendReply(&Reply, sizeof(Reply));
} }
#ifndef ENABLE_FEAT_F4HWN
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse) static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
{ {
#ifdef ENABLE_FEAT_F4HWN unsigned int i;
UNUSED(pKey); uint32_t IV[4];
UNUSED(pIn);
UNUSED(pResponse);
#else
unsigned int i;
uint32_t IV[4];
IV[0] = 0; IV[0] = 0;
IV[1] = 0; IV[1] = 0;
IV[2] = 0; IV[2] = 0;
IV[3] = 0; IV[3] = 0;
AES_Encrypt(pKey, IV, pIn, IV, true); AES_Encrypt(pKey, IV, pIn, IV, true);
for (i = 0; i < 4; i++)
if (IV[i] != pResponse[i])
return true;
for (i = 0; i < 4; i++)
if (IV[i] != pResponse[i])
return true;
#endif
return false; return false;
} }
#endif
// session init, sends back version info and state // session init, sends back version info and state
// timestamp is a session id really // timestamp is a session id really
@@ -360,6 +357,7 @@ static void CMD_0529(void)
SendReply(&Reply, sizeof(Reply)); SendReply(&Reply, sizeof(Reply));
} }
#ifndef ENABLE_FEAT_F4HWN
static void CMD_052D(const uint8_t *pBuffer) static void CMD_052D(const uint8_t *pBuffer)
{ {
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer; const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
@@ -400,6 +398,7 @@ static void CMD_052D(const uint8_t *pBuffer)
SendReply(&Reply, sizeof(Reply)); SendReply(&Reply, sizeof(Reply));
} }
#endif
// session init, sends back version info and state // session init, sends back version info and state
// timestamp is a session id really // timestamp is a session id really
@@ -600,10 +599,12 @@ void UART_HandleCommand(void)
case 0x0529: case 0x0529:
CMD_0529(); CMD_0529();
break; break;
case 0x052D: #ifndef ENABLE_FEAT_F4HWN
CMD_052D(UART_Command.Buffer); case 0x052D:
break; CMD_052D(UART_Command.Buffer);
break;
#endif
case 0x052F: case 0x052F:
CMD_052F(UART_Command.Buffer); CMD_052F(UART_Command.Buffer);

View File

@@ -326,17 +326,19 @@ void SETTINGS_InitEEPROM(void)
gMR_ChannelExclude[i] = false; gMR_ChannelExclude[i] = false;
} }
// 0F30..0F3F // 0F30..0F3F
EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey)); EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey));
bHasCustomAesKey = false; bHasCustomAesKey = false;
for (unsigned int i = 0; i < ARRAY_SIZE(gCustomAesKey); i++) #ifndef ENABLE_FEAT_F4HWN
{ for (unsigned int i = 0; i < ARRAY_SIZE(gCustomAesKey); i++)
if (gCustomAesKey[i] != 0xFFFFFFFFu) {
{ if (gCustomAesKey[i] != 0xFFFFFFFFu)
bHasCustomAesKey = true; {
return; bHasCustomAesKey = true;
} return;
} }
}
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
// 1FF0..0x1FF7 // 1FF0..0x1FF7