Fixed durable counter persistence and enforced counters for symmetric crypto, EC derivation, and XKEK derivation.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-07-15 22:50:31 +02:00
parent 71d5b751f4
commit 0f566c6722
+4
View File
@@ -45,6 +45,9 @@ int cmd_derive_asym(void) {
if (!(fkey = file_search((KEY_PREFIX << 8) | key_id)) || !file_has_data(fkey)) {
return SW_FILE_NOT_FOUND();
}
if (get_key_counter(fkey) == 0) {
return SW_FILE_FULL();
}
if (key_has_purpose(fkey, ALGO_EC_DERIVE) == false) {
return SW_CONDITIONS_NOT_SATISFIED();
}
@@ -97,5 +100,6 @@ int cmd_derive_asym(void) {
else {
return SW_WRONG_DATA();
}
decrement_key_counter(fkey);
return SW_OK();
}