aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2018-03-29 01:48:37 +0000
committerNIIBE Yutaka <[email protected]>2018-03-29 01:48:37 +0000
commit02d7bb819ff44cc90212568dd6ce24ae1dc5d17f (patch)
tree5e9f28ad76122df9629b9c26baea56b68aec9f9e
parentg10: Change ask_curve so that it can be used outside. (diff)
downloadgnupg-02d7bb819ff44cc90212568dd6ce24ae1dc5d17f.tar.gz
gnupg-02d7bb819ff44cc90212568dd6ce24ae1dc5d17f.zip
g10: check_pin_for_key_operation should be just before genkey.
* g10/card-util.c (generate_card_keys): Check PIN later. (card_generate_subkey): Likewise. -- Changing key attribute resets PIN authentication status. So, CHECKPIN should be after that, before key generation. Note that CHECKPIN is done for binding signature. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--g10/card-util.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/g10/card-util.c b/g10/card-util.c
index d78e9bd8e..2aa9c3f28 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -1498,9 +1498,6 @@ generate_card_keys (ctrl_t ctrl)
tty_printf ("\n");
}
- if (check_pin_for_key_operation (&info, &forced_chv1))
- goto leave;
-
/* If the cards features changeable key attributes, we ask for the
key size. */
if (info.is_v2 && info.extcap.aac)
@@ -1533,6 +1530,9 @@ generate_card_keys (ctrl_t ctrl)
the serialnumber and thus it won't harm. */
}
+ if (check_pin_for_key_operation (&info, &forced_chv1))
+ goto leave;
+
generate_keypair (ctrl, 1, NULL, info.serialno, want_backup);
leave:
@@ -1587,10 +1587,6 @@ card_generate_subkey (ctrl_t ctrl, kbnode_t pub_keyblock)
goto leave;
}
- err = check_pin_for_key_operation (&info, &forced_chv1);
- if (err)
- goto leave;
-
/* If the cards features changeable key attributes, we ask for the
key size. */
if (info.is_v2 && info.extcap.aac)
@@ -1621,6 +1617,10 @@ card_generate_subkey (ctrl_t ctrl, kbnode_t pub_keyblock)
the serialnumber and thus it won't harm. */
}
+ err = check_pin_for_key_operation (&info, &forced_chv1);
+ if (err)
+ goto leave;
+
err = generate_card_subkeypair (ctrl, pub_keyblock, keyno, info.serialno);
leave: