New API function mifare_desfire_aid_get_aid().
This commit is contained in:
parent
07709c2835
commit
8dac813e53
5 changed files with 21 additions and 3 deletions
1
NEWS
1
NEWS
|
@ -4,6 +4,7 @@ Changes between 0.2.0 and 0.2.1 [xx XXX xxxx]
|
||||||
functions were removed and replaced by the freefare_strerror(),
|
functions were removed and replaced by the freefare_strerror(),
|
||||||
freefare_strerror_r() and freefare_perror() functions.
|
freefare_strerror_r() and freefare_perror() functions.
|
||||||
*) New function mifare_desfire_last_picc_error().
|
*) New function mifare_desfire_last_picc_error().
|
||||||
|
*) New function mifare_desfire_aid_get_aid().
|
||||||
*) Blok numbers in ISO14443-4 blocks are incremented according to the
|
*) Blok numbers in ISO14443-4 blocks are incremented according to the
|
||||||
specification.
|
specification.
|
||||||
|
|
||||||
|
|
|
@ -243,6 +243,7 @@ typedef struct mifare_desfire_aid *MifareDESFireAID;
|
||||||
|
|
||||||
MifareDESFireAID mifare_desfire_aid_new (uint32_t aid);
|
MifareDESFireAID mifare_desfire_aid_new (uint32_t aid);
|
||||||
MifareDESFireAID mifare_desfire_aid_new_with_mad_aid (MadAid mad_aid, uint8_t n);
|
MifareDESFireAID mifare_desfire_aid_new_with_mad_aid (MadAid mad_aid, uint8_t n);
|
||||||
|
uint32_t mifare_desfire_aid_get_aid (MifareDESFireAID aid);
|
||||||
|
|
||||||
uint8_t mifare_desfire_last_picc_error (MifareTag tag);
|
uint8_t mifare_desfire_last_picc_error (MifareTag tag);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
.\"
|
.\"
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm mifare_desfire_aid_new ,
|
.Nm mifare_desfire_aid_new ,
|
||||||
.Nm mifare_desfire_aid_new_with_mad_aid
|
.Nm mifare_desfire_aid_new_with_mad_aid ,
|
||||||
|
.Nm mifare_desfire_aid_get_aid
|
||||||
.Nd Mifare DESFire AID Manipulation Functions
|
.Nd Mifare DESFire AID Manipulation Functions
|
||||||
.\" _ _ _
|
.\" _ _ _
|
||||||
.\" | | (_) |__ _ __ __ _ _ __ _ _
|
.\" | | (_) |__ _ __ __ _ _ __ _ _
|
||||||
|
@ -48,6 +49,8 @@ Mifare card manipulation library (libfreefare, \-lfreefare)
|
||||||
.Fn mifare_desfire_aid_new "uint32_t aid"
|
.Fn mifare_desfire_aid_new "uint32_t aid"
|
||||||
.Ft MifareDESFireAID
|
.Ft MifareDESFireAID
|
||||||
.Fn mifare_desfire_aid_new_with_mad_aid "MadAid mad_aid" "uint8_t n"
|
.Fn mifare_desfire_aid_new_with_mad_aid "MadAid mad_aid" "uint8_t n"
|
||||||
|
.Ft uint32_t
|
||||||
|
.Fn mifare_desfire_aid_get_aid "MifareDESFireAID aid"
|
||||||
.\" ____ _ _ _
|
.\" ____ _ _ _
|
||||||
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
|
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
|
||||||
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
|
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
|
||||||
|
@ -78,6 +81,12 @@ and
|
||||||
.Fn mifare_desfire_aid_new_with_mad_aid
|
.Fn mifare_desfire_aid_new_with_mad_aid
|
||||||
allocates memory that should be reclaimed using
|
allocates memory that should be reclaimed using
|
||||||
.Xr free 3 .
|
.Xr free 3 .
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
|
.Fn mifare_desfire_aid_get_aid
|
||||||
|
function returns the
|
||||||
|
.Vt aid
|
||||||
|
of the provided Mifare DESFire AID.
|
||||||
.\" ____ _ _
|
.\" ____ _ _
|
||||||
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
|
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
|
||||||
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
|
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
|
||||||
|
@ -85,7 +94,7 @@ allocates memory that should be reclaimed using
|
||||||
.\" |_| \_\___|\__|\__,_|_| |_| |_| \_/ \__,_|_|\__,_|\___||___/
|
.\" |_| \_\___|\__|\__,_|_| |_| |_| \_/ \__,_|_|\__,_|\___||___/
|
||||||
.\"
|
.\"
|
||||||
.Sh RETURN VALUES
|
.Sh RETURN VALUES
|
||||||
The functions returns the allocated AID on success,
|
The allocation functions returns the allocated AID on success,
|
||||||
.Va NULL
|
.Va NULL
|
||||||
otherwise.
|
otherwise.
|
||||||
.\" ____ _
|
.\" ____ _
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
#include <freefare.h>
|
#include <freefare.h>
|
||||||
#include "freefare_internal.h"
|
#include "freefare_internal.h"
|
||||||
|
|
||||||
// FIXME Theorically, it should be an uint24_t ...
|
// Theorically, it should be an uint24_t ...
|
||||||
MifareDESFireAID
|
MifareDESFireAID
|
||||||
mifare_desfire_aid_new (uint32_t aid)
|
mifare_desfire_aid_new (uint32_t aid)
|
||||||
{
|
{
|
||||||
|
@ -82,3 +82,8 @@ mifare_desfire_aid_new_with_mad_aid (MadAid mad_aid, uint8_t n)
|
||||||
return mifare_desfire_aid_new (0xf00000 | (mad_aid.function_cluster_code << 12) | (mad_aid.application_code << 4) | n);
|
return mifare_desfire_aid_new (0xf00000 | (mad_aid.function_cluster_code << 12) | (mad_aid.application_code << 4) | n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
mifare_desfire_aid_get_aid (MifareDESFireAID aid)
|
||||||
|
{
|
||||||
|
return aid->data[0] | (aid->data[1] << 8) | (aid->data[2] << 16);
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@ test_mifare_desfire_aid (void)
|
||||||
|
|
||||||
cut_assert_equal_memory (desfire_aid->data,3, desfire_aid2->data, 3, cut_message ("wrong aid"));
|
cut_assert_equal_memory (desfire_aid->data,3, desfire_aid2->data, 3, cut_message ("wrong aid"));
|
||||||
|
|
||||||
|
cut_assert_equal_int (mifare_desfire_aid_get_aid (desfire_aid), 0x00f12ab8, cut_message ("wrong aid"));
|
||||||
|
|
||||||
free (desfire_aid);
|
free (desfire_aid);
|
||||||
free (desfire_aid2);
|
free (desfire_aid2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue