seos_sam: ran make style

This commit is contained in:
Jakub Kramarz 2025-01-07 00:30:49 +01:00
commit 15a37ef9df
10 changed files with 176 additions and 176 deletions

View file

@ -96,12 +96,12 @@ int sam_rxtx(const uint8_t *data, uint16_t n, uint8_t *resp, uint16_t *resplen)
*resplen += more_len;
out:
out:
return res;
}
static inline void swap_clock_counters(volatile unsigned int * a, unsigned int * b){
static inline void swap_clock_counters(volatile unsigned int *a, unsigned int *b) {
unsigned int c = *a;
*a = *b;
*b = c;
@ -115,7 +115,7 @@ static inline void swap_clock_counters(volatile unsigned int * a, unsigned int *
* values. It is used to switch between different clock sources.
* It probably makes communication timing off, but at least makes it work.
*/
static void swap_clocks(void){
static void swap_clocks(void) {
static unsigned int tc0, tc1, tc2 = 0;
StopTicks();
swap_clock_counters(&(AT91C_BASE_TC0->TC_CV), &tc0);
@ -123,12 +123,12 @@ static void swap_clocks(void){
swap_clock_counters(&(AT91C_BASE_TC2->TC_CV), &tc2);
}
void switch_clock_to_ticks(void){
void switch_clock_to_ticks(void) {
swap_clocks();
StartTicks();
}
void switch_clock_to_countsspclk(void){
void switch_clock_to_countsspclk(void) {
swap_clocks();
StartCountSspClk();
}
@ -155,21 +155,21 @@ int sam_send_payload(
const uint8_t addr_dest,
const uint8_t addr_reply,
const uint8_t * const payload,
const uint8_t *const payload,
const uint16_t *payload_len,
uint8_t *response,
uint16_t *response_len
){
) {
int res = PM3_SUCCESS;
uint8_t * buf = response;
uint8_t *buf = response;
buf[0] = 0xA0; // CLA
buf[1] = 0xDA; // INS (PUT DATA)
buf[2] = 0x02; // P1 (TLV format?)
buf[3] = 0x63; // P2
buf[4] = SAM_TX_ASN1_PREFIX_LENGTH + (uint8_t) *payload_len; // LEN
buf[4] = SAM_TX_ASN1_PREFIX_LENGTH + (uint8_t) * payload_len; // LEN
buf[5] = addr_src;
buf[6] = addr_dest;
@ -185,10 +185,10 @@ int sam_send_payload(
*payload_len
);
uint16_t length = SAM_TX_ASN1_PREFIX_LENGTH + SAM_TX_APDU_PREFIX_LENGTH + (uint8_t) *payload_len;
uint16_t length = SAM_TX_ASN1_PREFIX_LENGTH + SAM_TX_APDU_PREFIX_LENGTH + (uint8_t) * payload_len;
LogTrace(buf, length, 0, 0, NULL, true);
if (g_dbglevel >= DBG_INFO){
if (g_dbglevel >= DBG_INFO) {
DbpString("SAM REQUEST APDU: ");
Dbhexdump(length, buf, false);
}
@ -201,12 +201,12 @@ int sam_send_payload(
}
LogTrace(response, *response_len, 0, 0, NULL, false);
if (g_dbglevel >= DBG_INFO){
if (g_dbglevel >= DBG_INFO) {
DbpString("SAM RESPONSE APDU: ");
Dbhexdump(*response_len, response, false);
}
out:
out:
return res;
}
@ -218,13 +218,13 @@ int sam_send_payload(
*
* @return Status code indicating success or failure of the operation.
*/
int sam_get_version(void){
int sam_get_version(void) {
int res = PM3_SUCCESS;
if (g_dbglevel >= DBG_DEBUG)
DbpString("start sam_get_version");
uint8_t * response = BigBuf_malloc(ISO7816_MAX_FRAME);
uint8_t *response = BigBuf_malloc(ISO7816_MAX_FRAME);
uint16_t response_len = ISO7816_MAX_FRAME;
uint8_t payload[] = {
@ -255,41 +255,41 @@ int sam_get_version(void){
if (g_dbglevel >= DBG_DEBUG)
DbpString("end sam_get_version");
if(response[5] != 0xbd){
if (response[5] != 0xbd) {
Dbprintf("Invalid SAM response");
goto error;
}else{
uint8_t * sam_response_an = sam_find_asn1_node(response + 5, 0x8a);
if(sam_response_an == NULL){
} else {
uint8_t *sam_response_an = sam_find_asn1_node(response + 5, 0x8a);
if (sam_response_an == NULL) {
if (g_dbglevel >= DBG_ERROR)
DbpString("SAM get response failed");
goto error;
}
uint8_t * sam_version_an = sam_find_asn1_node(sam_response_an, 0x80);
if(sam_version_an == NULL){
uint8_t *sam_version_an = sam_find_asn1_node(sam_response_an, 0x80);
if (sam_version_an == NULL) {
if (g_dbglevel >= DBG_ERROR)
DbpString("SAM get version failed");
goto error;
}
uint8_t * sam_build_an = sam_find_asn1_node(sam_response_an, 0x81);
if(sam_build_an == NULL){
uint8_t *sam_build_an = sam_find_asn1_node(sam_response_an, 0x81);
if (sam_build_an == NULL) {
if (g_dbglevel >= DBG_ERROR)
DbpString("SAM get firmware ID failed");
goto error;
}
if (g_dbglevel >= DBG_INFO){
if (g_dbglevel >= DBG_INFO) {
DbpString("SAM get version successful");
Dbprintf("Firmware version: %X.%X", sam_version_an[2], sam_version_an[3]);
Dbprintf("Firmware ID: ");
Dbhexdump(sam_build_an[1], sam_build_an+2, false);
Dbhexdump(sam_build_an[1], sam_build_an + 2, false);
}
goto out;
}
error:
error:
res = PM3_ESOFT;
out:
out:
BigBuf_free();
if (g_dbglevel >= DBG_DEBUG)
@ -310,14 +310,14 @@ int sam_get_version(void){
* @param type The type of the ASN.1 node to find.
* @return Pointer to the ASN.1 node of the specified type if found, otherwise NULL.
*/
uint8_t * sam_find_asn1_node(const uint8_t * root, const uint8_t type){
const uint8_t * end = (uint8_t *) root + *(root+1);
uint8_t * current = (uint8_t *) root + 2;
while(current < end){
if(*current == type){
uint8_t *sam_find_asn1_node(const uint8_t *root, const uint8_t type) {
const uint8_t *end = (uint8_t *) root + *(root + 1);
uint8_t *current = (uint8_t *) root + 2;
while (current < end) {
if (*current == type) {
return current;
}else{
current += 2 + *(current+1);
} else {
current += 2 + *(current + 1);
}
}
return NULL;
@ -339,21 +339,21 @@ uint8_t * sam_find_asn1_node(const uint8_t * root, const uint8_t type){
* @param data Pointer to the data to be appended.
* @param len The length of the data to be appended.
*/
void sam_append_asn1_node(const uint8_t * root, const uint8_t * node, uint8_t type, const uint8_t * const data, uint8_t len){
uint8_t * end = (uint8_t *) root + *(root+1) + 2;
void sam_append_asn1_node(const uint8_t *root, const uint8_t *node, uint8_t type, const uint8_t *const data, uint8_t len) {
uint8_t *end = (uint8_t *) root + *(root + 1) + 2;
*(end) = type;
*(end+1) = len;
memcpy(end+2, data, len);
*(end + 1) = len;
memcpy(end + 2, data, len);
for(uint8_t * current = (uint8_t *) root; current <= node; current += 2){
*(current+1) += 2 + len;
for (uint8_t *current = (uint8_t *) root; current <= node; current += 2) {
*(current + 1) += 2 + len;
};
return;
}
void sam_send_ack(void){
uint8_t * response = BigBuf_malloc(ISO7816_MAX_FRAME);
void sam_send_ack(void) {
uint8_t *response = BigBuf_malloc(ISO7816_MAX_FRAME);
uint16_t response_len = ISO7816_MAX_FRAME;
uint8_t payload[] = {

View file

@ -32,7 +32,7 @@ int sam_send_payload(
const uint8_t addr_dest,
const uint8_t addr_reply,
const uint8_t * const payload,
const uint8_t *const payload,
const uint16_t *payload_len,
uint8_t *response,
@ -41,8 +41,8 @@ int sam_send_payload(
int sam_get_version(void);
uint8_t * sam_find_asn1_node(const uint8_t * root, const uint8_t type);
void sam_append_asn1_node(const uint8_t * root, const uint8_t * node, uint8_t type, const uint8_t * const data, uint8_t len);
uint8_t *sam_find_asn1_node(const uint8_t *root, const uint8_t type);
void sam_append_asn1_node(const uint8_t *root, const uint8_t *node, uint8_t type, const uint8_t *const data, uint8_t len);
void sam_send_ack(void);

View file

@ -41,12 +41,12 @@
* @param card_select Pointer to the descriptor of the detected card.
* @return Status code indicating success or failure of the operation.
*/
static int sam_set_card_detected(picopass_hdr_t * card_select){
static int sam_set_card_detected(picopass_hdr_t *card_select) {
int res = PM3_SUCCESS;
if (g_dbglevel >= DBG_DEBUG)
DbpString("start sam_set_card_detected");
uint8_t * response = BigBuf_malloc(ISO7816_MAX_FRAME);
uint8_t *response = BigBuf_malloc(ISO7816_MAX_FRAME);
uint16_t response_len = ISO7816_MAX_FRAME;
// a0 12
@ -60,7 +60,7 @@ static int sam_set_card_detected(picopass_hdr_t * card_select){
uint8_t payload[] = {
0xa0, 18, // <- SAM command
0xad, 16, // <- set detected card
0xa0, 4+10,
0xa0, 4 + 10,
0x80, 2, // <- protocol
0x00, 0x04, // <- Picopass
0x81, 8, // <- CSN
@ -83,11 +83,11 @@ static int sam_set_card_detected(picopass_hdr_t * card_select){
// 8a 00 <- empty response (accepted)
// 90 00
if(response[5] != 0xbd){
if (response[5] != 0xbd) {
if (g_dbglevel >= DBG_ERROR)
Dbprintf("Invalid SAM response");
goto error;
}else{
} else {
// uint8_t * sam_response_an = sam_find_asn1_node(response + 5, 0x8a);
// if(sam_response_an == NULL){
// if (g_dbglevel >= DBG_ERROR)
@ -96,10 +96,10 @@ static int sam_set_card_detected(picopass_hdr_t * card_select){
// }
goto out;
}
error:
error:
res = PM3_ESOFT;
out:
out:
BigBuf_free();
if (g_dbglevel >= DBG_DEBUG)
@ -244,7 +244,7 @@ int sam_picopass_get_pacs(void) {
// 80 01
// 04
hexstr_to_byte_array("a005a103800104", sam_apdu, &sam_len);
if(sam_send_payload(0x44, 0x0a, 0x44, sam_apdu, (uint16_t *) &sam_len, resp, &resp_len) != PM3_SUCCESS) {
if (sam_send_payload(0x44, 0x0a, 0x44, sam_apdu, (uint16_t *) &sam_len, resp, &resp_len) != PM3_SUCCESS) {
res = PM3_ECARDEXCHANGE;
goto out;
}

View file

@ -49,15 +49,15 @@
* @param card_select Pointer to the descriptor of the detected card.
* @return Status code indicating success or failure of the operation.
*/
static int sam_set_card_detected(iso14a_card_select_t * card_select){
static int sam_set_card_detected(iso14a_card_select_t *card_select) {
int res = PM3_SUCCESS;
if (g_dbglevel >= DBG_DEBUG)
DbpString("start sam_set_card_detected");
uint8_t * request = BigBuf_malloc(ISO7816_MAX_FRAME);
uint8_t *request = BigBuf_malloc(ISO7816_MAX_FRAME);
uint16_t request_len = ISO7816_MAX_FRAME;
uint8_t * response = BigBuf_malloc(ISO7816_MAX_FRAME);
uint8_t *response = BigBuf_malloc(ISO7816_MAX_FRAME);
uint16_t response_len = ISO7816_MAX_FRAME;
const uint8_t payload[] = {
@ -69,9 +69,9 @@ static int sam_set_card_detected(iso14a_card_select_t * card_select){
};
memcpy(request, payload, sizeof(payload));
sam_append_asn1_node(request, request+4, 0x81, card_select->uid, card_select->uidlen);
sam_append_asn1_node(request, request+4, 0x82, card_select->atqa, 2);
sam_append_asn1_node(request, request+4, 0x83, &card_select->sak, 1);
sam_append_asn1_node(request, request + 4, 0x81, card_select->uid, card_select->uidlen);
sam_append_asn1_node(request, request + 4, 0x82, card_select->atqa, 2);
sam_append_asn1_node(request, request + 4, 0x83, &card_select->sak, 1);
request_len = request[1] + 2;
sam_send_payload(
@ -88,11 +88,11 @@ static int sam_set_card_detected(iso14a_card_select_t * card_select){
// 8a 00 <- empty response (accepted)
// 90 00
if(response[5] != 0xbd){
if (response[5] != 0xbd) {
if (g_dbglevel >= DBG_ERROR)
Dbprintf("Invalid SAM response");
goto error;
}else{
} else {
// uint8_t * sam_response_an = sam_find_asn1_node(response + 5, 0x8a);
// if(sam_response_an == NULL){
// if (g_dbglevel >= DBG_ERROR)
@ -101,10 +101,10 @@ static int sam_set_card_detected(iso14a_card_select_t * card_select){
// }
goto out;
}
error:
error:
res = PM3_ESOFT;
out:
out:
BigBuf_free();
if (g_dbglevel >= DBG_DEBUG)
@ -123,7 +123,7 @@ static int sam_set_card_detected(iso14a_card_select_t * card_select){
*
* @return Length of SAM APDU to be sent.
*/
inline static uint16_t sam_seos_copy_payload_nfc2sam(uint8_t *sam_tx, uint8_t * nfc_rx, uint8_t nfc_len){
inline static uint16_t sam_seos_copy_payload_nfc2sam(uint8_t *sam_tx, uint8_t *nfc_rx, uint8_t nfc_len) {
// NFC resp:
// 6f 0c 84 0a a0 00 00 04 40 00 01 01 00 01 90 00 fb e3
@ -148,8 +148,8 @@ inline static uint16_t sam_seos_copy_payload_nfc2sam(uint8_t *sam_tx, uint8_t *
memcpy(sam_tx, payload, sizeof(payload));
sam_append_asn1_node(sam_tx, sam_tx+4, 0x80, nfc_rx, nfc_len);
sam_append_asn1_node(sam_tx, sam_tx+4, 0x81, tag81, sizeof(tag81));
sam_append_asn1_node(sam_tx, sam_tx + 4, 0x80, nfc_rx, nfc_len);
sam_append_asn1_node(sam_tx, sam_tx + 4, 0x81, tag81, sizeof(tag81));
return sam_tx[1] + 2; // length of the ASN1 tree
}
@ -163,7 +163,7 @@ inline static uint16_t sam_seos_copy_payload_nfc2sam(uint8_t *sam_tx, uint8_t *
* @param sam_rx_buf Pointer to the buffer containing the data received from the SAM.
* @return Length of NFC APDU to be sent.
*/
inline static uint16_t sam_seos_copy_payload_sam2nfc(uint8_t * nfc_tx_buf, uint8_t * sam_rx_buf){
inline static uint16_t sam_seos_copy_payload_sam2nfc(uint8_t *nfc_tx_buf, uint8_t *sam_rx_buf) {
// SAM resp:
// c1 61 c1 00 00
// a1 21 <- nfc command
@ -182,8 +182,8 @@ inline static uint16_t sam_seos_copy_payload_sam2nfc(uint8_t * nfc_tx_buf, uint8
// 00 a4 04 00 0a a0 00 00 04 40 00 01 01 00 01 00
// copy data out of c1->a1>->a1->80 node
uint16_t nfc_tx_len = (uint8_t) *(sam_rx_buf + 10);
memcpy(nfc_tx_buf, sam_rx_buf+11, nfc_tx_len);
uint16_t nfc_tx_len = (uint8_t) * (sam_rx_buf + 10);
memcpy(nfc_tx_buf, sam_rx_buf + 11, nfc_tx_len);
return nfc_tx_len;
}
@ -199,7 +199,7 @@ inline static uint16_t sam_seos_copy_payload_sam2nfc(uint8_t * nfc_tx_buf, uint8
* @param response_len Pointer to the variable where the length of the retreived data will be stored.
* @return Status code indicating success or failure of the operation.
*/
static int sam_send_request_iso14a(const uint8_t * const request, const uint8_t request_len, uint8_t * response, uint8_t * response_len){
static int sam_send_request_iso14a(const uint8_t *const request, const uint8_t request_len, uint8_t *response, uint8_t *response_len) {
int res = PM3_SUCCESS;
if (g_dbglevel >= DBG_DEBUG)
DbpString("start sam_send_request_iso14a");
@ -207,22 +207,22 @@ static int sam_send_request_iso14a(const uint8_t * const request, const uint8_t
uint8_t buf1[ISO7816_MAX_FRAME] = {0};
uint8_t buf2[ISO7816_MAX_FRAME] = {0};
uint8_t * sam_tx_buf = buf1;
uint8_t *sam_tx_buf = buf1;
uint16_t sam_tx_len;
uint8_t * sam_rx_buf = buf2;
uint8_t *sam_rx_buf = buf2;
uint16_t sam_rx_len;
uint8_t * nfc_tx_buf = buf1;
uint8_t *nfc_tx_buf = buf1;
uint16_t nfc_tx_len;
uint8_t * nfc_rx_buf = buf2;
uint8_t *nfc_rx_buf = buf2;
uint16_t nfc_rx_len;
if(request_len > 0){
if (request_len > 0) {
sam_tx_len = request_len;
memcpy(sam_tx_buf, request, sam_tx_len);
}else{
} else {
// send get pacs
static const uint8_t payload[] = {
0xa0, 19, // <- SAM command
@ -243,9 +243,9 @@ static int sam_send_request_iso14a(const uint8_t * const request, const uint8_t
sam_rx_buf, &sam_rx_len
);
if(sam_rx_buf[1] == 0x61){ // commands to be relayed to card starts with 0x61
if (sam_rx_buf[1] == 0x61) { // commands to be relayed to card starts with 0x61
// tag <-> SAM exchange starts here
while(sam_rx_buf[1] == 0x61){
while (sam_rx_buf[1] == 0x61) {
switch_clock_to_countsspclk();
nfc_tx_len = sam_seos_copy_payload_sam2nfc(nfc_tx_buf, sam_rx_buf);
@ -259,7 +259,7 @@ static int sam_send_request_iso14a(const uint8_t * const request, const uint8_t
);
switch_clock_to_ticks();
sam_tx_len = sam_seos_copy_payload_nfc2sam(sam_tx_buf, nfc_rx_buf, nfc_rx_len-2);
sam_tx_len = sam_seos_copy_payload_nfc2sam(sam_tx_buf, nfc_rx_buf, nfc_rx_len - 2);
sam_send_payload(
0x14, 0x0a, 0x14,
@ -269,7 +269,7 @@ static int sam_send_request_iso14a(const uint8_t * const request, const uint8_t
// last SAM->TAG
// c1 61 c1 00 00 a1 02 >>82<< 00 90 00
if(sam_rx_buf[7] == 0x82){
if (sam_rx_buf[7] == 0x82) {
// tag <-> SAM exchange ends here
break;
}
@ -310,24 +310,24 @@ static int sam_send_request_iso14a(const uint8_t * const request, const uint8_t
// 82 01
// 07
// 90 00
if(request_len == 0){
if(
!(sam_rx_buf[5] == 0xbd && sam_rx_buf[5+2] == 0x8a && sam_rx_buf[5+4] == 0x03)
if (request_len == 0) {
if (
!(sam_rx_buf[5] == 0xbd && sam_rx_buf[5 + 2] == 0x8a && sam_rx_buf[5 + 4] == 0x03)
&&
!(sam_rx_buf[5] == 0xbd && sam_rx_buf[5+2] == 0xb3 && sam_rx_buf[5+4] == 0xa0)
){
!(sam_rx_buf[5] == 0xbd && sam_rx_buf[5 + 2] == 0xb3 && sam_rx_buf[5 + 4] == 0xa0)
) {
if (g_dbglevel >= DBG_ERROR)
Dbprintf("No PACS data in SAM response");
res=PM3_ESOFT;
res = PM3_ESOFT;
}
}
*response_len = sam_rx_buf[5+1] +2;
memcpy(response, sam_rx_buf+5, *response_len);
*response_len = sam_rx_buf[5 + 1] + 2;
memcpy(response, sam_rx_buf + 5, *response_len);
goto out;
out:
out:
return res;
}
@ -358,13 +358,13 @@ int sam_seos_get_pacs(PacketCommandNG *c) {
// step 1: ping SAM
sam_get_version();
if(!skipDetect){
if (!skipDetect) {
// step 2: get card information
iso14a_card_select_t card_a_info;
// implicit StartSspClk() happens here
iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD);
if (!iso14443a_select_card(NULL, &card_a_info, NULL, true, 0, false)){
if (!iso14443a_select_card(NULL, &card_a_info, NULL, true, 0, false)) {
goto err;
}
@ -378,7 +378,7 @@ int sam_seos_get_pacs(PacketCommandNG *c) {
uint8_t sam_response[ISO7816_MAX_FRAME] = { 0x00 };
uint8_t sam_response_len = 0;
res = sam_send_request_iso14a(cmd, cmd_len, sam_response, &sam_response_len);
if(res != PM3_SUCCESS){
if (res != PM3_SUCCESS) {
goto err;
}
if (g_dbglevel >= DBG_INFO)
@ -387,15 +387,15 @@ int sam_seos_get_pacs(PacketCommandNG *c) {
goto out;
goto off;
err:
err:
res = PM3_ENOPACS;
reply_ng(CMD_HF_SAM_SEOS, res, NULL, 0);
goto off;
out:
out:
reply_ng(CMD_HF_SAM_SEOS, PM3_SUCCESS, sam_response, sam_response_len);
goto off;
off:
if(disconnectAfter){
off:
if (disconnectAfter) {
switch_off();
}
set_tracing(false);

View file

@ -5441,7 +5441,7 @@ static int CmdHFiClassSAM(const char *Cmd) {
// third padded
// fourth ..
uint8_t *d = resp.data.asBytes;
HIDDumpPACSBits(d+2, d[1], verbose);
HIDDumpPACSBits(d + 2, d[1], verbose);
return PM3_SUCCESS;
}

View file

@ -1688,15 +1688,15 @@ static int CmdHfSeosSAM(const char *Cmd) {
verbose = true;
}
bool disconnectAfter = true;
if(arg_get_lit(ctx, 2)){
if (arg_get_lit(ctx, 2)) {
disconnectAfter = false;
}
bool skipDetect = false;
if(arg_get_lit(ctx, 3)){
if (arg_get_lit(ctx, 3)) {
skipDetect = true;
}
bool decodeTLV = false;
if(arg_get_lit(ctx, 4)){
if (arg_get_lit(ctx, 4)) {
decodeTLV = true;
}
@ -1735,11 +1735,11 @@ static int CmdHfSeosSAM(const char *Cmd) {
// 8a 07
// 03 05 <- tag + length
// 06 85 80 6d c0 <- decoded PACS data
if(d[0] == 0xbd && d[2] == 0x8a && d[4] == 0x03){
if (d[0] == 0xbd && d[2] == 0x8a && d[4] == 0x03) {
uint8_t pacs_length = d[5];
uint8_t * pacs_data = d + 6;
uint8_t *pacs_data = d + 6;
int res = HIDDumpPACSBits(pacs_data, pacs_length, verbose);
if(res != PM3_SUCCESS){
if (res != PM3_SUCCESS) {
return res;
}
// check for standard samCommandGetContentElement2:
@ -1752,21 +1752,21 @@ static int CmdHfSeosSAM(const char *Cmd) {
// 2b 06 01 04 01 81 e4 38 01 01 02 04 3c ff
// 82 01
// 07
} else if(d[0]==0xbd && d[2]==0xb3 && d[4]==0xa0){
const uint8_t * pacs = d + 6;
} else if (d[0] == 0xbd && d[2] == 0xb3 && d[4] == 0xa0) {
const uint8_t *pacs = d + 6;
const uint8_t pacs_length = pacs[1];
const uint8_t * pacs_data = pacs + 2;
const uint8_t *pacs_data = pacs + 2;
int res = HIDDumpPACSBits(pacs_data, pacs_length, verbose);
if(res != PM3_SUCCESS){
if (res != PM3_SUCCESS) {
return res;
}
const uint8_t * oid = pacs + 2 + pacs_length;
const uint8_t *oid = pacs + 2 + pacs_length;
const uint8_t oid_length = oid[1];
const uint8_t * oid_data = oid + 2;
const uint8_t *oid_data = oid + 2;
PrintAndLogEx(SUCCESS, "SIO OID.......: " _GREEN_("%s"), sprint_hex_inrow(oid_data, oid_length));
const uint8_t * mediaType = oid + 2 + oid_length;
const uint8_t *mediaType = oid + 2 + oid_length;
const uint8_t mediaType_data = mediaType[2];
PrintAndLogEx(SUCCESS, "SIO Media Type: " _GREEN_("%s"), getSioMediaTypeInfo(mediaType_data));

View file

@ -29,6 +29,6 @@ typedef struct {
int infoSeos(bool verbose);
int CmdHFSeos(const char *Cmd);
int seos_kdf(bool encryption, uint8_t* masterKey, uint8_t keyslot,
uint8_t* adfOid, size_t adfoid_len, uint8_t* diversifier, uint8_t diversifier_len, uint8_t* out, int encryption_algorithm, int hash_algorithm);
int seos_kdf(bool encryption, uint8_t *masterKey, uint8_t keyslot,
uint8_t *adfOid, size_t adfoid_len, uint8_t *diversifier, uint8_t diversifier_len, uint8_t *out, int encryption_algorithm, int hash_algorithm);
#endif

View file

@ -1664,7 +1664,7 @@ void HIDUnpack(int idx, wiegand_message_t *packed) {
}
}
int HIDDumpPACSBits(const uint8_t * const data, const uint8_t length, bool verbose){
int HIDDumpPACSBits(const uint8_t *const data, const uint8_t length, bool verbose) {
uint8_t n = length - 1;
uint8_t pad = data[0];
char *binstr = (char *)calloc((length * 8) + 1, sizeof(uint8_t));

View file

@ -54,7 +54,7 @@ bool HIDPack(int format_idx, wiegand_card_t *card, wiegand_message_t *packed, bo
bool HIDTryUnpack(wiegand_message_t *packed);
void HIDPackTryAll(wiegand_card_t *card, bool preamble);
void HIDUnpack(int idx, wiegand_message_t *packed);
int HIDDumpPACSBits(const uint8_t * const data, const uint8_t length, bool verbose);
int HIDDumpPACSBits(const uint8_t *const data, const uint8_t length, bool verbose);
void print_wiegand_code(wiegand_message_t *packed);
void print_desc_wiegand(cardformat_t *fmt, wiegand_message_t *packed);
#endif