Skip to content

Commit

Permalink
Fix change PIN for RP2350.
Browse files Browse the repository at this point in the history
Fixes #27.

Signed-off-by: Pol Henarejos <[email protected]>
  • Loading branch information
polhenarejos committed Jan 8, 2025
1 parent 7991233 commit abb4d23
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/openpgp/cmd_change_pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "openpgp.h"
#include "otp.h"

int cmd_change_pin() {
if (P1(apdu) != 0x0) {
Expand All @@ -31,6 +32,12 @@ int cmd_change_pin() {
if ((r = load_dek()) != PICOKEY_OK) {
return SW_EXEC_ERROR();
}

if (otp_key_1) {
for (int i = 0; i < 32; i++) {
dek[IV_SIZE + i] ^= otp_key_1[i];
}
}
r = check_pin(pw, apdu.data, pin_len);
if (r != 0x9000) {
return r;
Expand Down

0 comments on commit abb4d23

Please sign in to comment.