Fix touch policy on mgmt key change.
Fixes #38. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -983,12 +983,13 @@ static int cmd_set_mgmkey() {
|
|||||||
}
|
}
|
||||||
uint8_t touch = P2(apdu);
|
uint8_t touch = P2(apdu);
|
||||||
if (touch != 0xFF && touch != 0xFE) {
|
if (touch != 0xFF && touch != 0xFE) {
|
||||||
if (touch == 0xFF) {
|
return SW_INCORRECT_P1P2();
|
||||||
touch = TOUCHPOLICY_NEVER;
|
}
|
||||||
}
|
if (touch == 0xFF) {
|
||||||
else if (touch == 0xFE) {
|
touch = TOUCHPOLICY_NEVER;
|
||||||
touch = TOUCHPOLICY_ALWAYS;
|
}
|
||||||
}
|
else if (touch == 0xFE) {
|
||||||
|
touch = TOUCHPOLICY_ALWAYS;
|
||||||
}
|
}
|
||||||
uint8_t algo = apdu.data[0], key_ref = apdu.data[1], pinlen = apdu.data[2];
|
uint8_t algo = apdu.data[0], key_ref = apdu.data[1], pinlen = apdu.data[2];
|
||||||
if ((key_ref != EF_PIV_KEY_CARDMGM) || (!(algo == PIV_ALGO_AES128 && pinlen == 16) && !(algo == PIV_ALGO_AES192 && pinlen == 24) && !(algo == PIV_ALGO_AES256 && pinlen == 32) && !(algo == PIV_ALGO_3DES && pinlen == 24))) {
|
if ((key_ref != EF_PIV_KEY_CARDMGM) || (!(algo == PIV_ALGO_AES128 && pinlen == 16) && !(algo == PIV_ALGO_AES192 && pinlen == 24) && !(algo == PIV_ALGO_AES256 && pinlen == 32) && !(algo == PIV_ALGO_3DES && pinlen == 24))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user