aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2010-09-28 08:29:13 +0000
committerWerner Koch <[email protected]>2010-09-28 08:29:13 +0000
commit398e686085fd40ea3d20e99ff5c83ef27626f1ab (patch)
treefd06dd3be5a27fae79b5d5d074103b915ffbce22
parentFix bug 1285 (diff)
downloadgnupg-398e686085fd40ea3d20e99ff5c83ef27626f1ab.tar.gz
gnupg-398e686085fd40ea3d20e99ff5c83ef27626f1ab.zip
Allow more hash algorithms with the OpenPGP card.
-rw-r--r--NEWS2
-rw-r--r--g10/ChangeLog5
-rw-r--r--g10/call-agent.c22
3 files changed, 27 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 470914277..03c2a0b41 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Noteworthy changes in version 2.0.17 (unreleased)
* gpg-agent now tests for a newly created gpg-agent.conf after a HUP.
+ * Allow more hash algorithms with the OpenPGP v2 card.
+
Noteworthy changes in version 2.0.16 (2010-07-19)
-------------------------------------------------
diff --git a/g10/ChangeLog b/g10/ChangeLog
index a56053125..322c94cf7 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-28 Werner Koch <[email protected]>
+
+ * call-agent.c (hash_algo_option): New.
+ (agent_scd_pksign): Use it.
+
2010-07-20 Werner Koch <[email protected]>
* mainproc.c (print_pkenc_list): Print a STATUS_ERROR. Fixes
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 260cd48a9..fce8eb07a 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -892,6 +892,25 @@ membuf_data_cb (void *opaque, const void *buffer, size_t length)
return 0;
}
+
+/* Helper returning a command option to describe the used hash
+ algorithm. See scd/command.c:cmd_pksign. */
+static const char *
+hash_algo_option (int algo)
+{
+ switch (algo)
+ {
+ case GCRY_MD_RMD160: return "--hash=rmd160";
+ case GCRY_MD_SHA1 : return "--hash=sha1";
+ case GCRY_MD_SHA224: return "--hash=sha224";
+ case GCRY_MD_SHA256: return "--hash=sha256";
+ case GCRY_MD_SHA384: return "--hash=sha384";
+ case GCRY_MD_SHA512: return "--hash=sha512";
+ case GCRY_MD_MD5 : return "--hash=md5";
+ default: return "";
+ }
+}
+
/* Send a sign command to the scdaemon via gpg-agent's pass thru
mechanism. */
int
@@ -938,8 +957,7 @@ agent_scd_pksign (const char *serialno, int hashalgo,
else
#endif
snprintf (line, DIM(line)-1, "SCD PKSIGN %s%s",
- hashalgo == GCRY_MD_RMD160? "--hash=rmd160 " : "",
- serialno);
+ hash_algo_option (hashalgo), serialno);
line[DIM(line)-1] = 0;
rc = assuan_transact (agent_ctx, line, membuf_data_cb, &data,
default_inq_cb, NULL, NULL, NULL);