From 73c50a544ad6d5867c3b73cdc4ad1e5158a4f7ac Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Tue, 30 Mar 2010 16:24:37 +0000 Subject: [PATCH] Remove deprecated API mifare_ultralight_get_uid(), mifare_classic_get_uid(). --- examples/mifare-classic-format.c | 2 +- libfreefare/freefare.h | 3 --- libfreefare/mifare_classic.3 | 11 ----------- libfreefare/mifare_classic.c | 12 ------------ libfreefare/mifare_ultralight.3 | 11 ----------- libfreefare/mifare_ultralight.c | 20 -------------------- test/test_mifare_classic.c | 13 +------------ test/test_mifare_ultralight.c | 14 +------------- 8 files changed, 3 insertions(+), 83 deletions(-) diff --git a/examples/mifare-classic-format.c b/examples/mifare-classic-format.c index 6da47a1..160fdcf 100644 --- a/examples/mifare-classic-format.c +++ b/examples/mifare-classic-format.c @@ -119,7 +119,7 @@ main(int argc, char *argv[]) continue; } - char *tag_uid = mifare_classic_get_uid (tags[i]); + char *tag_uid = freefare_get_tag_uid (tags[i]); char buffer[BUFSIZ]; printf ("Found %s with UID %s. Format [yN] ", freefare_get_tag_friendly_name (tags[i]), tag_uid); diff --git a/libfreefare/freefare.h b/libfreefare/freefare.h index bccb4ce..f1475fa 100644 --- a/libfreefare/freefare.h +++ b/libfreefare/freefare.h @@ -63,8 +63,6 @@ int mifare_ultralight_disconnect (MifareTag tag); int mifare_ultralight_read (MifareTag tag, const MifareUltralightPageNumber page, 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 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_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); diff --git a/libfreefare/mifare_classic.3 b/libfreefare/mifare_classic.3 index 75e99f3..bd92d1f 100644 --- a/libfreefare/mifare_classic.3 +++ b/libfreefare/mifare_classic.3 @@ -39,7 +39,6 @@ .Nm mifare_classic_get_trailer_block_permission , .Nm mifare_classic_get_data_block_permission , .Nm mifare_classic_format_sector , -.Nm mifare_classic_get_uid , .Nm mifare_classic_trailer_block .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" .Ft int .Fn mifare_classic_format_sector "MifareTag tag" "const MifareClassicBlockNumber block" -.Ft "char *" -.Fn mifare_classic_get_uid "MifareTag tag" .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" .\" ____ _ _ _ @@ -201,14 +198,6 @@ access bits for the blocks of the sector .Vt ab_2 ; and a B key .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. .\" ____ _ _ .\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___ .\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __| diff --git a/libfreefare/mifare_classic.c b/libfreefare/mifare_classic.c index 68fa3bd..470e8c3 100644 --- a/libfreefare/mifare_classic.c +++ b/libfreefare/mifare_classic.c @@ -660,18 +660,6 @@ mifare_classic_format_sector (MifareTag tag, const MifareClassicBlockNumber bloc 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. */ diff --git a/libfreefare/mifare_ultralight.3 b/libfreefare/mifare_ultralight.3 index 30bf6f6..badd41d 100644 --- a/libfreefare/mifare_ultralight.3 +++ b/libfreefare/mifare_ultralight.3 @@ -29,7 +29,6 @@ .Nm mifare_ultralight_disconnect , .Nm mifare_ultralight_read , .Nm mifare_ultralight_write , -.Nm mifare_ultralight_get_uid , .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" .Ft int .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 is deactivated using .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. .\" ____ _ _ .\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___ .\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __| diff --git a/libfreefare/mifare_ultralight.c b/libfreefare/mifare_ultralight.c index 9e4f7c4..e0ae324 100644 --- a/libfreefare/mifare_ultralight.c +++ b/libfreefare/mifare_ultralight.c @@ -183,23 +183,3 @@ mifare_ultralight_write (MifareTag tag, const MifareUltralightPageNumber page, c 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; -} diff --git a/test/test_mifare_classic.c b/test/test_mifare_classic.c index 6e9ca5a..365ca79 100644 --- a/test/test_mifare_classic.c +++ b/test/test_mifare_classic.c @@ -331,7 +331,7 @@ test_mifare_classic_get_uid (void) { 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_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); -} diff --git a/test/test_mifare_ultralight.c b/test/test_mifare_ultralight.c index 52bda59..3e5b3e9 100644 --- a/test/test_mifare_ultralight.c +++ b/test/test_mifare_ultralight.c @@ -146,22 +146,10 @@ test_mifare_ultralight_get_uid (void) { 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_equal_int (14, strlen (uid), cut_message ("Wrong UID length")); 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); -}