Removed old code main function & apdu handling function
This commit is contained in:
@@ -406,52 +406,3 @@ bool handle_apdu(const uint8_t *const data)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int main(void)
|
||||
{
|
||||
uint8_t buf[260]; // 4 bytes APDU header + 256 bytes payload
|
||||
uint16_t idx;
|
||||
int state;
|
||||
uint8_t payload_size = 0;
|
||||
|
||||
init_eip712_context();
|
||||
|
||||
state = OFFSET_CLA;
|
||||
idx = 0;
|
||||
while (fread(&buf[idx], sizeof(buf[idx]), 1, stdin) > 0)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case OFFSET_CLA:
|
||||
case OFFSET_INS:
|
||||
case OFFSET_P1:
|
||||
case OFFSET_P2:
|
||||
state += 1;
|
||||
idx += 1;
|
||||
break;
|
||||
case OFFSET_LC:
|
||||
payload_size = buf[idx];
|
||||
state = OFFSET_DATA;
|
||||
idx += 1;
|
||||
break;
|
||||
case OFFSET_DATA:
|
||||
if (--payload_size == 0)
|
||||
{
|
||||
if (!handle_apdu(buf)) return false;
|
||||
state = OFFSET_CLA;
|
||||
idx = 0;
|
||||
}
|
||||
else idx += 1;
|
||||
break;
|
||||
default:
|
||||
PRINTF("Unexpected APDU state!\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
PRINTF("%lu bytes used in RAM\n", (mem_max + 1));
|
||||
#endif
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user