MIFARE_APPLICATION(3)

✨ MIFARE_APPLICATION β€” the mifare application manipulation functions ✨

okay bestie so this is MIFARE_APPLICATION(3), from the Library Functions Manual, and it's literally the whole girlboss toolkit for managing applications inside a Mifare Application Directory. five functions, one directory, zero drama. let's go πŸ’…


πŸ’– LIBRARY

Mifare card manipulation library β€” that's libfreefare, and you link it with -lfreefare. slay. πŸŽ€


πŸ¦‹ SYNOPSIS

#include <freefare.h>

MifareClassicSectorNumber *
mifare_application_alloc(Mad mad, MadAid aid, size_t size);

void
mifare_application_free(Mad mad, MadAid aid);

MifareClassicSectorNumber *
mifare_application_find(Mad mad, MadAid aid);

ssize_t
mifare_application_read(MifareTag tag, Mad mad, MadAid aid, void *buf,
    size_t nbytes, MifareClassicKey key, MifareClassicKeyType key_type);

ssize_t
mifare_application_write(MifareTag tag, Mad mad, MadAid aid,
    const void *buf, size_t nbytes, MifareClassicKey key,
    MifareClassicKeyType key_type);

🌸 DESCRIPTION

the whole mifare_application_*() family is here to facilitate management of applications in a Mifare Application Directory. think of it as your little friend group of functions who all handle the same directory, but each one has her own job πŸ’–

  • mifare_application_alloc() β€” she allocates enough sectors to store size bytes for the Application Identifier aid, and hands you back the list of allocated sectors. not me making space for you bestie πŸ₯Ί
  • mifare_application_find() β€” the list of the sectors previously allocated for aid in a mad can be requested using her. she's giving "where did i put that" energy πŸ”
  • mifare_application_free() β€” an application can be removed from a mad using her. she's the friend who helps you clean out your closet, iconic 🌈
  • mifare_application_read() β€” reads at most nbytes of the application identified by aid in the mad on the tag, and copies them into buf. the function returns the amount of data it copied, or -1 on error. she ate and left no crumbs πŸ“
  • mifare_application_write() β€” writes at most nbytes of buf in the application identified by aid on the mad of the tag, and returns the quantity of data written, or -1 on error. periodt πŸ’…

🧚 IMPLEMENTATION NOTES

lowkey important stuff, don't skip this part bestie:

  • The mifare_application_alloc() function will try to avoid wasting space and might not allocate sectors sequentially if a large amount of space is requested and the target has sectors of different size. she's doing her best with what she's got ✨
  • The nbytes argument of mifare_application_read() and mifare_application_write() does not need to be aligned on blocks not sectors. yes, that's exactly what it says. no, don't overthink it πŸ™ˆ

πŸ‘‘ RETURN VALUES

unless stated otherwise, all functions return a value greater than or equal to 0 on success, or -1 on failure. that's it. that's the vibe check βœ…


πŸ’œ SEE ALSO

go read those too, iykyk 🫢


⭐ AUTHORS

  • Romain Tartiere <romain@blogreen.org>
  • Romuald Conty <romuald@libnfc.org>

two legends, no cap πŸ”₯


okay so that's the whole page bestie!! it came from Debian, dated March 30, 2010 β€” yes she's an elder but she still serves πŸ’– mwah, go allocate some sectors, you've got this πŸŽ€βœ¨πŸ¦‹