Merge pull request #2078 from henrygab/more_const

More const
This commit is contained in:
Iceman 2023-08-15 21:10:35 +02:00 committed by GitHub
commit c00be4cb83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 74 additions and 74 deletions

View file

@ -53,7 +53,7 @@ void LCDFill(unsigned char xs, unsigned char ys, unsigned char width, unsigned c
} }
} }
void LCDString(char *lcd_string, const char *font_style, unsigned char x, unsigned char y, unsigned char fcolor, unsigned char bcolor) { void LCDString(const char *lcd_string, const char *font_style, unsigned char x, unsigned char y, unsigned char fcolor, unsigned char bcolor) {
unsigned int i; unsigned int i;
unsigned char mask = 0, px, py, xme, yme, offset; unsigned char mask = 0, px, py, xme, yme, offset;
const char *data; const char *data;

View file

@ -130,7 +130,7 @@ void LCDInit(void);
void LCDReset(void); void LCDReset(void);
void LCDSetXY(unsigned char x, unsigned char y); void LCDSetXY(unsigned char x, unsigned char y);
void LCDSetPixel(unsigned char x, unsigned char y, unsigned char color); void LCDSetPixel(unsigned char x, unsigned char y, unsigned char color);
void LCDString(char *lcd_string, const char *font_style, unsigned char x, unsigned char y, unsigned char fcolor, unsigned char bcolor); void LCDString(const char *lcd_string, const char *font_style, unsigned char x, unsigned char y, unsigned char fcolor, unsigned char bcolor);
void LCDFill(unsigned char xs, unsigned char ys, unsigned char width, unsigned char height, unsigned char color); void LCDFill(unsigned char xs, unsigned char ys, unsigned char width, unsigned char height, unsigned char color);
#endif #endif

View file

@ -635,7 +635,7 @@ static void hitagS_handle_reader_command(uint8_t *rx, const size_t rxlen,
/* /*
* Emulates a Hitag S Tag with the given data from the .hts file * Emulates a Hitag S Tag with the given data from the .hts file
*/ */
void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data, bool ledcontrol) { void SimulateHitagSTag(bool tag_mem_supplied, const uint8_t *data, bool ledcontrol) {
StopTicks(); StopTicks();
@ -1052,7 +1052,7 @@ static size_t concatbits(uint8_t *dstbuf, size_t dstbufskip, const uint8_t *srcb
return dstbufskip + srcbuflen; return dstbufskip + srcbuflen;
} }
static int selectHitagS(hitag_function htf, hitag_data *htd, uint8_t *tx, size_t sizeoftx, uint8_t *rx, size_t sizeofrx, int t_wait, bool ledcontrol) { static int selectHitagS(hitag_function htf, const hitag_data *htd, uint8_t *tx, size_t sizeoftx, uint8_t *rx, size_t sizeofrx, int t_wait, bool ledcontrol) {
StopTicks(); StopTicks();
FpgaDownloadAndGo(FPGA_BITSTREAM_LF); FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
@ -1263,7 +1263,7 @@ static int selectHitagS(hitag_function htf, hitag_data *htd, uint8_t *tx, size_t
* If the key was given the password will be decrypted. * If the key was given the password will be decrypted.
* Reads every page of a hitag S transpoder. * Reads every page of a hitag S transpoder.
*/ */
void ReadHitagS(hitag_function htf, hitag_data *htd, bool ledcontrol) { void ReadHitagS(hitag_function htf, const hitag_data *htd, bool ledcontrol) {
uint8_t rx[HITAG_FRAME_LEN]; uint8_t rx[HITAG_FRAME_LEN];
size_t rxlen = 0; size_t rxlen = 0;
@ -1356,7 +1356,7 @@ void ReadHitagS(hitag_function htf, hitag_data *htd, bool ledcontrol) {
* Authenticates to the Tag with the given Key or Challenge. * Authenticates to the Tag with the given Key or Challenge.
* Writes the given 32Bit data into page_ * Writes the given 32Bit data into page_
*/ */
void WritePageHitagS(hitag_function htf, hitag_data *htd, int page, bool ledcontrol) { void WritePageHitagS(hitag_function htf, const hitag_data *htd, int page, bool ledcontrol) {
bool bSuccessful = false; bool bSuccessful = false;
//check for valid input //check for valid input
@ -1443,7 +1443,7 @@ write_end:
* is not received correctly due to Antenna problems. This function * is not received correctly due to Antenna problems. This function
* detects these challenges. * detects these challenges.
*/ */
void Hitag_check_challenges(uint8_t *data, uint32_t datalen, bool ledcontrol) { void Hitag_check_challenges(const uint8_t *data, uint32_t datalen, bool ledcontrol) {
//check for valid input //check for valid input
if (datalen < 8) { if (datalen < 8) {
Dbprintf("Error, need chals"); Dbprintf("Error, need chals");

View file

@ -25,8 +25,8 @@
#include "hitag.h" #include "hitag.h"
void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data, bool ledcontrol); void SimulateHitagSTag(bool tag_mem_supplied, const uint8_t *data, bool ledcontrol);
void ReadHitagS(hitag_function htf, hitag_data *htd, bool ledcontrol); void ReadHitagS(hitag_function htf, const hitag_data *htd, bool ledcontrol);
void WritePageHitagS(hitag_function htf, hitag_data *htd, int page, bool ledcontrol); void WritePageHitagS(hitag_function htf, const hitag_data *htd, int page, bool ledcontrol);
void Hitag_check_challenges(uint8_t *data, uint32_t datalen, bool ledcontrol); void Hitag_check_challenges(const uint8_t *data, uint32_t datalen, bool ledcontrol);
#endif #endif

View file

@ -407,7 +407,7 @@ bool I2C_WriteByte(uint8_t data, uint8_t device_cmd, uint8_t device_address) {
//Sends array of data (Array, length, command to be written , SlaveDevice address ). //Sends array of data (Array, length, command to be written , SlaveDevice address ).
// len = uint16 because we need to write up to 256 bytes // len = uint16 because we need to write up to 256 bytes
bool I2C_BufferWrite(uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address) { bool I2C_BufferWrite(const uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address) {
bool bBreak = true; bool bBreak = true;
do { do {
if (!I2C_Start()) if (!I2C_Start())
@ -602,7 +602,7 @@ int16_t I2C_ReadFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t
return readcount; return readcount;
} }
bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address) { bool I2C_WriteFW(const uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address) {
//START, 0xB0, 0x00, 0x00, xx, yy, zz, ......, STOP //START, 0xB0, 0x00, 0x00, xx, yy, zz, ......, STOP
bool bBreak = true; bool bBreak = true;
@ -772,7 +772,7 @@ void SmartCardAtr(void) {
// StopTicks(); // StopTicks();
} }
void SmartCardRaw(smart_card_raw_t *p) { void SmartCardRaw(const smart_card_raw_t *p) {
LED_D_ON(); LED_D_ON();
uint16_t len = 0; uint16_t len = 0;

View file

@ -41,12 +41,12 @@ void I2C_Reset_EnterBootloader(void);
bool I2C_WriteCmd(uint8_t device_cmd, uint8_t device_address); bool I2C_WriteCmd(uint8_t device_cmd, uint8_t device_address);
bool I2C_WriteByte(uint8_t data, uint8_t device_cmd, uint8_t device_address); bool I2C_WriteByte(uint8_t data, uint8_t device_cmd, uint8_t device_address);
bool I2C_BufferWrite(uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address); bool I2C_BufferWrite(const uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address);
int16_t I2C_BufferRead(uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address); int16_t I2C_BufferRead(uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address);
// for firmware // for firmware
int16_t I2C_ReadFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address); int16_t I2C_ReadFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address);
bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address); bool I2C_WriteFW(const uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address);
bool sc_rx_bytes(uint8_t *dest, uint16_t *destlen); bool sc_rx_bytes(uint8_t *dest, uint16_t *destlen);
// //
@ -54,7 +54,7 @@ bool GetATR(smart_card_atr_t *card_ptr, bool verbose);
// generice functions // generice functions
void SmartCardAtr(void); void SmartCardAtr(void);
void SmartCardRaw(smart_card_raw_t *p); void SmartCardRaw(const smart_card_raw_t *p);
void SmartCardUpgrade(uint64_t arg0); void SmartCardUpgrade(uint64_t arg0);
void SmartCardSetBaud(uint64_t arg0); void SmartCardSetBaud(uint64_t arg0);
void SmartCardSetClock(uint64_t arg0); void SmartCardSetClock(uint64_t arg0);

View file

@ -188,7 +188,7 @@ void printHf14aConfig(void) {
* @brief setSamplingConfig * @brief setSamplingConfig
* @param sc * @param sc
*/ */
void setHf14aConfig(hf14a_config *hc) { void setHf14aConfig(const hf14a_config *hc) {
if ((hc->forceanticol >= 0) && (hc->forceanticol <= 2)) if ((hc->forceanticol >= 0) && (hc->forceanticol <= 2))
hf14aconfig.forceanticol = hc->forceanticol; hf14aconfig.forceanticol = hc->forceanticol;
@ -564,7 +564,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. // Thinfilm, Kovio mangles ISO14443A in the way that they don't use start bit nor parity bits.
static RAMFUNC int ManchesterDecoding_Thinfilm(uint8_t bit) { static RAMFUNC int ManchesterDecoding_Thinfilm(uint8_t bit) {
Demod.twoBits = (Demod.twoBits << 8) | bit; Demod.twoBits = (Demod.twoBits << 8) | bit;

View file

@ -121,7 +121,7 @@ typedef enum {
#endif #endif
void printHf14aConfig(void); void printHf14aConfig(void);
void setHf14aConfig(hf14a_config *hc); void setHf14aConfig(const hf14a_config *hc);
hf14a_config *getHf14aConfig(void); hf14a_config *getHf14aConfig(void);
void iso14a_set_timeout(uint32_t timeout); void iso14a_set_timeout(uint32_t timeout);
uint32_t iso14a_get_timeout(void); uint32_t iso14a_get_timeout(void);

View file

@ -701,7 +701,7 @@ static void TransmitFor14443b_AsTag(const uint8_t *response, uint16_t len) {
// Main loop of simulated tag: receive commands from reader, decide what // Main loop of simulated tag: receive commands from reader, decide what
// response to send, and send it. // response to send, and send it.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SimulateIso14443bTag(uint8_t *pupi) { void SimulateIso14443bTag(const uint8_t *pupi) {
LED_A_ON(); LED_A_ON();
// the only commands we understand is WUPB, AFI=0, Select All, N=1: // the only commands we understand is WUPB, AFI=0, Select All, N=1:

View file

@ -41,7 +41,7 @@ int iso14443b_select_card(iso14b_card_select_t *card);
int iso14443b_select_card_srx(iso14b_card_select_t *card); int iso14443b_select_card_srx(iso14b_card_select_t *card);
int iso14443b_select_xrx_card(iso14b_card_select_t *card); int iso14443b_select_xrx_card(iso14b_card_select_t *card);
void SimulateIso14443bTag(uint8_t *pupi); void SimulateIso14443bTag(const uint8_t *pupi);
void AcquireRawAdcSamplesIso14443b(uint32_t parameter); void AcquireRawAdcSamplesIso14443b(uint32_t parameter);
void ReadSTBlock(uint8_t blocknr); void ReadSTBlock(uint8_t blocknr);
void SniffIso14443b(void); void SniffIso14443b(void);

View file

@ -2656,7 +2656,7 @@ void SetTag15693Uid(const uint8_t *uid) {
switch_off(); switch_off();
} }
static void init_password_15693_Slix(uint8_t *buffer, uint8_t *pwd, const uint8_t *rnd) { static void init_password_15693_Slix(uint8_t *buffer, const uint8_t *pwd, const uint8_t *rnd) {
memcpy(buffer, pwd, 4); memcpy(buffer, pwd, 4);
if (rnd) { if (rnd) {
buffer[0] ^= rnd[0]; buffer[0] ^= rnd[0];
@ -2684,7 +2684,7 @@ static bool get_rnd_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t
return true; return true;
} }
static uint32_t disable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, uint8_t *password) { static uint32_t disable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, const uint8_t *password) {
uint8_t rnd[2]; uint8_t rnd[2];
if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) {
@ -2706,7 +2706,7 @@ static uint32_t disable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_ti
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t set_pass_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, uint8_t *password, uint8_t *uid) { static uint32_t set_pass_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, const uint8_t *password, uint8_t *uid) {
uint8_t rnd[2]; uint8_t rnd[2];
@ -2733,7 +2733,7 @@ static uint32_t set_pass_15693_Slix(uint32_t start_time, uint32_t *eof_time, uin
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t set_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *password) { static uint32_t set_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, const uint8_t *password) {
uint8_t rnd[2]; uint8_t rnd[2];
if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
@ -2754,7 +2754,7 @@ static uint32_t set_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time,
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t disable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *password, bool usepwd) { static uint32_t disable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, const uint8_t *password, bool usepwd) {
uint8_t uid[8]; uint8_t uid[8];
get_uid_slix(start_time, eof_time, uid); get_uid_slix(start_time, eof_time, uid);
@ -2788,7 +2788,7 @@ static uint32_t disable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time,
} }
static uint32_t enable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *password, bool usepwd) { static uint32_t enable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, const uint8_t *password, bool usepwd) {
uint8_t uid[8]; uint8_t uid[8];
get_uid_slix(start_time, eof_time, uid); get_uid_slix(start_time, eof_time, uid);
@ -2820,7 +2820,7 @@ static uint32_t enable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, u
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pwd_id, uint8_t *password, uint8_t *uid) { static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pwd_id, const uint8_t *password, uint8_t *uid) {
uint8_t new_pwd_cmd[] = { (ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS), ISO15693_WRITE_PASSWORD, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, pwd_id, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; uint8_t new_pwd_cmd[] = { (ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS), ISO15693_WRITE_PASSWORD, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, pwd_id, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
@ -2841,7 +2841,7 @@ static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_tim
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t pass_protect_EASAFI_15693_Slix(uint32_t start_time, uint32_t *eof_time, bool set_option_flag, uint8_t *password) { static uint32_t pass_protect_EASAFI_15693_Slix(uint32_t start_time, uint32_t *eof_time, bool set_option_flag, const uint8_t *password) {
uint8_t flags; uint8_t flags;
@ -2880,7 +2880,7 @@ static uint32_t pass_protect_EASAFI_15693_Slix(uint32_t start_time, uint32_t *eo
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t write_afi_15693(uint32_t start_time, uint32_t *eof_time, uint8_t *password, bool usepwd, uint8_t *uid, bool use_uid, uint8_t afi) { static uint32_t write_afi_15693(uint32_t start_time, uint32_t *eof_time, const uint8_t *password, bool usepwd, uint8_t *uid, bool use_uid, uint8_t afi) {
if (!use_uid) { if (!use_uid) {
int res_getuid = get_uid_slix(start_time, eof_time, uid); int res_getuid = get_uid_slix(start_time, eof_time, uid);
@ -2917,7 +2917,7 @@ static uint32_t write_afi_15693(uint32_t start_time, uint32_t *eof_time, uint8_t
} }
/* /*
static uint32_t enable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, uint8_t *password) { static uint32_t enable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, const uint8_t *password) {
uint8_t rnd[2]; uint8_t rnd[2];
if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
@ -2938,7 +2938,7 @@ static uint32_t enable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_tim
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, uint8_t *password) { static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, const uint8_t *password) {
uint8_t rnd[2]; uint8_t rnd[2];
if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
@ -2961,7 +2961,7 @@ static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_tim
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t destroy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t *password) { static uint32_t destroy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, const uint8_t *password) {
uint8_t rnd[2]; uint8_t rnd[2];
if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) {
@ -2985,7 +2985,7 @@ static uint32_t destroy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint
*/ */
void WritePasswordSlixIso15693(uint8_t *old_password, uint8_t *new_password, uint8_t pwd_id) { void WritePasswordSlixIso15693(const uint8_t *old_password, const uint8_t *new_password, uint8_t pwd_id) {
LED_D_ON(); LED_D_ON();
Iso15693InitReader(); Iso15693InitReader();
StartCountSspClk(); StartCountSspClk();
@ -3010,7 +3010,7 @@ void WritePasswordSlixIso15693(uint8_t *old_password, uint8_t *new_password, uin
} }
void DisablePrivacySlixIso15693(uint8_t *password) { void DisablePrivacySlixIso15693(const uint8_t *password) {
LED_D_ON(); LED_D_ON();
Iso15693InitReader(); Iso15693InitReader();
StartCountSspClk(); StartCountSspClk();
@ -3025,7 +3025,7 @@ void DisablePrivacySlixIso15693(uint8_t *password) {
switch_off(); switch_off();
} }
void EnablePrivacySlixIso15693(uint8_t *password) { void EnablePrivacySlixIso15693(const uint8_t *password) {
LED_D_ON(); LED_D_ON();
Iso15693InitReader(); Iso15693InitReader();
StartCountSspClk(); StartCountSspClk();
@ -3041,7 +3041,7 @@ void EnablePrivacySlixIso15693(uint8_t *password) {
} }
void DisableEAS_AFISlixIso15693(uint8_t *password, bool usepwd) { void DisableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd) {
LED_D_ON(); LED_D_ON();
Iso15693InitReader(); Iso15693InitReader();
StartCountSspClk(); StartCountSspClk();
@ -3059,7 +3059,7 @@ void DisableEAS_AFISlixIso15693(uint8_t *password, bool usepwd) {
switch_off(); switch_off();
} }
void EnableEAS_AFISlixIso15693(uint8_t *password, bool usepwd) { void EnableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd) {
LED_D_ON(); LED_D_ON();
Iso15693InitReader(); Iso15693InitReader();
StartCountSspClk(); StartCountSspClk();
@ -3074,7 +3074,7 @@ void EnableEAS_AFISlixIso15693(uint8_t *password, bool usepwd) {
switch_off(); switch_off();
} }
void PassProtextEASSlixIso15693(uint8_t *password) { void PassProtextEASSlixIso15693(const uint8_t *password) {
LED_D_ON(); LED_D_ON();
Iso15693InitReader(); Iso15693InitReader();
StartCountSspClk(); StartCountSspClk();
@ -3083,7 +3083,7 @@ void PassProtextEASSlixIso15693(uint8_t *password) {
reply_ng(CMD_HF_ISO15693_SLIX_PASS_PROTECT_EAS, res, NULL, 0); reply_ng(CMD_HF_ISO15693_SLIX_PASS_PROTECT_EAS, res, NULL, 0);
switch_off(); switch_off();
} }
void PassProtectAFISlixIso15693(uint8_t *password) { void PassProtectAFISlixIso15693(const uint8_t *password) {
LED_D_ON(); LED_D_ON();
Iso15693InitReader(); Iso15693InitReader();
StartCountSspClk(); StartCountSspClk();
@ -3093,7 +3093,7 @@ void PassProtectAFISlixIso15693(uint8_t *password) {
switch_off(); switch_off();
} }
void WriteAFIIso15693(uint8_t *password, bool use_pwd, uint8_t *uid, bool use_uid, uint8_t afi) { void WriteAFIIso15693(const uint8_t *password, bool use_pwd, uint8_t *uid, bool use_uid, uint8_t afi) {
LED_D_ON(); LED_D_ON();
Iso15693InitReader(); Iso15693InitReader();
StartCountSspClk(); StartCountSspClk();

View file

@ -60,12 +60,12 @@ int SendDataTagEOF(uint8_t *recv, uint16_t max_recv_len, uint32_t start_time, ui
void SetTag15693Uid(const uint8_t *uid); void SetTag15693Uid(const uint8_t *uid);
void WritePasswordSlixIso15693(uint8_t *old_password, uint8_t *new_password, uint8_t pwd_id); void WritePasswordSlixIso15693(const uint8_t *old_password, const uint8_t *new_password, uint8_t pwd_id);
void DisablePrivacySlixIso15693(uint8_t *password); void DisablePrivacySlixIso15693(const uint8_t *password);
void EnablePrivacySlixIso15693(uint8_t *password); void EnablePrivacySlixIso15693(const uint8_t *password);
void DisableEAS_AFISlixIso15693(uint8_t *password, bool usepwd); void DisableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd);
void EnableEAS_AFISlixIso15693(uint8_t *password, bool usepwd); void EnableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd);
void PassProtextEASSlixIso15693(uint8_t *password); void PassProtextEASSlixIso15693(const uint8_t *password);
void PassProtectAFISlixIso15693(uint8_t *password); void PassProtectAFISlixIso15693(const uint8_t *password);
void WriteAFIIso15693(uint8_t *password, bool usepwd, uint8_t *uid, bool use_uid, uint8_t afi); void WriteAFIIso15693(const uint8_t *password, bool usepwd, uint8_t *uid, bool use_uid, uint8_t afi);
#endif #endif

View file

@ -528,7 +528,7 @@ OUT:
StopTicks(); StopTicks();
} }
void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, uint8_t *data) { void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, const uint8_t *data) {
// configure ARM and FPGA // configure ARM and FPGA
init_reader(); init_reader();

View file

@ -25,7 +25,7 @@
void LegicRfInfo(void); void LegicRfInfo(void);
int LegicRfReaderEx(uint16_t offset, uint16_t len, uint8_t iv); int LegicRfReaderEx(uint16_t offset, uint16_t len, uint8_t iv);
void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv); void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv);
void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, uint8_t *data); void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, const uint8_t *data);
legic_card_select_t *getLegicCardInfo(void); legic_card_select_t *getLegicCardInfo(void);
#endif /* __LEGICRF_H */ #endif /* __LEGICRF_H */

View file

@ -287,7 +287,7 @@ void printT55xxConfig(void) {
DbpString(""); DbpString("");
} }
void setT55xxConfig(uint8_t arg0, t55xx_configurations_t *c) { void setT55xxConfig(uint8_t arg0, const t55xx_configurations_t *c) {
for (uint8_t i = 0; i < 4; i++) { for (uint8_t i = 0; i < 4; i++) {
if (c->m[i].start_gap != 0) if (c->m[i].start_gap != 0)
T55xx_Timing.m[i].start_gap = c->m[i].start_gap; T55xx_Timing.m[i].start_gap = c->m[i].start_gap;
@ -1009,7 +1009,7 @@ void CmdHIDsimTAG(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool
// prepare a waveform pattern in the buffer based on the ID given then // prepare a waveform pattern in the buffer based on the ID given then
// simulate a FSK tag until the button is pressed // simulate a FSK tag until the button is pressed
// arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock // arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock
void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, uint8_t *bits, bool ledcontrol, int numcycles) { void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, const uint8_t *bits, bool ledcontrol, int numcycles) {
FpgaDownloadAndGo(FPGA_BITSTREAM_LF); FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
@ -1045,7 +1045,7 @@ void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t cl
// prepare a waveform pattern in the buffer based on the ID given then // prepare a waveform pattern in the buffer based on the ID given then
// simulate a FSK tag until the button is pressed // simulate a FSK tag until the button is pressed
// arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock // arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock
void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, uint8_t *bits, bool ledcontrol) { void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, const uint8_t *bits, bool ledcontrol) {
CmdFSKsimTAGEx(fchigh, fclow, separator, clk, bitslen, bits, ledcontrol, -1); CmdFSKsimTAGEx(fchigh, fclow, separator, clk, bitslen, bits, ledcontrol, -1);
reply_ng(CMD_LF_FSK_SIMULATE, PM3_EOPABORTED, NULL, 0); reply_ng(CMD_LF_FSK_SIMULATE, PM3_EOPABORTED, NULL, 0);
} }
@ -1866,9 +1866,9 @@ void T55xxResetRead(uint8_t flags, bool ledcontrol) {
if (ledcontrol) LED_A_OFF(); if (ledcontrol) LED_A_OFF();
} }
void T55xxDangerousRawTest(uint8_t *data, bool ledcontrol) { void T55xxDangerousRawTest(const uint8_t *data, bool ledcontrol) {
// supports only default downlink mode // supports only default downlink mode
t55xx_test_block_t *c = (t55xx_test_block_t *)data; const t55xx_test_block_t *c = (const t55xx_test_block_t *)data;
uint8_t start_wait = 4; uint8_t start_wait = 4;
uint8_t bs[128 / 8]; uint8_t bs[128 / 8];
@ -2320,7 +2320,7 @@ void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, boo
} }
// clone viking tag to T55xx // clone viking tag to T55xx
void CopyVikingtoT55xx(uint8_t *blocks, bool q5, bool em, bool ledcontrol) { void CopyVikingtoT55xx(const uint8_t *blocks, bool q5, bool em, bool ledcontrol) {
uint32_t data[] = {T55x7_BITRATE_RF_32 | T55x7_MODULATION_MANCHESTER | (2 << T55x7_MAXBLOCK_SHIFT), 0, 0}; uint32_t data[] = {T55x7_BITRATE_RF_32 | T55x7_MODULATION_MANCHESTER | (2 << T55x7_MAXBLOCK_SHIFT), 0, 0};
if (q5) { if (q5) {

View file

@ -38,9 +38,9 @@ void CmdHIDsimTAGEx(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, boo
void CmdHIDsimTAG(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol); void CmdHIDsimTAG(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol);
void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen,
uint8_t *bits, bool ledcontrol, int numcycles); const uint8_t *bits, bool ledcontrol, int numcycles);
void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen,
uint8_t *bits, bool ledcontrol); const uint8_t *bits, bool ledcontrol);
void CmdASKsimTAG(uint8_t encoding, uint8_t invert, uint8_t separator, uint8_t clk, uint16_t size, void CmdASKsimTAG(uint8_t encoding, uint8_t invert, uint8_t separator, uint8_t clk, uint16_t size,
const uint8_t *bits, bool ledcontrol); const uint8_t *bits, bool ledcontrol);
void CmdPSKsimTAG(uint8_t carrier, uint8_t invert, uint8_t clk, uint16_t size, void CmdPSKsimTAG(uint8_t carrier, uint8_t invert, uint8_t clk, uint16_t size,
@ -54,7 +54,7 @@ int lf_em410x_watch(int findone, uint32_t *high, uint64_t *low, bool ledcontrol)
int lf_io_watch(int findone, uint32_t *high, uint32_t *low, bool ledcontrol); int lf_io_watch(int findone, uint32_t *high, uint32_t *low, bool ledcontrol);
void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool q5, bool em, bool ledcontrol); // Clone an HID card to T5557/T5567 void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool q5, bool em, bool ledcontrol); // Clone an HID card to T5557/T5567
void CopyVikingtoT55xx(uint8_t *blocks, bool q5, bool em, bool ledcontrol); void CopyVikingtoT55xx(const uint8_t *blocks, bool q5, bool em, bool ledcontrol);
int copy_em410x_to_t55xx(uint8_t card, uint8_t clock, uint32_t id_hi, uint32_t id_lo, bool ledcontrol); int copy_em410x_to_t55xx(uint8_t card, uint8_t clock, uint32_t id_hi, uint32_t id_lo, bool ledcontrol);
@ -66,7 +66,7 @@ void T55xxReadBlock(uint8_t page, bool pwd_mode, bool brute_mem, uint8_t block,
uint8_t downlink_mode, bool ledcontrol); uint8_t downlink_mode, bool ledcontrol);
void T55xxWakeUp(uint32_t pwd, uint8_t flags, bool ledcontrol); void T55xxWakeUp(uint32_t pwd, uint8_t flags, bool ledcontrol);
void T55xx_ChkPwds(uint8_t flags, bool ledcontrol); void T55xx_ChkPwds(uint8_t flags, bool ledcontrol);
void T55xxDangerousRawTest(uint8_t *data, bool ledcontrol); void T55xxDangerousRawTest(const uint8_t *data, bool ledcontrol);
void turn_read_lf_on(uint32_t delay); void turn_read_lf_on(uint32_t delay);
void turn_read_lf_off(uint32_t delay); void turn_read_lf_off(uint32_t delay);
@ -78,7 +78,7 @@ void EM4xWriteWord(uint8_t addr, uint32_t data, uint32_t pwd, uint8_t usepwd, bo
void EM4xProtectWord(uint32_t data, uint32_t pwd, uint8_t usepwd, bool ledcontrol); void EM4xProtectWord(uint32_t data, uint32_t pwd, uint8_t usepwd, bool ledcontrol);
void Cotag(uint32_t arg0, bool ledcontrol); void Cotag(uint32_t arg0, bool ledcontrol);
void setT55xxConfig(uint8_t arg0, t55xx_configurations_t *c); void setT55xxConfig(uint8_t arg0, const t55xx_configurations_t *c);
t55xx_configurations_t *getT55xxConfig(void); t55xx_configurations_t *getT55xxConfig(void);
void printT55xxConfig(void); void printT55xxConfig(void);
void loadT55xxConfig(void); void loadT55xxConfig(void);

View file

@ -94,7 +94,7 @@ void setDefaultSamplingConfig(void) {
* @brief setSamplingConfig * @brief setSamplingConfig
* @param sc * @param sc
*/ */
void setSamplingConfig(sample_config *sc) { void setSamplingConfig(const sample_config *sc) {
// decimation (1-8) how many bits of adc sample value to save // decimation (1-8) how many bits of adc sample value to save
if (sc->decimation > 0 && sc->decimation < 9) if (sc->decimation > 0 && sc->decimation < 9)

View file

@ -110,7 +110,7 @@ void LFSetupFPGAForADC(int divisor, bool reader_field);
* @brief setSamplingConfig * @brief setSamplingConfig
* @param sc * @param sc
*/ */
void setSamplingConfig(sample_config *sc); void setSamplingConfig(const sample_config *sc);
void setDefaultSamplingConfig(void); void setDefaultSamplingConfig(void);
sample_config *getSamplingConfig(void); sample_config *getSamplingConfig(void);

View file

@ -115,7 +115,7 @@ static void zx8211_setup_read(void) {
WDT_HIT(); WDT_HIT();
} }
static void zx_send(uint8_t *cmd, uint8_t clen) { static void zx_send(const uint8_t *cmd, uint8_t clen) {
if (clen == 0) if (clen == 0)
return; return;

View file

@ -23,8 +23,8 @@
* verifies the magic properties, then stores a formatted string, prefixed by * verifies the magic properties, then stores a formatted string, prefixed by
* prefix in dst. * prefix in dst.
*/ */
void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_info) { void FormatVersionInformation(char *dst, int len, const char *prefix, const void *version_info) {
struct version_information_t *v = (struct version_information_t *)version_info; const struct version_information_t *v = (const struct version_information_t *)version_info;
dst[0] = 0; dst[0] = 0;
strncat(dst, prefix, len - 1); strncat(dst, prefix, len - 1);
if (v->magic != VERSION_INFORMATION_MAGIC) { if (v->magic != VERSION_INFORMATION_MAGIC) {
@ -53,8 +53,8 @@ void FormatVersionInformation(char *dst, int len, const char *prefix, void *vers
strncat(dst, v->armsrc, len - strlen(dst) - 1); strncat(dst, v->armsrc, len - strlen(dst) - 1);
} }
void format_version_information_short(char *dst, int len, void *version_info) { void format_version_information_short(char *dst, int len, const void *version_info) {
struct version_information_t *v = (struct version_information_t *)version_info; const struct version_information_t *v = (const struct version_information_t *)version_info;
dst[0] = 0; dst[0] = 0;
if (v->magic != VERSION_INFORMATION_MAGIC) { if (v->magic != VERSION_INFORMATION_MAGIC) {
strncat(dst, "Missing/Invalid version information", len - strlen(dst) - 1); strncat(dst, "Missing/Invalid version information", len - strlen(dst) - 1);
@ -151,7 +151,7 @@ void num_to_bytes(uint64_t n, size_t len, uint8_t *dest) {
} }
} }
uint64_t bytes_to_num(uint8_t *src, size_t len) { uint64_t bytes_to_num(const uint8_t *src, size_t len) {
uint64_t num = 0; uint64_t num = 0;
while (len--) { while (len--) {
num = (num << 8) | (*src); num = (num << 8) | (*src);

View file

@ -50,8 +50,8 @@
#endif #endif
extern struct version_information_t g_version_information; extern struct version_information_t g_version_information;
void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_info); void FormatVersionInformation(char *dst, int len, const char *prefix, const void *version_info);
void format_version_information_short(char *dst, int len, void *version_info); void format_version_information_short(char *dst, int len, const void *version_info);
uint32_t reflect(uint32_t v, int b); // used in crc.c ... uint32_t reflect(uint32_t v, int b); // used in crc.c ...
uint8_t reflect8(uint8_t b); // dedicated 8bit reversal uint8_t reflect8(uint8_t b); // dedicated 8bit reversal
@ -59,7 +59,7 @@ uint16_t reflect16(uint16_t b); // dedicated 16bit reversal
uint32_t reflect32(uint32_t b); // dedicated 32bit reversal uint32_t reflect32(uint32_t b); // dedicated 32bit reversal
void num_to_bytes(uint64_t n, size_t len, uint8_t *dest); void num_to_bytes(uint64_t n, size_t len, uint8_t *dest);
uint64_t bytes_to_num(uint8_t *src, size_t len); uint64_t bytes_to_num(const uint8_t *src, size_t len);
// LE and BE to/from memory // LE and BE to/from memory
uint16_t MemLeToUint2byte(const uint8_t *data); uint16_t MemLeToUint2byte(const uint8_t *data);