mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-14 01:03:01 -07:00
Minor fixes
* fix compiler warnings on Ubuntu * cmdhf14a.c: make manufactureMapping static * cmdhf14a.c: fix format strings
This commit is contained in:
parent
91e03840f4
commit
b838c4ff27
6 changed files with 17 additions and 17 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "util_posix.h"
|
#include "util_posix.h"
|
||||||
#include "iso14443crc.h"
|
#include "iso14443crc.h"
|
||||||
|
@ -34,8 +35,13 @@
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
static int waitCmd(uint8_t iLen);
|
static int waitCmd(uint8_t iLen);
|
||||||
|
|
||||||
|
// structure and database for uid -> tagtype lookups
|
||||||
|
typedef struct {
|
||||||
|
uint8_t uid;
|
||||||
|
char* desc;
|
||||||
|
} manufactureName;
|
||||||
|
|
||||||
const manufactureName manufactureMapping[] = {
|
static const manufactureName manufactureMapping[] = {
|
||||||
// ID, "Vendor Country"
|
// ID, "Vendor Country"
|
||||||
{ 0x01, "Motorola UK" },
|
{ 0x01, "Motorola UK" },
|
||||||
{ 0x02, "ST Microelectronics SA France" },
|
{ 0x02, "ST Microelectronics SA France" },
|
||||||
|
@ -153,7 +159,7 @@ int CmdHF14AReader(const char *Cmd) {
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X':
|
case 'X':
|
||||||
cm = cm - ISO14A_CONNECT;
|
cm &= ~ISO14A_CONNECT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintAndLog("Unknown command.");
|
PrintAndLog("Unknown command.");
|
||||||
|
@ -191,7 +197,7 @@ int CmdHF14AReader(const char *Cmd) {
|
||||||
|
|
||||||
PrintAndLog(" UID : %s", sprint_hex(card.uid, card.uidlen));
|
PrintAndLog(" UID : %s", sprint_hex(card.uid, card.uidlen));
|
||||||
PrintAndLog("ATQA : %02x %02x", card.atqa[1], card.atqa[0]);
|
PrintAndLog("ATQA : %02x %02x", card.atqa[1], card.atqa[0]);
|
||||||
PrintAndLog(" SAK : %02x [%d]", card.sak, resp.arg[0]);
|
PrintAndLog(" SAK : %02x [%" PRIu64 "]", card.sak, resp.arg[0]);
|
||||||
if(card.ats_len >= 3) { // a valid ATS consists of at least the length byte (TL) and 2 CRC bytes
|
if(card.ats_len >= 3) { // a valid ATS consists of at least the length byte (TL) and 2 CRC bytes
|
||||||
PrintAndLog(" ATS : %s", sprint_hex(card.ats, card.ats_len));
|
PrintAndLog(" ATS : %s", sprint_hex(card.ats, card.ats_len));
|
||||||
}
|
}
|
||||||
|
@ -243,7 +249,7 @@ int CmdHF14AInfo(const char *Cmd)
|
||||||
|
|
||||||
PrintAndLog(" UID : %s", sprint_hex(card.uid, card.uidlen));
|
PrintAndLog(" UID : %s", sprint_hex(card.uid, card.uidlen));
|
||||||
PrintAndLog("ATQA : %02x %02x", card.atqa[1], card.atqa[0]);
|
PrintAndLog("ATQA : %02x %02x", card.atqa[1], card.atqa[0]);
|
||||||
PrintAndLog(" SAK : %02x [%d]", card.sak, resp.arg[0]);
|
PrintAndLog(" SAK : %02x [%" PRIu64 "]", card.sak, resp.arg[0]);
|
||||||
|
|
||||||
bool isMifareClassic = true;
|
bool isMifareClassic = true;
|
||||||
switch (card.sak) {
|
switch (card.sak) {
|
||||||
|
|
|
@ -15,12 +15,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
// structure and database for uid -> tagtype lookups
|
|
||||||
typedef struct {
|
|
||||||
uint8_t uid;
|
|
||||||
char* desc;
|
|
||||||
} manufactureName;
|
|
||||||
|
|
||||||
int CmdHF14A(const char *Cmd);
|
int CmdHF14A(const char *Cmd);
|
||||||
int CmdHF14AList(const char *Cmd);
|
int CmdHF14AList(const char *Cmd);
|
||||||
int CmdHF14AMifare(const char *Cmd);
|
int CmdHF14AMifare(const char *Cmd);
|
||||||
|
|
|
@ -215,7 +215,7 @@ static unsigned char *crypto_pk_polarssl_encrypt(const struct crypto_pk *_cp, co
|
||||||
|
|
||||||
res = rsa_public(&cp->ctx, buf, result);
|
res = rsa_public(&cp->ctx, buf, result);
|
||||||
if(res) {
|
if(res) {
|
||||||
printf("RSA encrypt failed. Error: %x data len: %d key len: %d\n", res * -1, len, keylen);
|
printf("RSA encrypt failed. Error: %x data len: %zd key len: %zd\n", res * -1, len, keylen);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ static unsigned char *crypto_pk_polarssl_decrypt(const struct crypto_pk *_cp, co
|
||||||
|
|
||||||
res = rsa_private(&cp->ctx, buf, result); // CHECK???
|
res = rsa_private(&cp->ctx, buf, result); // CHECK???
|
||||||
if(res) {
|
if(res) {
|
||||||
printf("RSA decrypt failed. Error: %x data len: %d key len: %d\n", res * -1, len, keylen);
|
printf("RSA decrypt failed. Error: %x data len: %zd key len: %zd\n", res * -1, len, keylen);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ static unsigned char *emv_pki_decode_message(const struct emv_pk *enc_pk,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cert_tlv->len != enc_pk->mlen) {
|
if (cert_tlv->len != enc_pk->mlen) {
|
||||||
printf("ERROR: Certificate length (%d) not equal key length (%d)\n", cert_tlv->len, enc_pk->mlen);
|
printf("ERROR: Certificate length (%zd) not equal key length (%zd)\n", cert_tlv->len, enc_pk->mlen);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
kcp = crypto_pk_open(enc_pk->pk_algo,
|
kcp = crypto_pk_open(enc_pk->pk_algo,
|
||||||
|
@ -451,7 +451,7 @@ struct tlvdb *emv_pki_perform_cda_ex(const struct emv_pk *enc_pk, const struct t
|
||||||
un_tlv,
|
un_tlv,
|
||||||
NULL);
|
NULL);
|
||||||
if (!data || data_len < 3) {
|
if (!data || data_len < 3) {
|
||||||
printf("ERROR: can't decode message. len %d\n", data_len);
|
printf("ERROR: can't decode message. len %zd\n", data_len);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ static int test_pk(bool verbose)
|
||||||
|
|
||||||
tmp = crypto_pk_get_parameter(pubk, 0, &tmp_len);
|
tmp = crypto_pk_get_parameter(pubk, 0, &tmp_len);
|
||||||
if (tmp_len != sizeof(pk_N) || memcmp(tmp, pk_N, tmp_len)) {
|
if (tmp_len != sizeof(pk_N) || memcmp(tmp, pk_N, tmp_len)) {
|
||||||
fprintf(stderr, "ERROR: crypto_pk_get_parameter(0) Modulus. param len %d len %d\n", tmp_len, sizeof(pk_N));
|
fprintf(stderr, "ERROR: crypto_pk_get_parameter(0) Modulus. param len %zd len %zd\n", tmp_len, sizeof(pk_N));
|
||||||
free(tmp);
|
free(tmp);
|
||||||
goto close_pub;
|
goto close_pub;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ static int test_pk(bool verbose)
|
||||||
|
|
||||||
tmp = crypto_pk_get_parameter(privk, 0, &tmp_len);
|
tmp = crypto_pk_get_parameter(privk, 0, &tmp_len);
|
||||||
if (tmp_len != sizeof(pk_N) || memcmp(tmp, pk_N, tmp_len)) {
|
if (tmp_len != sizeof(pk_N) || memcmp(tmp, pk_N, tmp_len)) {
|
||||||
fprintf(stderr, "ERROR: crypto_pk_get_parameter(0) Modulus. param len %d len %d\n", tmp_len, sizeof(pk_N));
|
fprintf(stderr, "ERROR: crypto_pk_get_parameter(0) Modulus. param len %zd len %zd\n", tmp_len, sizeof(pk_N));
|
||||||
free(tmp);
|
free(tmp);
|
||||||
goto close;
|
goto close;
|
||||||
}
|
}
|
||||||
|
|
|
@ -620,7 +620,7 @@ int hextobinarray(char *target, char *source)
|
||||||
else if (x >= 'A' && x <= 'F')
|
else if (x >= 'A' && x <= 'F')
|
||||||
x -= 'A' - 10;
|
x -= 'A' - 10;
|
||||||
else {
|
else {
|
||||||
printf("Discovered unknown character %c %d at idx %d of %s\n", x, x, source - start, start);
|
printf("Discovered unknown character %c %d at idx %d of %s\n", x, x, (unsigned int)(source - start), start);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// output
|
// output
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue