mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 15:26:13 +08:00
arm: fix prototypes
This commit is contained in:
parent
838d345918
commit
026707b960
|
@ -68,7 +68,7 @@
|
|||
|
||||
#define HF_14ASNIFF_LOGFILE "hf_14asniff.trc"
|
||||
|
||||
void DownloadTraceInstructions() {
|
||||
void DownloadTraceInstructions(void) {
|
||||
Dbprintf("");
|
||||
Dbprintf("To get the trace from flash and display it:");
|
||||
Dbprintf("1. mem spiffs dump o "HF_14ASNIFF_LOGFILE" f trace.trc");
|
||||
|
@ -81,7 +81,7 @@ void ModInfo(void) {
|
|||
DownloadTraceInstructions();
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
|
||||
Dbprintf("Starting standalone mode: hf_14asniff");
|
||||
|
|
|
@ -235,7 +235,7 @@ void ModInfo(void) {
|
|||
DbpString(" HF 14a sniff standalone with ULC/ULEV1/NTAG auth storing in flashmem - aka BogitoRun (Bogito)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
|
||||
StandAloneMode();
|
||||
|
||||
|
|
|
@ -215,22 +215,22 @@ void delete_schema(MFC1KSchema *p, int *schemas_counter, int index) {
|
|||
}
|
||||
}
|
||||
|
||||
void cjSetCursFRight() {
|
||||
void cjSetCursFRight(void) {
|
||||
vtsend_cursor_position(NULL, 98, (currfline));
|
||||
currfline++;
|
||||
}
|
||||
|
||||
void cjSetCursRight() {
|
||||
void cjSetCursRight(void) {
|
||||
vtsend_cursor_position(NULL, 59, (currline));
|
||||
currline++;
|
||||
}
|
||||
|
||||
void cjSetCursLeft() {
|
||||
void cjSetCursLeft(void) {
|
||||
vtsend_cursor_position(NULL, 0, (curlline));
|
||||
curlline++;
|
||||
}
|
||||
|
||||
void cjTabulize() { DbprintfEx(FLAG_RAWPRINT, "\t\t\t"); }
|
||||
void cjTabulize(void) { DbprintfEx(FLAG_RAWPRINT, "\t\t\t"); }
|
||||
|
||||
/*
|
||||
void cjPrintKey(uint64_t key, uint8_t *foundKey, uint16_t sectorNo, uint8_t type) {
|
||||
|
@ -275,7 +275,7 @@ void add_schemas_from_json_in_spiffs(char *filename) {
|
|||
}
|
||||
}
|
||||
|
||||
void ReadLastTagFromFlash() {
|
||||
void ReadLastTagFromFlash(void) {
|
||||
SpinOff(0);
|
||||
LED_A_ON();
|
||||
LED_B_ON();
|
||||
|
@ -332,7 +332,7 @@ void WriteTagToFlash(uint32_t uid, size_t size) {
|
|||
|
||||
void ModInfo(void) { DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)"); }
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
|
||||
// add_schema(Schemas, Noralsy, &total_schemas);
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
void DownloadLogInstructions() {
|
||||
void DownloadLogInstructions(void) {
|
||||
Dbprintf("");
|
||||
Dbprintf("[=] List all dumps from flash:");
|
||||
Dbprintf("[=] " _YELLOW_("-") " mem spiffs tree");
|
||||
|
@ -99,7 +99,7 @@ void ModInfo(void) {
|
|||
// A, B, C = Reading
|
||||
// A, D = Simulating
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
Dbprintf("[=] >> HF Legic Prime Read/Simulate Started <<");
|
||||
|
|
|
@ -210,7 +210,7 @@ void ModInfo(void) {
|
|||
DbpString(" HF Mifare sniff/clone - aka MattyRun (Matías A. Ré Medina)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> Matty mifare chk/dump/sim a.k.a MattyRun Started <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
|
|
@ -54,7 +54,7 @@ void ModInfo(void) {
|
|||
|
||||
uint8_t ppdol [255] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00}; // Default GET PROCESSING
|
||||
|
||||
uint8_t treatPDOL(uint8_t *apdu) { //Generate GET PROCESSING
|
||||
static uint8_t treatPDOL(uint8_t *apdu) { //Generate GET PROCESSING
|
||||
uint8_t plen = 7;
|
||||
//PDOL Format: 80 A8 00 00 + (PDOL Length+2) + 83 + PDOL Length + PDOL + 00
|
||||
for (uint8_t i = 1; i <= apdu[0]; i++) { //Magic stuff, the generation order is important
|
||||
|
@ -117,7 +117,7 @@ uint8_t treatPDOL(uint8_t *apdu) { //Generate GET PROCESSING
|
|||
return plen;
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(_YELLOW_(">>") "Reading Visa cards & Emulating a Visa MSD Transaction a.k.a. MSDSal Started<<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
|
|
@ -37,7 +37,7 @@ void ModInfo(void) {
|
|||
DbpString(" HF Mifare sniff/simulation - (Craig Young)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> Craig Young Mifare sniff UID/clone uid 2 magic/sim a.k.a YoungRun Started <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
|
|
@ -79,7 +79,7 @@ void LED_Slot(int i) {
|
|||
}
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
Dbprintf("[=] >> LF EM4100 simulator started <<");
|
||||
|
|
|
@ -118,7 +118,7 @@ void SaveIDtoFlash(int addr, uint64_t id) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
Dbprintf("[=] >> LF EM4100 read/write/clone started <<");
|
||||
|
|
|
@ -42,7 +42,7 @@ void ModInfo(void) {
|
|||
}
|
||||
|
||||
// samy's sniff and repeat routine for LF
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> LF HID corporate bruteforce a.k.a CorporateBrute Started <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define LF_HIDCOLLECT_LOGFILE "lf_hidcollect.log"
|
||||
|
||||
|
||||
void DownloadLogInstructions() {
|
||||
void DownloadLogInstructions(void) {
|
||||
Dbprintf("");
|
||||
Dbprintf("[=] To get the logfile from flash and display it:");
|
||||
Dbprintf("[=] " _YELLOW_("1.") " mem spiffs dump o "LF_HIDCOLLECT_LOGFILE" f "LF_HIDCOLLECT_LOGFILE);
|
||||
|
@ -76,7 +76,7 @@ void append(uint8_t *entry, size_t entry_len) {
|
|||
LED_B_OFF();
|
||||
}
|
||||
|
||||
uint32_t IceEM410xdemod() {
|
||||
uint32_t IceEM410xdemod(void) {
|
||||
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
size_t idx = 0;
|
||||
|
@ -128,7 +128,7 @@ uint32_t IceEM410xdemod() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t IceAWIDdemod() {
|
||||
uint32_t IceAWIDdemod(void) {
|
||||
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
size_t size = MIN(12800, BigBuf_max_traceLen());
|
||||
|
@ -180,7 +180,7 @@ uint32_t IceAWIDdemod() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t IceIOdemod() {
|
||||
uint32_t IceIOdemod(void) {
|
||||
|
||||
int dummyIdx = 0;
|
||||
uint8_t version = 0, facilitycode = 0;
|
||||
|
@ -224,7 +224,7 @@ uint32_t IceIOdemod() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t IceHIDDemod() {
|
||||
uint32_t IceHIDDemod(void) {
|
||||
|
||||
int dummyIdx = 0;
|
||||
|
||||
|
@ -320,7 +320,7 @@ void ModInfo(void) {
|
|||
DbpString(_YELLOW_(" LF HID / IOprox / AWID / EM4100 collector mode") " - a.k.a IceHID (Iceman)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
LFSetupFPGAForADC(LF_DIVISOR_125, true);
|
||||
|
|
|
@ -23,7 +23,7 @@ void ModInfo(void) {
|
|||
}
|
||||
|
||||
// samy's sniff and repeat routine for LF
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> LF HID proxII bruteforce a.k.a ProxBrute Started (Brad Antoniewicz) <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
|
|
|
@ -31,7 +31,7 @@ void ModInfo(void) {
|
|||
// C = playing bank A
|
||||
// D = playing bank B
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
Dbprintf(">> LF HID Read/Clone/Sim a.k.a SamyRun Started <<");
|
||||
|
|
|
@ -18,7 +18,7 @@ void ModInfo(void) {
|
|||
DbpString(" LF skeleton mode - aka Skeleton (iceman)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf("[=] LF skeleton code a.k.a Skeleton started");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
|
|
|
@ -6,5 +6,5 @@ void ModInfo(void) {
|
|||
DbpString(" No standalone mode present");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef __STANDALONE_H
|
||||
#define __STANDALONE_H
|
||||
|
||||
void RunMod();
|
||||
void ModInfo();
|
||||
void RunMod(void);
|
||||
void ModInfo(void);
|
||||
|
||||
#endif /* __STANDALONE_H */
|
||||
|
|
|
@ -144,7 +144,7 @@ uint16_t AvgAdc(int ch) {
|
|||
return (a + 15) >> 5;
|
||||
}
|
||||
|
||||
void MeasureAntennaTuning(void) {
|
||||
static void MeasureAntennaTuning(void) {
|
||||
|
||||
uint32_t peak = 0;
|
||||
|
||||
|
@ -221,7 +221,7 @@ void MeasureAntennaTuning(void) {
|
|||
}
|
||||
|
||||
// Measure HF in milliVolt
|
||||
uint16_t MeasureAntennaTuningHfData(void) {
|
||||
static uint16_t MeasureAntennaTuningHfData(void) {
|
||||
|
||||
#if defined RDV4
|
||||
return (MAX_ADC_HF_VOLTAGE_RDV40 * AvgAdc(ADC_CHAN_HF_RDV40)) >> 10;
|
||||
|
@ -232,7 +232,7 @@ uint16_t MeasureAntennaTuningHfData(void) {
|
|||
}
|
||||
|
||||
// Measure LF in milliVolt
|
||||
uint32_t MeasureAntennaTuningLfData(void) {
|
||||
static uint32_t MeasureAntennaTuningLfData(void) {
|
||||
return (MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10;
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ void ReadMem(int addr) {
|
|||
extern struct version_information version_information;
|
||||
/* bootrom version information is pointed to from _bootphase1_version_pointer */
|
||||
extern char *_bootphase1_version_pointer, _flash_start, _flash_end, __data_src_start__;
|
||||
void SendVersion(void) {
|
||||
static void SendVersion(void) {
|
||||
char temp[PM3_CMD_DATA_SIZE - 12]; /* Limited data payload in USB packets */
|
||||
char VersionString[PM3_CMD_DATA_SIZE - 12] = { '\0' };
|
||||
|
||||
|
@ -302,7 +302,7 @@ void SendVersion(void) {
|
|||
reply_ng(CMD_VERSION, PM3_SUCCESS, (uint8_t *)&payload, 12 + payload.versionstr_len);
|
||||
}
|
||||
|
||||
void TimingIntervalAcquisition(void) {
|
||||
static void TimingIntervalAcquisition(void) {
|
||||
// trigger new acquisition by turning main oscillator off and on
|
||||
mck_from_pll_to_slck();
|
||||
mck_from_slck_to_pll();
|
||||
|
@ -312,7 +312,7 @@ void TimingIntervalAcquisition(void) {
|
|||
|
||||
// measure the Connection Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.
|
||||
// Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the PacketCommandNG structure included.
|
||||
void printConnSpeed(void) {
|
||||
static void printConnSpeed(void) {
|
||||
DbpString(_BLUE_("Transfer Speed"));
|
||||
Dbprintf(" Sending packets to client...");
|
||||
|
||||
|
@ -339,7 +339,7 @@ void printConnSpeed(void) {
|
|||
/**
|
||||
* Prints runtime information about the PM3.
|
||||
**/
|
||||
void SendStatus(void) {
|
||||
static void SendStatus(void) {
|
||||
BigBuf_print_status();
|
||||
Fpga_print_status();
|
||||
#ifdef WITH_FLASH
|
||||
|
@ -382,7 +382,7 @@ void SendStatus(void) {
|
|||
reply_ng(CMD_STATUS, PM3_SUCCESS, NULL, 0);
|
||||
}
|
||||
|
||||
void SendCapabilities(void) {
|
||||
static void SendCapabilities(void) {
|
||||
capabilities_t capabilities;
|
||||
capabilities.version = CAPABILITIES_VERSION;
|
||||
capabilities.via_fpc = reply_via_fpc;
|
||||
|
|
|
@ -113,7 +113,7 @@ static char iso_type = 0;
|
|||
//-----------------------------------------------------------------------------
|
||||
// Wrapper for sending APDUs to type A and B cards
|
||||
//-----------------------------------------------------------------------------
|
||||
int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response) {
|
||||
static int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response) {
|
||||
switch (iso_type) {
|
||||
case 'a':
|
||||
return iso14_apdu(apdu, (uint16_t) length, false, response, NULL);
|
||||
|
@ -130,7 +130,7 @@ int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response) {
|
|||
//-----------------------------------------------------------------------------
|
||||
// Closes the communication channel and turns off the field
|
||||
//-----------------------------------------------------------------------------
|
||||
void EPA_Finish() {
|
||||
void EPA_Finish(void) {
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
iso_type = 0;
|
||||
|
@ -501,7 +501,7 @@ void EPA_PACE_Replay(PacketCommandNG *c) {
|
|||
// Set up a communication channel (Card Select, PPS)
|
||||
// Returns 0 on success or a non-zero error code on failure
|
||||
//-----------------------------------------------------------------------------
|
||||
int EPA_Setup() {
|
||||
int EPA_Setup(void) {
|
||||
|
||||
// first, look for type A cards
|
||||
// power up the field
|
||||
|
|
|
@ -23,12 +23,12 @@ typedef struct {
|
|||
} pace_version_info_t;
|
||||
|
||||
// general functions
|
||||
void EPA_Finish();
|
||||
void EPA_Finish(void);
|
||||
size_t EPA_Parse_CardAccess(uint8_t *data,
|
||||
size_t length,
|
||||
pace_version_info_t *pace_info);
|
||||
int EPA_Read_CardAccess(uint8_t *buffer, size_t max_length);
|
||||
int EPA_Setup();
|
||||
int EPA_Setup(void);
|
||||
|
||||
// PACE related functions
|
||||
int EPA_PACE_MSE_Set_AT(pace_version_info_t pace_version_info, uint8_t password);
|
||||
|
|
|
@ -37,11 +37,11 @@ static uint8_t felica_select_card(felica_card_select_t *card);
|
|||
static void TransmitFor18092_AsReader(uint8_t *frame, int len, uint32_t *timing, uint8_t power, uint8_t highspeed);
|
||||
bool WaitForFelicaReply(uint16_t maxbytes);
|
||||
|
||||
void iso18092_set_timeout(uint32_t timeout) {
|
||||
static void iso18092_set_timeout(uint32_t timeout) {
|
||||
felica_timeout = timeout + (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER) / (16 * 8) + 2;
|
||||
}
|
||||
|
||||
uint32_t iso18092_get_timeout(void) {
|
||||
static uint32_t iso18092_get_timeout(void) {
|
||||
return felica_timeout - (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER) / (16 * 8) - 2;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ static struct {
|
|||
# define SYNC_16BIT 0xB24D
|
||||
#endif
|
||||
|
||||
static void FelicaFrameReset() {
|
||||
static void FelicaFrameReset(void) {
|
||||
FelicaFrame.state = STATE_UNSYNCD;
|
||||
FelicaFrame.posCnt = 0;
|
||||
FelicaFrame.crc_ok = false;
|
||||
|
@ -481,7 +481,7 @@ static void iso18092_setup(uint8_t fpga_minor_mode) {
|
|||
LED_D_ON();
|
||||
}
|
||||
|
||||
void felica_reset_frame_mode() {
|
||||
static void felica_reset_frame_mode(void) {
|
||||
switch_off();
|
||||
//Resetting Frame mode (First set in fpgaloader.c)
|
||||
AT91C_BASE_SSC->SSC_RFMR = SSC_FRAME_MODE_BITS_IN_WORD(8) | AT91C_SSC_MSBF | SSC_FRAME_MODE_WORDS_PER_TRANSFER(0);
|
||||
|
@ -738,7 +738,7 @@ void felica_sim_lite(uint64_t uid) {
|
|||
|
||||
#define RES_SVC_LEN 11 + 3
|
||||
|
||||
void felica_dump_lite_s() {
|
||||
void felica_dump_lite_s(void) {
|
||||
uint8_t ndef[8];
|
||||
uint8_t poll[10] = { 0xb2, 0x4d, 0x06, FELICA_POLL_REQ, 0xff, 0xff, 0x00, 0x00, 0x09, 0x21};
|
||||
uint16_t liteblks[28] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x90, 0x91, 0x92, 0xa0};
|
||||
|
|
|
@ -17,6 +17,6 @@
|
|||
void felica_sendraw(PacketCommandNG *c);
|
||||
void felica_sniff(uint32_t samplesToSkip, uint32_t triggersToSkip);
|
||||
void felica_sim_lite(uint64_t uid);
|
||||
void felica_dump_lite_s();
|
||||
void felica_dump_lite_s(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@ void FlashmemSetSpiBaudrate(uint32_t baudrate) {
|
|||
}
|
||||
|
||||
// initialize
|
||||
bool FlashInit() {
|
||||
bool FlashInit(void) {
|
||||
FlashSetup(FLASHMEM_SPIBAUDRATE);
|
||||
|
||||
StartTicks();
|
||||
|
@ -435,7 +435,7 @@ bool Flash_WipeMemoryPage(uint8_t page) {
|
|||
return true;
|
||||
}
|
||||
// Wipes flash memory completely, fills with 0xFF
|
||||
bool Flash_WipeMemory() {
|
||||
bool Flash_WipeMemory(void) {
|
||||
if (!FlashInit()) {
|
||||
if (DBGLEVEL > 3) Dbprintf("Flash_WriteData init fail");
|
||||
return false;
|
||||
|
@ -462,7 +462,7 @@ bool Flash_WipeMemory() {
|
|||
}
|
||||
|
||||
// enable the flash write
|
||||
void Flash_WriteEnable() {
|
||||
void Flash_WriteEnable(void) {
|
||||
FlashSendLastByte(WRITEENABLE);
|
||||
if (DBGLEVEL > 3) Dbprintf("Flash Write enabled");
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
void FlashmemSetSpiBaudrate(uint32_t baudrate);
|
||||
bool FlashInit();
|
||||
bool FlashInit(void);
|
||||
void FlashSetup(uint32_t baudrate);
|
||||
void FlashStop(void);
|
||||
bool Flash_WaitIdle(void);
|
||||
|
@ -122,9 +122,9 @@ void Flash_TransferAdresse(uint32_t address);
|
|||
|
||||
bool Flash_CheckBusy(uint32_t timeout);
|
||||
|
||||
void Flash_WriteEnable();
|
||||
void Flash_WriteEnable(void);
|
||||
bool Flash_WipeMemoryPage(uint8_t page);
|
||||
bool Flash_WipeMemory();
|
||||
bool Flash_WipeMemory(void);
|
||||
bool Flash_Erase4k(uint8_t block, uint8_t sector);
|
||||
//bool Flash_Erase32k(uint32_t address);
|
||||
bool Flash_Erase64k(uint8_t block);
|
||||
|
|
|
@ -373,7 +373,7 @@ static uint32_t hitag_reader_send_frame(const uint8_t *frame, size_t frame_len)
|
|||
return wait;
|
||||
}
|
||||
|
||||
uint8_t hitag_crc(uint8_t *data, size_t length) {
|
||||
static uint8_t hitag_crc(uint8_t *data, size_t length) {
|
||||
uint8_t crc = 0xff;
|
||||
unsigned int byte, bit;
|
||||
for (byte = 0; byte < ((length + 7) / 8); byte++) {
|
||||
|
@ -411,7 +411,7 @@ void fix_ac_decoding(uint8_t *input, size_t len) {
|
|||
// looks at number of received bits.
|
||||
// 0 = collision?
|
||||
// 32 = good response
|
||||
bool hitag_plain(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen, bool hitag_s) {
|
||||
static bool hitag_plain(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen, bool hitag_s) {
|
||||
uint8_t crc;
|
||||
*txlen = 0;
|
||||
switch (rxlen) {
|
||||
|
@ -480,7 +480,7 @@ bool hitag_plain(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen, bo
|
|||
}
|
||||
|
||||
|
||||
bool hitag1_authenticate(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen) {
|
||||
static bool hitag1_authenticate(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen) {
|
||||
uint8_t crc;
|
||||
*txlen = 0;
|
||||
switch (rxlen) {
|
||||
|
|
|
@ -110,7 +110,7 @@ bool end = false;
|
|||
* Implementation of the crc8 calculation from Hitag S
|
||||
* from http://www.proxmark.org/files/Documents/125%20kHz%20-%20Hitag/HitagS.V11.pdf
|
||||
*/
|
||||
void calc_crc(unsigned char *crc, unsigned char data, unsigned char Bitcount) {
|
||||
static void calc_crc(unsigned char *crc, unsigned char data, unsigned char Bitcount) {
|
||||
*crc ^= data; // crc = crc (exor) data
|
||||
do {
|
||||
if (*crc & 0x80) { // if (MSB-CRC == 1)
|
||||
|
@ -333,7 +333,7 @@ static int check_select(uint8_t *rx, uint32_t uid) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void hitagS_set_frame_modulation() {
|
||||
static void hitagS_set_frame_modulation(void) {
|
||||
switch (tag.mode) {
|
||||
case HT_STANDARD:
|
||||
sof_bits = 1;
|
||||
|
@ -1075,7 +1075,7 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) {
|
|||
DbpString("Sim Stopped");
|
||||
}
|
||||
|
||||
void hitagS_receive_frame(uint8_t *rx, size_t *rxlen, int *response) {
|
||||
static void hitagS_receive_frame(uint8_t *rx, size_t *rxlen, int *response) {
|
||||
|
||||
// Reset values for receiving frames
|
||||
memset(rx, 0x00, HITAG_FRAME_LEN * sizeof(uint8_t));
|
||||
|
|
30
armsrc/i2c.c
30
armsrc/i2c.c
|
@ -39,7 +39,7 @@ volatile unsigned long c;
|
|||
// timer.
|
||||
// I2CSpinDelayClk(4) = 12.31us
|
||||
// I2CSpinDelayClk(1) = 3.07us
|
||||
void __attribute__((optimize("O0"))) I2CSpinDelayClk(uint16_t delay) {
|
||||
static void __attribute__((optimize("O0"))) I2CSpinDelayClk(uint16_t delay) {
|
||||
for (c = delay * 2; c; c--) {};
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ void I2C_Reset_EnterBootloader(void) {
|
|||
}
|
||||
|
||||
// Wait for the clock to go High.
|
||||
bool WaitSCL_H_delay(uint32_t delay) {
|
||||
static bool WaitSCL_H_delay(uint32_t delay) {
|
||||
while (delay--) {
|
||||
if (SCL_read) {
|
||||
return true;
|
||||
|
@ -158,11 +158,11 @@ bool WaitSCL_H_delay(uint32_t delay) {
|
|||
|
||||
// 5000 * 3.07us = 15350us. 15.35ms
|
||||
// 15000 * 3.07us = 46050us. 46.05ms
|
||||
bool WaitSCL_H(void) {
|
||||
static bool WaitSCL_H(void) {
|
||||
return WaitSCL_H_delay(15000);
|
||||
}
|
||||
|
||||
bool WaitSCL_L_delay(uint32_t delay) {
|
||||
static bool WaitSCL_L_delay(uint32_t delay) {
|
||||
while (delay--) {
|
||||
if (!SCL_read) {
|
||||
return true;
|
||||
|
@ -172,14 +172,14 @@ bool WaitSCL_L_delay(uint32_t delay) {
|
|||
return false;
|
||||
}
|
||||
// 5000 * 3.07us = 15350us. 15.35ms
|
||||
bool WaitSCL_L(void) {
|
||||
static bool WaitSCL_L(void) {
|
||||
return WaitSCL_L_delay(15000);
|
||||
}
|
||||
|
||||
// Wait max 1800ms or until SCL goes LOW.
|
||||
// It timeout reading response from card
|
||||
// Which ever comes first
|
||||
bool WaitSCL_L_timeout(void) {
|
||||
static bool WaitSCL_L_timeout(void) {
|
||||
volatile uint16_t delay = 1800;
|
||||
while (delay--) {
|
||||
// exit on SCL LOW
|
||||
|
@ -191,7 +191,7 @@ bool WaitSCL_L_timeout(void) {
|
|||
return (delay == 0);
|
||||
}
|
||||
|
||||
bool I2C_Start(void) {
|
||||
static bool I2C_Start(void) {
|
||||
|
||||
I2C_DELAY_XCLK(4);
|
||||
SDA_H;
|
||||
|
@ -209,7 +209,7 @@ bool I2C_Start(void) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool I2C_WaitForSim() {
|
||||
static bool I2C_WaitForSim(void) {
|
||||
|
||||
// wait for data from card
|
||||
if (!WaitSCL_L_timeout())
|
||||
|
@ -225,7 +225,7 @@ bool I2C_WaitForSim() {
|
|||
}
|
||||
|
||||
// send i2c STOP
|
||||
void I2C_Stop(void) {
|
||||
static void I2C_Stop(void) {
|
||||
SCL_L;
|
||||
I2C_DELAY_2CLK;
|
||||
SDA_L;
|
||||
|
@ -238,7 +238,7 @@ void I2C_Stop(void) {
|
|||
}
|
||||
|
||||
// Send i2c ACK
|
||||
void I2C_Ack(void) {
|
||||
static void I2C_Ack(void) {
|
||||
SCL_L;
|
||||
I2C_DELAY_2CLK;
|
||||
SDA_L;
|
||||
|
@ -251,7 +251,7 @@ void I2C_Ack(void) {
|
|||
}
|
||||
|
||||
// Send i2c NACK
|
||||
void I2C_NoAck(void) {
|
||||
static void I2C_NoAck(void) {
|
||||
SCL_L;
|
||||
I2C_DELAY_2CLK;
|
||||
SDA_H;
|
||||
|
@ -263,7 +263,7 @@ void I2C_NoAck(void) {
|
|||
I2C_DELAY_2CLK;
|
||||
}
|
||||
|
||||
bool I2C_WaitAck(void) {
|
||||
static bool I2C_WaitAck(void) {
|
||||
SCL_L;
|
||||
I2C_DELAY_1CLK;
|
||||
SDA_H;
|
||||
|
@ -282,7 +282,7 @@ bool I2C_WaitAck(void) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void I2C_SendByte(uint8_t data) {
|
||||
static void I2C_SendByte(uint8_t data) {
|
||||
uint8_t bits = 8;
|
||||
|
||||
while (bits--) {
|
||||
|
@ -308,7 +308,7 @@ void I2C_SendByte(uint8_t data) {
|
|||
SCL_L;
|
||||
}
|
||||
|
||||
int16_t I2C_ReadByte(void) {
|
||||
static int16_t I2C_ReadByte(void) {
|
||||
uint8_t bits = 8, b = 0;
|
||||
|
||||
SDA_H;
|
||||
|
@ -623,7 +623,7 @@ int I2C_get_version(uint8_t *maj, uint8_t *min) {
|
|||
}
|
||||
|
||||
// Will read response from smart card module, retries 3 times to get the data.
|
||||
bool sc_rx_bytes(uint8_t *dest, uint8_t *destlen) {
|
||||
static bool sc_rx_bytes(uint8_t *dest, uint8_t *destlen) {
|
||||
|
||||
uint8_t i = 3;
|
||||
int16_t len = 0;
|
||||
|
|
|
@ -520,7 +520,7 @@ static RAMFUNC int OutOfNDecoding(int bit) {
|
|||
// Manchester
|
||||
//=============================================================================
|
||||
static tDemodIc Demod;
|
||||
static void DemodIcReset() {
|
||||
static void DemodIcReset(void) {
|
||||
Demod.bitCount = 0;
|
||||
Demod.posCount = 0;
|
||||
Demod.syncBit = 0;
|
||||
|
@ -985,7 +985,7 @@ void RAMFUNC SniffIClass(void) {
|
|||
switch_off();
|
||||
}
|
||||
|
||||
void rotateCSN(uint8_t *originalCSN, uint8_t *rotatedCSN) {
|
||||
static void rotateCSN(uint8_t *originalCSN, uint8_t *rotatedCSN) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++)
|
||||
rotatedCSN[i] = (originalCSN[i] >> 3) | (originalCSN[(i + 1) % 8] << 5);
|
||||
|
@ -1146,7 +1146,7 @@ static void CodeIClassTagAnswer(const uint8_t *cmd, int len) {
|
|||
}
|
||||
|
||||
// Only SOF
|
||||
static void CodeIClassTagSOF() {
|
||||
static void CodeIClassTagSOF(void) {
|
||||
//So far a dummy implementation, not used
|
||||
//int lastProxToAirDuration =0;
|
||||
|
||||
|
@ -1757,7 +1757,7 @@ static void TransmitIClassCommand(const uint8_t *cmd, int len, int *wait) {
|
|||
//-----------------------------------------------------------------------------
|
||||
// Prepare iClass reader command to send to FPGA
|
||||
//-----------------------------------------------------------------------------
|
||||
void CodeIClassCommand(const uint8_t *cmd, int len) {
|
||||
static void CodeIClassCommand(const uint8_t *cmd, int len) {
|
||||
int i, j, k;
|
||||
|
||||
ToSendReset();
|
||||
|
@ -1793,7 +1793,7 @@ void CodeIClassCommand(const uint8_t *cmd, int len) {
|
|||
ToSendMax++;
|
||||
}
|
||||
|
||||
void ReaderTransmitIClass_ext(uint8_t *frame, int len, int wait) {
|
||||
static void ReaderTransmitIClass_ext(uint8_t *frame, int len, int wait) {
|
||||
|
||||
// This is tied to other size changes
|
||||
CodeIClassCommand(frame, len);
|
||||
|
@ -1804,7 +1804,7 @@ void ReaderTransmitIClass_ext(uint8_t *frame, int len, int wait) {
|
|||
|
||||
LogTrace(frame, len, rsamples, rsamples, NULL, true);
|
||||
}
|
||||
void ReaderTransmitIClass(uint8_t *frame, int len) {
|
||||
static void ReaderTransmitIClass(uint8_t *frame, int len) {
|
||||
ReaderTransmitIClass_ext(frame, len, 330);
|
||||
}
|
||||
|
||||
|
@ -1862,7 +1862,7 @@ static int GetIClassAnswer(uint8_t *receivedResponse, int maxLen, int *wait) {
|
|||
return false;
|
||||
}
|
||||
|
||||
int ReaderReceiveIClass(uint8_t *receivedAnswer) {
|
||||
static int ReaderReceiveIClass(uint8_t *receivedAnswer) {
|
||||
|
||||
if (GetIClassAnswer(receivedAnswer, 0, NULL) == false)
|
||||
return 0;
|
||||
|
@ -1871,7 +1871,7 @@ int ReaderReceiveIClass(uint8_t *receivedAnswer) {
|
|||
return Demod.len;
|
||||
}
|
||||
|
||||
void setupIclassReader() {
|
||||
static void setupIclassReader(void) {
|
||||
|
||||
LEDsoff();
|
||||
|
||||
|
@ -1898,7 +1898,7 @@ void setupIclassReader() {
|
|||
LED_A_ON();
|
||||
}
|
||||
|
||||
bool sendCmdGetResponseWithRetries(uint8_t *command, size_t cmdsize, uint8_t *resp, uint8_t expected_size, int8_t retries) {
|
||||
static bool sendCmdGetResponseWithRetries(uint8_t *command, size_t cmdsize, uint8_t *resp, uint8_t expected_size, int8_t retries) {
|
||||
while (retries-- > 0) {
|
||||
|
||||
ReaderTransmitIClass(command, cmdsize);
|
||||
|
@ -1935,7 +1935,7 @@ bool sendCmdGetResponseWithRetries(uint8_t *command, size_t cmdsize, uint8_t *re
|
|||
* 1 = Got CSN
|
||||
* 2 = Got CSN and CC
|
||||
*/
|
||||
uint8_t handshakeIclassTag_ext(uint8_t *card_data, bool use_credit_key) {
|
||||
static uint8_t handshakeIclassTag_ext(uint8_t *card_data, bool use_credit_key) {
|
||||
|
||||
// act_all...
|
||||
static uint8_t act_all[] = { ICLASS_CMD_ACTALL };
|
||||
|
@ -2000,7 +2000,7 @@ uint8_t handshakeIclassTag_ext(uint8_t *card_data, bool use_credit_key) {
|
|||
// we got all data;
|
||||
return 2;
|
||||
}
|
||||
uint8_t handshakeIclassTag(uint8_t *card_data) {
|
||||
static uint8_t handshakeIclassTag(uint8_t *card_data) {
|
||||
return handshakeIclassTag_ext(card_data, false);
|
||||
}
|
||||
|
||||
|
@ -2458,7 +2458,7 @@ void iClass_Dump(uint8_t blockno, uint8_t numblks) {
|
|||
BigBuf_free();
|
||||
}
|
||||
|
||||
bool iClass_WriteBlock_ext(uint8_t blockno, uint8_t *data) {
|
||||
static bool iClass_WriteBlock_ext(uint8_t blockno, uint8_t *data) {
|
||||
uint8_t resp[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t write[] = { 0x80 | ICLASS_CMD_UPDATE, blockno, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
memcpy(write + 2, data, 12); // data + mac
|
||||
|
|
|
@ -191,7 +191,7 @@ const bool Mod_Miller_LUT[] = {
|
|||
#define IsMillerModulationNibble1(b) (Mod_Miller_LUT[(b & 0x000000F0) >> 4])
|
||||
#define IsMillerModulationNibble2(b) (Mod_Miller_LUT[(b & 0x0000000F)])
|
||||
|
||||
tUart14a *GetUart14a() {
|
||||
tUart14a *GetUart14a(void) {
|
||||
return &Uart;
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ const bool Mod_Manchester_LUT[] = {
|
|||
#define IsManchesterModulationNibble1(b) (Mod_Manchester_LUT[(b & 0x00F0) >> 4])
|
||||
#define IsManchesterModulationNibble2(b) (Mod_Manchester_LUT[(b & 0x000F)])
|
||||
|
||||
tDemod14a *GetDemod14a() {
|
||||
tDemod14a *GetDemod14a(void) {
|
||||
return &Demod;
|
||||
}
|
||||
void Demod14aReset(void) {
|
||||
|
@ -480,7 +480,7 @@ RAMFUNC int ManchesterDecoding(uint8_t bit, uint16_t offset, uint32_t non_real_t
|
|||
|
||||
|
||||
// Thinfilm, Kovio mangels ISO14443A in the way that they don't use start bit nor parity bits.
|
||||
RAMFUNC int ManchesterDecoding_Thinfilm(uint8_t bit) {
|
||||
static RAMFUNC int ManchesterDecoding_Thinfilm(uint8_t bit) {
|
||||
Demod.twoBits = (Demod.twoBits << 8) | bit;
|
||||
|
||||
if (Demod.state == DEMOD_14A_UNSYNCD) {
|
||||
|
@ -1613,7 +1613,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) {
|
|||
|
||||
// prepare a delayed transfer. This simply shifts ToSend[] by a number
|
||||
// of bits specified in the delay parameter.
|
||||
void PrepareDelayedTransfer(uint16_t delay) {
|
||||
static void PrepareDelayedTransfer(uint16_t delay) {
|
||||
delay &= 0x07;
|
||||
if (!delay) return;
|
||||
|
||||
|
@ -1683,7 +1683,7 @@ static void TransmitFor14443a(const uint8_t *cmd, uint16_t len, uint32_t *timing
|
|||
//-----------------------------------------------------------------------------
|
||||
// Prepare reader command (in bits, support short frames) to send to FPGA
|
||||
//-----------------------------------------------------------------------------
|
||||
void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8_t *par) {
|
||||
static void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8_t *par) {
|
||||
int last = 0;
|
||||
|
||||
ToSendReset();
|
||||
|
@ -1759,10 +1759,11 @@ void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8
|
|||
//-----------------------------------------------------------------------------
|
||||
// Prepare reader command to send to FPGA
|
||||
//-----------------------------------------------------------------------------
|
||||
void CodeIso14443aAsReaderPar(const uint8_t *cmd, uint16_t len, const uint8_t *par) {
|
||||
/*
|
||||
static void CodeIso14443aAsReaderPar(const uint8_t *cmd, uint16_t len, const uint8_t *par) {
|
||||
CodeIso14443aBitsAsReaderPar(cmd, len * 8, par);
|
||||
}
|
||||
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
// Wait for commands from reader
|
||||
// Stop when button is pressed (return 1) or field was gone (return 2)
|
||||
|
@ -2153,7 +2154,7 @@ void ReaderTransmitPar(uint8_t *frame, uint16_t len, uint8_t *par, uint32_t *tim
|
|||
ReaderTransmitBitsPar(frame, len * 8, par, timing);
|
||||
}
|
||||
|
||||
void ReaderTransmitBits(uint8_t *frame, uint16_t len, uint32_t *timing) {
|
||||
static void ReaderTransmitBits(uint8_t *frame, uint16_t len, uint32_t *timing) {
|
||||
// Generate parity and redirect
|
||||
uint8_t par[MAX_PARITY_SIZE] = {0x00};
|
||||
GetParity(frame, len / 8, par);
|
||||
|
@ -2167,7 +2168,7 @@ void ReaderTransmit(uint8_t *frame, uint16_t len, uint32_t *timing) {
|
|||
ReaderTransmitBitsPar(frame, len * 8, par, timing);
|
||||
}
|
||||
|
||||
int ReaderReceiveOffset(uint8_t *receivedAnswer, uint16_t offset, uint8_t *par) {
|
||||
static int ReaderReceiveOffset(uint8_t *receivedAnswer, uint16_t offset, uint8_t *par) {
|
||||
if (!GetIso14443aAnswerFromTag(receivedAnswer, par, offset))
|
||||
return false;
|
||||
LogTrace(receivedAnswer, Demod.len, Demod.startTime * 16 - DELAY_AIR2ARM_AS_READER, Demod.endTime * 16 - DELAY_AIR2ARM_AS_READER, par, false);
|
||||
|
@ -2769,7 +2770,7 @@ OUT:
|
|||
// Determine the distance between two nonces.
|
||||
// Assume that the difference is small, but we don't know which is first.
|
||||
// Therefore try in alternating directions.
|
||||
int32_t dist_nt(uint32_t nt1, uint32_t nt2) {
|
||||
static int32_t dist_nt(uint32_t nt1, uint32_t nt2) {
|
||||
|
||||
if (nt1 == nt2) return 0;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ static struct {
|
|||
uint8_t *output;
|
||||
} Uart;
|
||||
|
||||
static void Uart14bReset() {
|
||||
static void Uart14bReset(void) {
|
||||
Uart.state = STATE_14B_UNSYNCD;
|
||||
Uart.shiftReg = 0;
|
||||
Uart.bitCnt = 0;
|
||||
|
@ -134,7 +134,7 @@ static struct {
|
|||
} Demod;
|
||||
|
||||
// Clear out the state of the "UART" that receives from the tag.
|
||||
static void Demod14bReset() {
|
||||
static void Demod14bReset(void) {
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
Demod.bitCount = 0;
|
||||
Demod.posCount = 0;
|
||||
|
@ -765,7 +765,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
|
||||
// The soft decision on the bit uses an estimate of just the
|
||||
// quadrant of the reference angle, not the exact angle.
|
||||
#define MAKE_SOFT_DECISION() { \
|
||||
#define MAKE_SOFT_DECISION(void) { \
|
||||
if (Demod.sumI > 0) { \
|
||||
v = ci; \
|
||||
} else { \
|
||||
|
@ -780,7 +780,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
|
||||
// Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by abs(ci) + abs(cq)
|
||||
// Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by max(abs(ci),abs(cq)) + 1/2*min(abs(ci),abs(cq)))
|
||||
#define CHECK_FOR_SUBCARRIER_old() { \
|
||||
#define CHECK_FOR_SUBCARRIER_old(void) { \
|
||||
if (ci < 0) { \
|
||||
if (cq < 0) { /* ci < 0, cq < 0 */ \
|
||||
if (cq < ci) { \
|
||||
|
@ -813,7 +813,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
}
|
||||
|
||||
//note: couldn't we just use MAX(ABS(ci),ABS(cq)) + (MIN(ABS(ci),ABS(cq))/2) from common.h - marshmellow
|
||||
#define CHECK_FOR_SUBCARRIER() { v = MAX(myI, myQ) + (MIN(myI, myQ) >> 1); }
|
||||
#define CHECK_FOR_SUBCARRIER(void) { v = MAX(myI, myQ) + (MIN(myI, myQ) >> 1); }
|
||||
|
||||
switch (Demod.state) {
|
||||
case DEMOD_UNSYNCD:
|
||||
|
@ -964,7 +964,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
* Demodulate the samples we received from the tag, also log to tracebuffer
|
||||
* quiet: set to 'TRUE' to disable debug output
|
||||
*/
|
||||
static void GetTagSamplesFor14443bDemod() {
|
||||
static void GetTagSamplesFor14443bDemod(void) {
|
||||
bool finished = false;
|
||||
// int lastRxCounter = ISO14443B_DMA_BUFFER_SIZE;
|
||||
uint32_t time_0 = 0, time_stop = 0;
|
||||
|
@ -1195,7 +1195,7 @@ uint8_t iso14443b_apdu(uint8_t const *message, size_t message_length, uint8_t *r
|
|||
/**
|
||||
* SRx Initialise.
|
||||
*/
|
||||
uint8_t iso14443b_select_srx_card(iso14b_card_select_t *card) {
|
||||
static uint8_t iso14443b_select_srx_card(iso14b_card_select_t *card) {
|
||||
// INITIATE command: wake up the tag using the INITIATE
|
||||
static const uint8_t init_srx[] = { ISO14443B_INITIATE, 0x00, 0x97, 0x5b };
|
||||
// SELECT command (with space for CRC)
|
||||
|
@ -1332,7 +1332,7 @@ uint8_t iso14443b_select_card(iso14b_card_select_t *card) {
|
|||
|
||||
// Set up ISO 14443 Type B communication (similar to iso14443a_setup)
|
||||
// field is setup for "Sending as Reader"
|
||||
void iso14443b_setup() {
|
||||
void iso14443b_setup(void) {
|
||||
LEDsoff();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
||||
|
@ -1577,7 +1577,7 @@ void RAMFUNC SniffIso14443b(void) {
|
|||
switch_off();
|
||||
}
|
||||
|
||||
void iso14b_set_trigger(bool enable) {
|
||||
static void iso14b_set_trigger(bool enable) {
|
||||
trigger = enable;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
# define AddCrc14B(data, len) compute_crc(CRC_14443_B, (data), (len), (data)+(len), (data)+(len)+1)
|
||||
#endif
|
||||
|
||||
void iso14443b_setup();
|
||||
void iso14443b_setup(void);
|
||||
uint8_t iso14443b_apdu(uint8_t const *message, size_t message_length, uint8_t *response);
|
||||
uint8_t iso14443b_select_card(iso14b_card_select_t *card);
|
||||
uint8_t iso14443b_select_card_srx(iso14b_card_select_t *card);
|
||||
|
|
|
@ -703,7 +703,7 @@ static void BuildInventoryResponse(uint8_t *cmdout, uint8_t *uid) {
|
|||
// If you do not need the answer use NULL for *recv[]
|
||||
// return: length of received data
|
||||
// logging enabled
|
||||
int SendDataTag(uint8_t *send, int sendlen, bool init, int speed, uint8_t *outdata) {
|
||||
static int SendDataTag(uint8_t *send, int sendlen, bool init, int speed, uint8_t *outdata) {
|
||||
|
||||
int t_samples = 0, wait = 0, elapsed = 0, answer_len = 0;
|
||||
|
||||
|
@ -741,7 +741,7 @@ int SendDataTag(uint8_t *send, int sendlen, bool init, int speed, uint8_t *outda
|
|||
|
||||
// Decodes a message from a tag and displays its metadata and content
|
||||
#define DBD15STATLEN 48
|
||||
void DbdecodeIso15693Answer(int len, uint8_t *d) {
|
||||
static void DbdecodeIso15693Answer(int len, uint8_t *d) {
|
||||
|
||||
if (len > 3) {
|
||||
char status[DBD15STATLEN + 1] = {0};
|
||||
|
|
|
@ -65,7 +65,7 @@ static uint32_t last_frame_end; /* ts of last bit of previews rx or tx frame */
|
|||
// I/O interface abstraction (FPGA -> ARM)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static inline uint8_t rx_byte_from_fpga() {
|
||||
static inline uint8_t rx_byte_from_fpga(void) {
|
||||
for (;;) {
|
||||
WDT_HIT();
|
||||
|
||||
|
@ -94,9 +94,9 @@ static inline uint8_t rx_byte_from_fpga() {
|
|||
// on a i/q pair from two subsequent correlations, but does not matter.
|
||||
// Note: inlining this function would fail with -Os
|
||||
#ifdef __OPTIMIZE_SIZE__
|
||||
static int32_t sample_power() {
|
||||
static int32_t sample_power(void) {
|
||||
#else
|
||||
static inline int32_t sample_power() {
|
||||
static inline int32_t sample_power(void) {
|
||||
#endif
|
||||
int32_t q = (int8_t)rx_byte_from_fpga();
|
||||
q = ABS(q);
|
||||
|
@ -113,7 +113,7 @@ static inline int32_t sample_power() {
|
|||
//
|
||||
// Note: The demodulator would be drifting (18.9us * 5 != 100us), rx_frame
|
||||
// has a delay loop that aligns rx_bit calls to the TAG tx timeslots.
|
||||
static inline bool rx_bit() {
|
||||
static inline bool rx_bit(void) {
|
||||
int32_t power;
|
||||
|
||||
for (size_t i = 0; i < 5; ++i) {
|
||||
|
@ -211,7 +211,7 @@ static uint32_t rx_frame(uint8_t len) {
|
|||
return frame;
|
||||
}
|
||||
|
||||
static bool rx_ack() {
|
||||
static bool rx_ack(void) {
|
||||
// change fpga into rx mode
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR
|
||||
| FPGA_HF_READER_RX_XCORR_848_KHZ
|
||||
|
@ -387,7 +387,7 @@ static int16_t read_byte(uint16_t index, uint8_t cmd_sz) {
|
|||
|
||||
// Transmit write command, wait until (3.6ms) the tag sends back an unencrypted
|
||||
// ACK ('1' bit) and forward the prng time based.
|
||||
bool write_byte(uint16_t index, uint8_t byte, uint8_t addr_sz) {
|
||||
static bool write_byte(uint16_t index, uint8_t byte, uint8_t addr_sz) {
|
||||
uint32_t cmd = index << 1 | LEGIC_WRITE; // prepare command
|
||||
uint8_t crc = calc_crc4(cmd, addr_sz + 1, byte); // calculate crc
|
||||
cmd |= byte << (addr_sz + 1); // append value
|
||||
|
|
|
@ -88,7 +88,7 @@ static inline bool wait_for(bool value, const uint32_t timeout) {
|
|||
// - A bit length >80.2us is a 1
|
||||
// - A bit length <80.2us is a 0
|
||||
// - A bit length >148.6us is a code violation
|
||||
static inline int8_t rx_bit() {
|
||||
static inline int8_t rx_bit(void) {
|
||||
// backup ts for threshold calculation
|
||||
uint32_t bit_start = last_frame_end;
|
||||
|
||||
|
@ -187,7 +187,7 @@ static void tx_frame(uint32_t frame, uint8_t len) {
|
|||
LogTrace(cmdbytes, sizeof(cmdbytes), last_frame_start, last_frame_end, NULL, false);
|
||||
}
|
||||
|
||||
static void tx_ack() {
|
||||
static void tx_ack(void) {
|
||||
// wait for ack timeslot
|
||||
last_frame_end += TAG_ACK_WAIT;
|
||||
legic_prng_forward(TAG_ACK_WAIT / TAG_BIT_PERIOD - 1);
|
||||
|
@ -308,7 +308,7 @@ static int32_t init_card(uint8_t cardtype, legic_card_select_t *p_card) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void init_tag() {
|
||||
static void init_tag(void) {
|
||||
// configure FPGA
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SIMULATOR
|
||||
|
|
|
@ -65,7 +65,7 @@ void lf_sample_mean(void) {
|
|||
Dbprintf("LF ADC average %u", adc_avg);
|
||||
}
|
||||
|
||||
size_t lf_count_edge_periods_ex(size_t max, bool wait, bool detect_gap) {
|
||||
static size_t lf_count_edge_periods_ex(size_t max, bool wait, bool detect_gap) {
|
||||
size_t periods = 0;
|
||||
volatile uint8_t adc_val;
|
||||
uint8_t avg_peak = adc_avg + 3, avg_through = adc_avg - 3;
|
||||
|
@ -132,7 +132,7 @@ size_t lf_detect_gap(size_t max) {
|
|||
return lf_count_edge_periods_ex(max, false, true);
|
||||
}
|
||||
|
||||
void lf_reset_counter() {
|
||||
void lf_reset_counter(void) {
|
||||
|
||||
// TODO: find out the correct reset settings for tag and reader mode
|
||||
// if (reader_mode) {
|
||||
|
@ -147,11 +147,11 @@ void lf_reset_counter() {
|
|||
// }
|
||||
}
|
||||
|
||||
bool lf_get_tag_modulation() {
|
||||
bool lf_get_tag_modulation(void) {
|
||||
return (rising_edge == false);
|
||||
}
|
||||
|
||||
bool lf_get_reader_modulation() {
|
||||
bool lf_get_reader_modulation(void) {
|
||||
return rising_edge;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ void lf_init(bool reader, bool simulate) {
|
|||
lf_sample_mean();
|
||||
}
|
||||
|
||||
void lf_finalize() {
|
||||
void lf_finalize(void) {
|
||||
// Disable timers
|
||||
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
|
||||
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKDIS;
|
||||
|
|
|
@ -21,15 +21,15 @@ void lf_sample_mean(void);
|
|||
bool lf_test_periods(size_t expected, size_t count);
|
||||
size_t lf_count_edge_periods(size_t max);
|
||||
size_t lf_detect_gap(size_t max);
|
||||
void lf_reset_counter();
|
||||
void lf_reset_counter(void);
|
||||
|
||||
bool lf_get_tag_modulation();
|
||||
bool lf_get_reader_modulation();
|
||||
bool lf_get_tag_modulation(void);
|
||||
bool lf_get_reader_modulation(void);
|
||||
|
||||
void lf_wait_periods(size_t periods);
|
||||
//void lf_init(bool reader);
|
||||
void lf_init(bool reader, bool simulate);
|
||||
void lf_finalize();
|
||||
void lf_finalize(void);
|
||||
size_t lf_detect_field_drop(size_t max);
|
||||
bool lf_manchester_send_bytes(const uint8_t *frame, size_t frame_len);
|
||||
void lf_modulation(bool modulation);
|
||||
|
|
|
@ -622,7 +622,7 @@ void ReadTItag(void) {
|
|||
StopTicks();
|
||||
}
|
||||
|
||||
void WriteTIbyte(uint8_t b) {
|
||||
static void WriteTIbyte(uint8_t b) {
|
||||
int i = 0;
|
||||
|
||||
// modulate 8 bits out to the antenna
|
||||
|
@ -1574,7 +1574,7 @@ void TurnReadLFOn(uint32_t delay) {
|
|||
//int adcval = ((MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10);
|
||||
WaitUS(delay);
|
||||
}
|
||||
void TurnReadLF_off(uint32_t delay) {
|
||||
static void TurnReadLF_off(uint32_t delay) {
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
WaitUS(delay);
|
||||
}
|
||||
|
@ -1586,7 +1586,7 @@ void TurnReadLF_off(uint32_t delay) {
|
|||
#define T55_LLR_REF (136 * 8)
|
||||
|
||||
// Write one bit to chip
|
||||
void T55xxWriteBit(uint8_t bit, uint8_t downlink_idx) {
|
||||
static void T55xxWriteBit(uint8_t bit, uint8_t downlink_idx) {
|
||||
|
||||
switch (bit) {
|
||||
case 0 :
|
||||
|
@ -1622,7 +1622,7 @@ void T55xxWriteBit(uint8_t bit, uint8_t downlink_idx) {
|
|||
// num_bits - how many bits (low x bits of data) Max 32 bits at a time
|
||||
// max_len - how many bytes can the bit_array hold (ensure no buffer overflow)
|
||||
// returns "Next" bit offset / bits stored (for next store)
|
||||
uint8_t T55xx_SetBits(uint8_t *bs, uint8_t start_offset, uint32_t data, uint8_t num_bits, uint8_t max_len) {
|
||||
static uint8_t T55xx_SetBits(uint8_t *bs, uint8_t start_offset, uint32_t data, uint8_t num_bits, uint8_t max_len) {
|
||||
int8_t next_offset = start_offset;
|
||||
|
||||
// Check if data will fit.
|
||||
|
@ -1646,7 +1646,7 @@ uint8_t T55xx_SetBits(uint8_t *bs, uint8_t start_offset, uint32_t data, uint8_t
|
|||
}
|
||||
|
||||
// Send one downlink command to the card
|
||||
void T55xx_SendCMD(uint32_t data, uint32_t pwd, uint16_t arg) {
|
||||
static void T55xx_SendCMD(uint32_t data, uint32_t pwd, uint16_t arg) {
|
||||
|
||||
/*
|
||||
arg bits
|
||||
|
@ -2108,7 +2108,7 @@ void T55xxWakeUp(uint32_t pwd, uint8_t flags) {
|
|||
|
||||
|
||||
/*-------------- Cloning routines -----------*/
|
||||
void WriteT55xx(uint32_t *blockdata, uint8_t startblock, uint8_t numblocks) {
|
||||
static void WriteT55xx(uint32_t *blockdata, uint8_t startblock, uint8_t numblocks) {
|
||||
|
||||
t55xx_write_block_t cmd;
|
||||
cmd.pwd = 0;
|
||||
|
@ -2300,7 +2300,7 @@ uint8_t *fwd_write_ptr; //forwardlink bit pointer
|
|||
// These timings work for 4469/4269/4305 (with the 55*8 above)
|
||||
// WRITE_0 = 23*8 , 9*8
|
||||
|
||||
uint8_t Prepare_Cmd(uint8_t cmd) {
|
||||
static uint8_t Prepare_Cmd(uint8_t cmd) {
|
||||
|
||||
*forward_ptr++ = 0; //start bit
|
||||
*forward_ptr++ = 0; //second pause for 4050 code
|
||||
|
@ -2320,7 +2320,7 @@ uint8_t Prepare_Cmd(uint8_t cmd) {
|
|||
// prepares address bits
|
||||
// see EM4469 spec
|
||||
//====================================================================
|
||||
uint8_t Prepare_Addr(uint8_t addr) {
|
||||
static uint8_t Prepare_Addr(uint8_t addr) {
|
||||
|
||||
register uint8_t line_parity;
|
||||
|
||||
|
@ -2341,7 +2341,7 @@ uint8_t Prepare_Addr(uint8_t addr) {
|
|||
// prepares data bits intreleaved with parity bits
|
||||
// see EM4469 spec
|
||||
//====================================================================
|
||||
uint8_t Prepare_Data(uint16_t data_low, uint16_t data_hi) {
|
||||
static uint8_t Prepare_Data(uint16_t data_low, uint16_t data_hi) {
|
||||
|
||||
register uint8_t column_parity;
|
||||
register uint8_t i, j;
|
||||
|
@ -2377,7 +2377,7 @@ uint8_t Prepare_Data(uint16_t data_low, uint16_t data_hi) {
|
|||
// Requires: forwarLink_data filled with valid bits (1 bit per byte)
|
||||
// fwd_bit_count set with number of bits to be sent
|
||||
//====================================================================
|
||||
void SendForward(uint8_t fwd_bit_count) {
|
||||
static void SendForward(uint8_t fwd_bit_count) {
|
||||
|
||||
// iceman, 21.3us increments for the USclock verification.
|
||||
// 55FC * 8us == 440us / 21.3 === 20.65 steps. could be too short. Go for 56FC instead
|
||||
|
@ -2411,7 +2411,7 @@ void SendForward(uint8_t fwd_bit_count) {
|
|||
}
|
||||
}
|
||||
|
||||
void EM4xLogin(uint32_t pwd) {
|
||||
static void EM4xLogin(uint32_t pwd) {
|
||||
uint8_t len;
|
||||
forward_ptr = forwardLink_data;
|
||||
len = Prepare_Cmd(FWD_CMD_LOGIN);
|
||||
|
|
|
@ -29,7 +29,7 @@ Default LF config is set to:
|
|||
*/
|
||||
sample_config config = { 1, 8, 1, LF_DIVISOR_125, 0, 0, 1} ;
|
||||
|
||||
void printConfig() {
|
||||
void printConfig(void) {
|
||||
uint32_t d = config.divisor;
|
||||
DbpString(_BLUE_("LF Sampling config"));
|
||||
Dbprintf(" [q] divisor.............%d ( "_GREEN_("%d.%02d kHz")")", d, 12000 / (d + 1), ((1200000 + (d + 1) / 2) / (d + 1)) - ((12000 / (d + 1)) * 100));
|
||||
|
@ -90,7 +90,7 @@ sample_config *getSamplingConfig(void) {
|
|||
* @param stream
|
||||
* @param bit
|
||||
*/
|
||||
void pushBit(BitstreamOut *stream, uint8_t bit) {
|
||||
static void pushBit(BitstreamOut *stream, uint8_t bit) {
|
||||
int bytepos = stream->position >> 3; // divide by 8
|
||||
int bitpos = stream->position & 7;
|
||||
*(stream->buffer + bytepos) &= ~(1 << (7 - bitpos));
|
||||
|
@ -143,7 +143,7 @@ void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) {
|
|||
samples.total_saved = 0;
|
||||
}
|
||||
|
||||
uint32_t getSampleCounter() {
|
||||
uint32_t getSampleCounter(void) {
|
||||
return samples.total_saved;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ uint32_t DoPartialAcquisition(int trigger_threshold, bool verbose, uint32_t samp
|
|||
return DoAcquisition(1, 8, 0, trigger_threshold, verbose, sample_size, cancel_after, 0);
|
||||
}
|
||||
|
||||
uint32_t ReadLF(bool reader_field, bool verbose, uint32_t sample_size) {
|
||||
static uint32_t ReadLF(bool reader_field, bool verbose, uint32_t sample_size) {
|
||||
if (verbose)
|
||||
printConfig();
|
||||
|
||||
|
@ -368,7 +368,7 @@ uint32_t SampleLF(bool verbose, uint32_t sample_size) {
|
|||
* Initializes the FPGA for sniffer-mode (field off), and acquires the samples.
|
||||
* @return number of bits sampled
|
||||
**/
|
||||
uint32_t SniffLF() {
|
||||
uint32_t SniffLF(void) {
|
||||
BigBuf_Clear_ext(false);
|
||||
return ReadLF(false, true, 0);
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ void doCotagAcquisition(size_t sample_size) {
|
|||
computeSignalProperties(dest, bufsize);
|
||||
}
|
||||
|
||||
uint32_t doCotagAcquisitionManchester() {
|
||||
uint32_t doCotagAcquisitionManchester(void) {
|
||||
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
uint16_t bufsize = BigBuf_max_traceLen();
|
||||
|
|
|
@ -40,7 +40,7 @@ uint32_t SampleLF(bool verbose, uint32_t sample_size);
|
|||
* Initializes the FPGA for sniff-mode (field off), and acquires the samples.
|
||||
* @return number of bits sampled
|
||||
**/
|
||||
uint32_t SniffLF();
|
||||
uint32_t SniffLF(void);
|
||||
|
||||
uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, int16_t trigger_threshold,
|
||||
bool verbose, uint32_t sample_size, uint32_t cancel_after, int32_t samples_to_skip);
|
||||
|
@ -73,7 +73,7 @@ void initSampleBuffer(uint32_t *sample_size);
|
|||
void initSampleBufferEx(uint32_t *sample_size, bool use_malloc);
|
||||
void logSampleSimple(uint8_t sample);
|
||||
void logSample(uint8_t sample, uint8_t decimation, uint8_t bits_per_sample, bool avg);
|
||||
uint32_t getSampleCounter();
|
||||
uint32_t getSampleCounter(void);
|
||||
|
||||
/**
|
||||
* Setup the FPGA to listen for samples. This method downloads the FPGA bitstream
|
||||
|
@ -97,8 +97,8 @@ void LFSetupFPGAForADC(int divisor, bool reader_field);
|
|||
*/
|
||||
void setSamplingConfig(sample_config *sc);
|
||||
|
||||
sample_config *getSamplingConfig();
|
||||
sample_config *getSamplingConfig(void);
|
||||
|
||||
void printConfig();
|
||||
void printConfig(void);
|
||||
|
||||
#endif // __LFSAMPLING_H
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
// send an incomplete dummy response in order to trigger the card's authentication failure timeout
|
||||
#ifndef CHK_TIMEOUT
|
||||
# define CHK_TIMEOUT() { \
|
||||
# define CHK_TIMEOUT(void) { \
|
||||
ReaderTransmit(&dummy_answer, 1, NULL); \
|
||||
uint32_t timeout = GetCountSspClk() + HARDNESTED_AUTHENTICATION_TIMEOUT; \
|
||||
while (GetCountSspClk() < timeout) {}; \
|
||||
|
@ -627,7 +627,7 @@ void MifareUSetPwd(uint8_t arg0, uint8_t *datain) {
|
|||
}
|
||||
|
||||
// Return 1 if the nonce is invalid else return 0
|
||||
int valid_nonce(uint32_t Nt, uint32_t NtEnc, uint32_t Ks1, uint8_t *parity) {
|
||||
static int valid_nonce(uint32_t Nt, uint32_t NtEnc, uint32_t Ks1, uint8_t *parity) {
|
||||
return ((oddparity8((Nt >> 24) & 0xFF) == ((parity[0]) ^ oddparity8((NtEnc >> 24) & 0xFF) ^ BIT(Ks1, 16))) & \
|
||||
(oddparity8((Nt >> 16) & 0xFF) == ((parity[1]) ^ oddparity8((NtEnc >> 16) & 0xFF) ^ BIT(Ks1, 8))) & \
|
||||
(oddparity8((Nt >> 8) & 0xFF) == ((parity[2]) ^ oddparity8((NtEnc >> 8) & 0xFF) ^ BIT(Ks1, 0)))) ? 1 : 0;
|
||||
|
@ -1229,7 +1229,7 @@ typedef struct chk_t {
|
|||
// 2 = failed to select.
|
||||
// 1 = wrong key
|
||||
// 0 = correct key
|
||||
uint8_t chkKey(struct chk_t *c) {
|
||||
static uint8_t chkKey(struct chk_t *c) {
|
||||
uint8_t i = 0, res = 2;
|
||||
while (i < 5) {
|
||||
// this part is from Piwi's faster nonce collecting part in Hardnested.
|
||||
|
@ -1250,7 +1250,7 @@ uint8_t chkKey(struct chk_t *c) {
|
|||
return res;
|
||||
}
|
||||
|
||||
uint8_t chkKey_readb(struct chk_t *c, uint8_t *keyb) {
|
||||
static uint8_t chkKey_readb(struct chk_t *c, uint8_t *keyb) {
|
||||
|
||||
if (!iso14443a_fast_select_card(c->uid, c->cl))
|
||||
return 2;
|
||||
|
@ -1275,7 +1275,7 @@ uint8_t chkKey_readb(struct chk_t *c, uint8_t *keyb) {
|
|||
return res;
|
||||
}
|
||||
|
||||
void chkKey_scanA(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
static void chkKey_scanA(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
for (uint8_t s = 0; s < *sectorcnt; s++) {
|
||||
|
||||
// skip already found A keys
|
||||
|
@ -1293,7 +1293,7 @@ void chkKey_scanA(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, ui
|
|||
}
|
||||
}
|
||||
|
||||
void chkKey_scanB(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
static void chkKey_scanB(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
for (uint8_t s = 0; s < *sectorcnt; s++) {
|
||||
|
||||
// skip already found B keys
|
||||
|
@ -1313,7 +1313,7 @@ void chkKey_scanB(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, ui
|
|||
|
||||
// loop all A keys,
|
||||
// when A is found but not B, try to read B.
|
||||
void chkKey_loopBonly(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
static void chkKey_loopBonly(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
|
||||
// read Block B, if A is found.
|
||||
for (uint8_t s = 0; s < *sectorcnt; ++s) {
|
||||
|
@ -2190,7 +2190,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain) {
|
|||
OnSuccessMagic();
|
||||
}
|
||||
|
||||
void MifareCIdent() {
|
||||
void MifareCIdent(void) {
|
||||
// variables
|
||||
uint8_t isGen = 0;
|
||||
uint8_t rec[1] = {0x00};
|
||||
|
@ -2248,7 +2248,7 @@ OUT:
|
|||
BigBuf_free();
|
||||
}
|
||||
|
||||
void MifareHasStaticNonce() {
|
||||
void MifareHasStaticNonce(void) {
|
||||
|
||||
// variables
|
||||
int retval = PM3_SUCCESS, len;
|
||||
|
@ -2297,7 +2297,7 @@ OUT:
|
|||
crypto1_deinit(pcs);
|
||||
}
|
||||
|
||||
void OnSuccessMagic() {
|
||||
void OnSuccessMagic(void) {
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
set_tracing(false);
|
||||
|
|
|
@ -41,14 +41,14 @@ int MifareECardLoadExt(uint8_t sectorcnt, uint8_t keytype);
|
|||
|
||||
void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain); // Work with "magic Chinese" card
|
||||
void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain);
|
||||
void MifareCIdent(); // is "magic chinese" card?
|
||||
void MifareHasStaticNonce(); // Has the tag a static nonce?
|
||||
void MifareCIdent(void); // is "magic chinese" card?
|
||||
void MifareHasStaticNonce(void); // Has the tag a static nonce?
|
||||
|
||||
void MifareSetMod(uint8_t *datain);
|
||||
void MifarePersonalizeUID(uint8_t keyType, uint8_t perso_option, uint64_t key);
|
||||
|
||||
void MifareUSetPwd(uint8_t arg0, uint8_t *datain);
|
||||
void OnSuccessMagic();
|
||||
void OnSuccessMagic(void);
|
||||
void OnErrorMagic(uint8_t reason);
|
||||
|
||||
int32_t dist_nt(uint32_t nt1, uint32_t nt2);
|
||||
|
|
|
@ -36,7 +36,7 @@ static uint8_t deselect_cmd[] = {0xc2, 0xe0, 0xb4};
|
|||
struct desfire_key skey = {0};
|
||||
static desfirekey_t sessionkey = &skey;
|
||||
|
||||
bool InitDesfireCard() {
|
||||
bool InitDesfireCard(void) {
|
||||
|
||||
pcb_blocknum = 0;
|
||||
|
||||
|
@ -107,7 +107,7 @@ void MifareSendCommand(uint8_t *datain) {
|
|||
LED_B_OFF();
|
||||
}
|
||||
|
||||
void MifareDesfireGetInformation() {
|
||||
void MifareDesfireGetInformation(void) {
|
||||
|
||||
LEDsoff();
|
||||
|
||||
|
@ -683,7 +683,7 @@ size_t CreateAPDU(uint8_t *datain, size_t len, uint8_t *dataout) {
|
|||
// crc_update(&desfire_crc32, byte, 8);
|
||||
// uint32_t crc = crc_finish(&desfire_crc32);
|
||||
|
||||
void OnSuccess() {
|
||||
void OnSuccess(void) {
|
||||
pcb_blocknum = 0;
|
||||
ReaderTransmit(deselect_cmd, 3, NULL);
|
||||
if (mifare_ultra_halt()) {
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
bool InitDesfireCard();
|
||||
bool InitDesfireCard(void);
|
||||
void MifareSendCommand(uint8_t *datain);
|
||||
void MifareDesfireGetInformation();
|
||||
void MifareDesfireGetInformation(void);
|
||||
void MifareDES_Auth1(uint8_t *datain);
|
||||
void ReaderMifareDES(uint32_t param, uint32_t param2, uint8_t *datain);
|
||||
int DesfireAPDU(uint8_t *cmd, size_t cmd_len, uint8_t *dataout);
|
||||
size_t CreateAPDU(uint8_t *datain, size_t len, uint8_t *dataout);
|
||||
void OnSuccess();
|
||||
void OnSuccess(void);
|
||||
void OnError(uint8_t reason);
|
||||
void OnErrorNG(uint16_t cmd, uint8_t reason);
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ bool RAMFUNC MfSniffLogic(const uint8_t *data, uint16_t len, uint8_t *parity, ui
|
|||
}
|
||||
*/
|
||||
|
||||
void RAMFUNC MfSniffSend() {
|
||||
void RAMFUNC MfSniffSend(void) {
|
||||
uint16_t tracelen = BigBuf_get_traceLen();
|
||||
int packlen = tracelen; // total number of bytes to send
|
||||
uint8_t *data = BigBuf_get_addr();
|
||||
|
|
|
@ -355,7 +355,7 @@ int mifare_ultra_auth(uint8_t *keybytes) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int mifare_ultra_readblockEx(uint8_t blockNo, uint8_t *blockData) {
|
||||
static int mifare_ultra_readblockEx(uint8_t blockNo, uint8_t *blockData) {
|
||||
uint16_t len = 0;
|
||||
uint8_t bt[2] = {0x00, 0x00};
|
||||
uint8_t receivedAnswer[MAX_FRAME_SIZE] = {0x00};
|
||||
|
@ -509,7 +509,7 @@ int mifare_classic_halt(struct Crypto1State *pcs, uint32_t uid) {
|
|||
return mifare_classic_halt_ex(pcs);
|
||||
}
|
||||
|
||||
int mifare_ultra_halt() {
|
||||
int mifare_ultra_halt(void) {
|
||||
uint16_t len = 0;
|
||||
uint8_t receivedAnswer[4] = {0x00, 0x00, 0x00, 0x00};
|
||||
len = mifare_sendcmd_short(NULL, CRYPT_NONE, ISO14443A_CMD_HALT, 0x00, receivedAnswer, NULL, NULL);
|
||||
|
|
|
@ -75,7 +75,7 @@ int mifare_ultra_auth(uint8_t *keybytes);
|
|||
int mifare_ultra_readblock(uint8_t blockNo, uint8_t *blockData);
|
||||
//int mifare_ultra_writeblock_compat(uint8_t blockNo, uint8_t *blockData);
|
||||
int mifare_ultra_writeblock(uint8_t blockNo, uint8_t *blockData);
|
||||
int mifare_ultra_halt();
|
||||
int mifare_ultra_halt(void);
|
||||
|
||||
// desfire
|
||||
int mifare_sendcmd_special(struct Crypto1State *pcs, uint8_t crypted, uint8_t cmd, uint8_t *data, uint8_t *answer, uint8_t *answer_parity, uint32_t *timing);
|
||||
|
|
|
@ -173,7 +173,7 @@ bool IsBlock1PCF7931(uint8_t *block) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ReadPCF7931() {
|
||||
void ReadPCF7931(void) {
|
||||
int found_blocks = 0; // successfully read blocks
|
||||
int max_blocks = 8; // readable blocks
|
||||
uint8_t memory_blocks[8][17]; // PCF content
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
size_t DemodPCF7931(uint8_t **outBlocks);
|
||||
bool IsBlock0PCF7931(uint8_t *block);
|
||||
bool IsBlock1PCF7931(uint8_t *block);
|
||||
void ReadPCF7931();
|
||||
void ReadPCF7931(void);
|
||||
void SendCmdPCF7931(uint32_t *tab);
|
||||
bool AddBytePCF7931(uint8_t byte, uint32_t *tab, int32_t l, int32_t p);
|
||||
bool AddBitPCF7931(bool b, uint32_t *tab, int32_t l, int32_t p);
|
||||
|
|
|
@ -108,7 +108,7 @@ static enum spiffs_mount_status {
|
|||
RDV40_SPIFFS_UNKNOWN
|
||||
} RDV40_SPIFFS_MOUNT_STATUS;
|
||||
|
||||
int rdv40_spiffs_mounted() {
|
||||
static int rdv40_spiffs_mounted(void) {
|
||||
int ret = 0;
|
||||
|
||||
switch (RDV40_SPIFFS_MOUNT_STATUS) {
|
||||
|
@ -124,7 +124,7 @@ int rdv40_spiffs_mounted() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int rdv40_spiffs_mount() {
|
||||
int rdv40_spiffs_mount(void) {
|
||||
if (rdv40_spiffs_mounted()) {
|
||||
Dbprintf("ERR: SPIFFS already mounted !");
|
||||
return SPIFFS_ERR_MOUNTED;
|
||||
|
@ -146,7 +146,7 @@ int rdv40_spiffs_mount() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int rdv40_spiffs_unmount() {
|
||||
int rdv40_spiffs_unmount(void) {
|
||||
if (!rdv40_spiffs_mounted()) {
|
||||
Dbprintf("ERR: SPIFFS not mounted !");
|
||||
return SPIFFS_ERR_NOT_MOUNTED;
|
||||
|
@ -162,7 +162,7 @@ int rdv40_spiffs_unmount() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int rdv40_spiffs_check() {
|
||||
int rdv40_spiffs_check(void) {
|
||||
rdv40_spiffs_lazy_mount();
|
||||
SPIFFS_check(&fs);
|
||||
SPIFFS_gc_quick(&fs, 0);
|
||||
|
@ -195,17 +195,17 @@ void read_from_spiffs(const char *filename, uint8_t *dst, uint32_t size) {
|
|||
SPIFFS_close(&fs, fd);
|
||||
}
|
||||
|
||||
void rename_in_spiffs(const char *old_filename, const char *new_filename) {
|
||||
static void rename_in_spiffs(const char *old_filename, const char *new_filename) {
|
||||
if (SPIFFS_rename(&fs, old_filename, new_filename) < 0)
|
||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||
}
|
||||
|
||||
void remove_from_spiffs(const char *filename) {
|
||||
static void remove_from_spiffs(const char *filename) {
|
||||
if (SPIFFS_remove(&fs, filename) < 0)
|
||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||
}
|
||||
|
||||
spiffs_stat stat_in_spiffs(const char *filename) {
|
||||
static spiffs_stat stat_in_spiffs(const char *filename) {
|
||||
spiffs_stat s;
|
||||
if (SPIFFS_stat(&fs, filename, &s) < 0)
|
||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||
|
@ -217,7 +217,7 @@ uint32_t size_in_spiffs(const char *filename) {
|
|||
return s.size;
|
||||
}
|
||||
|
||||
rdv40_spiffs_fsinfo info_of_spiffs() {
|
||||
static rdv40_spiffs_fsinfo info_of_spiffs(void) {
|
||||
rdv40_spiffs_fsinfo fsinfo;
|
||||
fsinfo.blockSize = SPIFFS_CFG_LOG_BLOCK_SZ;
|
||||
fsinfo.pageSize = LOG_PAGE_SIZE;
|
||||
|
@ -238,7 +238,7 @@ int exists_in_spiffs(const char *filename) {
|
|||
return rc == SPIFFS_OK;
|
||||
}
|
||||
|
||||
RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
||||
static RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
||||
RDV40SpiFFSFileType filetype = RDV40_SPIFFS_FILETYPE_UNKNOWN;
|
||||
char symlinked[SPIFFS_OBJ_NAME_LEN];
|
||||
sprintf(symlinked, "%s.lnk", filename);
|
||||
|
@ -270,16 +270,16 @@ RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
|||
}
|
||||
return filetype;
|
||||
}
|
||||
|
||||
int is_valid_filename(const char *filename) {
|
||||
/*
|
||||
static int is_valid_filename(const char *filename) {
|
||||
if (filename == NULL) {
|
||||
return false;
|
||||
}
|
||||
uint32_t len = strlen(filename);
|
||||
return len > 0 && len < SPIFFS_OBJ_NAME_LEN;
|
||||
}
|
||||
|
||||
void copy_in_spiffs(const char *src, const char *dst) {
|
||||
*/
|
||||
static void copy_in_spiffs(const char *src, const char *dst) {
|
||||
uint32_t size = size_in_spiffs((char *)src);
|
||||
uint8_t *mem = BigBuf_malloc(size);
|
||||
read_from_spiffs((char *)src, (uint8_t *)mem, size);
|
||||
|
@ -297,7 +297,7 @@ void copy_in_spiffs(const char *src, const char *dst) {
|
|||
// 1 if the mount status actually changed
|
||||
// so you know what to do IN CASE you wished to set things "back to previous
|
||||
// state"
|
||||
int rdv40_spiffs_lazy_mount() {
|
||||
int rdv40_spiffs_lazy_mount(void) {
|
||||
int changed = 0;
|
||||
if (!rdv40_spiffs_mounted()) {
|
||||
changed = rdv40_spiffs_mount();
|
||||
|
@ -309,7 +309,7 @@ int rdv40_spiffs_lazy_mount() {
|
|||
}
|
||||
|
||||
// unmount if not already
|
||||
int rdv40_spiffs_lazy_unmount() {
|
||||
int rdv40_spiffs_lazy_unmount(void) {
|
||||
int changed = 0;
|
||||
if (rdv40_spiffs_mounted()) {
|
||||
changed = rdv40_spiffs_unmount();
|
||||
|
@ -362,7 +362,7 @@ void my_lazy_spiffs_act(){
|
|||
// this lazy_mount since needed and can also report back the change on
|
||||
state implied by eventual mount, if needed rdv40_spiffs_lazy_read((const char
|
||||
*)".SHOULDRESET",(uint8_t *)resetret,4); if( resetret == "YESS" ) { uint8_t
|
||||
changed = rdv40_spiffs_lazy_format(); // this will imply change only if we where
|
||||
changed = rdv40_spiffs_lazy_format(void); // this will imply change only if we where
|
||||
already mounted beforehand, was the case after our reading without further
|
||||
rollback rdv40_spiffs_lazy_mount_rollback(changed); // so if we were mounted
|
||||
just get back to this state. If not, just don't.
|
||||
|
@ -444,7 +444,7 @@ int rdv40_spiffs_stat(char *filename, uint32_t *buf, RDV40SpiFFSSafetyLevel leve
|
|||
)
|
||||
}
|
||||
|
||||
int rdv40_spiffs_getfsinfo(rdv40_spiffs_fsinfo *fsinfo, RDV40SpiFFSSafetyLevel level) {
|
||||
static int rdv40_spiffs_getfsinfo(rdv40_spiffs_fsinfo *fsinfo, RDV40SpiFFSSafetyLevel level) {
|
||||
RDV40_SPIFFS_SAFE_FUNCTION( //
|
||||
*fsinfo = info_of_spiffs(); //
|
||||
)
|
||||
|
@ -538,7 +538,7 @@ int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, R
|
|||
///////// MISC HIGH LEVEL FUNCTIONS ////////////////////////////////////////////
|
||||
#define SPIFFS_BANNER DbpString(_BLUE_("Flash Memory FileSystem tree (SPIFFS)"));
|
||||
|
||||
void rdv40_spiffs_safe_print_fsinfo() {
|
||||
void rdv40_spiffs_safe_print_fsinfo(void) {
|
||||
rdv40_spiffs_fsinfo fsinfo;
|
||||
rdv40_spiffs_getfsinfo(&fsinfo, RDV40_SPIFFS_SAFETY_SAFE);
|
||||
|
||||
|
@ -603,7 +603,7 @@ void rdv40_spiffs_safe_print_tree(uint8_t banner) {
|
|||
|
||||
|
||||
// Selftest function
|
||||
void test_spiffs() {
|
||||
void test_spiffs(void) {
|
||||
Dbprintf("----------------------------------------------");
|
||||
Dbprintf("Testing SPIFFS operations");
|
||||
Dbprintf("----------------------------------------------");
|
||||
|
|
|
@ -33,9 +33,9 @@ typedef struct rdv40_spiffs_fsinfo {
|
|||
|
||||
int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
|
||||
int rdv40_spiffs_check();
|
||||
int rdv40_spiffs_lazy_unmount();
|
||||
int rdv40_spiffs_lazy_mount();
|
||||
int rdv40_spiffs_check(void);
|
||||
int rdv40_spiffs_lazy_unmount(void);
|
||||
int rdv40_spiffs_lazy_mount(void);
|
||||
int rdv40_spiffs_lazy_mount_rollback(int changed);
|
||||
int rdv40_spiffs_write(char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_read(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
|
@ -44,12 +44,12 @@ int rdv40_spiffs_remove(char *filename, RDV40SpiFFSSafetyLevel level);
|
|||
int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
void write_to_spiffs(const char *filename, uint8_t *src, uint32_t size);
|
||||
void read_from_spiffs(const char *filename, uint8_t *dst, uint32_t size);
|
||||
void test_spiffs();
|
||||
void test_spiffs(void);
|
||||
void rdv40_spiffs_safe_print_tree(uint8_t banner);
|
||||
int rdv40_spiffs_unmount();
|
||||
int rdv40_spiffs_mount();
|
||||
int rdv40_spiffs_unmount(void);
|
||||
int rdv40_spiffs_mount(void);
|
||||
int rdv40_spiffs_is_symlink(const char *s);
|
||||
void rdv40_spiffs_safe_print_fsinfo();
|
||||
void rdv40_spiffs_safe_print_fsinfo(void);
|
||||
int rdv40_spiffs_make_symlink(char *linkdest, char *filename, RDV40SpiFFSSafetyLevel level);
|
||||
void append_to_spiffs(const char *filename, uint8_t *src, uint32_t size);
|
||||
int rdv40_spiffs_copy(char *src, char *dst, RDV40SpiFFSSafetyLevel level);
|
||||
|
|
|
@ -59,7 +59,8 @@ static void uncompress_data_section(void) {
|
|||
common_area.arg1 = data_section.total_in;
|
||||
}
|
||||
|
||||
void __attribute__((section(".startos"))) Vector(void) {
|
||||
void __attribute__((section(".startos"))) Vector(void);
|
||||
void Vector(void) {
|
||||
/* Stack should have been set up by the bootloader */
|
||||
// char *src;
|
||||
char *dst, *end;
|
||||
|
|
|
@ -247,7 +247,7 @@ int strncmp(const char *s1, const char *s2, size_t n) {
|
|||
|
||||
|
||||
#define isspace(a) __extension__ ({ unsigned char bb__isspace = (a) - 9; bb__isspace == (' ' - 9) || bb__isspace <= (13 - 9); })
|
||||
|
||||
/*
|
||||
unsigned long strtoul(const char *p, char **out_p, int base) {
|
||||
unsigned long v = 0;
|
||||
|
||||
|
@ -319,6 +319,7 @@ long strtol(const char *p, char **out_p, int base) {
|
|||
if (out_p) *out_p = (char *)p;
|
||||
return v;
|
||||
}
|
||||
*/
|
||||
|
||||
char c_tolower(int c) {
|
||||
// (int)a = 97, (int)A = 65
|
||||
|
|
|
@ -51,7 +51,7 @@ void ReadThinFilm(void) {
|
|||
#define SEC_F 0x00
|
||||
uint16_t FpgaSendQueueDelay;
|
||||
|
||||
uint16_t ReadReaderField(void) {
|
||||
static uint16_t ReadReaderField(void) {
|
||||
#if defined RDV4
|
||||
return AvgAdc(ADC_CHAN_HF_RDV40);
|
||||
#else
|
||||
|
@ -71,7 +71,7 @@ static void CodeThinfilmAsTag(const uint8_t *cmd, uint16_t len) {
|
|||
ToSendMax++;
|
||||
}
|
||||
|
||||
int EmSendCmdThinfilmRaw(uint8_t *resp, uint16_t respLen) {
|
||||
static int EmSendCmdThinfilmRaw(uint8_t *resp, uint16_t respLen) {
|
||||
volatile uint8_t b;
|
||||
uint16_t i = 0;
|
||||
uint32_t ThisTransferTime;
|
||||
|
|
|
@ -30,10 +30,10 @@ uint32_t RAMFUNC GetCountUS(void);
|
|||
void ResetUSClock(void);
|
||||
void SpinDelayCountUs(uint32_t us);
|
||||
|
||||
void StartCountSspClk();
|
||||
void StartCountSspClk(void);
|
||||
void ResetSspClk(void);
|
||||
uint32_t RAMFUNC GetCountSspClk();
|
||||
uint32_t RAMFUNC GetCountSspClkDelta();
|
||||
uint32_t RAMFUNC GetCountSspClk(void);
|
||||
uint32_t RAMFUNC GetCountSspClkDelta(uint32_t start);
|
||||
|
||||
void StartTicks(void);
|
||||
uint32_t GetTicks(void);
|
||||
|
|
|
@ -83,7 +83,7 @@ uint8_t hex2int(char hexchar) {
|
|||
}
|
||||
}
|
||||
|
||||
void LEDsoff() {
|
||||
void LEDsoff(void) {
|
||||
LED_A_OFF();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
|
|
Loading…
Reference in a new issue