aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog17
-rw-r--r--g10/call-agent.c4
-rw-r--r--g10/gpg.c16
-rw-r--r--g10/main.h2
-rw-r--r--g10/misc.c17
-rw-r--r--g10/pkclist.c12
-rw-r--r--g10/sign.c5
-rw-r--r--g10/status.c33
-rw-r--r--g10/status.h3
-rw-r--r--g10/textfilter.c2
10 files changed, 104 insertions, 7 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 69e43614f..e5bc8e837 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,20 @@
+2007-01-30 Werner Koch <[email protected]>
+
+ * status.c (write_status_begin_signing): New.
+ * sign.c (sign_file, sign_symencrypt_file): Call it.
+ * textfilter.c (copy_clearsig_text): Call it.
+
+ * call-agent.c (agent_scd_pksign): Pass --hash-rmd160 to SCD if
+ required.
+
+ * gpg.c (main): Let --no-use-agent and --gpg-agent-info print a
+ warning.
+ * misc.c (obsolete_option): New.
+
+2007-01-29 Werner Koch <[email protected]>
+
+ * pkclist.c (do_we_trust_pre): Issue a user-id-hint status code.
+
2007-01-15 Werner Koch <[email protected]>
* parse-packet.c (read_protected_v3_mpi): Make sure to stop
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 30b46fa99..b5e76fdbf 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -668,7 +668,9 @@ agent_scd_pksign (const char *serialno, int hashalgo,
snprintf (line, DIM(line)-1, "SCD PKAUTH %s", serialno);
else
#endif
- snprintf (line, DIM(line)-1, "SCD PKSIGN %s", serialno);
+ snprintf (line, DIM(line)-1, "SCD PKSIGN %s%s",
+ hashalgo == GCRY_MD_RMD160? "--hash=rmd160 " : "",
+ serialno);
line[DIM(line)-1] = 0;
rc = assuan_transact (agent_ctx, line, membuf_data_cb, &data,
NULL, NULL, NULL, NULL);
diff --git a/g10/gpg.c b/g10/gpg.c
index 05ea39039..e8e83c2c5 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -2134,10 +2134,20 @@ main (int argc, char **argv )
opt.list_options|=LIST_SHOW_UNUSABLE_SUBKEYS;
break;
- case oBatch: opt.batch = 1; nogreeting = 1; break;
+ case oBatch:
+ opt.batch = 1;
+ nogreeting = 1;
+ break;
+
case oUseAgent: /* Dummy. */
- case oNoUseAgent: /* Dummy. */ break;
- case oGpgAgentInfo: opt.gpg_agent_info = pargs.r.ret_str; break;
+ break;
+ case oNoUseAgent:
+ obsolete_option (configname, configlineno, "--no-use-agent");
+ break;
+ case oGpgAgentInfo:
+ obsolete_option (configname, configlineno, "--gpg-agent-info");
+ break;
+
case oAnswerYes: opt.answer_yes = 1; break;
case oAnswerNo: opt.answer_no = 1; break;
case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
diff --git a/g10/main.h b/g10/main.h
index 478e56de9..1860853da 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -105,6 +105,8 @@ char *pct_expando(const char *string,struct expando_args *args);
void deprecated_warning(const char *configname,unsigned int configlineno,
const char *option,const char *repl1,const char *repl2);
void deprecated_command (const char *name);
+void obsolete_option (const char *configname, unsigned int configlineno,
+ const char *name);
int string_to_cipher_algo (const char *string);
int string_to_digest_algo (const char *string);
diff --git a/g10/misc.c b/g10/misc.c
index bf32228c3..50bb6af13 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -469,6 +469,10 @@ openpgp_pk_algo_usage ( int algo )
int
openpgp_md_test_algo( int algo )
{
+ /* Note: If the list of actual supported OpenPGP algorithms changes,
+ make sure that our hard coded values at
+ print_status_begin_signing() gets updated. */
+
if (algo < 0 || algo > 110)
return gpg_error (GPG_ERR_DIGEST_ALGO);
return gcry_md_test_algo (algo);
@@ -737,6 +741,19 @@ deprecated_command (const char *name)
}
+void
+obsolete_option (const char *configname, unsigned int configlineno,
+ const char *name)
+{
+ if(configname)
+ log_info (_("%s:%u: obsolete option \"%s\" - it has no effect\n"),
+ configname, configlineno, name);
+ else
+ log_info (_("WARNING: \"%s\" is an obsolete option - it has no effect\n"),
+ name);
+}
+
+
/*
* Wrapper around gcry_cipher_map_name to provide a fallback using the
* "Sn" syntax as used by the preference strings.
diff --git a/g10/pkclist.c b/g10/pkclist.c
index 6588802ad..82abe3f0d 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -464,6 +464,18 @@ do_we_trust_pre( PKT_public_key *pk, unsigned int trustlevel )
tty_printf("\n");
+
+ if (is_status_enabled ())
+ {
+ u32 kid[2];
+ char *hint_str;
+
+ keyid_from_pk (pk, kid);
+ hint_str = get_long_user_id_string ( kid );
+ write_status_text ( STATUS_USERID_HINT, hint_str );
+ xfree (hint_str);
+ }
+
if( cpr_get_answer_is_yes("untrusted_key.override",
_("Use this key anyway? (y/N) ")) )
rc = 1;
diff --git a/g10/sign.c b/g10/sign.c
index 8ae9c0b28..062fa9f48 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -503,6 +503,7 @@ only_old_style( SK_LIST sk_list )
}
+
static void
print_status_sig_created ( PKT_secret_key *sk, PKT_signature *sig, int what )
{
@@ -983,7 +984,7 @@ sign_file( strlist_t filenames, int detached, strlist_t locusr,
goto leave;
}
- write_status (STATUS_BEGIN_SIGNING);
+ write_status_begin_signing (mfx.md);
/* Setup the inner packet. */
if( detached ) {
@@ -1361,7 +1362,7 @@ sign_symencrypt_file (const char *fname, strlist_t locusr)
goto leave;
}
- write_status (STATUS_BEGIN_SIGNING);
+ write_status_begin_signing (mfx.md);
/* Pipe data through all filters; i.e. write the signed stuff */
/*(current filters: zip - encrypt - armor)*/
diff --git a/g10/status.c b/g10/status.c
index b0d0cd74c..83a28cda4 100644
--- a/g10/status.c
+++ b/g10/status.c
@@ -323,6 +323,39 @@ write_status_buffer ( int no, const char *buffer, size_t len, int wrap )
}
+/* Print the BEGIN_SIGNING status message. If MD is not NULL it is
+ used retrieve the hash algorithms used for the message. */
+void
+write_status_begin_signing (gcry_md_hd_t md)
+{
+ if (md)
+ {
+ char buf[100];
+ size_t buflen;
+ int i;
+
+ /* We use a hard coded list of possible algorithms. Using other
+ algorithms than specified by OpenPGP does not make sense
+ anyway. We do this out of performance reasons: Walking all
+ the 110 allowed Ids is not a good idea given the way the
+ check is implemented in libgcrypt. Recall that the only use
+ of this status code is to create the micalg algorithm for
+ PGP/MIME. */
+ buflen = 0;
+ for (i=1; i <= 11; i++)
+ if (i < 4 || i > 7)
+ if ( gcry_md_is_enabled (md, i) && buflen < DIM(buf) )
+ {
+ snprintf (buf+buflen, DIM(buf) - buflen - 1,
+ "%sH%d", buflen? " ":"",i);
+ buflen += strlen (buf+buflen);
+ }
+ write_status_text ( STATUS_BEGIN_SIGNING, buf );
+ }
+ else
+ write_status ( STATUS_BEGIN_SIGNING );
+}
+
static int
myread(int fd, void *buf, size_t count)
diff --git a/g10/status.h b/g10/status.h
index b5dbe7480..6fad17a46 100644
--- a/g10/status.h
+++ b/g10/status.h
@@ -131,6 +131,9 @@ void write_status_buffer ( int no,
void write_status_text_and_buffer ( int no, const char *text,
const char *buffer, size_t len, int wrap );
+void write_status_begin_signing (gcry_md_hd_t md);
+
+
int cpr_enabled(void);
char *cpr_get( const char *keyword, const char *prompt );
char *cpr_get_no_help( const char *keyword, const char *prompt );
diff --git a/g10/textfilter.c b/g10/textfilter.c
index daa57de0a..dc34aa244 100644
--- a/g10/textfilter.c
+++ b/g10/textfilter.c
@@ -178,7 +178,7 @@ copy_clearsig_text( IOBUF out, IOBUF inp, gcry_md_hd_t md,
if( !escape_dash )
escape_from = 0;
- write_status (STATUS_BEGIN_SIGNING);
+ write_status_begin_signing (md);
for(;;) {
maxlen = MAX_LINELEN;