[Gpg4win-commits] r1213 - in trunk: . patches/gnupg2-2.0.12
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Jul 13 18:32:12 CEST 2009
Author: werner
Date: 2009-07-13 18:32:11 +0200 (Mon, 13 Jul 2009)
New Revision: 1213
Added:
trunk/patches/gnupg2-2.0.12/06-opgp-sign3072.patch
trunk/patches/gnupg2-2.0.12/07-gpg-no-detached.patch
Modified:
trunk/ChangeLog
trunk/Makefile.am
Log:
More gnupg patches to backport stuff from the current develop version.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-07-10 08:56:47 UTC (rev 1212)
+++ trunk/ChangeLog 2009-07-13 16:32:11 UTC (rev 1213)
@@ -1,3 +1,9 @@
+2009-07-13 Werner Koch <wk at g10code.com>
+
+ * patches/gnupg2-2.0.12/06-opgp-sign3072.patch: New.
+ * patches/gnupg2-2.0.12/07-gpg-no-detached.patch: New.
+ * Makefile.am (EXTRA_DIST): Add them..
+
2009-07-10 Emanuel Schuetze <emanuel.schuetze at intevation.de>
* packages/packages.current: Update kdesupport.
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2009-07-10 08:56:47 UTC (rev 1212)
+++ trunk/Makefile.am 2009-07-13 16:32:11 UTC (rev 1213)
@@ -48,6 +48,8 @@
patches/gnupg2-2.0.12/03-opgp-writekey.patch \
patches/gnupg2-2.0.12/04-hash-prefs.patch \
patches/gnupg2-2.0.12/05-dns-sd.patch \
+ patches/gnupg2-2.0.12/06-opgp-sign3072.patch \
+ patches/gnupg2-2.0.12/07-gpg-no-detached.patch \
patches/gpgol-0.9.91/01-gpgme.patch \
patches/claws-mail-3.7.1/01-fix-spaces-after-re.patch \
patches/claws-mail-3.7.1/02-3.7.1cvs22.patch \
Added: trunk/patches/gnupg2-2.0.12/06-opgp-sign3072.patch
===================================================================
--- trunk/patches/gnupg2-2.0.12/06-opgp-sign3072.patch 2009-07-10 08:56:47 UTC (rev 1212)
+++ trunk/patches/gnupg2-2.0.12/06-opgp-sign3072.patch 2009-07-13 16:32:11 UTC (rev 1213)
@@ -0,0 +1,225 @@
+#! /bin/sh
+cd scd && patch -p0 -f $* < $0
+exit $?
+
+2009-07-10 Werner Koch <wk at g10code.com>
+
+ * iso7816.c (iso7816_compute_ds): Add args EXTENDED_MODE and LE.
+ Change all callers to use 0.
+ (iso7816_internal_authenticate): Add args EXTENDED_MODE and LE.
+ * app-openpgp.c (do_sign): Take exmode and Le from card
+ capabilities and pass them to iso7816_compute_ds.
+ (do_auth): Ditto for iso7816_internal_authenticate.
+ (change_keyattr): Reset CHV verification status.
+
+
+Index: iso7816.c
+===================================================================
+--- iso7816.c (revision 5072)
++++ iso7816.c (working copy)
+@@ -505,9 +505,10 @@
+ /* Perform the security operation COMPUTE DIGITAL SIGANTURE. On
+ success 0 is returned and the data is availavle in a newly
+ allocated buffer stored at RESULT with its length stored at
+- RESULTLEN. */
++ RESULTLEN. For LE see do_generate_keypair. */
+ gpg_error_t
+-iso7816_compute_ds (int slot, const unsigned char *data, size_t datalen,
++iso7816_compute_ds (int slot, int extended_mode,
++ const unsigned char *data, size_t datalen, int le,
+ unsigned char **result, size_t *resultlen)
+ {
+ int sw;
+@@ -517,9 +518,16 @@
+ *result = NULL;
+ *resultlen = 0;
+
+- sw = apdu_send (slot, 0,
+- 0x00, CMD_PSO, 0x9E, 0x9A, datalen, (const char*)data,
+- result, resultlen);
++ if (!extended_mode)
++ le = 256; /* Ignore provided Le and use what apdu_send uses. */
++ else if (le >= 0 && le < 256)
++ le = 256;
++
++ sw = apdu_send_le (slot, extended_mode,
++ 0x00, CMD_PSO, 0x9E, 0x9A,
++ datalen, (const char*)data,
++ le,
++ result, resultlen);
+ if (sw != SW_SUCCESS)
+ {
+ /* Make sure that pending buffers are released. */
+@@ -586,9 +594,11 @@
+ }
+
+
++/* For LE see do_generate_keypair. */
+ gpg_error_t
+-iso7816_internal_authenticate (int slot,
++iso7816_internal_authenticate (int slot, int extended_mode,
+ const unsigned char *data, size_t datalen,
++ int le,
+ unsigned char **result, size_t *resultlen)
+ {
+ int sw;
+@@ -598,8 +608,16 @@
+ *result = NULL;
+ *resultlen = 0;
+
+- sw = apdu_send (slot, 0, 0x00, CMD_INTERNAL_AUTHENTICATE, 0, 0,
+- datalen, (const char*)data, result, resultlen);
++ if (!extended_mode)
++ le = 256; /* Ignore provided Le and use what apdu_send uses. */
++ else if (le >= 0 && le < 256)
++ le = 256;
++
++ sw = apdu_send_le (slot, extended_mode,
++ 0x00, CMD_INTERNAL_AUTHENTICATE, 0, 0,
++ datalen, (const char*)data,
++ le,
++ result, resultlen);
+ if (sw != SW_SUCCESS)
+ {
+ /* Make sure that pending buffers are released. */
+Index: app-openpgp.c
+===================================================================
+--- app-openpgp.c (revision 5072)
++++ app-openpgp.c (working copy)
+@@ -2397,6 +2397,9 @@
+ log_info ("size of key %d changed to %u bits\n", keyno+1, nbits);
+ flush_cache (app);
+ parse_algorithm_attribute (app, keyno);
++ app->did_chv1 = 0;
++ app->did_chv2 = 0;
++ app->did_chv3 = 0;
+ return err;
+ }
+
+@@ -3008,6 +3011,7 @@
+ const char *fpr = NULL;
+ unsigned long sigcount;
+ int use_auth = 0;
++ int exmode, le_value;
+
+ if (!keyidstr || !*keyidstr)
+ return gpg_error (GPG_ERR_INV_VALUE);
+@@ -3148,7 +3152,19 @@
+ xfree (pinvalue);
+ }
+
+- rc = iso7816_compute_ds (app->slot, data, datalen, outdata, outdatalen);
++
++ if (app->app_local->cardcap.ext_lc_le)
++ {
++ exmode = 1; /* Use extended length. */
++ le_value = app->app_local->extcap.max_rsp_data;
++ }
++ else
++ {
++ exmode = 0;
++ le_value = 0;
++ }
++ rc = iso7816_compute_ds (app->slot, exmode, data, datalen, le_value,
++ outdata, outdatalen);
+ return rc;
+ }
+
+@@ -3219,8 +3235,23 @@
+
+ rc = verify_chv2 (app, pincb, pincb_arg);
+ if (!rc)
+- rc = iso7816_internal_authenticate (app->slot, indata, indatalen,
+- outdata, outdatalen);
++ {
++ int exmode, le_value;
++
++ if (app->app_local->cardcap.ext_lc_le)
++ {
++ exmode = 1; /* Use extended length. */
++ le_value = app->app_local->extcap.max_rsp_data;
++ }
++ else
++ {
++ exmode = 0;
++ le_value = 0;
++ }
++ rc = iso7816_internal_authenticate (app->slot, exmode,
++ indata, indatalen, le_value,
++ outdata, outdatalen);
++ }
+ return rc;
+ }
+
+Index: iso7816.h
+===================================================================
+--- iso7816.h (revision 5072)
++++ iso7816.h (working copy)
+@@ -93,15 +93,17 @@
+ gpg_error_t iso7816_manage_security_env (int slot, int p1, int p2,
+ const unsigned char *data,
+ size_t datalen);
+-gpg_error_t iso7816_compute_ds (int slot,
++gpg_error_t iso7816_compute_ds (int slot, int extended_mode,
+ const unsigned char *data, size_t datalen,
++ int le,
+ unsigned char **result, size_t *resultlen);
+ gpg_error_t iso7816_decipher (int slot, int extended_mode,
+ const unsigned char *data, size_t datalen,
+ int padind,
+ unsigned char **result, size_t *resultlen);
+-gpg_error_t iso7816_internal_authenticate (int slot,
++gpg_error_t iso7816_internal_authenticate (int slot, int extended_mode,
+ const unsigned char *data, size_t datalen,
++ int le,
+ unsigned char **result, size_t *resultlen);
+ gpg_error_t iso7816_generate_keypair (int slot, int extended_mode,
+ const unsigned char *data, size_t datalen,
+
+Index: app-dinsig.c
+===================================================================
+--- app-dinsig.c (revision 5072)
++++ app-dinsig.c (working copy)
+@@ -483,7 +483,8 @@
+
+ rc = verify_pin (app, pincb, pincb_arg);
+ if (!rc)
+- rc = iso7816_compute_ds (app->slot, data, datalen, outdata, outdatalen);
++ rc = iso7816_compute_ds (app->slot, 0, data, datalen, 0,
++ outdata, outdatalen);
+ return rc;
+ }
+
+Index: app-nks.c
+===================================================================
+--- app-nks.c (revision 5072)
++++ app-nks.c (working copy)
+@@ -969,7 +969,8 @@
+ rc = verify_pin (app, 0, NULL, pincb, pincb_arg);
+ /* Compute the signature. */
+ if (!rc)
+- rc = iso7816_compute_ds (app->slot, data, datalen, outdata, outdatalen);
++ rc = iso7816_compute_ds (app->slot, 0, data, datalen, 0,
++ outdata, outdatalen);
+ return rc;
+ }
+
+Index: app-p15.c
+===================================================================
+--- app-p15.c (revision 5072)
++++ app-p15.c (working copy)
+@@ -3180,11 +3180,11 @@
+ }
+
+ if (hashalgo == MD_USER_TLS_MD5SHA1)
+- err = iso7816_compute_ds (app->slot, data, 36, outdata, outdatalen);
++ err = iso7816_compute_ds (app->slot, 0, data, 36, 0, outdata, outdatalen);
+ else if (no_data_padding)
+- err = iso7816_compute_ds (app->slot, data+15, 20, outdata, outdatalen);
++ err = iso7816_compute_ds (app->slot, 0, data+15, 20, 0,outdata,outdatalen);
+ else
+- err = iso7816_compute_ds (app->slot, data, 35, outdata, outdatalen);
++ err = iso7816_compute_ds (app->slot, 0, data, 35, 0, outdata, outdatalen);
+ return err;
+ }
+
Property changes on: trunk/patches/gnupg2-2.0.12/06-opgp-sign3072.patch
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/patches/gnupg2-2.0.12/07-gpg-no-detached.patch
===================================================================
--- trunk/patches/gnupg2-2.0.12/07-gpg-no-detached.patch 2009-07-10 08:56:47 UTC (rev 1212)
+++ trunk/patches/gnupg2-2.0.12/07-gpg-no-detached.patch 2009-07-13 16:32:11 UTC (rev 1213)
@@ -0,0 +1,226 @@
+#! /bin/sh
+patch -p0 -f $* < $0
+exit $?
+
+[g10]
+2009-07-13 Werner Koch <wk at g10code.com>
+
+ * exec.c: Fix function name indentation.
+ (expand_args): Simplify by using membuf functions.
+ (exec_write): Fix memory leak on error.
+ (w32_system): Use DETACHED_PROCESS so that a new console is not
+ created.
+
+
+Index: g10/exec.c
+===================================================================
+--- g10/exec.c (revision 5069)
++++ g10/exec.c (working copy)
+@@ -17,6 +17,12 @@
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
++/*
++ FIXME: We should replace most code in this module by our
++ spawn implementation from common/exechelp.c.
++ */
++
++
+ #include <config.h>
+ #include <stdlib.h>
+ #include <stdarg.h>
+@@ -40,19 +46,24 @@
+ #include "iobuf.h"
+ #include "util.h"
+ #include "mkdtemp.h" /* From gnulib. */
++#include "membuf.h"
+ #include "exec.h"
+
+ #ifdef NO_EXEC
+-int exec_write(struct exec_info **info,const char *program,
++int
++exec_write(struct exec_info **info,const char *program,
+ const char *args_in,const char *name,int writeonly,int binary)
+ {
+ log_error(_("no remote program execution supported\n"));
+ return G10ERR_GENERAL;
+ }
+
+-int exec_read(struct exec_info *info) { return G10ERR_GENERAL; }
+-int exec_finish(struct exec_info *info) { return G10ERR_GENERAL; }
+-int set_exec_path(const char *path) { return G10ERR_GENERAL; }
++int
++exec_read(struct exec_info *info) { return G10ERR_GENERAL; }
++int
++exec_finish(struct exec_info *info) { return G10ERR_GENERAL; }
++int
++set_exec_path(const char *path) { return G10ERR_GENERAL; }
+
+ #else /* ! NO_EXEC */
+
+@@ -60,7 +71,8 @@
+ /* This is a nicer system() for windows that waits for programs to
+ return before returning control to the caller. I hate helpful
+ computers. */
+-static int w32_system(const char *command)
++static int
++w32_system(const char *command)
+ {
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si;
+@@ -74,7 +86,9 @@
+ memset(&si,0,sizeof(si));
+ si.cb=sizeof(si);
+
+- if(!CreateProcess(NULL,string,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
++ if(!CreateProcess(NULL,string,NULL,NULL,FALSE,
++ DETACHED_PROCESS,
++ NULL,NULL,&si,&pi))
+ return -1;
+
+ /* Wait for the child to exit */
+@@ -89,7 +103,8 @@
+ #endif
+
+ /* Replaces current $PATH */
+-int set_exec_path(const char *path)
++int
++set_exec_path(const char *path)
+ {
+ char *p;
+
+@@ -111,7 +126,8 @@
+ }
+
+ /* Makes a temp directory and filenames */
+-static int make_tempdir(struct exec_info *info)
++static int
++make_tempdir(struct exec_info *info)
+ {
+ char *tmp=opt.temp_dir,*namein=info->name,*nameout;
+
+@@ -192,10 +208,11 @@
+
+ /* Expands %i and %o in the args to the full temp files within the
+ temp directory. */
+-static int expand_args(struct exec_info *info,const char *args_in)
++static int
++expand_args(struct exec_info *info,const char *args_in)
+ {
+- const char *ch=args_in;
+- unsigned int size,len;
++ const char *ch = args_in;
++ membuf_t command;
+
+ info->flags.use_temp_files=0;
+ info->flags.keep_temp_files=0;
+@@ -203,10 +220,7 @@
+ if(DBG_EXTPROG)
+ log_debug("expanding string \"%s\"\n",args_in);
+
+- size=100;
+- info->command=xmalloc(size);
+- len=0;
+- info->command[0]='\0';
++ init_membuf (&command, 100);
+
+ while(*ch!='\0')
+ {
+@@ -252,37 +266,20 @@
+ }
+
+ if(append)
+- {
+- size_t applen=strlen(append);
+-
+- if(applen+len>size-1)
+- {
+- if(applen<100)
+- applen=100;
+-
+- size+=applen;
+- info->command=xrealloc(info->command,size);
+- }
+-
+- strcat(info->command,append);
+- len+=strlen(append);
+- }
++ put_membuf_str (&command, append);
+ }
+ else
+- {
+- if(len==size-1) /* leave room for the \0 */
+- {
+- size+=100;
+- info->command=xrealloc(info->command,size);
+- }
++ put_membuf (&command, ch, 1);
+
+- info->command[len++]=*ch;
+- info->command[len]='\0';
+- }
+-
+ ch++;
+ }
+
++ put_membuf (&command, "", 1); /* Terminate string. */
++
++ info->command = get_membuf (&command, NULL);
++ if (!info->command)
++ return gpg_error_from_syserror ();
++
+ if(DBG_EXTPROG)
+ log_debug("args expanded to \"%s\", use %u, keep %u\n",info->command,
+ info->flags.use_temp_files,info->flags.keep_temp_files);
+@@ -290,10 +287,7 @@
+ return 0;
+
+ fail:
+-
+- xfree(info->command);
+- info->command=NULL;
+-
++ xfree (get_membuf (&command, NULL));
+ return G10ERR_GENERAL;
+ }
+
+@@ -303,8 +297,9 @@
+ If there are args, but no tempfiles, then it's a fork/exec/pipe via
+ shell -c. If there are tempfiles, then it's a system. */
+
+-int exec_write(struct exec_info **info,const char *program,
+- const char *args_in,const char *name,int writeonly,int binary)
++int
++exec_write(struct exec_info **info,const char *program,
++ const char *args_in,const char *name,int writeonly,int binary)
+ {
+ int ret=G10ERR_GENERAL;
+
+@@ -483,10 +478,16 @@
+ ret=0;
+
+ fail:
++ if (ret)
++ {
++ xfree (*info);
++ *info = NULL;
++ }
+ return ret;
+ }
+
+-int exec_read(struct exec_info *info)
++int
++exec_read(struct exec_info *info)
+ {
+ int ret=G10ERR_GENERAL;
+
+@@ -565,7 +566,8 @@
+ return ret;
+ }
+
+-int exec_finish(struct exec_info *info)
++int
++exec_finish(struct exec_info *info)
+ {
+ int ret=info->progreturn;
+
Property changes on: trunk/patches/gnupg2-2.0.12/07-gpg-no-detached.patch
___________________________________________________________________
Name: svn:executable
+ *
More information about the Gpg4win-commits
mailing list