Dirty patch to be able to create "real" MifareDESFareAID.
This commit is contained in:
parent
8f645fbe62
commit
02d09e58f7
3 changed files with 15 additions and 5 deletions
|
@ -80,7 +80,8 @@ main(int argc, char *argv[])
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
errx (EXIT_FAILURE, "Authentication on master application failed");
|
errx (EXIT_FAILURE, "Authentication on master application failed");
|
||||||
|
|
||||||
MifareDESFireAID aid = mifare_desfire_aid_new (0x12, 0x34, 0x5);
|
MadAid mad_aid = { 0x12, 0x34 };
|
||||||
|
MifareDESFireAID aid = mifare_desfire_aid_new_with_mad_aid (mad_aid, 0x5);
|
||||||
res = mifare_desfire_create_application (tags[i], aid, 0xFF, 0x1);
|
res = mifare_desfire_create_application (tags[i], aid, 0xFF, 0x1);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
errx (EXIT_FAILURE, "Application creation failed");
|
errx (EXIT_FAILURE, "Application creation failed");
|
||||||
|
|
|
@ -237,7 +237,7 @@ enum mifare_desfire_file_types {
|
||||||
struct mifare_desfire_aid;
|
struct mifare_desfire_aid;
|
||||||
typedef struct mifare_desfire_aid *MifareDESFireAID;
|
typedef struct mifare_desfire_aid *MifareDESFireAID;
|
||||||
|
|
||||||
MifareDESFireAID mifare_desfire_aid_new (uint8_t application_code, uint8_t function_cluster_code, uint8_t n);
|
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);
|
||||||
|
|
||||||
struct mifare_desfire_key;
|
struct mifare_desfire_key;
|
||||||
|
|
|
@ -19,17 +19,26 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <freefare.h>
|
#include <freefare.h>
|
||||||
#include "freefare_internal.h"
|
#include "freefare_internal.h"
|
||||||
|
|
||||||
|
// FIXME Theorically, it should be an uint24_t ...
|
||||||
MifareDESFireAID
|
MifareDESFireAID
|
||||||
mifare_desfire_aid_new (uint8_t application_code, uint8_t function_cluster_code, uint8_t n)
|
mifare_desfire_aid_new (uint32_t aid)
|
||||||
{
|
{
|
||||||
MadAid mad_aid = { application_code, function_cluster_code };
|
MifareDESFireAID res;
|
||||||
return mifare_desfire_aid_new_with_mad_aid (mad_aid, n);
|
|
||||||
|
if ((res = malloc (sizeof (*res)))) {
|
||||||
|
// XXX We may take care of endianess
|
||||||
|
memcpy(res->data, ((uint8_t*)&aid), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX This function ease the MifareDESFireAID creation using a Mifare Classic AID (see MIFARE Application Directory document - section 3.10 MAD and MIFARE DESFire)
|
||||||
MifareDESFireAID
|
MifareDESFireAID
|
||||||
mifare_desfire_aid_new_with_mad_aid (MadAid mad_aid, uint8_t n)
|
mifare_desfire_aid_new_with_mad_aid (MadAid mad_aid, uint8_t n)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue