1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-03-24 22:09:57 +01:00

Allow more hash algorithms with the OpenPGP card.

This commit is contained in:
Werner Koch 2010-09-28 08:29:13 +00:00
parent a384e94b73
commit 398e686085
3 changed files with 27 additions and 2 deletions

2
NEWS
View File

@ -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)
-------------------------------------------------

View File

@ -1,3 +1,8 @@
2010-09-28 Werner Koch <wk@g10code.com>
* call-agent.c (hash_algo_option): New.
(agent_scd_pksign): Use it.
2010-07-20 Werner Koch <wk@g10code.com>
* mainproc.c (print_pkenc_list): Print a STATUS_ERROR. Fixes

View File

@ -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);