Use new methods search_file() and file_put_data().
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -36,7 +36,7 @@ int cmd_reset_retry() {
|
||||
if (P1(apdu) == 0x0 || P1(apdu) == 0x2) {
|
||||
uint8_t newpin_len = 0;
|
||||
if (P1(apdu) == 0x0) {
|
||||
uint8_t so_pin_len = file_read_uint8(file_get_data(file_sopin));
|
||||
uint8_t so_pin_len = file_read_uint8(file_sopin);
|
||||
if ((uint16_t)apdu.nc <= so_pin_len + 1) {
|
||||
return SW_WRONG_LENGTH();
|
||||
}
|
||||
@@ -58,7 +58,7 @@ int cmd_reset_retry() {
|
||||
uint8_t dhash[33];
|
||||
dhash[0] = newpin_len;
|
||||
double_hash_pin(apdu.data + (apdu.nc - newpin_len), newpin_len, dhash + 1);
|
||||
flash_write_data_to_file(file_pin1, dhash, sizeof(dhash));
|
||||
file_put_data(file_pin1, dhash, sizeof(dhash));
|
||||
if (pin_reset_retries(file_pin1, true) != CCID_OK) {
|
||||
return SW_MEMORY_FAILURE();
|
||||
}
|
||||
@@ -82,7 +82,7 @@ int cmd_reset_retry() {
|
||||
return SW_COMMAND_NOT_ALLOWED();
|
||||
}
|
||||
if (P1(apdu) == 0x1) {
|
||||
uint8_t so_pin_len = file_read_uint8(file_get_data(file_sopin));
|
||||
uint8_t so_pin_len = file_read_uint8(file_sopin);
|
||||
if (apdu.nc != so_pin_len) {
|
||||
return SW_WRONG_LENGTH();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user