Decrement counter.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-07-15 22:52:24 +02:00
parent 0f664f5d18
commit 953a7933e9
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -167,6 +167,9 @@ int cmd_cipher_sym(void) {
if (!ef) {
return SW_FILE_NOT_FOUND();
}
if (get_key_counter(ef) == 0) {
return SW_FILE_FULL();
}
if (key_has_purpose(ef, algo) == false) {
return SW_CONDITIONS_NOT_SATISFIED();
}
@@ -605,5 +608,8 @@ int cmd_cipher_sym(void) {
mbedtls_platform_zeroize(kdata, sizeof(kdata));
return SW_WRONG_P1P2();
}
if (ef) {
decrement_key_counter(ef);
}
return SW_OK();
}
+1
View File
@@ -178,6 +178,7 @@ int cmd_decrypt_asym(void) {
return SW_EXEC_ERROR();
}
mbedtls_platform_zeroize(res_APDU, 32);
decrement_key_counter(ef);
return SW_OK();
}
}