Remove deprecated API mifare_ultralight_get_uid(), mifare_classic_get_uid().
This commit is contained in:
parent
574b068b3f
commit
73c50a544a
8 changed files with 3 additions and 83 deletions
|
@ -119,7 +119,7 @@ main(int argc, char *argv[])
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *tag_uid = mifare_classic_get_uid (tags[i]);
|
char *tag_uid = freefare_get_tag_uid (tags[i]);
|
||||||
char buffer[BUFSIZ];
|
char buffer[BUFSIZ];
|
||||||
|
|
||||||
printf ("Found %s with UID %s. Format [yN] ", freefare_get_tag_friendly_name (tags[i]), tag_uid);
|
printf ("Found %s with UID %s. Format [yN] ", freefare_get_tag_friendly_name (tags[i]), tag_uid);
|
||||||
|
|
|
@ -63,8 +63,6 @@ int mifare_ultralight_disconnect (MifareTag tag);
|
||||||
int mifare_ultralight_read (MifareTag tag, const MifareUltralightPageNumber page, MifareUltralightPage *data);
|
int mifare_ultralight_read (MifareTag tag, const MifareUltralightPageNumber page, MifareUltralightPage *data);
|
||||||
int mifare_ultralight_write (MifareTag tag, const MifareUltralightPageNumber page, const MifareUltralightPage data);
|
int mifare_ultralight_write (MifareTag tag, const MifareUltralightPageNumber page, const MifareUltralightPage data);
|
||||||
|
|
||||||
char *mifare_ultralight_get_uid (MifareTag tag);
|
|
||||||
|
|
||||||
typedef unsigned char MifareClassicBlock[16];
|
typedef unsigned char MifareClassicBlock[16];
|
||||||
|
|
||||||
typedef uint8_t MifareSectorNumber;
|
typedef uint8_t MifareSectorNumber;
|
||||||
|
@ -91,7 +89,6 @@ int mifare_classic_get_trailer_block_permission (MifareTag tag, const MifareC
|
||||||
int mifare_classic_get_data_block_permission (MifareTag tag, const MifareClassicBlockNumber block, const unsigned char permission, const MifareClassicKeyType key_type);
|
int mifare_classic_get_data_block_permission (MifareTag tag, const MifareClassicBlockNumber block, const unsigned char permission, const MifareClassicKeyType key_type);
|
||||||
|
|
||||||
int mifare_classic_format_sector (MifareTag tag, const MifareClassicBlockNumber block);
|
int mifare_classic_format_sector (MifareTag tag, const MifareClassicBlockNumber block);
|
||||||
char *mifare_classic_get_uid (MifareTag tag);
|
|
||||||
|
|
||||||
void mifare_classic_trailer_block (MifareClassicBlock *block, const MifareClassicKey key_a, uint8_t ab_0, uint8_t ab_1, uint8_t ab_2, uint8_t ab_tb, const uint8_t gpb, const MifareClassicKey key_b);
|
void mifare_classic_trailer_block (MifareClassicBlock *block, const MifareClassicKey key_a, uint8_t ab_0, uint8_t ab_1, uint8_t ab_2, uint8_t ab_tb, const uint8_t gpb, const MifareClassicKey key_b);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
.Nm mifare_classic_get_trailer_block_permission ,
|
.Nm mifare_classic_get_trailer_block_permission ,
|
||||||
.Nm mifare_classic_get_data_block_permission ,
|
.Nm mifare_classic_get_data_block_permission ,
|
||||||
.Nm mifare_classic_format_sector ,
|
.Nm mifare_classic_format_sector ,
|
||||||
.Nm mifare_classic_get_uid ,
|
|
||||||
.Nm mifare_classic_trailer_block
|
.Nm mifare_classic_trailer_block
|
||||||
.Nd Mifare Classic Manipulation Functions
|
.Nd Mifare Classic Manipulation Functions
|
||||||
.\" _ _ _
|
.\" _ _ _
|
||||||
|
@ -86,8 +85,6 @@ Mifare card manipulation library (libfreefare, \-lfreefare)
|
||||||
.Fn mifare_classic_get_data_block_permission "MifareTag tag" "const MifareClassicBlockNumber block" "const unsigned char permission" "const MifareClassicKeyType key_type"
|
.Fn mifare_classic_get_data_block_permission "MifareTag tag" "const MifareClassicBlockNumber block" "const unsigned char permission" "const MifareClassicKeyType key_type"
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn mifare_classic_format_sector "MifareTag tag" "const MifareClassicBlockNumber block"
|
.Fn mifare_classic_format_sector "MifareTag tag" "const MifareClassicBlockNumber block"
|
||||||
.Ft "char *"
|
|
||||||
.Fn mifare_classic_get_uid "MifareTag tag"
|
|
||||||
.Ft void
|
.Ft void
|
||||||
.Fn mifare_classic_trailer_block "MifareClassicBlock *block" "const MifareClassicKey key_a" "const uint8_t ab_0" "const uint8_t ab_1" "const uint8_t ab_2" "const uint8_t ab_tb" "const uint8_t gpb" "const MifareClassicKey key_b"
|
.Fn mifare_classic_trailer_block "MifareClassicBlock *block" "const MifareClassicKey key_a" "const uint8_t ab_0" "const uint8_t ab_1" "const uint8_t ab_2" "const uint8_t ab_tb" "const uint8_t gpb" "const MifareClassicKey key_b"
|
||||||
.\" ____ _ _ _
|
.\" ____ _ _ _
|
||||||
|
@ -201,14 +198,6 @@ access bits for the blocks of the sector
|
||||||
.Vt ab_2 ;
|
.Vt ab_2 ;
|
||||||
and a B key
|
and a B key
|
||||||
.Vt key_b .
|
.Vt key_b .
|
||||||
.Pp
|
|
||||||
The
|
|
||||||
.Fn mifare_classic_get_uid
|
|
||||||
function retrieves a text representation of the UID of a
|
|
||||||
.Fn tag .
|
|
||||||
It is not required for the
|
|
||||||
.Vt tag
|
|
||||||
to be active to use this function.
|
|
||||||
.\" ____ _ _
|
.\" ____ _ _
|
||||||
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
|
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
|
||||||
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
|
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
|
||||||
|
|
|
@ -660,18 +660,6 @@ mifare_classic_format_sector (MifareTag tag, const MifareClassicBlockNumber bloc
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* UID accessor
|
|
||||||
*/
|
|
||||||
char*
|
|
||||||
mifare_classic_get_uid(MifareTag tag)
|
|
||||||
{
|
|
||||||
char* uid = malloc((4 * 2) + 1);
|
|
||||||
snprintf(uid, 9, "%02x%02x%02x%02x", tag->info.abtUid[0], tag->info.abtUid[1], tag->info.abtUid[2], tag->info.abtUid[3]);
|
|
||||||
uid[8] = '\0';
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the sector's first block number in the provided block's sector.
|
* Get the sector's first block number in the provided block's sector.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
.Nm mifare_ultralight_disconnect ,
|
.Nm mifare_ultralight_disconnect ,
|
||||||
.Nm mifare_ultralight_read ,
|
.Nm mifare_ultralight_read ,
|
||||||
.Nm mifare_ultralight_write ,
|
.Nm mifare_ultralight_write ,
|
||||||
.Nm mifare_ultralight_get_uid ,
|
|
||||||
.Nd Mifare UltraLight Manipulation Functions
|
.Nd Mifare UltraLight Manipulation Functions
|
||||||
.\" _ _ _
|
.\" _ _ _
|
||||||
.\" | | (_) |__ _ __ __ _ _ __ _ _
|
.\" | | (_) |__ _ __ __ _ _ __ _ _
|
||||||
|
@ -54,8 +53,6 @@ Mifare card manipulation library (libfreefare, \-lfreefare)
|
||||||
.Fn mifare_ultralight_read "MifareTag tag" "const MifareUltralightPageNumber page" "MifareUltralightPage *data"
|
.Fn mifare_ultralight_read "MifareTag tag" "const MifareUltralightPageNumber page" "MifareUltralightPage *data"
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn mifare_ultralight_write "MifareTag tag" "const MifareUltralightPageNumber page" "const MifareUltralightPage data"
|
.Fn mifare_ultralight_write "MifareTag tag" "const MifareUltralightPageNumber page" "const MifareUltralightPage data"
|
||||||
.Ft "char *"
|
|
||||||
.Fn mifare_ultralight_get_uid "MifareTag tag"
|
|
||||||
.\" ____ _ _ _
|
.\" ____ _ _ _
|
||||||
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
|
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
|
||||||
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
|
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
|
||||||
|
@ -88,14 +85,6 @@ After usage, a
|
||||||
.Vt tag
|
.Vt tag
|
||||||
is deactivated using
|
is deactivated using
|
||||||
.Fn mifare_ultralight_disconnect .
|
.Fn mifare_ultralight_disconnect .
|
||||||
.Pp
|
|
||||||
The
|
|
||||||
.Fn mifare_ultralight_get_uid
|
|
||||||
function retrieves a text representation of the UID of a
|
|
||||||
.Fn tag .
|
|
||||||
It is not required for the
|
|
||||||
.Vt tag
|
|
||||||
to be active to use this function.
|
|
||||||
.\" ____ _ _
|
.\" ____ _ _
|
||||||
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
|
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
|
||||||
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
|
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
|
||||||
|
|
|
@ -183,23 +183,3 @@ mifare_ultralight_write (MifareTag tag, const MifareUltralightPageNumber page, c
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Miscellaneous functions
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
mifare_ultralight_get_uid (MifareTag tag)
|
|
||||||
{
|
|
||||||
char *uid = malloc (2 * 7 + 1);
|
|
||||||
sprintf (uid, "%02x%02x%02x%02x%02x%02x%02x",
|
|
||||||
tag->info.abtUid[0],
|
|
||||||
tag->info.abtUid[1],
|
|
||||||
tag->info.abtUid[2],
|
|
||||||
tag->info.abtUid[3],
|
|
||||||
tag->info.abtUid[4],
|
|
||||||
tag->info.abtUid[5],
|
|
||||||
tag->info.abtUid[6]);
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ test_mifare_classic_get_uid (void)
|
||||||
{
|
{
|
||||||
char *uid;
|
char *uid;
|
||||||
|
|
||||||
uid = mifare_classic_get_uid (tag);
|
uid = freefare_get_tag_uid (tag);
|
||||||
|
|
||||||
cut_assert_not_null (uid, cut_message ("mifare_classic_get_uid() failed"));
|
cut_assert_not_null (uid, cut_message ("mifare_classic_get_uid() failed"));
|
||||||
cut_assert_equal_int (8, strlen (uid), cut_message ("Wrong UID length"));
|
cut_assert_equal_int (8, strlen (uid), cut_message ("Wrong UID length"));
|
||||||
|
@ -358,14 +358,3 @@ test_mifare_classic_sector_boundaries (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
test_mifare_classic_get_uid_freefare_get_tag_uid (void)
|
|
||||||
{
|
|
||||||
char *s1 = mifare_classic_get_uid (tag);
|
|
||||||
char *s2 = freefare_get_tag_uid (tag);
|
|
||||||
|
|
||||||
cut_assert_equal_string (s1, s2, cut_message ("UID don't match"));
|
|
||||||
|
|
||||||
free (s1);
|
|
||||||
free (s2);
|
|
||||||
}
|
|
||||||
|
|
|
@ -146,22 +146,10 @@ test_mifare_ultralight_get_uid (void)
|
||||||
{
|
{
|
||||||
char *uid;
|
char *uid;
|
||||||
|
|
||||||
uid = mifare_ultralight_get_uid (tag);
|
uid = freefare_get_tag_uid (tag);
|
||||||
|
|
||||||
cut_assert_not_null (uid, cut_message ("mifare_ultralight_get_uid() failed"));
|
cut_assert_not_null (uid, cut_message ("mifare_ultralight_get_uid() failed"));
|
||||||
cut_assert_equal_int (14, strlen (uid), cut_message ("Wrong UID length"));
|
cut_assert_equal_int (14, strlen (uid), cut_message ("Wrong UID length"));
|
||||||
|
|
||||||
free (uid);
|
free (uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
test_mifare_ultralight_get_uid_freefare_get_tag_uid (void)
|
|
||||||
{
|
|
||||||
char *s1 = mifare_ultralight_get_uid (tag);
|
|
||||||
char *s2 = freefare_get_tag_uid (tag);
|
|
||||||
|
|
||||||
cut_assert_equal_string (s1, s2, cut_message ("UID don't match"));
|
|
||||||
|
|
||||||
free (s1);
|
|
||||||
free (s2);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue