support more hash algorithms to support the v2 card
authorWerner Koch <wk@gnupg.org>
Sat, 24 Jul 2010 09:18:42 +0000 (09:18 +0000)
committerWerner Koch <wk@gnupg.org>
Sat, 24 Jul 2010 09:18:42 +0000 (09:18 +0000)
g10/ChangeLog
g10/cardglue.c
g10/cardglue.h

index 6b421df..0ba1060 100644 (file)
@@ -1,3 +1,9 @@
+2010-07-24  Werner Koch  <wk@g10code.com>
+
+       * cardglue.c (agent_scd_pksign): Allow more hash algorithms when
+       using with scdaemon.
+       * cardglue.h (GCRY_MD_MD5): New.
+
 2010-06-18  Werner Koch  <wk@g10code.com>
 
        * parse-packet.c (skip_packet, parse_gpg_control): Take care of
index f004188..809b315 100644 (file)
@@ -1323,7 +1323,13 @@ agent_scd_pksign (const char *serialno, int hashalgo,
         {
           init_membuf (&data, 1024);
           snprintf (line, DIM(line)-1, "SCD PKSIGN %s%s",
-                    hashalgo == GCRY_MD_RMD160? "--hash=rmd160 ": "",
+                    hashalgo == GCRY_MD_SHA1?   "--hash=sha1 ":
+                    hashalgo == GCRY_MD_SHA224? "--hash=sha224 ":
+                    hashalgo == GCRY_MD_SHA256? "--hash=sha256 ":
+                    hashalgo == GCRY_MD_SHA384? "--hash=sha384 ":
+                    hashalgo == GCRY_MD_SHA512? "--hash=sha512 ":
+                    hashalgo == GCRY_MD_RMD160? "--hash=rmd160 ":
+                    hashalgo == GCRY_MD_MD5?    "--hash=md5 "   : "",
                     serialno);
           line[DIM(line)-1] = 0;
           rc = test_transact (assuan_transact (app->assuan_ctx, line,
index b653f36..50b2922 100644 (file)
@@ -181,6 +181,7 @@ void log_printhex (const char *text, const void *buffer, size_t length);
 #define GCRY_MD_SHA384 DIGEST_ALGO_SHA384
 #define GCRY_MD_SHA512 DIGEST_ALGO_SHA512
 #define GCRY_MD_SHA224 DIGEST_ALGO_SHA224
+#define GCRY_MD_MD5    DIGEST_ALGO_MD5
 
 void gcry_mpi_release (MPI a);
 MPI  gcry_mpi_set_opaque (MPI a, void *p, unsigned int len);