mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-07 21:51:17 -07:00
Code cleanup:
- correctly use inttypes.h scanf and printf macros (PRIx64 et al) - fix indendation warnings
This commit is contained in:
parent
2d0717853d
commit
43534cbad2
14 changed files with 58 additions and 57 deletions
|
@ -44,8 +44,9 @@ int split(char *str, char *arr[MAX_ARGS]){
|
|||
while(isspace(str[beginIndex])){
|
||||
++beginIndex;
|
||||
}
|
||||
if(str[beginIndex] == '\0')
|
||||
if(str[beginIndex] == '\0') {
|
||||
break;
|
||||
}
|
||||
endIndex = beginIndex;
|
||||
while (str[endIndex] && !isspace(str[endIndex])){
|
||||
++endIndex;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <stdio.h> // also included in util.h
|
||||
#include <string.h> // also included in util.h
|
||||
#include <inttypes.h>
|
||||
#include <limits.h> // for CmdNorm INT_MIN && INT_MAX
|
||||
#include "data.h" // also included in util.h
|
||||
#include "cmddata.h"
|
||||
|
@ -171,22 +172,22 @@ void printEM410x(uint32_t hi, uint64_t id)
|
|||
}
|
||||
if (hi){
|
||||
//output 88 bit em id
|
||||
PrintAndLog("\nEM TAG ID : %06X%016llX", hi, id);
|
||||
PrintAndLog("\nEM TAG ID : %06X%016" PRIX64, hi, id);
|
||||
} else{
|
||||
//output 40 bit em id
|
||||
PrintAndLog("\nEM TAG ID : %010llX", id);
|
||||
PrintAndLog("Unique TAG ID : %010llX", id2lo);
|
||||
PrintAndLog("\nEM TAG ID : %010" PRIX64, id);
|
||||
PrintAndLog("Unique TAG ID : %010" PRIX64, id2lo);
|
||||
PrintAndLog("\nPossible de-scramble patterns");
|
||||
PrintAndLog("HoneyWell IdentKey {");
|
||||
PrintAndLog("DEZ 8 : %08lld",id & 0xFFFFFF);
|
||||
PrintAndLog("DEZ 10 : %010lld",id & 0xFFFFFFFF);
|
||||
PrintAndLog("DEZ 5.5 : %05lld.%05lld",(id>>16LL) & 0xFFFF,(id & 0xFFFF));
|
||||
PrintAndLog("DEZ 3.5A : %03lld.%05lld",(id>>32ll),(id & 0xFFFF));
|
||||
PrintAndLog("DEZ 3.5B : %03lld.%05lld",(id & 0xFF000000) >> 24,(id & 0xFFFF));
|
||||
PrintAndLog("DEZ 3.5C : %03lld.%05lld",(id & 0xFF0000) >> 16,(id & 0xFFFF));
|
||||
PrintAndLog("DEZ 14/IK2 : %014lld",id);
|
||||
PrintAndLog("DEZ 15/IK3 : %015lld",id2lo);
|
||||
PrintAndLog("DEZ 20/ZK : %02lld%02lld%02lld%02lld%02lld%02lld%02lld%02lld%02lld%02lld",
|
||||
PrintAndLog("DEZ 8 : %08" PRIu64,id & 0xFFFFFF);
|
||||
PrintAndLog("DEZ 10 : %010" PRIu64,id & 0xFFFFFFFF);
|
||||
PrintAndLog("DEZ 5.5 : %05lld.%05" PRIu64,(id>>16LL) & 0xFFFF,(id & 0xFFFF));
|
||||
PrintAndLog("DEZ 3.5A : %03lld.%05" PRIu64,(id>>32ll),(id & 0xFFFF));
|
||||
PrintAndLog("DEZ 3.5B : %03lld.%05" PRIu64,(id & 0xFF000000) >> 24,(id & 0xFFFF));
|
||||
PrintAndLog("DEZ 3.5C : %03lld.%05" PRIu64,(id & 0xFF0000) >> 16,(id & 0xFFFF));
|
||||
PrintAndLog("DEZ 14/IK2 : %014" PRIu64,id);
|
||||
PrintAndLog("DEZ 15/IK3 : %015" PRIu64,id2lo);
|
||||
PrintAndLog("DEZ 20/ZK : %02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64,
|
||||
(id2lo & 0xf000000000) >> 36,
|
||||
(id2lo & 0x0f00000000) >> 32,
|
||||
(id2lo & 0x00f0000000) >> 28,
|
||||
|
@ -199,8 +200,8 @@ void printEM410x(uint32_t hi, uint64_t id)
|
|||
(id2lo & 0x000000000f)
|
||||
);
|
||||
uint64_t paxton = (((id>>32) << 24) | (id & 0xffffff)) + 0x143e00;
|
||||
PrintAndLog("}\nOther : %05lld_%03lld_%08lld",(id&0xFFFF),((id>>16LL) & 0xFF),(id & 0xFFFFFF));
|
||||
PrintAndLog("Pattern Paxton : %lld [0x%llX]", paxton, paxton);
|
||||
PrintAndLog("}\nOther : %05" PRIu64 "_%03" PRIu64 "_%08" PRIu64 "",(id&0xFFFF),((id>>16LL) & 0xFF),(id & 0xFFFFFF));
|
||||
PrintAndLog("Pattern Paxton : %" PRIu64 " [0x%" PRIX64 "]", paxton, paxton);
|
||||
|
||||
uint32_t p1id = (id & 0xFFFFFF);
|
||||
uint8_t arr[32] = {0x00};
|
||||
|
@ -1572,8 +1573,8 @@ int CmdFDXBdemodBI(const char *Cmd){
|
|||
if (g_debugMode) PrintAndLog("Raw ID Hex: %s", sprint_hex(raw,8));
|
||||
|
||||
uint16_t calcCrc = crc16_ccitt_kermit(raw, 8);
|
||||
PrintAndLog("Animal ID: %04u-%012llu", countryCode, NationalCode);
|
||||
PrintAndLog("National Code: %012llu", NationalCode);
|
||||
PrintAndLog("Animal ID: %04u-%012" PRIu64, countryCode, NationalCode);
|
||||
PrintAndLog("National Code: %012" PRIu64, NationalCode);
|
||||
PrintAndLog("CountryCode: %04u", countryCode);
|
||||
PrintAndLog("Extended Data: %s", dataBlockBit ? "True" : "False");
|
||||
PrintAndLog("reserved Code: %u", reservedCode);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "util.h"
|
||||
|
@ -490,7 +491,7 @@ int CmdHF14ASim(const char *Cmd)
|
|||
|
||||
// Are we handling the (optional) second part uid?
|
||||
if (long_uid > 0xffffffff) {
|
||||
PrintAndLog("Emulating ISO/IEC 14443 type A tag with 7 byte UID (%014"llx")",long_uid);
|
||||
PrintAndLog("Emulating ISO/IEC 14443 type A tag with 7 byte UID (%014" PRIx64 ")",long_uid);
|
||||
// Store the second part
|
||||
c.arg[2] = (long_uid & 0xffffffff);
|
||||
long_uid >>= 32;
|
||||
|
|
|
@ -36,7 +36,7 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
|
|||
m = m > 0 ? m : 1;
|
||||
n = n > 0 ? n : 1;
|
||||
|
||||
PrintAndLog("Collecting %u %"hhu"-byte nonces", n, m);
|
||||
PrintAndLog("Collecting %u %u-byte nonces", n, m);
|
||||
PrintAndLog("Start: %u", time(NULL));
|
||||
// repeat n times
|
||||
for (unsigned int i = 0; i < n; i++) {
|
||||
|
|
|
@ -1349,7 +1349,7 @@ uint64_t hexarray_to_uint64(uint8_t *key) {
|
|||
for (int i = 0;i < 8;i++)
|
||||
sprintf(&temp[(i *2)],"%02X",key[i]);
|
||||
temp[16] = '\0';
|
||||
if (sscanf(temp,"%016"llx,&uint_key) < 1)
|
||||
if (sscanf(temp,"%016" SCNx64,&uint_key) < 1)
|
||||
return 0;
|
||||
return uint_key;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "proxmark3.h"
|
||||
#include "data.h"
|
||||
#include "ui.h"
|
||||
|
@ -323,7 +324,7 @@ int CmdLegicRfSim(const char *Cmd)
|
|||
c.arg[0] = 6;
|
||||
c.arg[1] = 3;
|
||||
c.arg[2] = 0;
|
||||
sscanf(Cmd, " %"lli" %"lli" %"lli, &c.arg[0], &c.arg[1], &c.arg[2]);
|
||||
sscanf(Cmd, " %" SCNi64 " %" SCNi64 " %" SCNi64, &c.arg[0], &c.arg[1], &c.arg[2]);
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
@ -331,7 +332,7 @@ int CmdLegicRfSim(const char *Cmd)
|
|||
int CmdLegicRfWrite(const char *Cmd)
|
||||
{
|
||||
UsbCommand c={CMD_WRITER_LEGIC_RF};
|
||||
int res = sscanf(Cmd, " 0x%"llx" 0x%"llx, &c.arg[0], &c.arg[1]);
|
||||
int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64, &c.arg[0], &c.arg[1]);
|
||||
if(res != 2) {
|
||||
PrintAndLog("Please specify the offset and length as two hex strings");
|
||||
return -1;
|
||||
|
@ -343,7 +344,7 @@ int CmdLegicRfWrite(const char *Cmd)
|
|||
int CmdLegicRfFill(const char *Cmd)
|
||||
{
|
||||
UsbCommand cmd ={CMD_WRITER_LEGIC_RF};
|
||||
int res = sscanf(Cmd, " 0x%"llx" 0x%"llx" 0x%"llx, &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
|
||||
int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64 " 0x%" SCNx64, &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
|
||||
if(res != 3) {
|
||||
PrintAndLog("Please specify the offset, length and value as two hex strings");
|
||||
return -1;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
// High frequency MIFARE commands
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "cmdhfmf.h"
|
||||
#include "./nonce2key/nonce2key.h"
|
||||
|
||||
|
@ -82,7 +83,7 @@ int CmdHF14AMifare(const char *Cmd)
|
|||
} else {
|
||||
isOK = 0;
|
||||
printf("------------------------------------------------------------------\n");
|
||||
PrintAndLog("Found valid key:%012"llx" \n", r_key);
|
||||
PrintAndLog("Found valid key:%012" PRIx64 " \n", r_key);
|
||||
}
|
||||
|
||||
PrintAndLog("");
|
||||
|
@ -632,7 +633,7 @@ int CmdHF14AMfNested(const char *Cmd)
|
|||
}
|
||||
key64 = bytes_to_num(keyBlock, 6);
|
||||
if (key64) {
|
||||
PrintAndLog("Found valid key:%012"llx, key64);
|
||||
PrintAndLog("Found valid key:%012" PRIx64, key64);
|
||||
|
||||
// transfer key to the emulator
|
||||
if (transferToEml) {
|
||||
|
@ -718,7 +719,7 @@ int CmdHF14AMfNested(const char *Cmd)
|
|||
|
||||
key64 = bytes_to_num(keyBlock, 6);
|
||||
if (key64) {
|
||||
PrintAndLog("Found valid key:%012"llx, key64);
|
||||
PrintAndLog("Found valid key:%012" PRIx64, key64);
|
||||
e_sector[sectorNo].foundKey[trgKeyType] = 1;
|
||||
e_sector[sectorNo].Key[trgKeyType] = key64;
|
||||
}
|
||||
|
@ -734,7 +735,7 @@ int CmdHF14AMfNested(const char *Cmd)
|
|||
PrintAndLog("|sec|key A |res|key B |res|");
|
||||
PrintAndLog("|---|----------------|---|----------------|---|");
|
||||
for (i = 0; i < SectorsCnt; i++) {
|
||||
PrintAndLog("|%03d| %012"llx" | %d | %012"llx" | %d |", i,
|
||||
PrintAndLog("|%03d| %012" PRIx64 " | %d | %012" PRIx64 " | %d |", i,
|
||||
e_sector[i].Key[0], e_sector[i].foundKey[0], e_sector[i].Key[1], e_sector[i].foundKey[1]);
|
||||
}
|
||||
PrintAndLog("|---|----------------|---|----------------|---|");
|
||||
|
@ -925,7 +926,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
|||
}
|
||||
memset(keyBlock + 6 * keycnt, 0, 6);
|
||||
num_to_bytes(strtoll(buf, NULL, 16), 6, keyBlock + 6*keycnt);
|
||||
PrintAndLog("chk custom key[%2d] %012"llx, keycnt, bytes_to_num(keyBlock + 6*keycnt, 6));
|
||||
PrintAndLog("chk custom key[%2d] %012" PRIx64 , keycnt, bytes_to_num(keyBlock + 6*keycnt, 6));
|
||||
keycnt++;
|
||||
memset(buf, 0, sizeof(buf));
|
||||
}
|
||||
|
@ -969,7 +970,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
|||
res = mfCheckKeys(b, t, true, size, &keyBlock[6*c], &key64);
|
||||
if (res != 1) {
|
||||
if (!res) {
|
||||
PrintAndLog("Found valid key:[%012"llx"]",key64);
|
||||
PrintAndLog("Found valid key:[%012" PRIx64 "]",key64);
|
||||
num_to_bytes(key64, 6, foundKey[t][i]);
|
||||
validKey[t][i] = true;
|
||||
}
|
||||
|
@ -1058,7 +1059,7 @@ void readerAttack(nonces_t ar_resp[], bool setEmulatorMem, bool doStandardAttack
|
|||
uint8_t sectorNum = ar_resp[i+ATTACK_KEY_COUNT].sector;
|
||||
uint8_t keyType = ar_resp[i+ATTACK_KEY_COUNT].keytype;
|
||||
|
||||
PrintAndLog("M-Found Key%s for sector %02d: [%012"llx"]"
|
||||
PrintAndLog("M-Found Key%s for sector %02d: [%012" PRIx64 "]"
|
||||
, keyType ? "B" : "A"
|
||||
, sectorNum
|
||||
, key
|
||||
|
@ -1670,7 +1671,7 @@ int CmdHF14AMfEKeyPrn(const char *Cmd)
|
|||
}
|
||||
keyA = bytes_to_num(data, 6);
|
||||
keyB = bytes_to_num(data + 10, 6);
|
||||
PrintAndLog("|%03d| %012"llx" | %012"llx" |", i, keyA, keyB);
|
||||
PrintAndLog("|%03d| %012" PRIx64 " | %012" PRIx64 " |", i, keyA, keyB);
|
||||
}
|
||||
PrintAndLog("|---|----------------|----------------|");
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include "crc16.h"
|
||||
#include "proxmark3.h"
|
||||
#include "data.h"
|
||||
|
@ -273,7 +274,7 @@ int CmdTIWrite(const char *Cmd)
|
|||
UsbCommand c = {CMD_WRITE_TI_TYPE};
|
||||
int res = 0;
|
||||
|
||||
res = sscanf(Cmd, "%012"llx" %012"llx" %012"llx"", &c.arg[0], &c.arg[1], &c.arg[2]);
|
||||
res = sscanf(Cmd, "%012" PRIx64 " %012" PRIx64 " %012" PRIx64 "", &c.arg[0], &c.arg[1], &c.arg[2]);
|
||||
|
||||
if (res == 2) c.arg[2]=0;
|
||||
if (res < 2)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include "proxmark3.h"
|
||||
#include "sleep.h"
|
||||
#include "flash.h"
|
||||
|
@ -295,7 +296,7 @@ static int get_proxmark_state(uint32_t *state)
|
|||
*state = resp.arg[0];
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Error: Couldn't get proxmark state, bad response type: 0x%04"llx"\n", resp.cmd);
|
||||
fprintf(stderr, "Error: Couldn't get proxmark state, bad response type: 0x%04" PRIx64 "\n", resp.cmd);
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
@ -357,7 +358,7 @@ static int wait_for_ack(void)
|
|||
UsbCommand ack;
|
||||
ReceiveCommand(&ack);
|
||||
if (ack.cmd != CMD_ACK) {
|
||||
printf("Error: Unexpected reply 0x%04"llx" (expected ACK)\n", ack.cmd);
|
||||
printf("Error: Unexpected reply 0x%04" PRIx64 " (expected ACK)\n", ack.cmd);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "sleep.h"
|
||||
#include "proxmark3.h"
|
||||
#include "flash.h"
|
||||
|
@ -25,10 +26,10 @@ static char* serial_port_name;
|
|||
void cmd_debug(UsbCommand* UC) {
|
||||
// Debug
|
||||
printf("UsbCommand length[len=%zd]\n",sizeof(UsbCommand));
|
||||
printf(" cmd[len=%zd]: %016"llx"\n",sizeof(UC->cmd),UC->cmd);
|
||||
printf(" arg0[len=%zd]: %016"llx"\n",sizeof(UC->arg[0]),UC->arg[0]);
|
||||
printf(" arg1[len=%zd]: %016"llx"\n",sizeof(UC->arg[1]),UC->arg[1]);
|
||||
printf(" arg2[len=%zd]: %016"llx"\n",sizeof(UC->arg[2]),UC->arg[2]);
|
||||
printf(" cmd[len=%zd]: %016" PRIx64 "\n",sizeof(UC->cmd),UC->cmd);
|
||||
printf(" arg0[len=%zd]: %016" PRIx64 "\n",sizeof(UC->arg[0]),UC->arg[0]);
|
||||
printf(" arg1[len=%zd]: %016" PRIx64 "\n",sizeof(UC->arg[1]),UC->arg[1]);
|
||||
printf(" arg2[len=%zd]: %016" PRIx64 "\n",sizeof(UC->arg[2]),UC->arg[2]);
|
||||
printf(" data[len=%zd]: ",sizeof(UC->d.asBytes));
|
||||
for (size_t i=0; i<16; i++) {
|
||||
printf("%02x",UC->d.asBytes[i]);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#define llx PRIx64
|
||||
|
||||
#include "nonce2key.h"
|
||||
#include "mifarehost.h"
|
||||
|
@ -48,7 +47,7 @@ int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_
|
|||
// Reset the last three significant bits of the reader nonce
|
||||
nr &= 0xffffff1f;
|
||||
|
||||
PrintAndLog("\nuid(%08x) nt(%08x) par(%016"llx") ks(%016"llx") nr(%08"llx")\n\n",uid,nt,par_info,ks_info,nr);
|
||||
PrintAndLog("\nuid(%08x) nt(%08x) par(%016" PRIx64") ks(%016" PRIx64") nr(%08" PRIx32")\n\n",uid,nt,par_info,ks_info,nr);
|
||||
|
||||
for (pos=0; pos<8; pos++)
|
||||
{
|
||||
|
@ -86,7 +85,7 @@ int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_
|
|||
lfsr_rollback_word(state+i, uid^nt, 0);
|
||||
crypto1_get_lfsr(state + i, &key_recovered);
|
||||
*(state_s + i) = key_recovered;
|
||||
//fprintf(fp, "%012llx\n",key_recovered);
|
||||
//fprintf(fp, "%012" PRIx64 "\n",key_recovered);
|
||||
}
|
||||
//fclose(fp);
|
||||
|
||||
|
@ -105,7 +104,7 @@ int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_
|
|||
p2 = state_s;
|
||||
while ( *p1 != -1 && *p2 != -1 ) {
|
||||
if (compar_state(p1, p2) == 0) {
|
||||
printf("p1:%"llx" p2:%"llx" p3:%"llx" key:%012"llx"\n",(uint64_t)(p1-last_keylist),(uint64_t)(p2-state_s),(uint64_t)(p3-last_keylist),*p1);
|
||||
printf("p1:%" PRIx64" p2:%" PRIx64 " p3:%" PRIx64" key:%012" PRIx64 "\n",(uint64_t)(p1-last_keylist),(uint64_t)(p2-state_s),(uint64_t)(p3-last_keylist),*p1);
|
||||
*p3++ = *p1++;
|
||||
p2++;
|
||||
}
|
||||
|
@ -175,7 +174,7 @@ bool mfkey32(nonces_t data, uint64_t *outputkey) {
|
|||
crypto1_word(t, uid ^ nt, 0);
|
||||
crypto1_word(t, nr1_enc, 1);
|
||||
if (ar1_enc == (crypto1_word(t, 0, 0) ^ prng_successor(nt, 64))) {
|
||||
//PrintAndLog("Found Key: [%012"llx"]",key);
|
||||
//PrintAndLog("Found Key: [%012" PRIx64 "]",key);
|
||||
outkey = key;
|
||||
counter++;
|
||||
if (counter==20) break;
|
||||
|
@ -226,7 +225,7 @@ bool tryMfk32_moebius(nonces_t data, uint64_t *outputkey) {
|
|||
crypto1_word(t, uid ^ nt1, 0);
|
||||
crypto1_word(t, nr1_enc, 1);
|
||||
if (ar1_enc == (crypto1_word(t, 0, 0) ^ prng_successor(nt1, 64))) {
|
||||
//PrintAndLog("Found Key: [%012"llx"]",key);
|
||||
//PrintAndLog("Found Key: [%012" PRIx64 "]",key);
|
||||
outkey=key;
|
||||
++counter;
|
||||
if (counter==20)
|
||||
|
@ -277,7 +276,7 @@ int tryMfk64(uint32_t uid, uint32_t nt, uint32_t nr_enc, uint32_t ar_enc, uint32
|
|||
lfsr_rollback_word(revstate, nr_enc, 1);
|
||||
lfsr_rollback_word(revstate, uid ^ nt, 0);
|
||||
crypto1_get_lfsr(revstate, &key);
|
||||
PrintAndLog("Found Key: [%012"llx"]", key);
|
||||
PrintAndLog("Found Key: [%012" PRIx64 "]", key);
|
||||
crypto1_destroy(revstate);
|
||||
*outputkey = key;
|
||||
|
||||
|
|
|
@ -12,13 +12,6 @@
|
|||
#ifndef PROXMARK3_H__
|
||||
#define PROXMARK3_H__
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#define llx PRIx64
|
||||
#define lli PRIi64
|
||||
#define llu PRIu64
|
||||
#define hhu PRIu8
|
||||
|
||||
#include "usb_cmd.h"
|
||||
|
||||
#define PROXPROMPT "proxmark3> "
|
||||
|
|
|
@ -786,12 +786,13 @@ prev(poly_t *poly) {
|
|||
unsigned long fulllength = poly->length + ofs;
|
||||
bmp_t accu;
|
||||
|
||||
if(ofs)
|
||||
if(ofs) {
|
||||
/* removable optimisation */
|
||||
if(poly->length < (unsigned long) BMP_BIT) {
|
||||
*poly->bitmap = rev(*poly->bitmap >> ofs, (int) poly->length) << ofs;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* claim remaining bits of last word (as we use public function pshift()) */
|
||||
poly->length = fulllength;
|
||||
|
|
|
@ -161,7 +161,7 @@ static int l_nonce2key(lua_State *L){
|
|||
uint8_t dest_key[8];
|
||||
num_to_bytes(key,sizeof(dest_key),dest_key);
|
||||
|
||||
//printf("Pushing to lua stack: %012"llx"\n",key);
|
||||
//printf("Pushing to lua stack: %012" PRIx64 "\n",key);
|
||||
lua_pushlstring(L,(const char *) dest_key,sizeof(dest_key));
|
||||
|
||||
return 2; //Two return values
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue