Discard authentication information after deleting the currently selected application.

This commit is contained in:
Romain Tartiere 2010-12-10 14:30:28 +00:00
parent fac03f5456
commit 0e2bc992bf
2 changed files with 15 additions and 0 deletions

5
NEWS
View file

@ -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.

View file

@ -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;
}