diff --git a/NEWS b/NEWS index 8f6a480..0403fa0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +Changes between 0.2.2 and 0.2.3 [XX xxx XXXX] + + *) Deprecate authentication information when deleting the currently selected + application + Changes between 0.2.1 and 0.2.2 [23 nov 2010] *) Fix build when cutter is not available or is disabled. diff --git a/libfreefare/mifare_desfire.c b/libfreefare/mifare_desfire.c index 717413a..f510a2a 100644 --- a/libfreefare/mifare_desfire.c +++ b/libfreefare/mifare_desfire.c @@ -556,6 +556,16 @@ mifare_desfire_delete_application (MifareTag tag, MifareDESFireAID aid) DESFIRE_TRANSCEIVE (tag, cmd, res); + /* + * If we have deleted the current application, we are not authenticated + * anymore. + */ + if (MIFARE_DESFIRE (tag)->selected_application == (uint32_t)(aid->data[0] | aid->data[1] << 8 | aid->data[2] << 16)) { + free (MIFARE_DESFIRE (tag)->session_key); + MIFARE_DESFIRE (tag)->session_key = NULL; + MIFARE_DESFIRE (tag)->selected_application = 0x000000; + } + return 0; }