From 6f23b7f3ebef81b1827e44246b797bcb147882c1 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 14 May 2024 12:40:26 +0200 Subject: [PATCH] fix fct name mismatch, const params, --- armsrc/iso14443b.c | 4 ++-- armsrc/iso15693.c | 28 ++++++++++++++-------------- armsrc/iso15693.h | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/armsrc/iso14443b.c b/armsrc/iso14443b.c index a388f76f3..a802f6282 100644 --- a/armsrc/iso14443b.c +++ b/armsrc/iso14443b.c @@ -774,7 +774,7 @@ void SimulateIso14443bTag(const uint8_t *pupi) { int cardSTATE = SIM_NOFIELD; int vHf = 0; // in mV - tosend_t *ts = get_tosend(); + const tosend_t *ts = get_tosend(); uint8_t *receivedCmd = BigBuf_calloc(MAX_FRAME_SIZE); @@ -1566,7 +1566,7 @@ static void CodeIso14443bAsReader(const uint8_t *cmd, int len, bool framing) { * Convenience function to encode, transmit and trace iso 14443b comms */ static void CodeAndTransmit14443bAsReader(const uint8_t *cmd, int len, uint32_t *start_time, uint32_t *eof_time, bool framing) { - tosend_t *ts = get_tosend(); + const tosend_t *ts = get_tosend(); CodeIso14443bAsReader(cmd, len, framing); TransmitFor14443b_AsReader(start_time); if (g_trigger) LED_A_ON(); diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index 0c7d1335a..6387672ea 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -1009,7 +1009,7 @@ int GetIso15693AnswerFromTag(uint8_t *response, uint16_t max_len, uint16_t timeo } uint32_t dma_start_time = 0; - uint16_t *upTo = dma->buf; + const uint16_t *upTo = dma->buf; for (;;) { @@ -1502,7 +1502,7 @@ int GetIso15693CommandFromReader(uint8_t *received, size_t max_len, uint32_t *eo if (g_dbglevel > DBG_ERROR) Dbprintf("FpgaSetupSscDma failed. Exiting"); return -4; } - uint8_t *upTo = dma->buf; + const uint8_t *upTo = dma->buf; uint32_t dma_start_time = GetCountSspClk() & 0xfffffff8; @@ -1603,7 +1603,7 @@ void AcquireRawAdcSamplesIso15693(void) { SpinDelay(250); // Now send the command - tosend_t *ts = get_tosend(); + const tosend_t *ts = get_tosend(); uint32_t start_time = 0; TransmitTo15693Tag(ts->buf, ts->max, &start_time, false); @@ -1681,7 +1681,7 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string, bool icla // Count of samples received so far, so that we can include timing int samples = 0; - uint16_t *upTo = dma->buf; + const uint16_t *upTo = dma->buf; for (;;) { @@ -1902,7 +1902,7 @@ static void BuildIdentifyRequest(uint8_t *cmd) { // 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, bool speed_fast, uint8_t *recv, +int SendDataTag(const uint8_t *send, int sendlen, bool init, bool speed_fast, uint8_t *recv, uint16_t max_recv_len, uint32_t start_time, uint16_t timeout, uint32_t *eof_time, uint16_t *resp_len) { if (init) { @@ -1918,7 +1918,7 @@ int SendDataTag(uint8_t *send, int sendlen, bool init, bool speed_fast, uint8_t CodeIso15693AsReader256(send, sendlen); } - tosend_t *ts = get_tosend(); + const tosend_t *ts = get_tosend(); TransmitTo15693Tag(ts->buf, ts->max, &start_time, false); if (tearoff_hook() == PM3_ETEAROFF) { // tearoff occurred @@ -1941,7 +1941,7 @@ int SendDataTag(uint8_t *send, int sendlen, bool init, bool speed_fast, uint8_t int SendDataTagEOF(uint8_t *recv, uint16_t max_recv_len, uint32_t start_time, uint16_t timeout, uint32_t *eof_time, bool fsk, bool recv_speed, uint16_t *resp_len) { CodeIso15693AsReaderEOF(); - tosend_t *ts = get_tosend(); + const tosend_t *ts = get_tosend(); TransmitTo15693Tag(ts->buf, ts->max, &start_time, false); uint32_t end_time = start_time + 32 * (8 * ts->max - 4); // subtract the 4 padding bits after EOF LogTrace_ISO15693(NULL, 0, (start_time * 4), (end_time * 4), NULL, true); @@ -1959,9 +1959,9 @@ int SendDataTagEOF(uint8_t *recv, uint16_t max_recv_len, uint32_t start_time, ui // Decodes a message from a tag and displays its metadata and content #define DBD15STATLEN 48 -static void DbdecodeIso15693Answer(int len, uint8_t *d) { +static void DbdecodeIso15693Answer(int n, const uint8_t *d) { - if (len > 3) { + if (n > 3) { char status[DBD15STATLEN + 1] = {0}; @@ -2007,7 +2007,7 @@ static void DbdecodeIso15693Answer(int len, uint8_t *d) { strncat(status, "No error ", DBD15STATLEN - strlen(status)); } - if (CheckCrc15(d, len)) + if (CheckCrc15(d, n)) strncat(status, "[+] crc ( " _GREEN_("ok") " )", DBD15STATLEN - strlen(status)); else strncat(status, "[!] crc ( " _RED_("fail") " )", DBD15STATLEN - strlen(status)); @@ -2127,7 +2127,7 @@ void EmlClearIso15693(void) { // Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands // all demodulation performed in arm rather than host. - greg -void SimTagIso15693(uint8_t *uid, uint8_t block_size) { +void SimTagIso15693(const uint8_t *uid, uint8_t block_size) { // free eventually allocated BigBuf memory BigBuf_free_keep_EM(); @@ -2581,7 +2581,7 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) { AddCrc15(recv, recvLen); recvLen += 2; CodeIso15693AsTag(recv, recvLen); - tosend_t *ts = get_tosend(); + const tosend_t *ts = get_tosend(); uint32_t response_time = reader_eof_time + DELAY_ISO15693_VCD_TO_VICC_SIM; if (tag->expectFsk) { // Not suppoted yet @@ -3028,7 +3028,7 @@ static uint32_t disable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_ti return PM3_SUCCESS; } -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) { +static uint32_t set_pass_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, const uint8_t *password, const uint8_t *uid) { uint8_t rnd[2]; @@ -3141,7 +3141,7 @@ static uint32_t enable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, c return PM3_SUCCESS; } -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) { +static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pwd_id, const uint8_t *password, const 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}; diff --git a/armsrc/iso15693.h b/armsrc/iso15693.h index 6870c3f95..0f04fddf9 100644 --- a/armsrc/iso15693.h +++ b/armsrc/iso15693.h @@ -47,13 +47,13 @@ int GetIso15693AnswerFromTag(uint8_t *response, uint16_t max_len, uint16_t timeo void AcquireRawAdcSamplesIso15693(void); void ReaderIso15693(iso15_card_select_t *p_card); // ISO15693 reader void EmlClearIso15693(void); -void SimTagIso15693(uint8_t *uid, uint8_t block_size); // simulate an ISO15693 tag +void SimTagIso15693(const uint8_t *uid, uint8_t block_size); // simulate an ISO15693 tag void BruteforceIso15693Afi(uint32_t flags); // find an AFI of a tag void SendRawCommand15693(iso15_raw_cmd_t *packet); // send arbitrary commands from CLI void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string, bool iclass); -int SendDataTag(uint8_t *send, int sendlen, bool init, bool speed_fast, uint8_t *recv, +int SendDataTag(const uint8_t *send, int sendlen, bool init, bool speed_fast, uint8_t *recv, uint16_t max_recv_len, uint32_t start_time, uint16_t timeout, uint32_t *eof_time, uint16_t *resp_len); int SendDataTagEOF(uint8_t *recv, uint16_t max_recv_len, uint32_t start_time, uint16_t timeout, uint32_t *eof_time, bool fsk, bool recv_speed, uint16_t *resp_len); @@ -68,5 +68,5 @@ void DisableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd); void EnableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd); void PassProtextEASSlixIso15693(const uint8_t *password); void PassProtectAFISlixIso15693(const uint8_t *password); -void WriteAFIIso15693(const uint8_t *password, bool usepwd, 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); #endif