diff options
author | Werner Koch <wk@gnupg.org> | 2004-02-18 17:57:38 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2004-02-18 17:57:38 +0100 |
commit | bda3467067cb93de9a86b8cad17e20c3f0558d0c (patch) | |
tree | 85d57ec155bec7789647f9ee9303fb34c9dd696c /agent/pksign.c | |
parent | * gpgsm.c: Fixed value parsing for --with-validation. (diff) | |
download | gnupg2-bda3467067cb93de9a86b8cad17e20c3f0558d0c.tar.xz gnupg2-bda3467067cb93de9a86b8cad17e20c3f0558d0c.zip |
* protect-tool.c (main): Setup the used character set.
* gpg-agent.c (main): Ditto.
* gpg-agent.c (set_debug): New. New option --debug-level.
(main): New option --gpgconf-list.
Diffstat (limited to 'agent/pksign.c')
-rw-r--r-- | agent/pksign.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/agent/pksign.c b/agent/pksign.c index 8bec33c0b..acde66029 100644 --- a/agent/pksign.c +++ b/agent/pksign.c @@ -1,5 +1,5 @@ -/* pksign.c - public key signing (well, acually using a secret key) - * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +/* pksign.c - public key signing (well, actually using a secret key) + * Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -35,17 +35,10 @@ static int do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash) { gcry_sexp_t hash; - const char * s; - char * p, tmp[16]; + const char *s; + char tmp[16+1]; int i, rc; -#ifdef __GNUC__ -#warning I do not like that stuff - libgcrypt provides easier interfaces. -wk -#endif - /* FIXME: Either use the build function or create canonical encoded - S-expressions. */ - - p = xmalloc (64 + 2 * mdlen); s = gcry_md_algo_name (algo); if (s && strlen (s) < 16) { @@ -53,15 +46,10 @@ do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash) tmp[i] = tolower (s[i]); tmp[i] = '\0'; } - sprintf (p, "(data\n (flags pkcs1)\n (hash %s #", tmp); - for (i=0; i < mdlen; i++) - { - sprintf (tmp, "%02x", (byte)md[i]); - strcat (p, tmp); - } - strcat (p, "#))\n"); - rc = gcry_sexp_sscan (&hash, NULL, p, strlen (p)); - xfree (p); + rc = gcry_sexp_build (&hash, NULL, + "(data (flags pkcs1) (hash %s %b))", + tmp, + mdlen, md); *r_hash = hash; return rc; } |