Bladeren bron

Correct length when sending hardcoded ADF response

Eric Betts 8 maanden geleden
bovenliggende
commit
67442f98c8
1 gewijzigde bestanden met toevoegingen van 6 en 2 verwijderingen
  1. 6 2
      seos_emulator.c

+ 6 - 2
seos_emulator.c

@@ -268,8 +268,12 @@ bool seos_emulator_select_adf(
 
             if(credential->adf_response[0] == 0xCD) {
                 FURI_LOG_I(TAG, "Using hardcoded ADF Response");
-                bit_buffer_append_bytes(
-                    tx_buffer, credential->adf_response, sizeof(credential->adf_response));
+                // 4 byte cipher/hash
+                // 2 byte cryptogram header
+                // x bytes of cryptogram
+                // 10 bytes for mac (2 byte header + 8 byte cmac)
+                size_t adf_response_len = 4 + 2 + credential->adf_response[5] + 10;
+                bit_buffer_append_bytes(tx_buffer, credential->adf_response, adf_response_len);
 
                 params->cipher = credential->adf_response[2];
                 params->hash = credential->adf_response[3];