DO is cleared when no data is provided.

Solves #50.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-02-18 00:38:52 +01:00
parent e6cc190c4f
commit 704df76499

View File

@@ -45,8 +45,9 @@ int cmd_put_data() {
if (currentEF && currentEF->fid == fid) { // previously selected same EF if (currentEF && currentEF->fid == fid) { // previously selected same EF
ef = currentEF; ef = currentEF;
} }
if (apdu.nc > 0 && (ef->type & FILE_DATA_FLASH)) { if (ef->type & FILE_DATA_FLASH) {
int r = 0; int r = 0;
if (apdu.nc > 0) {
if (fid == EF_RC) { if (fid == EF_RC) {
has_rc = false; has_rc = false;
if ((r = load_dek()) != PICOKEY_OK) { if ((r = load_dek()) != PICOKEY_OK) {
@@ -76,5 +77,9 @@ int cmd_put_data() {
} }
low_flash_available(); low_flash_available();
} }
else {
delete_file(ef);
}
}
return SW_OK(); return SW_OK();
} }