Rename MifareTag to FreefareTag.
Because we are libfreefare and not libmifare, the generic tag type should not be so specific.
This commit is contained in:
parent
d946230aec
commit
42b21ff42f
42 changed files with 384 additions and 381 deletions
|
|
@ -44,9 +44,9 @@ MifareClassicKey default_keys_int[] = {
|
|||
{ 0xaa,0xbb,0xcc,0xdd,0xee,0xff },
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00 }
|
||||
};
|
||||
int format_mifare_classic_1k (MifareTag tag);
|
||||
int format_mifare_classic_4k (MifareTag tag);
|
||||
int try_format_sector (MifareTag tag, MifareClassicSectorNumber sector);
|
||||
int format_mifare_classic_1k (FreefareTag tag);
|
||||
int format_mifare_classic_4k (FreefareTag tag);
|
||||
int try_format_sector (FreefareTag tag, MifareClassicSectorNumber sector);
|
||||
|
||||
static int at_block = 0;
|
||||
static int mod_block = 10;
|
||||
|
|
@ -73,7 +73,7 @@ display_progress (void)
|
|||
}
|
||||
|
||||
int
|
||||
format_mifare_classic_1k (MifareTag tag)
|
||||
format_mifare_classic_1k (FreefareTag tag)
|
||||
{
|
||||
printf (START_FORMAT_N, 16);
|
||||
for (int sector = 0; sector < 16; sector++) {
|
||||
|
|
@ -85,7 +85,7 @@ format_mifare_classic_1k (MifareTag tag)
|
|||
}
|
||||
|
||||
int
|
||||
format_mifare_classic_4k (MifareTag tag)
|
||||
format_mifare_classic_4k (FreefareTag tag)
|
||||
{
|
||||
printf (START_FORMAT_N, 32 + 8);
|
||||
for (int sector = 0; sector < (32 + 8); sector++) {
|
||||
|
|
@ -97,7 +97,7 @@ format_mifare_classic_4k (MifareTag tag)
|
|||
}
|
||||
|
||||
int
|
||||
try_format_sector (MifareTag tag, MifareClassicSectorNumber sector)
|
||||
try_format_sector (FreefareTag tag, MifareClassicSectorNumber sector)
|
||||
{
|
||||
display_progress ();
|
||||
for (size_t i = 0; i < (sizeof (default_keys) / sizeof (MifareClassicKey)); i++) {
|
||||
|
|
@ -143,7 +143,7 @@ main(int argc, char *argv[])
|
|||
int ch;
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
while ((ch = getopt (argc, argv, "fhy")) != -1) {
|
||||
switch (ch) {
|
||||
|
|
@ -238,7 +238,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (format) {
|
||||
enum mifare_tag_type tt = freefare_get_tag_type (tags[i]);
|
||||
enum freefare_tag_type tt = freefare_get_tag_type (tags[i]);
|
||||
at_block = 0;
|
||||
|
||||
if (format_options.fast) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
int error = 0;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
Mad mad;
|
||||
|
||||
int ch;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ uint8_t *ndef_msg;
|
|||
size_t ndef_msg_len;
|
||||
|
||||
static int
|
||||
search_sector_key (MifareTag tag, MifareClassicSectorNumber sector, MifareClassicKey *key, MifareClassicKeyType *key_type)
|
||||
search_sector_key (FreefareTag tag, MifareClassicSectorNumber sector, MifareClassicKey *key, MifareClassicKeyType *key_type)
|
||||
{
|
||||
MifareClassicBlockNumber block = mifare_classic_sector_last_block (sector);
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ search_sector_key (MifareTag tag, MifareClassicSectorNumber sector, MifareClassi
|
|||
}
|
||||
|
||||
static int
|
||||
fix_mad_trailer_block (nfc_device *device, MifareTag tag, MifareClassicSectorNumber sector, MifareClassicKey key, MifareClassicKeyType key_type)
|
||||
fix_mad_trailer_block (nfc_device *device, FreefareTag tag, MifareClassicSectorNumber sector, MifareClassicKey key, MifareClassicKeyType key_type)
|
||||
{
|
||||
MifareClassicBlock block;
|
||||
mifare_classic_trailer_block (&block, mad_public_key_a, 0x0, 0x1, 0x1, 0x6, 0x00, default_keyb);
|
||||
|
|
@ -136,7 +136,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
int error = 0;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
Mad mad;
|
||||
MifareClassicKey transport_key = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
if (argc > 1)
|
||||
errx (EXIT_FAILURE, "usage: %s", argv[0]);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ main(int argc, char *argv[])
|
|||
int ch;
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
while ((ch = getopt (argc, argv, "hyK:")) != -1) {
|
||||
switch (ch) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ main(int argc, char *argv[])
|
|||
int ch;
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
while ((ch = getopt (argc, argv, "hyK:")) != -1) {
|
||||
switch (ch) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ main(int argc, char *argv[])
|
|||
int ch;
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
while ((ch = getopt (argc, argv, "hy")) != -1) {
|
||||
switch (ch) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ main(int argc, char *argv[])
|
|||
int ch;
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
while ((ch = getopt (argc, argv, "hyK:")) != -1) {
|
||||
switch (ch) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ main(int argc, char *argv[])
|
|||
int ch;
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
while ((ch = getopt (argc, argv, "hyK:")) != -1) {
|
||||
switch (ch) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
if (argc > 1)
|
||||
errx (EXIT_FAILURE, "usage: %s", argv[0]);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ main(int argc, char *argv[])
|
|||
int ch;
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
char *ndef_output = NULL;
|
||||
while ((ch = getopt (argc, argv, "hyo:k:")) != -1) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ main(int argc, char *argv[])
|
|||
int ch;
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
char *ndef_input = NULL;
|
||||
while ((ch = getopt (argc, argv, "hyi:k:")) != -1) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
int error = EXIT_SUCCESS;
|
||||
nfc_device *device = NULL;
|
||||
MifareTag *tags = NULL;
|
||||
FreefareTag *tags = NULL;
|
||||
|
||||
if (argc > 1)
|
||||
errx (EXIT_FAILURE, "usage: %s", argv[0]);
|
||||
|
|
@ -69,7 +69,7 @@ main (int argc, char *argv[])
|
|||
char *tag_uid = freefare_get_tag_uid (tags[i]);
|
||||
printf ("Tag with UID %s is a %s\n", tag_uid, freefare_get_tag_friendly_name (tags[i]));
|
||||
if (freefare_get_tag_type (tags[i]) == ULTRALIGHT_C) {
|
||||
MifareTag tag = tags[i];
|
||||
FreefareTag tag = tags[i];
|
||||
int res;
|
||||
MifareDESFireKey key;
|
||||
uint8_t key1_3des_data[16] = { 0x49, 0x45, 0x4D, 0x4B, 0x41, 0x45, 0x52, 0x42, 0x21, 0x4E, 0x41, 0x43, 0x55, 0x4F, 0x59, 0x46 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue