summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog6
-rw-r--r--g10/mainproc.c1
-rw-r--r--g10/passphrase.c20
-rw-r--r--g10/status.c2
-rw-r--r--g10/status.h2
5 files changed, 24 insertions, 7 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index c2885b4e1..217367ec9 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,9 @@
+Thu Apr 8 09:35:53 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
+
+ * mainproc.c (proc_encrypted): Add a new status output
+ * passphrase.c (passphrase_to_dek): Ditto.
+ * status.h status.c: Add new status tokens.
+
Wed Apr 7 20:51:39 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
* encr-data.c (decrypt_data): Fixes for 128 bit blocksize
diff --git a/g10/mainproc.c b/g10/mainproc.c
index bb78f4b4e..45acb3838 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -245,6 +245,7 @@ proc_encrypted( CTX c, PACKET *pkt )
log_info(_("decryption okay\n"));
}
else {
+ write_status( STATUS_DECRYPTION_FAILED );
log_error(_("decryption failed: %s\n"), g10_errstr(result));
/* FIXME: if this is secret key not available, try with
* other keys */
diff --git a/g10/passphrase.c b/g10/passphrase.c
index 6da528015..3cc8e009d 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -133,14 +133,20 @@ passphrase_to_dek( u32 *keyid, int cipher_algo, STRING2KEY *s2k, int mode )
:DEFAULT_DIGEST_ALGO;
}
- if( keyid && !next_pw && is_status_enabled() ) {
+ if( !next_pw && is_status_enabled() ) {
char buf[50];
- sprintf( buf, "%08lX%08lX", (ulong)keyid[0], (ulong)keyid[1] );
- if( keyid[2] && keyid[3] && keyid[0] != keyid[2]
- && keyid[1] != keyid[3] )
- sprintf( buf+strlen(buf), " %08lX%08lX",
- (ulong)keyid[2], (ulong)keyid[3] );
- write_status_text( STATUS_NEED_PASSPHRASE, buf );
+ if( keyid ) {
+ sprintf( buf, "%08lX%08lX", (ulong)keyid[0], (ulong)keyid[1] );
+ if( keyid[2] && keyid[3] && keyid[0] != keyid[2]
+ && keyid[1] != keyid[3] )
+ sprintf( buf+strlen(buf), " %08lX%08lX",
+ (ulong)keyid[2], (ulong)keyid[3] );
+ write_status_text( STATUS_NEED_PASSPHRASE, buf );
+ }
+ else {
+ sprintf( buf, "%d %d %d", cipher_algo, s2k->mode, s2k->hash_algo );
+ write_status_text( STATUS_NEED_PASSPHRASE_SYM, buf );
+ }
}
if( keyid && !opt.batch && !next_pw ) {
diff --git a/g10/status.c b/g10/status.c
index 1b6dc1095..889c63b0c 100644
--- a/g10/status.c
+++ b/g10/status.c
@@ -104,6 +104,8 @@ write_status_text ( int no, const char *text)
case STATUS_BAD_PASSPHRASE : s = "BAD_PASSPHRASE\n"; break;
case STATUS_NO_PUBKEY : s = "NO_PUBKEY\n"; break;
case STATUS_NO_SECKEY : s = "NO_SECKEY\n"; break;
+ case STATUS_NEED_PASSPHRASE_SYM: s = "NEED_PASSPHRASE_SYM\n"; break;
+ case STATUS_DECRYPTION_FAILED: s = "DECRYPTION_FAILED\n"; break;
default: s = "?\n"; break;
}
diff --git a/g10/status.h b/g10/status.h
index 7beb32123..a4622f817 100644
--- a/g10/status.h
+++ b/g10/status.h
@@ -55,6 +55,8 @@
#define STATUS_BAD_PASSPHRASE 25
#define STATUS_NO_PUBKEY 26
#define STATUS_NO_SECKEY 27
+#define STATUS_NEED_PASSPHRASE_SYM 28
+#define STATUS_DECRYPTION_FAILED 29
/*-- status.c --*/
void set_status_fd ( int fd );