Skip to content

Commit

Permalink
Merge pull request nfc-tools#62 from janschiefer/convenience_functions
Browse files Browse the repository at this point in the history
Convenience function for application settings on Mifare DESFire PICCs.
  • Loading branch information
smortex committed Jun 26, 2017
2 parents 0db44b2 + f293cf9 commit 91c2c59
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions libfreefare/freefare.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,22 @@ enum mifare_desfire_file_types {
#define APPLICATION_CRYPTO_3K3DES 0x40
#define APPLICATION_CRYPTO_AES 0x80

/* Mifare DESFire Application settings
* bit 7 - 4: Number of key needed to change application keys (key 0 - 13; 0 = master key; 14 = key itself required for key change; 15 = all keys are frozen)
* bit 3: Application configuration frozen = 0; Application configuration changeable when authenticated with application master key = 1
* bit 2: Application master key authentication required for create/delete files = 0; Authentication not required = 1
* bit 1: GetFileIDs, GetFileSettings and GetKeySettings behavior: Master key authentication required = 0; No authentication required = 1
* bit 0 = Application master key frozen = 0; Application master key changeable = 1
*/

#define MDAPP_SETTINGS(key_no_for_key_changing,config_changeable,free_create_delete_files,free_listing_contents,app_master_key_changeable) ( \
(key_no_for_key_changing << 4) | \
(config_changeable << 3) | \
(free_listing_contents << 1) | \
(app_master_key_changeable) \
)


/* Access right */

#define MDAR(read,write,read_write,change_access_rights) ( \
Expand Down

0 comments on commit 91c2c59

Please sign in to comment.