em4x70 makestyle

This commit is contained in:
Christian Molson 2020-12-12 10:02:43 -05:00
commit 701914430f
2 changed files with 11 additions and 11 deletions

View file

@ -365,31 +365,31 @@ static int authenticate(const uint8_t *rnd, const uint8_t *frnd, uint8_t *respon
if (find_listen_window(true)) { if (find_listen_window(true)) {
em4x70_send_nibble(EM4X70_COMMAND_AUTH, true); em4x70_send_nibble(EM4X70_COMMAND_AUTH, true);
// Send 56-bit Random number // Send 56-bit Random number
for(int i=0;i<7;i++) { for (int i = 0; i < 7; i++) {
em4x70_send_byte(rnd[i]); em4x70_send_byte(rnd[i]);
} }
// Send 7 x 0's (Diversity bits) // Send 7 x 0's (Diversity bits)
for(int i=0; i<7; i++) { for (int i = 0; i < 7; i++) {
em4x70_send_bit(0); em4x70_send_bit(0);
} }
// Send 28-bit f(RN) // Send 28-bit f(RN)
// Send first 24 bits // Send first 24 bits
for(int i=0; i < 3; i++) { for (int i = 0; i < 3; i++) {
em4x70_send_byte(frnd[i]); em4x70_send_byte(frnd[i]);
} }
// Send last 4 bits (no parity) // Send last 4 bits (no parity)
em4x70_send_nibble((frnd[3] >> 4) & 0xf, false); em4x70_send_nibble((frnd[3] >> 4) & 0xf, false);
// Receive header, 20-bit g(RN), LIW // Receive header, 20-bit g(RN), LIW
uint8_t grnd[EM4X70_MAX_RECEIVE_LENGTH] = {0}; uint8_t grnd[EM4X70_MAX_RECEIVE_LENGTH] = {0};
int num = em4x70_receive(grnd); int num = em4x70_receive(grnd);
if(num < 10) { if (num < 10) {
Dbprintf("Auth failed"); Dbprintf("Auth failed");
return PM3_ESOFT; return PM3_ESOFT;
} }

View file

@ -253,7 +253,7 @@ int CmdEM4x70Auth(const char *Cmd) {
"Authenticate against an EM4x70 by sending random number (RN) and F(RN)\n" "Authenticate against an EM4x70 by sending random number (RN) and F(RN)\n"
" If F(RN) is incorrect based on the tag crypt key, the tag will not respond", " If F(RN) is incorrect based on the tag crypt key, the tag will not respond",
"lf em 4x70 auth -r 11223344556677 -f 11223344\n" "lf em 4x70 auth -r 11223344556677 -f 11223344\n"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -264,9 +264,9 @@ int CmdEM4x70Auth(const char *Cmd) {
}; };
CLIExecWithReturn(ctx, Cmd, argtable, true); CLIExecWithReturn(ctx, Cmd, argtable, true);
etd.parity = arg_get_lit(ctx, 1); etd.parity = arg_get_lit(ctx, 1);
int rnd_len = 7; int rnd_len = 7;
CLIGetHexWithReturn(ctx, 2, etd.rnd, &rnd_len); CLIGetHexWithReturn(ctx, 2, etd.rnd, &rnd_len);