We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61261aa commit d45a0bfCopy full SHA for d45a0bf
src/openpgp/piv.c
@@ -888,15 +888,14 @@ static int cmd_change_pin() {
888
return SW_MEMORY_FAILURE();
889
}
890
uint8_t *pin_data = file_get_data(ef), pin_len = apdu.nc - pin_data[0];
891
- uint8_t dhash[33];
892
- double_hash_pin(apdu.data, pin_data[0], dhash + 1);
893
- if (memcmp(dhash, file_get_data(ef) + 1, sizeof(dhash) - 1) != 0) {
894
- return SW_SECURITY_STATUS_NOT_SATISFIED();
+ uint16_t ret = check_pin(ef, apdu.data, pin_data[0]);
+ if (ret != 0x9000) {
+ return ret;
895
+ uint8_t dhash[33];
896
dhash[0] = pin_len;
897
double_hash_pin(apdu.data + pin_data[0], pin_len, dhash + 1);
898
flash_write_data_to_file(ef, dhash, sizeof(dhash));
899
- pin_reset_retries(ef, true);
900
low_flash_available();
901
return SW_OK();
902
0 commit comments