1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

gpg: Add the fingerprint to KEY_CREATED for subkeys.

* g10/keygen.c (print_status_key_created): Make more robust by
allowing a NULL for PK.
(generate_subkeypair): Use print_status_key_created.
(generate_card_subkeypair): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-06-02 22:01:51 +02:00
parent 1b460f049e
commit 8d976a6b07
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -166,11 +166,14 @@ print_status_key_created (int letter, PKT_public_key *pk, const char *handle)
if (letter || pk) if (letter || pk)
{ {
*p++ = letter; *p++ = letter;
*p++ = ' '; if (pk)
fingerprint_from_pk (pk, array, &n); {
s = array; *p++ = ' ';
for (i=0; i < n ; i++, s++, p += 2) fingerprint_from_pk (pk, array, &n);
sprintf (p, "%02X", *s); s = array;
for (i=0; i < n ; i++, s++, p += 2)
sprintf (p, "%02X", *s);
}
} }
if (*handle) if (*handle)
{ {
@ -4662,7 +4665,8 @@ generate_subkeypair (ctrl_t ctrl, kbnode_t keyblock, const char *algostr,
if (err) if (err)
goto leave; goto leave;
write_status_text (STATUS_KEY_CREATED, "S"); print_status_key_created ('S', sub_psk, NULL);
leave: leave:
xfree (key_from_hexgrip); xfree (key_from_hexgrip);
@ -4691,6 +4695,7 @@ generate_card_subkeypair (kbnode_t pub_keyblock,
u32 expire; u32 expire;
u32 cur_time; u32 cur_time;
struct para_data_s *para = NULL; struct para_data_s *para = NULL;
PKT_public_key *sub_pk = NULL;
log_assert (keyno >= 1 && keyno <= 3); log_assert (keyno >= 1 && keyno <= 3);
@ -4757,8 +4762,6 @@ generate_card_subkeypair (kbnode_t pub_keyblock,
/* Get the pointer to the generated public subkey packet. */ /* Get the pointer to the generated public subkey packet. */
if (!err) if (!err)
{ {
PKT_public_key *sub_pk = NULL;
for (node = pub_keyblock; node; node = node->next) for (node = pub_keyblock; node; node = node->next)
if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY) if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
sub_pk = node->pkt->pkt.public_key; sub_pk = node->pkt->pkt.public_key;
@ -4771,7 +4774,7 @@ generate_card_subkeypair (kbnode_t pub_keyblock,
if (err) if (err)
log_error (_("Key generation failed: %s\n"), gpg_strerror (err) ); log_error (_("Key generation failed: %s\n"), gpg_strerror (err) );
else else
write_status_text (STATUS_KEY_CREATED, "S"); print_status_key_created ('S', sub_pk, NULL);
release_parameter_list (para); release_parameter_list (para);
return err; return err;
} }