From a66fa9c25ee1c1bc1a2bf4538ca132ab969191c8 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 3 Jan 2001 13:36:03 +0000 Subject: [PATCH] Add KEY_CREATED status --- g10/ChangeLog | 5 +++++ g10/keygen.c | 9 ++++++++- g10/status.c | 1 + g10/status.h | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index a81046c8f..691e3f59a 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,8 @@ +2001-01-03 Werner Koch + + * status.c, status.h : New status KEY_CREATED + * keygen.c (do_generate_keypair,generate_subkeypair): Emit it. + 2000-12-28 Werner Koch * signal.c (got_fatal_signal): Remove lockfiles here because the diff --git a/g10/keygen.c b/g10/keygen.c index 2ebad085d..d8ed75635 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -1511,6 +1511,7 @@ do_generate_keypair( struct para_data_s *para, PKT_secret_key *sk = NULL; const char *s; int rc; + int did_sub = 0; if( outctrl->dryrun ) { log_info("dry-run mode - key generation skipped\n"); @@ -1609,6 +1610,7 @@ do_generate_keypair( struct para_data_s *para, rc = write_keybinding(pub_root, pub_root, sk); if( !rc ) rc = write_keybinding(sec_root, pub_root, sk); + did_sub = 1; } @@ -1689,6 +1691,9 @@ do_generate_keypair( struct para_data_s *para, else tty_printf(_("Key generation failed: %s\n"), g10_errstr(rc) ); } + else { + write_status_text (STATUS_KEY_CREATED, did_sub? "B":"P"); + } release_kbnode( pub_root ); release_kbnode( sec_root ); if( sk ) /* the unprotected secret key */ @@ -1783,8 +1788,10 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock ) rc = write_keybinding(pub_keyblock, pub_keyblock, sk); if( !rc ) rc = write_keybinding(sec_keyblock, pub_keyblock, sk); - if( !rc ) + if( !rc ) { okay = 1; + write_status_text (STATUS_KEY_CREATED, "S"); + } leave: if( rc ) diff --git a/g10/status.c b/g10/status.c index 18a2ed2f5..d2da0b662 100644 --- a/g10/status.c +++ b/g10/status.c @@ -136,6 +136,7 @@ get_status_string ( int no ) case STATUS_POLICY_URL : s = "POLICY_URL" ; break; case STATUS_BEGIN_STREAM : s = "BEGIN_STREAM"; break; case STATUS_END_STREAM : s = "END_STREAM"; break; + case STATUS_KEY_CREATED : s = "KEY_CREATED"; break; default: s = "?"; break; } return s; diff --git a/g10/status.h b/g10/status.h index cccc33400..bc8ac5f0a 100644 --- a/g10/status.h +++ b/g10/status.h @@ -87,7 +87,7 @@ #define STATUS_POLICY_URL 55 #define STATUS_BEGIN_STREAM 56 #define STATUS_END_STREAM 57 - +#define STATUS_KEY_CREATED 58 /*-- status.c --*/ void set_status_fd ( int fd );