Fix change PIN for RP2350.
Fixes #27. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "openpgp.h"
|
#include "openpgp.h"
|
||||||
|
#include "otp.h"
|
||||||
|
|
||||||
int cmd_change_pin() {
|
int cmd_change_pin() {
|
||||||
if (P1(apdu) != 0x0) {
|
if (P1(apdu) != 0x0) {
|
||||||
@@ -31,6 +32,12 @@ int cmd_change_pin() {
|
|||||||
if ((r = load_dek()) != PICOKEY_OK) {
|
if ((r = load_dek()) != PICOKEY_OK) {
|
||||||
return SW_EXEC_ERROR();
|
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);
|
r = check_pin(pw, apdu.data, pin_len);
|
||||||
if (r != 0x9000) {
|
if (r != 0x9000) {
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
Reference in New Issue
Block a user