aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2012-02-01 02:30:05 +0000
committerDavid Shaw <[email protected]>2012-02-01 02:55:06 +0000
commit2b3cb2ee94625498e7a7f939216c9bcddef6ec20 (patch)
treeb78d70f8e7b356c654a48dc315bb35ec73239584
parentgl: Add support for Android to stdint.h replacement. (diff)
downloadgnupg-2b3cb2ee94625498e7a7f939216c9bcddef6ec20.tar.gz
gnupg-2b3cb2ee94625498e7a7f939216c9bcddef6ec20.zip
Honor --cert-digest-algo when recreating a cert.
* g10/sign.c (update_keysig_packet): Honor --cert-digest-algo when recreating a cert. This is used by various things in --edit-key like setpref, primary, etc. Suggested by Christian Aistleitner.
-rw-r--r--g10/sign.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/g10/sign.c b/g10/sign.c
index 4cc813c46..b2c8f0e56 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -1,6 +1,6 @@
/* sign.c - sign data
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2010 Free Software Foundation, Inc.
+ * 2007, 2010, 2012 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -1576,7 +1576,7 @@ update_keysig_packet( PKT_signature **ret_sig,
void *opaque)
{
PKT_signature *sig;
- int rc=0;
+ int rc=0, digest_algo;
gcry_md_hd_t md;
if ((!orig_sig || !pk || !pksk)
@@ -1584,6 +1584,11 @@ update_keysig_packet( PKT_signature **ret_sig,
|| (orig_sig->sig_class == 0x18 && !subpk))
return G10ERR_GENERAL;
+ if ( opt.cert_digest_algo )
+ digest_algo = opt.cert_digest_algo;
+ else
+ digest_algo = orig_sig->digest_algo;
+
if ( gcry_md_open (&md, orig_sig->digest_algo, 0 ) )
BUG ();