From cvs at cvs.gnupg.org Tue Apr 1 17:09:00 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 01 Apr 2008 17:09:00 +0200 Subject: [svn] GnuPG - r4733 - in trunk: . kbx sm Message-ID: Author: wk Date: 2008-04-01 17:08:57 +0200 (Tue, 01 Apr 2008) New Revision: 4733 Modified: trunk/ChangeLog trunk/configure.ac trunk/kbx/ChangeLog trunk/kbx/keybox-defs.h trunk/kbx/keybox-init.c trunk/kbx/keybox-search.c trunk/kbx/keybox-update.c trunk/sm/call-dirmngr.c trunk/sm/certchain.c trunk/sm/keydb.c Log: Fix a problem with dirmngr looked up certificates. Typo fixes. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/ChangeLog 2008-04-01 15:08:57 UTC (rev 4733) @@ -1,3 +1,8 @@ +2008-04-01 Werner Koch + + * configure.ac: Require curl 7.10 (Oct 1 2002) or later as we use + curl_version_info(). + 2008-03-27 Werner Koch * Makefile.am (dist_doc_DATA): New. Install README. Modified: trunk/kbx/ChangeLog =================================================================== --- trunk/kbx/ChangeLog 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/kbx/ChangeLog 2008-04-01 15:08:57 UTC (rev 4733) @@ -1,3 +1,10 @@ +2008-04-01 Werner Koch + + * keybox-init.c (keybox_new, keybox_release): Track used handles. + (_keybox_close_file): New. + * keybox-update.c (keybox_insert_cert, keybox_set_flags) + (keybox_delete, keybox_compress): Use the new close function. + 2008-03-13 Werner Koch * keybox-blob.c (x509_email_kludge): Use the same code as in @@ -280,7 +287,8 @@ names. - Copyright 2001 g10 Code GmbH + Copyright 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without @@ -289,4 +297,3 @@ This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - \ No newline at end of file Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/configure.ac 2008-04-01 15:08:57 UTC (rev 4733) @@ -831,8 +831,9 @@ # # Check for curl. We fake the curl API if libcurl isn't installed. +# We require 7.10 or later as we use curl_version_info(). # -LIBCURL_CHECK_CONFIG([yes],,,[fake_curl=yes]) +LIBCURL_CHECK_CONFIG([yes],[7.10],,[fake_curl=yes]) AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes) # Generic, for us, means curl Modified: trunk/kbx/keybox-defs.h =================================================================== --- trunk/kbx/keybox-defs.h 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/kbx/keybox-defs.h 2008-04-01 15:08:57 UTC (rev 4733) @@ -53,13 +53,31 @@ typedef struct keybox_name *KB_NAME; -typedef struct keybox_name const * CONST_KB_NAME; -struct keybox_name { - struct keybox_name *next; +typedef struct keybox_name const *CONST_KB_NAME; +struct keybox_name +{ + /* Link to the next resources, so that we can walk all + resources. */ + KB_NAME next; + + /* True if this is a keybox with secret keys. */ int secret; + /*DOTLOCK lockhd;*/ + + /* A table with all the handles accessing this resources. + HANDLE_TABLE_SIZE gives the allocated length of this table unused + entrues are set to NULL. HANDLE_TABLE may be NULL. */ + KEYBOX_HANDLE *handle_table; + size_t handle_table_size; + + /* Not yet used. */ int is_locked; + + /* Not yet used. */ int did_full_scan; + + /* The name of the resource file. */ char fname[1]; }; @@ -129,7 +147,10 @@ /* int preserve_permissions; */ /* } keybox_opt; */ +/*-- keybox-init.c --*/ +void _keybox_close_file (KEYBOX_HANDLE hd); + /*-- keybox-blob.c --*/ #ifdef KEYBOX_WITH_OPENPGP /* fixme */ Modified: trunk/kbx/keybox-init.c =================================================================== --- trunk/kbx/keybox-init.c 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/kbx/keybox-init.c 2008-04-01 15:08:57 UTC (rev 4733) @@ -30,10 +30,9 @@ static KB_NAME kb_names; -/* - Register a filename for plain keybox files. Returns a pointer to be - used to create a handles etc or NULL to indicate that it has already - been registered */ +/* Register a filename for plain keybox files. Returns a pointer to + be used to create a handles and so on. Returns NULL to indicate + that FNAME has already been registered. */ void * keybox_register_file (const char *fname, int secret) { @@ -50,6 +49,10 @@ return NULL; strcpy (kr->fname, fname); kr->secret = !!secret; + + kr->handle_table = NULL; + kr->handle_table_size = 0; + /* kr->lockhd = NULL;*/ kr->is_locked = 0; kr->did_full_scan = 0; @@ -83,6 +86,7 @@ { KEYBOX_HANDLE hd; KB_NAME resource = token; + int idx; assert (resource && !resource->secret == !secret); hd = xtrycalloc (1, sizeof *hd); @@ -90,6 +94,43 @@ { hd->kb = resource; hd->secret = !!secret; + if (!resource->handle_table) + { + resource->handle_table_size = 3; + resource->handle_table = xtrycalloc (resource->handle_table_size, + sizeof *resource->handle_table); + if (!resource->handle_table) + { + resource->handle_table_size = 0; + xfree (hd); + return NULL; + } + } + for (idx=0; idx < resource->handle_table_size; idx++) + if (!resource->handle_table[idx]) + { + resource->handle_table[idx] = hd; + break; + } + if (!(idx < resource->handle_table_size)) + { + KEYBOX_HANDLE *tmptbl; + size_t newsize; + + newsize = resource->handle_table_size + 5; + tmptbl = xtryrealloc (resource->handle_table, + newsize * sizeof (*tmptbl)); + if (!tmptbl) + { + xfree (hd); + return NULL; + } + resource->handle_table = tmptbl; + resource->handle_table_size = newsize; + resource->handle_table[idx] = hd; + for (idx++; idx < resource->handle_table_size; idx++) + resource->handle_table[idx] = NULL; + } } return hd; } @@ -99,6 +140,13 @@ { if (!hd) return; + if (hd->kb->handle_table) + { + int idx; + for (idx=0; idx < hd->kb->handle_table_size; idx++) + if (hd->kb->handle_table[idx] == hd) + hd->kb->handle_table[idx] = NULL; + } _keybox_release_blob (hd->found.blob); if (hd->fp) { @@ -128,3 +176,27 @@ return 0; } + +/* Close the file of the resource identified by HD. For consistent + results this fucntion closes the files of all handles pointing to + the resource identified by HD. */ +void +_keybox_close_file (KEYBOX_HANDLE hd) +{ + int idx; + KEYBOX_HANDLE roverhd; + + if (!hd || !hd->kb || !hd->kb->handle_table) + return; + + for (idx=0; idx < hd->kb->handle_table_size; idx++) + if ((roverhd = hd->kb->handle_table[idx])) + { + if (roverhd->fp) + { + fclose (roverhd->fp); + roverhd->fp = NULL; + } + } + assert (!hd->fp); +} Modified: trunk/kbx/keybox-search.c =================================================================== --- trunk/kbx/keybox-search.c 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/kbx/keybox-search.c 2008-04-01 15:08:57 UTC (rev 4733) @@ -458,7 +458,7 @@ #ifdef KEYBOX_WITH_X509 /* Return true if the key in BLOB matches the 20 bytes keygrip GRIP. We don't have the keygrips as meta data, thus wen need to parse the - certificate. Fixme: We might wat to return proper error codes + certificate. Fixme: We might want to return proper error codes instead of failing a search for invalid certificates etc. */ static int blob_x509_has_grip (KEYBOXBLOB blob, const unsigned char *grip) @@ -750,10 +750,10 @@ } } - /* kludge: we need to convert an SN given as hexstring to it's - binary representation - in some cases we are not able to store it - in the search descriptor, because due to its usage it is not - possible to free allocated memory */ + /* Kludge: We need to convert an SN given as hexstring to its binary + representation - in some cases we are not able to store it in the + search descriptor, because due to the way we use it, it is not + possible to free allocated memory. */ if (sn_array) { const unsigned char *s; Modified: trunk/kbx/keybox-update.c =================================================================== --- trunk/kbx/keybox-update.c 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/kbx/keybox-update.c 2008-04-01 15:08:57 UTC (rev 4733) @@ -136,7 +136,7 @@ xfree (bakfname); return tmperr; } - + *r_bakfname = bakfname; *r_tmpfname = tmpfname; return 0; @@ -167,7 +167,7 @@ /* iobuf_ioctl (NULL, 2, 0, (char*)bakfname ); */ /* iobuf_ioctl (NULL, 2, 0, (char*)fname ); */ - /* first make a backup file except for secret keyboxs */ + /* First make a backup file except for secret keyboxes. */ if (!secret) { #if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__) @@ -179,7 +179,7 @@ } } - /* then rename the file */ + /* Then rename the file. */ #if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__) remove (fname); #endif @@ -386,12 +386,8 @@ /* Close this one otherwise we will mess up the position for a next search. Fixme: it would be better to adjust the position after - the write opertions. */ - if (hd->fp) - { - fclose (hd->fp); - hd->fp = NULL; - } + the write operation. */ + _keybox_close_file (hd); rc = _keybox_create_x509_blob (&blob, cert, sha1_digest, hd->ephemeral); if (!rc) @@ -453,11 +449,7 @@ off += flag_pos; - if (hd->fp) - { - fclose (hd->fp); - hd->fp = NULL; - } + _keybox_close_file (hd); fp = fopen (hd->kb->fname, "r+b"); if (!fp) return gpg_error (gpg_err_code_from_errno (errno)); @@ -522,12 +514,7 @@ return gpg_error (GPG_ERR_GENERAL); off += 4; - if (hd->fp) - { - fclose (hd->fp); - hd->fp = NULL; - } - + _keybox_close_file (hd); fp = fopen (hd->kb->fname, "r+b"); if (!fp) return gpg_error (gpg_err_code_from_errno (errno)); @@ -575,11 +562,7 @@ if (!fname) return gpg_error (GPG_ERR_INV_HANDLE); - if (hd->fp) - { - fclose (hd->fp); - hd->fp = NULL; - } + _keybox_close_file (hd); /* Open the source file. Because we do a rename, we have to check the permissions of the file */ Modified: trunk/sm/call-dirmngr.c =================================================================== --- trunk/sm/call-dirmngr.c 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/sm/call-dirmngr.c 2008-04-01 15:08:57 UTC (rev 4733) @@ -703,7 +703,7 @@ } -/* Run the Directroy Managers lookup command using the pattern +/* Run the Directory Manager's lookup command using the pattern compiled from the strings given in NAMES. The caller must provide the callback CB which will be passed cert by cert. Note that CTRL is optional. With CACHE_ONLY the dirmngr will search only its own Modified: trunk/sm/certchain.c =================================================================== --- trunk/sm/certchain.c 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/sm/certchain.c 2008-04-01 15:08:57 UTC (rev 4733) @@ -596,9 +596,9 @@ { rc = keydb_search_issuer_sn (kh, s, authidno); if (rc) - keydb_search_reset (kh); + keydb_search_reset (kh); - /* In case of an error, try to get the certifcate from the + /* In case of an error, try to get the certificate from the dirmngr. That is done by trying to put that certifcate into the ephemeral DB and let the code below do the actual retrieve. Thus there is no error checking. Modified: trunk/sm/keydb.c =================================================================== --- trunk/sm/keydb.c 2008-03-31 21:17:18 UTC (rev 4732) +++ trunk/sm/keydb.c 2008-04-01 15:08:57 UTC (rev 4733) @@ -392,7 +392,7 @@ /* If the keyring has not yet been locked, lock it now. This - operation is required before any update opeations; it is optionaly + operation is required before any update operation; it is optional for an insert operation. The lock is released with keydb_released. */ gpg_error_t From cvs at cvs.gnupg.org Wed Apr 2 10:20:39 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 02 Apr 2008 10:20:39 +0200 Subject: [svn] GnuPG - r4734 - branches/STABLE-BRANCH-1-4/doc Message-ID: Author: wk Date: 2008-04-02 10:20:38 +0200 (Wed, 02 Apr 2008) New Revision: 4734 Modified: branches/STABLE-BRANCH-1-4/doc/ChangeLog branches/STABLE-BRANCH-1-4/doc/yat2m.c Log: Fix rendering of @samp. Modified: branches/STABLE-BRANCH-1-4/doc/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/doc/ChangeLog 2008-04-01 15:08:57 UTC (rev 4733) +++ branches/STABLE-BRANCH-1-4/doc/ChangeLog 2008-04-02 08:20:38 UTC (rev 4734) @@ -1,3 +1,8 @@ +2008-04-02 Werner Koch + + * yat2m.c (proc_texi_cmd): Use the \(aq glyph for @samp. This is + bug#898. + 2007-12-21 Werner Koch * README.W32: Tell that Vista is supported and that at least NT-4 Modified: branches/STABLE-BRANCH-1-4/doc/yat2m.c =================================================================== --- branches/STABLE-BRANCH-1-4/doc/yat2m.c 2008-04-01 15:08:57 UTC (rev 4733) +++ branches/STABLE-BRANCH-1-4/doc/yat2m.c 2008-04-02 08:20:38 UTC (rev 4734) @@ -449,7 +449,7 @@ { "code", 0, "\\fB", "\\fR" }, { "sc", 0, "\\fB", "\\fR" }, { "var", 0, "\\fI", "\\fR" }, - { "samp", 0, "'", "'" }, + { "samp", 0, "\\(aq", "\\(aq'" }, { "file", 0, "`\\fI","\\fR'" }, { "env", 0, "`\\fI","\\fR'" }, { "acronym", 0 }, From cvs at cvs.gnupg.org Wed Apr 2 10:48:09 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 02 Apr 2008 10:48:09 +0200 Subject: [svn] GnuPG - r4735 - branches/STABLE-BRANCH-1-4/doc Message-ID: Author: wk Date: 2008-04-02 10:48:08 +0200 (Wed, 02 Apr 2008) New Revision: 4735 Modified: branches/STABLE-BRANCH-1-4/doc/ChangeLog branches/STABLE-BRANCH-1-4/doc/opt-homedir.texi branches/STABLE-BRANCH-1-4/doc/yat2m.c Log: Yet another minor yat2m fix. Modified: branches/STABLE-BRANCH-1-4/doc/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/doc/ChangeLog 2008-04-02 08:20:38 UTC (rev 4734) +++ branches/STABLE-BRANCH-1-4/doc/ChangeLog 2008-04-02 08:48:08 UTC (rev 4735) @@ -1,7 +1,10 @@ 2008-04-02 Werner Koch + * opt-homedir.texi: Remove special case for Registry key. + * yat2m.c (proc_texi_cmd): Use the \(aq glyph for @samp. This is bug#898. + (proc_texi_buffer): Handle backslashs correctly. 2007-12-21 Werner Koch Modified: branches/STABLE-BRANCH-1-4/doc/opt-homedir.texi =================================================================== --- branches/STABLE-BRANCH-1-4/doc/opt-homedir.texi 2008-04-02 08:20:38 UTC (rev 4734) +++ branches/STABLE-BRANCH-1-4/doc/opt-homedir.texi 2008-04-02 08:48:08 UTC (rev 4735) @@ -6,9 +6,5 @@ recognized when given on the command line. It also overrides any home directory stated through the environment variable @env{GNUPGHOME} or (on W32 systems) by means on the Registry entry - at ifset isman - at var{HKCU\\Software\\GNU\\GnuPG:HomeDir}. - at end ifset - at ifclear isman @var{HKCU\Software\GNU\GnuPG:HomeDir}. - at end ifclear + Modified: branches/STABLE-BRANCH-1-4/doc/yat2m.c =================================================================== --- branches/STABLE-BRANCH-1-4/doc/yat2m.c 2008-04-02 08:20:38 UTC (rev 4734) +++ branches/STABLE-BRANCH-1-4/doc/yat2m.c 2008-04-02 08:48:08 UTC (rev 4735) @@ -42,7 +42,7 @@ the next input line if that line begins with @section, @subsection or @chapheading. - To insert verbatim troff markup, the follwing texinfo code may be + To insert verbatim troff markup, the following texinfo code may be used: @ifset manverb @@ -675,6 +675,8 @@ } *eol_action = 0; } + else if (*s == '\\') + fputs ("\\\\", fp); else putc (*s, fp); } @@ -842,7 +844,7 @@ { char *line; int lnr = 0; - /* Fixme: The follwing state variables don't carry over to include + /* Fixme: The following state variables don't carry over to include files. */ int in_verbatim = 0; int skip_to_end = 0; /* Used to skip over menu entries. */ From cvs at cvs.gnupg.org Wed Apr 2 18:10:00 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 02 Apr 2008 18:10:00 +0200 Subject: [svn] GpgOL - r242 - in trunk: . doc po src Message-ID: Author: wk Date: 2008-04-02 18:09:58 +0200 (Wed, 02 Apr 2008) New Revision: 242 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac trunk/doc/gpgol.texi trunk/po/de.po trunk/po/sv.po trunk/src/ChangeLog trunk/src/Makefile.am trunk/src/common.c trunk/src/engine-assuan.c trunk/src/engine.c trunk/src/main.c trunk/src/mimeparser.c trunk/src/util.h Log: Preparing a release [The diff below has been truncated] Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/ChangeLog 2008-04-02 16:09:58 UTC (rev 242) @@ -1,3 +1,7 @@ +2008-04-01 Werner Koch + + * configure.ac (AC_INIT): Fix quoting. + 2008-03-19 Werner Koch * Release 0.10.9. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/src/ChangeLog 2008-04-02 16:09:58 UTC (rev 242) @@ -1,5 +1,23 @@ +2008-04-02 Werner Koch + + * engine-assuan.c (destroy_command): Add arg FORCE. + (op_assuan_encrypt_bottom): Call destroy_command. + + * mimeparser.c (struct mime_context): Use parser_error to return + gpg error codes. + + * main.c (read_options): Allow names for debug flags. + * common.c (trim_spaces): New. + 2008-03-31 Werner Koch + * engine-assuan.c (struct work_item_s): Add SWITCH_COUNTER. + (switch_threads, clear_switch_threads): New. + (worker_start_write): Use it. + * engine.c (struct engine_filter_s): Add SWITCH_COUNTER. + (switch_threads, clear_switch_threads): New. + (filter_gpgme_read_cb): Use it. + * ext-commands.h (class GpgolExtCommands): Add m_nCmdCryptoState. * ext-commands.cpp (InstallCommands): Add a toolbar crypto state button. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/NEWS 2008-04-02 16:09:58 UTC (rev 242) @@ -1,5 +1,13 @@ +Noteworthy changes for version 0.10.10 (2008-04-02) +=================================================== + + * Visual cleanups. + + * Changes to the I/O dispatcher. + + Noteworthy changes for version 0.10.9 (2008-03-19) -================================================= +================================================== * Decrypt opaque signed and encrypted S/MIME mails. @@ -8,7 +16,7 @@ Noteworthy changes for version 0.10.8 (2008-03-18) -================================================= +================================================== * Fixed a segv introduced with 0.10.6. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/configure.ac 2008-04-02 16:09:58 UTC (rev 242) @@ -16,12 +16,13 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [0.10.9]) +m4_define([my_version], [0.10.10]) m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) -AC_INIT([gpgol], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]), +AC_INIT([gpgol], + [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])], [bug-gpgol at g10code.com]) NEED_GPG_ERROR_VERSION=1.4 Modified: trunk/doc/gpgol.texi =================================================================== --- trunk/doc/gpgol.texi 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/doc/gpgol.texi 2008-04-02 16:09:58 UTC (rev 242) @@ -661,24 +661,26 @@ make the log file output more verbose; these are actually bit flags according to the following table (which may change with any release): @table @code - at item 2 (0x0002) + at item 2 (0x0002) (ioworker) Tell what the Assuan I/O scheduler is doing. - at item 4 (0x0004) + at item 4 (0x0004) (ioworker-extra) Even more verbose Assuan I/O scheduler reporting. - at item 8 (0x0008) + at item 8 (0x0008) (filter) Tell what the filter I/O system is doing. - at item 16 (0x0010) + at item 16 (0x0010) (filter-extra) Tell how the filter I/O locks the resources. - at item 32 (0x0020) + at item 32 (0x0020) (memory) Tell about resource allocation. - at item 64 (0x0040) + at item 64 (0x0040) (commands) Tell about command events. - at item 128 (0x0080) + at item 128 (0x0080) (mime-parser) Tell what the MIME parser is doing - at item 256 (0x0100) + at item 256 (0x0100) (mime-data) Print data lines while parsing MIME. @end table -You may use the regular C-syntax for entering the value. +You may use the regular C-syntax for entering the value. As an +alternative you may use the names ofthe flags, separated by space or +comma. @itemx HKCU\Software\GNU\GpgOL:logFile Modified: trunk/po/de.po [not shown] Modified: trunk/po/sv.po [not shown] Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/src/Makefile.am 2008-04-02 16:09:58 UTC (rev 242) @@ -74,13 +74,13 @@ $(DLLTOOL) --output-lib $@ --def $< libgpg-error.a: - ln -s $(shell $(GPG_ERROR_CONFIG) --prefix)/lib/libgpg-error.a + ln -s $$($(GPG_ERROR_CONFIG) --prefix)/lib/libgpg-error.a . libgpgme.a: - ln -s $(shell $(GPGME_CONFIG) --prefix)/lib/libgpgme.a + ln -s $$($(GPGME_CONFIG) --prefix)/lib/libgpgme.a . libassuan.a: - ln -s $(shell $(LIBASSUAN_CONFIG) --prefix)/lib/libassuan.a + ln -s $$($(LIBASSUAN_CONFIG) --prefix)/lib/libassuan.a . clean-local: rm -f libmapi32.a libgpg-error.a libgpgme.a libassuan.a Modified: trunk/src/common.c =================================================================== --- trunk/src/common.c 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/src/common.c 2008-04-02 16:09:58 UTC (rev 242) @@ -413,6 +413,36 @@ } +/* Strip off leading and trailing white spaces from STRING. Returns + STRING. */ +char * +trim_spaces (char *arg_string) +{ + char *string = arg_string; + char *p, *mark; + + /* Find first non space character. */ + for (p = string; *p && isascii (*p) && isspace (*p) ; p++ ) + ; + /* Move characters. */ + for (mark = NULL; (*string = *p); string++, p++ ) + { + if (isascii (*p) && isspace (*p)) + { + if (!mark) + mark = string; + } + else + mark = NULL ; + } + if (mark) + *mark = 0; + + return arg_string; +} + + + /* Helper for read_w32_registry_string(). */ static HKEY get_root_key(const char *root) Modified: trunk/src/engine-assuan.c =================================================================== --- trunk/src/engine-assuan.c 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/src/engine-assuan.c 2008-04-02 16:09:58 UTC (rev 242) @@ -111,6 +111,8 @@ queue. */ OVERLAPPED ov; /* The overlapped info structure. */ char buffer[1024]; /* The buffer used by ReadFile or WriteFile. */ + + ULONG switch_counter; /* Used by switch_threads. */ }; @@ -636,6 +638,39 @@ #endif /* not used. */ +/* This is a wraper around SwitchToThread, a syscall we unfortunately + need due to the lack of an sophisticated event system. The wrapper + calls SwitchToThread but after a couple of immediate folliwing + switches, it introduces a short delays. */ +static void +switch_threads (work_item_t item) +{ + ULONG count; + + count = InterlockedExchangeAdd (&item->switch_counter, 1); + if (count > 5) + { + /* Tried too often without success. Use Sleep until + clear_switch_threads has been called. */ + InterlockedExchange (&item->switch_counter, 5); + SleepEx (60, TRUE); + } + else if (!SwitchToThread ()) + { + /* No runable other thread: Fall asleep. */ + SleepEx (8, TRUE); + } +} + +/* Call this fucntion if some action has been done. */ +static void +clear_switch_threads (work_item_t item) +{ + InterlockedExchange (&item->switch_counter, 0); +} + + + /* Helper for async_worker_thread. Returns true if the item's handle needs to be put on the wait list. This is called with the worker @@ -763,13 +798,16 @@ /* Read from the callback and the write to the handle. The gpgme callback is expected to never block. */ nread = gpgme_data_read (item->data, item->buffer, sizeof item->buffer); + if (nread < 0 && errno == EAGAIN) + switch_threads (item); + else + clear_switch_threads (item); if (nread < 0) { if (errno == EAGAIN) { /* log_debug ("%s:%s: [%s:%p] ignoring EAGAIN from callback", */ /* SRCNAME, __func__, item->name, item->hd); */ - SwitchToThread (); retval = 1; } else @@ -955,7 +993,21 @@ /* INFINITE, QS_ALLEVENTS); */ if (n == WAIT_FAILED) { + int i; + DWORD hdinfo; + log_error_w32 (-1, "%s:%s: WFMO failed", SRCNAME, __func__); + for (i=0; i < hdarraylen; i++) + { + hdinfo = 0; + if (!GetHandleInformation (hdarray[i], &hdinfo)) + log_debug_w32 (-1, "%s:%s: WFMO GetHandleInfo(%p) failed", + SRCNAME, __func__, hdarray[i]); + else + log_debug ("%s:%s: WFMO GetHandleInfo(%p)=0x%lu", + SRCNAME, __func__, hdarray[i], + (unsigned long)hdinfo); + } Sleep (1000); } else if (n >= 0 && n < hdarraylen) @@ -1060,33 +1112,60 @@ { if (item->cld) { + work_item_t itm2; + if (!item->cld->final_err && item->got_error) item->cld->final_err = gpg_error (GPG_ERR_EIO); - if (!item->cld->final_err) + /* Check whether there are other work items in this + group we need to wait for before invoking the + closure. */ + for (itm2=work_queue; itm2; itm2 = itm2->next) + if (itm2->used && itm2 != item + && itm2->cmdid == item->cmdid + && itm2->wait_on_success + && !(itm2->got_ready || itm2->got_error)) + break; + if (itm2) { - /* Check whether there are other work items in - this group we need to wait for before - invoking the closure. */ - work_item_t itm2; - - for (itm2=work_queue; itm2; itm2 = itm2->next) - if (itm2->used && itm2 != item - && itm2->cmdid == item->cmdid - && itm2->wait_on_success - && !(itm2->got_ready || itm2->got_error)) - break; - if (itm2) + if (debug_ioworker) + log_debug ("%s:%s: [%s:%p] delaying closure " + "due to [%s:%p]", SRCNAME, __func__, + item->name, item->hd, + itm2->name, itm2->hd); + item->delayed_ready = 1; + if (item->cld->final_err) { - if (debug_ioworker) - log_debug ("%s:%s: [%s:%p] delaying closure " - "due to [%s/%p]", SRCNAME, __func__, - item->name, item->hd, - itm2->name, itm2->hd); - item->delayed_ready = 1; - break; + /* If we received an error we better do not + assume that the server has properly + closed all I/O channels. Send a cancel + to the work item we are waiting for. */ + if (!itm2->aborting) + { + if (debug_ioworker) + log_debug ("%s:%s: [%s:%p] calling CancelIO", + SRCNAME, __func__, + itm2->name, itm2->hd); + itm2->aborting = 1; + if (!CancelIo (itm2->hd)) + log_error_w32 (-1, "%s:%s: [%s:%p] " + "CancelIo failed", + SRCNAME,__func__, + itm2->name, itm2->hd); + } + else + { + if (debug_ioworker) + log_debug ("%s:%s: [%s:%p] clearing " + "wait on success flag", + SRCNAME, __func__, + itm2->name, itm2->hd); + itm2->wait_on_success = 0; + } } + break; } + item->delayed_ready = 0; if (debug_ioworker) log_debug ("%s:%s: [%s:%p] invoking closure", @@ -1189,18 +1268,19 @@ /* Remove all items from the work queue belonging to the command with the id CMDID. */ static void -destroy_command (ULONG cmdid) +destroy_command (ULONG cmdid, int force) { work_item_t item; EnterCriticalSection (&work_queue_lock); for (item = work_queue; item; item = item->next) - if (item->used && item->cmdid == cmdid && !item->wait_on_success) + if (item->used && item->cmdid == cmdid + && (!item->wait_on_success || force)) { if (debug_ioworker) log_debug ("%s:%s: [%s:%p] cmdid=%lu registered for destroy", SRCNAME, __func__, item->name, item->hd, item->cmdid); - /* First send an I/O cancel in case the the last + /* First send an I/O cancel in case the last GetOverlappedResult returned only a partial result. This works because we are always running within the async_worker_thread. */ @@ -1315,7 +1395,7 @@ break; case 1: /* Ready. */ cld->status_ready = 1; - destroy_command (cld->cmdid); + destroy_command (cld->cmdid, 0); break; default: log_error ("%s:%s: invalid line from server", SRCNAME, __func__); @@ -1432,7 +1512,7 @@ correct relationship between a popups and the active window. If this function returns success, the data objects may only be destroyed after an engine_wait or engine_cancel. On success the - fucntion returns a pojunter to the encryption state and thus + function returns a poiunter to the encryption state and thus requires that op_assuan_encrypt_bottom will be run later. */ int op_assuan_encrypt (protocol_t protocol, @@ -1579,11 +1659,15 @@ if (err) { - /* Fixme: Cancel stuff in the work_queue. */ + xfree (encstate->cld); + encstate->cld = NULL; + engine_private_set_cancel (encstate->filter, NULL); close_pipe (encstate->inpipe); close_pipe (encstate->outpipe); - xfree (encstate->cld); + if (cancel) + destroy_command (encstate->cmdid, 1); assuan_disconnect (encstate->ctx); + encstate->ctx = NULL; } else engine_private_set_cancel (encstate->filter, encstate->ctx); Modified: trunk/src/engine.c =================================================================== --- trunk/src/engine.c 2008-03-31 16:29:54 UTC (rev 241) +++ trunk/src/engine.c 2008-04-02 16:09:58 UTC (rev 242) @@ -105,6 +105,9 @@ /* A pointer used convey information from engine_encrypt_prepare to engine_encrypt_start. */ struct engine_assuan_encstate_s *encstate; + + /* Counter used to optimize voluntary thread switching. */ + ULONG switch_counter; }; @@ -198,8 +201,36 @@ } +/* This is a wraper around SwitchToThread, a syscall we unfortunately + need due to the lack of an sophisticated event system. The wrapper + calls SwitchToThread but after a couple of immediate folliwing + switches, it introduces a short delays. */ +static void +switch_threads (engine_filter_t filter) +{ + ULONG count; + count = InterlockedExchangeAdd (&filter->switch_counter, 1); + if (count > 5) + { + InterlockedExchange (&filter->switch_counter, 5); + SleepEx (50, TRUE); + } + else if (!SwitchToThread ()) + { + /* No runable other thread: Fall asleep. */ + SleepEx (5, TRUE); + } +} +/* Call this fucntion if some action has been done. */ +static void +clear_switch_threads (engine_filter_t filter) +{ + InterlockedExchange (&filter->switch_counter, 0); +} + + /* This read callback is used by GPGME to read data from a filter object. The function should return the number of bytes read, 0 on EOF, and -1 on error. If an error occurs, ERRNO should be set to @@ -234,9 +265,11 @@ errno = EAGAIN; if (debug_filter_extra) log_debug ("%s:%s: leave; result=EAGAIN\n", SRCNAME, __func__); - SwitchToThread (); + switch_threads (filter); return -1; } + else + clear_switch_threads (filter); if (debug_filter) log_debug ("%s:%s: waiting for in.condvar\n", SRCNAME, __func__); WaitForSingleObject (filter->in.condvar, 500); @@ -425,8 +458,11 @@ SRCNAME, __func__, indata, (int)indatalen, filter->outfnc); for (;;) { + int any; + /* If there is something to write out, do this now to make space for more data. */ + any = 0; take_out_lock (filter, __func__); while (filter->out.length) { @@ -447,13 +483,19 @@ memmove (filter->out.buffer, filter->out.buffer + nbytes, filter->out.length - nbytes); filter->out.length -= nbytes; + any = 1; } if (!PulseEvent (filter->out.condvar)) log_error_w32 (-1, "%s:%s: PulseEvent(out) failed", SRCNAME, __func__); release_out_lock (filter, __func__); - + + if (any) + clear_switch_threads (filter); + else + switch_threads (filter); + + any = 0; take_in_lock (filter, __func__); - if (!indata && !indatalen) { filter->in.got_eof = 1; @@ -480,17 +522,23 @@ memcpy (filter->in.buffer, indata, filter->in.length); indata += filter->in.length; indatalen -= filter->in.length; + any = 1; } + /* Terminate the loop if the filter queue is empty OR the filter + is ready and there is nothing left for output. */ if (!filter->in.length || (filter->in.ready && !filter->out.length)) { release_in_lock (filter, __func__); From cvs at cvs.gnupg.org Wed Apr 2 18:15:25 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 02 Apr 2008 18:15:25 +0200 Subject: [svn] GpgOL - r243 - tags Message-ID: Author: wk Date: 2008-04-02 18:15:24 +0200 (Wed, 02 Apr 2008) New Revision: 243 Added: tags/gpgol-0.10.10/ Log: From cvs at cvs.gnupg.org Wed Apr 2 20:03:06 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 02 Apr 2008 20:03:06 +0200 Subject: [svn] GnuPG - r4736 - trunk/g10 Message-ID: Author: wk Date: 2008-04-02 20:03:04 +0200 (Wed, 02 Apr 2008) New Revision: 4736 Modified: trunk/g10/ChangeLog trunk/g10/gpg.c Log: disable DSA2 for old Libgcrypts. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2008-04-02 08:48:08 UTC (rev 4735) +++ trunk/g10/ChangeLog 2008-04-02 18:03:04 UTC (rev 4736) @@ -1,3 +1,7 @@ +2008-04-02 Werner Koch + + * gpg.c (main): Do not allow DSA2 with a too old Libgcrypt. + 2008-03-26 Werner Koch * tdbio.c (lookup_hashtable): Make cmp args const. Modified: trunk/g10/gpg.c =================================================================== --- trunk/g10/gpg.c 2008-04-02 08:48:08 UTC (rev 4735) +++ trunk/g10/gpg.c 2008-04-02 18:03:04 UTC (rev 4736) @@ -2932,6 +2932,15 @@ "use!\n"); #endif + /* Older Libgcrypts fail with an assertion during DSA key + generation. Better disable DSA2 entirely. */ + if (opt.flags.dsa2 && !gcry_check_version ("1.4.0") ) + { + log_info ("WARNING: " + "DSA2 is only available with Libgcrypt 1.4 and later\n"); + opt.flags.dsa2 = 0; + } + if (opt.verbose > 2) log_info ("using character set `%s'\n", get_native_charset ()); From cvs at cvs.gnupg.org Thu Apr 3 11:58:29 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu, 03 Apr 2008 11:58:29 +0200 Subject: [svn] GnuPG - r4737 - trunk/doc Message-ID: Author: wk Date: 2008-04-03 11:58:28 +0200 (Thu, 03 Apr 2008) New Revision: 4737 Modified: trunk/doc/ChangeLog trunk/doc/TRANSLATE trunk/doc/opt-homedir.texi trunk/doc/yat2m.c Log: Fixed last yat2m change. Add a similar change to @file and @env. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2008-04-02 18:03:04 UTC (rev 4736) +++ trunk/doc/ChangeLog 2008-04-03 09:58:28 UTC (rev 4737) @@ -1,3 +1,16 @@ +2008-04-03 Werner Koch + + * yat2m.c (proc_texi_cmd): Remove extra apostrophe from @samp and + use open and close quote to @file and @env. + +2008-04-02 Werner Koch + + * opt-homedir.texi: Remove special case for Registry key. + + * yat2m.c (proc_texi_cmd): Use the \(aq glyph for @samp. This is + bug#898. + (proc_texi_buffer): Handle backslashs correctly. + 2008-03-27 Werner Koch * Makefile.am (nobase_dist_doc_DATA, dist_html_DATA): New. Move Modified: trunk/doc/TRANSLATE =================================================================== --- trunk/doc/TRANSLATE 2008-04-02 18:03:04 UTC (rev 4736) +++ trunk/doc/TRANSLATE 2008-04-03 09:58:28 UTC (rev 4737) @@ -43,7 +43,7 @@ .gpgsm.some.help-item This string has been translated. -The percent sign is not a special character and if tehre is something +The percent sign is not a special character and if there is something to watch out there will be a remark. Modified: trunk/doc/opt-homedir.texi =================================================================== --- trunk/doc/opt-homedir.texi 2008-04-02 18:03:04 UTC (rev 4736) +++ trunk/doc/opt-homedir.texi 2008-04-03 09:58:28 UTC (rev 4737) @@ -6,9 +6,5 @@ recognized when given on the command line. It also overrides any home directory stated through the environment variable @env{GNUPGHOME} or (on W32 systems) by means on the Registry entry - at ifset isman - at var{HKCU\\Software\\GNU\\GnuPG:HomeDir}. - at end ifset - at ifclear isman @var{HKCU\Software\GNU\GnuPG:HomeDir}. - at end ifclear + Modified: trunk/doc/yat2m.c =================================================================== --- trunk/doc/yat2m.c 2008-04-02 18:03:04 UTC (rev 4736) +++ trunk/doc/yat2m.c 2008-04-03 09:58:28 UTC (rev 4737) @@ -449,9 +449,9 @@ { "code", 0, "\\fB", "\\fR" }, { "sc", 0, "\\fB", "\\fR" }, { "var", 0, "\\fI", "\\fR" }, - { "samp", 0, "'", "'" }, - { "file", 0, "`\\fI","\\fR'" }, - { "env", 0, "`\\fI","\\fR'" }, + { "samp", 0, "\\(aq", "\\(aq" }, + { "file", 0, "\\(oq\\fI","\\fR\\(cq" }, + { "env", 0, "\\(oq\\fI","\\fR\\(cq" }, { "acronym", 0 }, { "dfn", 0 }, { "option", 0, "\\fB", "\\fR" }, @@ -675,6 +675,8 @@ } *eol_action = 0; } + else if (*s == '\\') + fputs ("\\\\", fp); else putc (*s, fp); } From cvs at cvs.gnupg.org Fri Apr 4 16:14:28 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 04 Apr 2008 16:14:28 +0200 Subject: [svn] GpgOL - r244 - in trunk: . src Message-ID: Author: wk Date: 2008-04-04 16:14:27 +0200 (Fri, 04 Apr 2008) New Revision: 244 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac trunk/src/ChangeLog trunk/src/common.c trunk/src/engine-assuan.c trunk/src/engine.c trunk/src/main.c Log: Fix sign+encr problem. [The diff below has been truncated] Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-04-02 16:15:24 UTC (rev 243) +++ trunk/ChangeLog 2008-04-04 14:14:27 UTC (rev 244) @@ -1,3 +1,11 @@ +2008-04-04 Werner Koch + + * Release 0.10.11. + +2008-04-02 Werner Koch + + * Release 0.10.10. + 2008-04-01 Werner Koch * configure.ac (AC_INIT): Fix quoting. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-04-02 16:15:24 UTC (rev 243) +++ trunk/src/ChangeLog 2008-04-04 14:14:27 UTC (rev 244) @@ -1,3 +1,17 @@ +2008-04-04 Werner Koch + + * engine-assuan.c (worker_start_read, worker_check_read): Factor + common code out to .. + (write_to_callback): .. new. + (async_worker_thread): Better comments and minor changes. + (enqueue_callback): Add arg INACTIVE. + (set_items_active): New. + (start_command): Set items active. + (op_assuan_encrypt): Create input and output items as inactive. + (async_worker_thread): Handle the inactive flag. + + * common.c (gpgol_spawn_detached): Do not inherit handles. + 2008-04-02 Werner Koch * engine-assuan.c (destroy_command): Add arg FORCE. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-04-02 16:15:24 UTC (rev 243) +++ trunk/NEWS 2008-04-04 14:14:27 UTC (rev 244) @@ -1,3 +1,9 @@ +Noteworthy changes for version 0.10.11 (2008-04-04) +=================================================== + + * Fixed a performavce problem with signed+encrypted. + + Noteworthy changes for version 0.10.10 (2008-04-02) =================================================== Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-04-02 16:15:24 UTC (rev 243) +++ trunk/configure.ac 2008-04-04 14:14:27 UTC (rev 244) @@ -16,7 +16,7 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [0.10.10]) +m4_define([my_version], [0.10.11]) m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ Modified: trunk/src/common.c =================================================================== --- trunk/src/common.c 2008-04-02 16:15:24 UTC (rev 243) +++ trunk/src/common.c 2008-04-04 14:14:27 UTC (rev 244) @@ -31,6 +31,7 @@ #endif #include #include +#include #include "common.h" @@ -788,7 +789,7 @@ } -/* Fork and exec the program gioven in CMDLINE with /dev/null as +/* Fork and exec the program given in CMDLINE with /dev/null as stdin, stdout and stderr. Returns 0 on success. */ int gpgol_spawn_detached (const char *cmdline) @@ -818,7 +819,7 @@ cmdline_copy, /* Command line arguments. */ &sec_attr, /* Process security attributes. */ &sec_attr, /* Thread security attributes. */ - TRUE, /* Inherit handles. */ + FALSE, /* Inherit handles. */ cr_flags, /* Creation flags. */ NULL, /* Environment. */ NULL, /* Use current drive/directory. */ Modified: trunk/src/engine-assuan.c =================================================================== --- trunk/src/engine-assuan.c 2008-04-02 16:15:24 UTC (rev 243) +++ trunk/src/engine-assuan.c 2008-04-04 14:14:27 UTC (rev 244) @@ -99,11 +99,12 @@ gpgme_data_t data; /* The data object we write to or read from. */ int writing; /* If true we are going to write to HD. */ HANDLE hd; /* The handle we read from or write to. */ + int inactive; /* If set, the handle is not yet active. */ int io_pending; /* I/O is still pending. The value is the number of bytes to be written or the size of the buffer given to ReadFile. */ int got_ready; /* Operation finished. */ - int delayed_ready; /* Ready but delayed to to a missing prerequesite. */ + int delayed_ready; /* Ready but delayed due to a missing prerequesite. */ int got_error; /* An error as been encountered. */ int aborting; /* Set to true after a CancelIO has been issued. */ void (*finalize)(work_item_t); /* Function called immediately before @@ -672,13 +673,49 @@ +/* Helper to write to the callback. */ +static void +write_to_callback (work_item_t item, DWORD nbytes) +{ + int nwritten; + + if (!nbytes) + { + /* (With overlapped, EOF is not indicated by NBYTES==0.) */ + log_error ("%s:%s: [%s:%p] short read (0 bytes)", + SRCNAME, __func__, item->name, item->hd); + } + else + { + assert (nbytes > 0); + nwritten = gpgme_data_write (item->data, item->buffer, nbytes); + if (nwritten < 0) + { + log_error ("%s:%s: [%s:%p] error writing to callback: %s", + SRCNAME, __func__, item->name, item->hd,strerror (errno)); + item->got_error = 1; + } + else if (nwritten < nbytes) + { + log_error ("%s:%s: [%s:%p] short write to callback (%d of %lu)", + SRCNAME, __func__, item->name, item->hd, nwritten,nbytes); + item->got_error = 1; + } + else + { + if (debug_ioworker) + log_debug ("%s:%s: [%s:%p] wrote %d bytes to callback", + SRCNAME, __func__, item->name, item->hd, nwritten); + } + } +} + /* Helper for async_worker_thread. Returns true if the item's handle needs to be put on the wait list. This is called with the worker mutex hold. */ static int worker_start_read (work_item_t item) { - int nwritten; DWORD nbytes; int retval = 0; @@ -687,34 +724,7 @@ if (ReadFile (item->hd, item->buffer, sizeof item->buffer, &nbytes, &item->ov) ) { - /* (With overlapped, EOF is not indicated by NBYTES==0.) */ - if (!nbytes) - log_error ("%s:%s: [%s:%p] short read (0 bytes)", - SRCNAME, __func__, item->name, item->hd); - else - { - nwritten = gpgme_data_write (item->data, item->buffer, nbytes); - if (nwritten < 0) - { - log_error ("%s:%s: [%s:%p] writing to callback failed: %s", - SRCNAME, __func__, item->name, item->hd, - strerror (errno)); - item->got_error = 1; - } - else if (nwritten < nbytes) - { - log_error ("%s:%s: [%s:%p] short write to callback (%d of %lu)", - SRCNAME, __func__, item->name, item->hd, - nwritten, nbytes); - item->got_error = 1; - } - else - { - if (debug_ioworker) - log_debug ("%s:%s: [%s:%p] wrote %d bytes to callback", - SRCNAME, __func__, item->name, item->hd, nwritten); - } - } + write_to_callback (item, nbytes); retval = 1; } else @@ -753,34 +763,7 @@ static void worker_check_read (work_item_t item, DWORD nbytes) { - int nwritten; - - if (!nbytes) - log_error ("%s:%s: [%s:%p] short read (0 bytes)", - SRCNAME, __func__, item->name, item->hd); - else - { - assert (nbytes > 0); - nwritten = gpgme_data_write (item->data, item->buffer, nbytes); - if (nwritten < 0) - { - log_error ("%s:%s: [%s:%p] error writing to callback: %s", - SRCNAME, __func__, item->name, item->hd,strerror (errno)); - item->got_error = 1; - } - else if (nwritten < nbytes) - { - log_error ("%s:%s: [%s:%p] short write to callback (%d of %lu)", - SRCNAME, __func__, item->name, item->hd, nwritten,nbytes); - item->got_error = 1; - } - else - { - if (debug_ioworker) - log_debug ("%s:%s: [%s:%p] wrote %d bytes to callback", - SRCNAME, __func__, item->name, item->hd, nwritten); - } - } + write_to_callback (item, nbytes); } @@ -795,23 +778,26 @@ DWORD nbytes; int retval = 0; + assert (!item->io_pending); + /* Read from the callback and the write to the handle. The gpgme callback is expected to never block. */ nread = gpgme_data_read (item->data, item->buffer, sizeof item->buffer); - if (nread < 0 && errno == EAGAIN) - switch_threads (item); - else - clear_switch_threads (item); if (nread < 0) { if (errno == EAGAIN) { -/* log_debug ("%s:%s: [%s:%p] ignoring EAGAIN from callback", */ -/* SRCNAME, __func__, item->name, item->hd); */ + /* EAGAIN from the callback. That means that data is + currently not available. */ + if (debug_ioworker_extra) + log_debug ("%s:%s: [%s:%p] EAGAIN received from callback", + SRCNAME, __func__, item->name, item->hd); + switch_threads (item); retval = 1; } else { + clear_switch_threads (item); log_error ("%s:%s: [%s:%p] error reading from callback: %s", SRCNAME, __func__, item->name, item->hd,strerror (errno)); item->got_error = 1; @@ -819,14 +805,15 @@ } else if (!nread) { + clear_switch_threads (item); if (debug_ioworker) log_debug ("%s:%s: [%s:%p] EOF received from callback", SRCNAME, __func__, item->name, item->hd); item->got_ready = 1; - retval = 1; } else { + clear_switch_threads (item); if (WriteFile (item->hd, item->buffer, nread, &nbytes, &item->ov)) { if (nbytes < nread) @@ -841,7 +828,7 @@ log_debug ("%s:%s: [%s:%p] wrote %lu bytes", SRCNAME, __func__, item->name, item->hd, nbytes); } - retval = 1; + retval = 1; /* Keep on waiting for space in the pipe. */ } else { @@ -849,11 +836,12 @@ if (syserr == ERROR_IO_PENDING) { + /* This is the common case. Start the async I/O. */ if (debug_ioworker) log_debug ("%s:%s: [%s:%p] io(write) pending (%d bytes)", SRCNAME, __func__, item->name, item->hd, nread); item->io_pending = nread; - retval = 1; + retval = 1; /* Need to wait for the I/O to complete. */ } else { @@ -905,12 +893,17 @@ for (;;) { - /* Process our queue and fire up async I/O requests. */ + /* + Step 1: Walk our queue and fire up async I/O requests. + */ if (debug_ioworker_extra) - log_debug ("%s:%s: processing work queue", SRCNAME, __func__); + log_debug ("%s:%s: step 1 - scanning work queue", SRCNAME, __func__); EnterCriticalSection (&work_queue_lock); + + /* We always need to wait on the the work queue event. */ hdarraylen = 0; hdarray[hdarraylen++] = work_queue_event; + count = 0; any_ready = 0; for (item = work_queue; item; item = item->next) @@ -934,8 +927,15 @@ SRCNAME, __func__, item->name, item->hd); continue; } - - if (item->io_pending) + + /* Decide whether we need to wait for this item. This is + the case if the previous WriteFile or ReadFile indicated + that I/O is pending or if the worker_start_foo function + indicated that we should wait. Put handles we want to + wait upon into HDARRAY. */ + if (item->inactive) + addit = 0; + else if (item->io_pending) addit = 1; else if (item->writing) addit = worker_start_write (item); @@ -945,26 +945,47 @@ if (addit) { hdarray[hdarraylen++] = item->hd; - item->waiting = 1; /* Just for the trace output. */ + item->waiting = 1; /* Only required for debugging. */ } + + /* Set a flag if this work item is ready or got an error. */ if (!item->delayed_ready && (item->got_error || item->got_ready)) any_ready = 1; } LeaveCriticalSection (&work_queue_lock); + /* + Step 2: Wait for events or handle activitity. + */ if (any_ready) { + /* There is at least one work item which is ready or got an + error. Skip the wait step so that we process it + immediately. */ if (debug_ioworker_extra) - log_debug ("%s:%s: %d items in queue; skipping wait", + log_debug ("%s:%s: step 2 - %d items in queue; skipping wait", SRCNAME, __func__, count); } else { - /* First process any window messages of this thread. Do + if (debug_ioworker_extra) + { + log_debug ("%s:%s: step 2 - " + "%d items in queue; waiting for %d items:", + SRCNAME, __func__, count, hdarraylen-1); + for (item = work_queue; item; item = item->next) + { + if (item->waiting) + log_debug ("%s:%s: [%s:%p]", + SRCNAME, __func__, item->name, item->hd); + } + } + /* [Currently not used] + First process any window messages of this thread. Do this before wating so that the message queue is cleared before waiting and we don't get stucked due to messages not removed. We need to process the message queue also - after the wait becuase we will only get to here if there + after the wait because we will only get to here if there is actual ui-server work to be done but some messages might still be in the queue. */ /* { */ @@ -977,22 +998,14 @@ /* } */ /* } */ - if (debug_ioworker_extra) - { - log_debug ("%s:%s: %d items in queue; waiting for %d items:", - SRCNAME, __func__, count, hdarraylen-1); - for (item = work_queue; item; item = item->next) - { - if (item->waiting) - log_debug ("%s:%s: [%s:%p]", - SRCNAME, __func__, item->name, item->hd); - } - } n = WaitForMultipleObjects (hdarraylen, hdarray, FALSE, INFINITE); /* n = MsgWaitForMultipleObjects (hdarraylen, hdarray, FALSE, */ /* INFINITE, QS_ALLEVENTS); */ if (n == WAIT_FAILED) { + /* The WFMO failed. This is an error; to help debugging + we now print information about all the handles we + wanted to wait upon. */ int i; DWORD hdinfo; @@ -1013,14 +1026,14 @@ else if (n >= 0 && n < hdarraylen) { if (debug_ioworker_extra) - log_debug ("%s:%s: WFMO succeeded (res=%d)", - SRCNAME,__func__, n); + log_debug ("%s:%s: WFMO succeeded (res=%d, hd=%p)", + SRCNAME, __func__, n, hdarray[n]); } else if (n == hdarraylen) { if (debug_ioworker_extra) - log_debug ("%s:%s: WFMO succeeded - MSGEVENT (res=%d)", - SRCNAME,__func__, n); + log_debug ("%s:%s: WFMO succeeded (res=%d, msgevent)", + SRCNAME, __func__, n); } else { @@ -1028,7 +1041,8 @@ Sleep (1000); } - /* Try to process the message queue. */ + /* [Currently not used] + Try to process the message queue. */ /* { */ /* MSG msg; */ @@ -1038,20 +1052,29 @@ /* DispatchMessage (&msg); */ /* } */ /* } */ - } - - /* Handle completion status. */ + /* + Step 3: Handle I/O completion status. + */ EnterCriticalSection (&work_queue_lock); if (debug_ioworker_extra) - log_debug ("%s:%s: checking completion states", SRCNAME, __func__); + log_debug ("%s:%s: step 3 - checking completion states", + SRCNAME, __func__); for (item = work_queue; item; item = item->next) { - if (!item->io_pending) - ; + if (!item->io_pending || item->inactive) + { + /* No I/O is pending for that item, thus there is no + need to check a completion status. */ + } else if (GetOverlappedResult (item->hd, &item->ov, &nbytes, FALSE)) { + /* An overlapped I/O result is available. Check that + the returned number of bytes are plausible and clear + the I/O pending flag of this work item. For a a read + item worker_check_read forwards the received data to + the caller. */ if (item->writing) worker_check_write (item, nbytes); else @@ -1060,32 +1083,33 @@ } else { + /* Some kind of error occured: Set appropriate + flags. */ int syserr = GetLastError (); if (syserr == ERROR_IO_INCOMPLETE) - ; - else if (!item->writing && syserr == ERROR_HANDLE_EOF) { - /* Got EOF. */ - if (debug_ioworker) - log_debug ("%s:%s: [%s:%p] EOF received", - SRCNAME, __func__, item->name, item->hd); - item->io_pending = 0; - item->got_ready = 1; + /* This is a common case, the I/O has not yet + completed for this work item. No need for any + action. */ } - else if (!item->writing && syserr == ERROR_BROKEN_PIPE) + else if (!item->writing && (syserr == ERROR_HANDLE_EOF + || syserr == ERROR_BROKEN_PIPE) ) { /* Got EOF. */ if (debug_ioworker) - log_debug ("%s:%s: [%s:%p] EOF (broken pipe) received", - SRCNAME, __func__, item->name, item->hd); + log_debug ("%s:%s: [%s:%p] EOF%s received", + SRCNAME, __func__, item->name, item->hd, + syserr==ERROR_BROKEN_PIPE?" (broken pipe)":""); item->io_pending = 0; item->got_ready = 1; } else { + /* Something went wrong. We better cancel the I/O. */ log_error_w32 (syserr, "%s:%s: [%s:%p] GetOverlappedResult failed", SRCNAME, __func__, item->name, item->hd); + item->io_pending = 0; item->got_error = 1; if (!item->aborting) { From cvs at cvs.gnupg.org Fri Apr 4 16:18:04 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 04 Apr 2008 16:18:04 +0200 Subject: [svn] GpgOL - r245 - tags Message-ID: Author: wk Date: 2008-04-04 16:18:04 +0200 (Fri, 04 Apr 2008) New Revision: 245 Added: tags/gpgol-0.10.11/ Log: From cvs at cvs.gnupg.org Mon Apr 7 21:31:16 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 07 Apr 2008 21:31:16 +0200 Subject: [svn] GnuPG - r4738 - in trunk: . common g10 keyserver po Message-ID: Author: wk Date: 2008-04-07 21:31:12 +0200 (Mon, 07 Apr 2008) New Revision: 4738 Added: trunk/common/t-b64.c trunk/keyserver/gpgkeys_kdns.c Modified: trunk/ChangeLog trunk/common/ChangeLog trunk/common/Makefile.am trunk/common/b64enc.c trunk/common/pka.c trunk/common/util.h trunk/configure.ac trunk/g10/ChangeLog trunk/g10/getkey.c trunk/g10/keyserver.c trunk/g10/pkclist.c trunk/keyserver/ChangeLog trunk/keyserver/Makefile.am trunk/keyserver/no-libgcrypt.c trunk/po/de.po Log: Minor cleanups. Implemented key helper kdns [The diff below has been truncated] Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/ChangeLog 2008-04-07 19:31:12 UTC (rev 4738) @@ -1,3 +1,8 @@ +2008-04-07 Werner Koch + + * configure.ac (ADNSLIBS): Test for adns. + (GPGKEYS_KDNS): New. + 2008-04-01 Werner Koch * configure.ac: Require curl 7.10 (Oct 1 2002) or later as we use @@ -2,2 +7,3 @@ curl_version_info(). + (AC_INIT): Fix quoting. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/common/ChangeLog 2008-04-07 19:31:12 UTC (rev 4738) @@ -1,3 +1,12 @@ +2008-04-07 Werner Koch + + * b64enc.c (b64enc_start): Detect PGP mode. + (b64enc_finish): Write PGP CRC. + * util.h (struct b64state): Add field CRC. + * t-b64.c: New. + + * pka.c (get_pka_info): Use xtrymalloc and check result. + 2008-03-25 Werner Koch * localename.c: Strip all W32 code. Include w32help.h. @@ -1168,8 +1177,8 @@ (atoi_1,atoi_2,atoi_4,xtoi_1,xtoi_2): New. - Copyright 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/g10/ChangeLog 2008-04-07 19:31:12 UTC (rev 4738) @@ -1,3 +1,9 @@ +2008-04-07 Werner Koch + + * keyserver.c (parse_keyserver_uri): Allow a default host name. + + * getkey.c (get_pubkey_byname): Replace sprintf by bin2hex. + 2008-04-02 Werner Koch * gpg.c (main): Do not allow DSA2 with a too old Libgcrypt. Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/keyserver/ChangeLog 2008-04-07 19:31:12 UTC (rev 4738) @@ -1,3 +1,10 @@ +2008-04-07 Werner Koch + + * gpgkeys_kdns.c: New. + * Makefile.am: Support kdns. + + * no-libgcrypt.c (gcry_strdup): Fix. It was not used. + 2008-03-25 Werner Koch * gpgkeys_ldap.c (build_attrs): Take care of char defaulting to Modified: trunk/common/Makefile.am =================================================================== --- trunk/common/Makefile.am 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/common/Makefile.am 2008-04-07 19:31:12 UTC (rev 4738) @@ -108,7 +108,7 @@ # Module tests # module_tests = t-convert t-gettime t-sysutils t-sexputil -module_maint_tests = t-helpfile +module_maint_tests = t-helpfile t-b64 t_common_ldadd = libcommon.a ../jnlib/libjnlib.a ../gl/libgnu.a \ $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) $(LIBINTL) $(LIBICONV) @@ -118,4 +118,7 @@ t_sysutils_LDADD = $(t_common_ldadd) t_helpfile_LDADD = $(t_common_ldadd) t_sexputil_LDADD = $(t_common_ldadd) +t_b64_LDADD = $(t_common_ldadd) + + Modified: trunk/common/b64enc.c =================================================================== --- trunk/common/b64enc.c 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/common/b64enc.c 2008-04-07 19:31:12 UTC (rev 4738) @@ -1,5 +1,5 @@ /* b64enc.c - Simple Base64 encoder. - * Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. + * Copyright (C) 2001, 2003, 2004, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -30,20 +30,121 @@ #define B64ENC_DID_HEADER 1 #define B64ENC_DID_TRAILER 2 #define B64ENC_NO_LINEFEEDS 16 +#define B64ENC_USE_PGPCRC 32 - /* The base-64 character list */ static unsigned char bintoasc[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; +/* Stuff required to create the OpenPGP CRC. This crc_table has been + created using this code: + + #include + #include + + #define CRCPOLY 0x864CFB + + int + main (void) + { + int i, j; + uint32_t t; + uint32_t crc_table[256]; + + crc_table[0] = 0; + for (i=j=0; j < 128; j++ ) + { + t = crc_table[j]; + if ( (t & 0x00800000) ) + { + t <<= 1; + crc_table[i++] = t ^ CRCPOLY; + crc_table[i++] = t; + } + else + { + t <<= 1; + crc_table[i++] = t; + crc_table[i++] = t ^ CRCPOLY; + } + } + + puts ("static const u32 crc_table[256] = {"); + for (i=j=0; i < 256; i++) + { + printf ("%s 0x%08lx", j? "":" ", (unsigned long)crc_table[i]); + if (i != 255) + { + putchar (','); + if ( ++j > 5) + { + j = 0; + putchar ('\n'); + } + } + } + puts ("\n};"); + return 0; + } +*/ +#define CRCINIT 0xB704CE +static const u32 crc_table[256] = { + 0x00000000, 0x00864cfb, 0x018ad50d, 0x010c99f6, 0x0393e6e1, 0x0315aa1a, + 0x021933ec, 0x029f7f17, 0x07a18139, 0x0727cdc2, 0x062b5434, 0x06ad18cf, + 0x043267d8, 0x04b42b23, 0x05b8b2d5, 0x053efe2e, 0x0fc54e89, 0x0f430272, + 0x0e4f9b84, 0x0ec9d77f, 0x0c56a868, 0x0cd0e493, 0x0ddc7d65, 0x0d5a319e, + 0x0864cfb0, 0x08e2834b, 0x09ee1abd, 0x09685646, 0x0bf72951, 0x0b7165aa, + 0x0a7dfc5c, 0x0afbb0a7, 0x1f0cd1e9, 0x1f8a9d12, 0x1e8604e4, 0x1e00481f, + 0x1c9f3708, 0x1c197bf3, 0x1d15e205, 0x1d93aefe, 0x18ad50d0, 0x182b1c2b, + 0x192785dd, 0x19a1c926, 0x1b3eb631, 0x1bb8faca, 0x1ab4633c, 0x1a322fc7, + 0x10c99f60, 0x104fd39b, 0x11434a6d, 0x11c50696, 0x135a7981, 0x13dc357a, + 0x12d0ac8c, 0x1256e077, 0x17681e59, 0x17ee52a2, 0x16e2cb54, 0x166487af, + 0x14fbf8b8, 0x147db443, 0x15712db5, 0x15f7614e, 0x3e19a3d2, 0x3e9fef29, + 0x3f9376df, 0x3f153a24, 0x3d8a4533, 0x3d0c09c8, 0x3c00903e, 0x3c86dcc5, + 0x39b822eb, 0x393e6e10, 0x3832f7e6, 0x38b4bb1d, 0x3a2bc40a, 0x3aad88f1, + 0x3ba11107, 0x3b275dfc, 0x31dced5b, 0x315aa1a0, 0x30563856, 0x30d074ad, + 0x324f0bba, 0x32c94741, 0x33c5deb7, 0x3343924c, 0x367d6c62, 0x36fb2099, + 0x37f7b96f, 0x3771f594, 0x35ee8a83, 0x3568c678, 0x34645f8e, 0x34e21375, + 0x2115723b, 0x21933ec0, 0x209fa736, 0x2019ebcd, 0x228694da, 0x2200d821, + 0x230c41d7, 0x238a0d2c, 0x26b4f302, 0x2632bff9, 0x273e260f, 0x27b86af4, + 0x252715e3, 0x25a15918, 0x24adc0ee, 0x242b8c15, 0x2ed03cb2, 0x2e567049, + 0x2f5ae9bf, 0x2fdca544, 0x2d43da53, 0x2dc596a8, 0x2cc90f5e, 0x2c4f43a5, + 0x2971bd8b, 0x29f7f170, 0x28fb6886, 0x287d247d, 0x2ae25b6a, 0x2a641791, + 0x2b688e67, 0x2beec29c, 0x7c3347a4, 0x7cb50b5f, 0x7db992a9, 0x7d3fde52, + 0x7fa0a145, 0x7f26edbe, 0x7e2a7448, 0x7eac38b3, 0x7b92c69d, 0x7b148a66, + 0x7a181390, 0x7a9e5f6b, 0x7801207c, 0x78876c87, 0x798bf571, 0x790db98a, + 0x73f6092d, 0x737045d6, 0x727cdc20, 0x72fa90db, 0x7065efcc, 0x70e3a337, + 0x71ef3ac1, 0x7169763a, 0x74578814, 0x74d1c4ef, 0x75dd5d19, 0x755b11e2, + 0x77c46ef5, 0x7742220e, 0x764ebbf8, 0x76c8f703, 0x633f964d, 0x63b9dab6, + 0x62b54340, 0x62330fbb, 0x60ac70ac, 0x602a3c57, 0x6126a5a1, 0x61a0e95a, + 0x649e1774, 0x64185b8f, 0x6514c279, 0x65928e82, 0x670df195, 0x678bbd6e, + 0x66872498, 0x66016863, 0x6cfad8c4, 0x6c7c943f, 0x6d700dc9, 0x6df64132, + 0x6f693e25, 0x6fef72de, 0x6ee3eb28, 0x6e65a7d3, 0x6b5b59fd, 0x6bdd1506, + 0x6ad18cf0, 0x6a57c00b, 0x68c8bf1c, 0x684ef3e7, 0x69426a11, 0x69c426ea, + 0x422ae476, 0x42aca88d, 0x43a0317b, 0x43267d80, 0x41b90297, 0x413f4e6c, + 0x4033d79a, 0x40b59b61, 0x458b654f, 0x450d29b4, 0x4401b042, 0x4487fcb9, + 0x461883ae, 0x469ecf55, 0x479256a3, 0x47141a58, 0x4defaaff, 0x4d69e604, + 0x4c657ff2, 0x4ce33309, 0x4e7c4c1e, 0x4efa00e5, 0x4ff69913, 0x4f70d5e8, + 0x4a4e2bc6, 0x4ac8673d, 0x4bc4fecb, 0x4b42b230, 0x49ddcd27, 0x495b81dc, + 0x4857182a, 0x48d154d1, 0x5d26359f, 0x5da07964, 0x5cace092, 0x5c2aac69, + 0x5eb5d37e, 0x5e339f85, 0x5f3f0673, 0x5fb94a88, 0x5a87b4a6, 0x5a01f85d, + 0x5b0d61ab, 0x5b8b2d50, 0x59145247, 0x59921ebc, 0x589e874a, 0x5818cbb1, + 0x52e37b16, 0x526537ed, 0x5369ae1b, 0x53efe2e0, 0x51709df7, 0x51f6d10c, + 0x50fa48fa, 0x507c0401, 0x5542fa2f, 0x55c4b6d4, 0x54c82f22, 0x544e63d9, + 0x56d11cce, 0x56575035, 0x575bc9c3, 0x57dd8538 +}; + + /* Prepare for base-64 writing to the stream FP. If TITLE is not NULL and not an empty string, this string will be used as the title for the armor lines, with TITLE being an empty string, we don't write the header lines and furthermore even don't write any linefeeds. - With TITLE beeing NULL, we merely don't write header but make sure - that lines are not too long. Note, that we don't write any output - unless at least one byte get written using b64enc_write. */ + If TITLE starts with "PGP " the OpenPGP CRC checksum will be + written as well. With TITLE beeing NULL, we merely don't write + header but make sure that lines are not too long. Note, that we + don't write any output unless at least one byte get written using + b64enc_write. */ gpg_error_t b64enc_start (struct b64state *state, FILE *fp, const char *title) { @@ -53,9 +154,14 @@ state->flags |= B64ENC_NO_LINEFEEDS; else if (title) { + if (!strncmp (title, "PGP ", 4)) + { + state->flags |= B64ENC_USE_PGPCRC; + state->crc = CRCINIT; + } state->title = xtrystrdup (title); if (!state->title) - return gpg_error_from_syserror (); + return gpg_error_from_syserror (); } return 0; } @@ -88,7 +194,11 @@ || fputs (state->title, fp) == EOF || fputs ("-----\n", fp) == EOF) goto write_error; + if ( (state->flags & B64ENC_USE_PGPCRC) + && fputs ("\n", fp) == EOF) + goto write_error; } + state->flags |= B64ENC_DID_HEADER; } @@ -96,7 +206,17 @@ quad_count = state->quad_count; assert (idx < 4); memcpy (radbuf, state->radbuf, idx); - + + if ( (state->flags & B64ENC_USE_PGPCRC) ) + { + size_t n; + u32 crc = state->crc; + + for (p=buffer, n=nbytes; n; p++, n-- ) + crc = (crc << 8) ^ crc_table[((crc >> 16)&0xff) ^ *p]; + state->crc = (crc & 0x00ffffff); + } + for (p=buffer; nbytes; p++, nbytes--) { radbuf[idx++] = *p; @@ -138,6 +258,7 @@ unsigned char radbuf[4]; int idx, quad_count; FILE *fp; + char tmp[4]; if (!(state->flags & B64ENC_DID_HEADER)) goto cleanup; @@ -151,8 +272,6 @@ if (idx) { - char tmp[4]; - tmp[0] = bintoasc[(*radbuf>>2)&077]; if (idx == 1) { @@ -186,6 +305,26 @@ && !(state->flags & B64ENC_NO_LINEFEEDS) && fputs ("\n", fp) == EOF) goto write_error; + + if ( (state->flags & B64ENC_USE_PGPCRC) ) + { + /* Write the CRC. */ + putc ('=', fp); + radbuf[0] = state->crc >>16; + radbuf[1] = state->crc >> 8; + radbuf[2] = state->crc; + tmp[0] = bintoasc[(*radbuf>>2)&077]; + tmp[1] = bintoasc[(((*radbuf<<4)&060)|((radbuf[1]>>4)&017))&077]; + tmp[2] = bintoasc[(((radbuf[1]<<2)&074)|((radbuf[2]>>6)&03))&077]; + tmp[3] = bintoasc[radbuf[2]&077]; + for (idx=0; idx < 4; idx++) + putc (tmp[idx], fp); + if (ferror (fp)) + goto write_error; + if (!(state->flags & B64ENC_NO_LINEFEEDS) + && fputs ("\n", fp) == EOF) + goto write_error; + } if (state->title) { Modified: trunk/common/pka.c =================================================================== --- trunk/common/pka.c 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/common/pka.c 2008-04-07 19:31:12 UTC (rev 4738) @@ -119,7 +119,9 @@ if (!domain || domain == address || !domain[1]) return NULL; /* invalid mail address given. */ - name = malloc (strlen (address) + 5 + 1); + name = xtrymalloc (strlen (address) + 5 + 1); + if (!name) + return NULL; memcpy (name, address, domain - address); strcpy (stpcpy (name + (domain-address), "._pka."), domain+1); Added: trunk/common/t-b64.c =================================================================== --- trunk/common/t-b64.c 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/common/t-b64.c 2008-04-07 19:31:12 UTC (rev 4738) @@ -0,0 +1,87 @@ +/* t-b64.c - Module tests for b64enc.c and b64dec.c + * Copyright (C) 2008 Free Software Foundation, Inc. + * + * This file is part of GnuPG. + * + * GnuPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GnuPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +/* + + As of now this is only a test program for manual tests. + + */ + + + +#include +#include +#include + +#include "util.h" + +#define pass() do { ; } while(0) +#define fail(a) do { fprintf (stderr, "%s:%d: test %d failed\n",\ + __FILE__,__LINE__, (a)); \ + errcount++; \ + } while(0) + +static int verbose; +static int errcount; + +static void +test_b64enc_pgp (const char *string) +{ + gpg_error_t err; + struct b64state state; + + if (!string) + string = "a"; + + err = b64enc_start (&state, stdout, "PGP MESSAGE"); + if (err) + fail (1); + + err = b64enc_write (&state, string, strlen (string)); + if (err) + fail (2); + + err = b64enc_finish (&state); + if (err) + fail (3); + + pass (); +} + + + + + + +int +main (int argc, char **argv) +{ + if (argc) + { argc--; argv++; } + if (argc && !strcmp (argv[0], "--verbose")) + { + verbose = 1; + argc--; argv++; + } + + test_b64enc_pgp (argc? *argv: NULL); + + return !!errcount; +} + Modified: trunk/common/util.h =================================================================== --- trunk/common/util.h 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/common/util.h 2008-04-07 19:31:12 UTC (rev 4738) @@ -152,6 +152,7 @@ FILE *fp; char *title; unsigned char radbuf[4]; + u32 crc; }; gpg_error_t b64enc_start (struct b64state *state, FILE *fp, const char *title); gpg_error_t b64enc_write (struct b64state *state, Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/configure.ac 2008-04-07 19:31:12 UTC (rev 4738) @@ -1,6 +1,6 @@ # configure.ac - for GnuPG 2.0 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -# 2006, 2007 Free Software Foundation, Inc. +# 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is part of GnuPG. # @@ -30,7 +30,8 @@ m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) -AC_INIT([gnupg], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]), +AC_INIT([gnupg], + [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])], [bug-gnupg at gnupg.org]) # Set development_version to yes if the minor number is odd or you # feel that the default check for a development version is not @@ -69,6 +70,7 @@ have_ksba=no have_pth=no have_libusb=no +have_adns=no use_bzip2=yes use_exec=yes @@ -759,6 +761,7 @@ # Make sure that the BIND 4 resolver interface is workable before # enabling any code that calls it. At some point I'll rewrite the # code to use the BIND 8 resolver API. + # We might also want to use adns instead. AC_MSG_CHECKING([whether the resolver is usable]) AC_LINK_IFELSE([AC_LANG_PROGRAM([#include @@ -822,7 +825,31 @@ AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes) + # +# Check for ADNS. +# +_cppflags="${CPPFLAGS}" +_ldflags="${LDFLAGS}" +AC_ARG_WITH(adns, + AC_HELP_STRING([--with-adns=DIR], + [look for the adns library in DIR]), + [if test -d "$withval"; then + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi]) +AC_CHECK_HEADERS(adns.h, + AC_CHECK_LIB(adns, adns_init, + [have_adns=yes], + [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]), + [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]) +if test "$have_adns" = "yes"; then + ADNSLIBS="-ladns" +fi +AC_SUBST(ADNSLIBS) + + +# # Check for LDAP # if test "$try_ldap" = yes ; then @@ -1264,6 +1291,11 @@ # # Decide what to build # +if test "$have_adns" = "yes"; then + AC_SUBST(GPGKEYS_KDNS, "gpg2keys_kdns$EXEEXT") +fi + + missing_pth=no if test $have_ksba = no; then build_gpgsm=no Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2008-04-03 09:58:28 UTC (rev 4737) +++ trunk/g10/getkey.c 2008-04-07 19:31:12 UTC (rev 4738) @@ -1012,9 +1012,8 @@ requirement as the URL might point to a key put in by an attacker. By forcing the use of the fingerprint, we won't use the attacker's key here. */ - if(rc==0 && fpr) + if (!rc && fpr) { - int i; char fpr_string[MAX_FINGERPRINT_LEN*2+1]; assert(fpr_len<=MAX_FINGERPRINT_LEN); @@ -1022,9 +1021,8 @@ free_strlist(namelist); namelist=NULL; - for(i=0;ischeme=xstrdup("hkp"); } - if(assume_hkp || (uri[0]=='/' && uri[1]=='/')) + if (uri[0]=='/' && uri[1]=='/' && uri[2] == '/') { + /* Three slashes means network path with a default host name. + This is a hack because it does not crok all possible + combiantions. We should better repalce all code bythe parser + from http.c. */ + keyserver->path = xstrdup (uri+2); From cvs at cvs.gnupg.org Mon Apr 7 21:55:45 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 07 Apr 2008 21:55:45 +0200 Subject: [svn] GnuPG - r4739 - trunk/keyserver Message-ID: Author: wk Date: 2008-04-07 21:55:44 +0200 (Mon, 07 Apr 2008) New Revision: 4739 Modified: trunk/keyserver/gpgkeys_kdns.c Log: Allow requesting TCP queries. Modified: trunk/keyserver/gpgkeys_kdns.c =================================================================== --- trunk/keyserver/gpgkeys_kdns.c 2008-04-07 19:31:12 UTC (rev 4738) +++ trunk/keyserver/gpgkeys_kdns.c 2008-04-07 19:55:44 UTC (rev 4739) @@ -63,9 +63,10 @@ /* The replacement string for the at sign. */ static const char *kdns_at_repl; +/* Flag indicating that a TCP conenction should be used. */ +static int kdns_usevc; - /* Retrieve one key. ADDRESS should be an RFC-2822 addr-spec. */ static int @@ -103,9 +104,8 @@ if (opt->verbose > 2) fprintf(console, PGM": looking up `%s'\n", name); - if ( adns_synchronous (adns_ctx, name, (adns_r_unknown | my_adns_r_cert), - adns_qf_quoteok_query, + adns_qf_quoteok_query|(kdns_usevc?adns_qf_usevc:0), &answer) ) { fprintf (console, PGM": DNS query failed: %s\n", strerror (errno)); @@ -191,14 +191,15 @@ " -o\toutput to this file\n" "\n", fp); fputs ("This keyserver helper accepts URLs of the form:\n" - " kdns://[NAMESERVER]/[ROOT][?at=[STRING]]\n" + " kdns://[NAMESERVER]/[ROOT][?at=STRING]\n" "with\n" " NAMESERVER used for queries (default: system standard)\n" " ROOT a DNS name appended to the query (default: none)\n" - " STRING A string to replace the '@' (default: \".\")\n" + " STRING a string to replace the '@' (default: \".\")\n" + "If a long answer is expected add the parameter \"usevc=1\".\n" "\n", fp); fputs ("Example: A query for \"hacker at gnupg.org\" with\n" - " kdns://10.0.0.1/example.net?at=_key?\n" + " kdns://10.0.0.1/example.net?at=_key&usevc=1\n" "setup as --auto-key-lookup does a CERT record query\n" "with type PGP on the nameserver 10.0.0.1 for\n" " hacker._key_.gnupg.org.example.net\n" @@ -308,8 +309,11 @@ return KEYSERVER_INTERNAL_ERROR; } - fprintf (console, PGM": HOST=%s\n", opt->host? opt->host:"(none)"); - fprintf (console, PGM": PATH=%s\n", opt->path? opt->path:"(none)"); + if (opt->verbose) + { + fprintf (console, PGM": HOST=%s\n", opt->host? opt->host:"(none)"); + fprintf (console, PGM": PATH=%s\n", opt->path? opt->path:"(none)"); + } if (opt->path && *opt->path == '/') { char *p, *pend; @@ -325,11 +329,9 @@ if (pend) *pend++ = 0; if (!strncmp (p, "at=", 3)) - { - /* Found. */ - kdns_at_repl = p+3; - break; - } + kdns_at_repl = p+3; + else if (!strncmp (p, "usevc=", 6)) + kdns_usevc = !!atoi (p+6); } while ((p = pend)); } @@ -341,9 +343,13 @@ } if (!strcmp (kdns_at_repl, ".")) kdns_at_repl = ""; - fprintf (console, PGM": kdns_root=%s\n", kdns_root); - fprintf (console, PGM": kdns_at=%s\n", kdns_at_repl); + if (opt->verbose) + { + fprintf (console, PGM": kdns_root=%s\n", kdns_root); + fprintf (console, PGM": kdns_at=%s\n", kdns_at_repl); + fprintf (console, PGM": kdns_usevc=%d\n", kdns_usevc); + } if (opt->debug) my_adns_initflags |= adns_if_debug; From cvs at cvs.gnupg.org Tue Apr 8 13:04:19 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 08 Apr 2008 13:04:19 +0200 Subject: [svn] GnuPG - r4740 - in trunk: . doc g10 tools Message-ID: Author: wk Date: 2008-04-08 13:04:16 +0200 (Tue, 08 Apr 2008) New Revision: 4740 Modified: trunk/NEWS trunk/doc/ChangeLog trunk/doc/gpg.texi trunk/g10/ChangeLog trunk/g10/getkey.c trunk/g10/gpg.c trunk/g10/import.c trunk/g10/keydb.h trunk/g10/keyedit.c trunk/g10/keyserver.c trunk/g10/options.h trunk/g10/pkclist.c trunk/tools/ChangeLog trunk/tools/gpgconf-comp.c Log: Enhanced --auto-key-locate. [The diff below has been truncated] Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/doc/ChangeLog 2008-04-08 11:04:16 UTC (rev 4740) @@ -1,3 +1,9 @@ +2008-04-08 Werner Koch + + * gpg.texi (GPG Configuration Options): Change subkeys.pgp.net to + keys.gnupg.net. Describe --auto-key-locate mechanisms local and + nodefault. + 2008-04-03 Werner Koch * yat2m.c (proc_texi_cmd): Remove extra apostrophe from @samp and Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/g10/ChangeLog 2008-04-08 11:04:16 UTC (rev 4740) @@ -1,3 +1,20 @@ +2008-04-08 Werner Koch + + * options.h (opt): Add AKL_NODEFAULT and AKL_LOCAL. + * getkey.c (parse_auto_key_locate): Parse them. + (get_pubkey_byname): Implement them. Add arg NO_AKL and use that + in all cases where a local key is expected. + * import.c (import_one): Fill in the fingerprint in all cases. + Use log_get_stream. + * keyserver.c (keyserver_import_pka): Set FPR to NULL on error. + Return G10ERR_NO_PUBKEY if no PKA info is available or no key URI + is given in the PKA record.. + (keyserver_import_cert): Return G10ERR_NO_PUBKEY if a CERT record + was not found. + + * getkey.c (get_pubkey_byname): Release FPR in the error case. + Continue with next mechanism on error. Better diagnostics. + 2008-04-07 Werner Koch * keyserver.c (parse_keyserver_uri): Allow a default host name. @@ -10121,7 +10138,7 @@ Copyright 1998,1999,2000,2001,2002,2003,2004,2005, - 2006,2007 Free Software Foundation, Inc. + 2006,2007,2008 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without Modified: trunk/tools/ChangeLog =================================================================== --- trunk/tools/ChangeLog 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/tools/ChangeLog 2008-04-08 11:04:16 UTC (rev 4740) @@ -1,3 +1,7 @@ +2008-04-08 Werner Koch + + * gpgconf-comp.c (gc_options_gpg): Add --auto-key-locate. + 2008-03-26 Werner Koch * make-dns-cert.c: Include unistd.h. Use config.h if requested. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/NEWS 2008-04-08 11:04:16 UTC (rev 4740) @@ -1,8 +1,13 @@ Noteworthy changes in version 2.0.10 (unreleased) ------------------------------------------------- + * New keyserver helper gpg2keys_kdns as generic DNS CERT lookup. Run + with --help for a short description. Requires the ADNS library. + * New mechanisms "local" and "nodefault" for --auto-key-locate [gpg]. + Fixed a few problems with this option. + Noteworthy changes in version 2.0.9 (2008-03-26) ------------------------------------------------ Modified: trunk/doc/gpg.texi =================================================================== --- trunk/doc/gpg.texi 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/doc/gpg.texi 2008-04-08 11:04:16 UTC (rev 4740) @@ -1305,28 +1305,41 @@ GnuPG can automatically locate and retrieve keys as needed using this option. This happens when encrypting to an email address (in the "user@@example.com" form), and there are no user@@example.com keys on -the local keyring. This option takes any number of the following -arguments, in the order they are to be tried: +the local keyring. This option takes any number of the following +mechanisms, in the order they are to be tried: @table @asis @item cert -locate a key using DNS CERT, as specified in rfc4398. +Locate a key using DNS CERT, as specified in rfc4398. @item pka -locate a key using DNS PKA. +Locate a key using DNS PKA. @item ldap -locate a key using the PGP Universal method of checking -"ldap://keys.(thedomain)". +Locate a key using the PGP Universal method of checking + at samp{ldap://keys.(thedomain)}. @item keyserver -locate a key using whatever keyserver is defined using the +Locate a key using whatever keyserver is defined using the @option{--keyserver} option. - at item (keyserver URL) -In addition, a keyserver URL as used in the @option{--keyserver} option may be -used here to query that particular keyserver. + at item keyserver-URL +In addition, a keyserver URL as used in the @option{--keyserver} option +may be used here to query that particular keyserver. + + at item local +Locate the key using the local keyrings. This mechanism allows to +select the order a local key lookup is done. Thus using + at samp{--auto-key-locate local} is identical to + at option{--no-auto-key-locate}. + + at item nodefault +This flag disables the standard local key lookup, done before any of the +mechanisms defined by the @option{--auto-key-locate} are tried. The +position of this mechanism in the list does not matter. It is not +required if @code{local} is also used. + @end table @item --keyid-format @code{short|0xshort|long|0xlong} @@ -1351,7 +1364,7 @@ Most keyservers synchronize with each other, so there is generally no need to send keys to more than one server. The keyserver - at code{hkp://subkeys.pgp.net} uses round robin DNS to give a different + at code{hkp://keys.gnupg.net} uses round robin DNS to give a different keyserver each time you use it. @item --keyserver-options @code{name=value1 } Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/g10/getkey.c 2008-04-08 11:04:16 UTC (rev 4740) @@ -1,6 +1,6 @@ /* getkey.c - Get a key from the database * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007 Free Software Foundation, Inc. + * 2006, 2007, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -912,64 +912,91 @@ /* Find a public key from NAME and return the keyblock or the key. If ret_kdb is not NULL, the KEYDB handle used to locate this keyblock is returned and the caller is responsible for closing it. If a key - was not found and NAME is a valid RFC822 mailbox and --auto-key-locate - has been enabled, we try to import the key via the online mechanisms - defined by --auto-key-locate. */ + was not found (or if local search has been disabled) and NAME is a + valid RFC822 mailbox and --auto-key-locate has been enabled, we try + to import the key via the online mechanisms defined by + --auto-key-locate. */ int get_pubkey_byname (PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, - KEYDB_HANDLE *ret_kdbhd, int include_unusable ) + KEYDB_HANDLE *ret_kdbhd, int include_unusable, + int no_akl) { int rc; strlist_t namelist = NULL; + struct akl *akl; + int nodefault = 0; - add_to_strlist( &namelist, name ); + /* Check whether we the default local search has been disabled. + This is the case if either the "nodefault" or the "local" keyword + are in the list of auto key locate mechanisms. */ + if (!no_akl) + { + for (akl=opt.auto_key_locate; akl; akl=akl->next) + if (akl->type == AKL_NODEFAULT || akl->type == AKL_LOCAL) + { + nodefault = 1; + break; + } + } - rc = key_byname( NULL, namelist, pk, NULL, 0, - include_unusable, ret_keyblock, ret_kdbhd); + if (nodefault) + rc = G10ERR_NO_PUBKEY; + else + { + add_to_strlist (&namelist, name); + rc = key_byname (NULL, namelist, pk, NULL, 0, + include_unusable, ret_keyblock, ret_kdbhd); + } /* If the requested name resembles a valid mailbox and automatic retrieval has been enabled, we try to import the key. */ - if (rc == G10ERR_NO_PUBKEY && is_valid_mailbox(name)) + if (rc == G10ERR_NO_PUBKEY && !no_akl && is_valid_mailbox(name)) { - struct akl *akl; - - for(akl=opt.auto_key_locate;akl;akl=akl->next) + for (akl=opt.auto_key_locate; akl; akl=akl->next) { - unsigned char *fpr=NULL; + unsigned char *fpr = NULL; size_t fpr_len; - + int did_key_byname = 0; + int no_fingerprint = 0; + const char *mechanism = "?"; + switch(akl->type) { + case AKL_NODEFAULT: + /* This is a dummy mechanism. */ + mechanism = "None"; + rc = G10ERR_NO_PUBKEY; + break; + + case AKL_LOCAL: + mechanism = "Local"; + did_key_byname = 1; + add_to_strlist (&namelist, name); + rc = key_byname (NULL, namelist, pk, NULL, 0, + include_unusable, ret_keyblock, ret_kdbhd); + break; + case AKL_CERT: + mechanism = "DNS CERT"; glo_ctrl.in_auto_key_retrieve++; rc=keyserver_import_cert(name,&fpr,&fpr_len); glo_ctrl.in_auto_key_retrieve--; - - if(rc==0) - log_info(_("automatically retrieved `%s' via %s\n"), - name,"DNS CERT"); break; case AKL_PKA: + mechanism = "PKA"; glo_ctrl.in_auto_key_retrieve++; rc=keyserver_import_pka(name,&fpr,&fpr_len); glo_ctrl.in_auto_key_retrieve--; - - if(rc==0) - log_info(_("automatically retrieved `%s' via %s\n"), - name,"PKA"); break; case AKL_LDAP: + mechanism = "LDAP"; glo_ctrl.in_auto_key_retrieve++; rc=keyserver_import_ldap(name,&fpr,&fpr_len); glo_ctrl.in_auto_key_retrieve--; - - if(rc==0) - log_info(_("automatically retrieved `%s' via %s\n"), - name,"LDAP"); break; case AKL_KEYSERVER: @@ -979,32 +1006,31 @@ and getting a whole lot of keys back. */ if(opt.keyserver) { + mechanism = opt.keyserver->uri; glo_ctrl.in_auto_key_retrieve++; rc=keyserver_import_name(name,&fpr,&fpr_len,opt.keyserver); glo_ctrl.in_auto_key_retrieve--; - - if(rc==0) - log_info(_("automatically retrieved `%s' via %s\n"), - name,opt.keyserver->uri); } + else + { + mechanism = "Unconfigured keyserver"; + rc = G10ERR_NO_PUBKEY; + } break; case AKL_SPEC: { struct keyserver_spec *keyserver; + mechanism = akl->spec->uri; keyserver=keyserver_match(akl->spec); glo_ctrl.in_auto_key_retrieve++; rc=keyserver_import_name(name,&fpr,&fpr_len,keyserver); glo_ctrl.in_auto_key_retrieve--; - - if(rc==0) - log_info(_("automatically retrieved `%s' via %s\n"), - name,akl->spec->uri); } break; } - + /* Use the fingerprint of the key that we actually fetched. This helps prevent problems where the key that we fetched doesn't have the same name that we used to fetch it. In @@ -1027,14 +1053,29 @@ log_info("auto-key-locate found fingerprint %s\n",fpr_string); add_to_strlist( &namelist, fpr_string ); - - xfree(fpr); } + else if (!rc && !fpr && !did_key_byname) + { + no_fingerprint = 1; + rc = G10ERR_NO_PUBKEY; + } + xfree (fpr); + fpr = NULL; - rc = key_byname( NULL, namelist, pk, NULL, 0, - include_unusable, ret_keyblock, ret_kdbhd); - if(rc!=G10ERR_NO_PUBKEY) - break; + if (!rc && !did_key_byname) + rc = key_byname (NULL, namelist, pk, NULL, 0, + include_unusable, ret_keyblock, ret_kdbhd); + if (!rc) + { + /* Key found. */ + log_info (_("automatically retrieved `%s' via %s\n"), + name, mechanism); + break; + } + if (rc != G10ERR_NO_PUBKEY || opt.verbose || no_fingerprint) + log_info (_("error retrieving `%s' via %s: %s\n"), + name, mechanism, + no_fingerprint? _("No fingerprint"):g10_errstr(rc)); } } @@ -2638,7 +2679,7 @@ rc = 0; while (!(rc = keydb_search (ctx->kr_handle, ctx->items, ctx->nitems))) { /* If we are searching for the first key we have to make sure - that the next interation does not no an implicit reset. + that the next iteration does not do an implicit reset. This can be triggered by an empty key ring. */ if (ctx->nitems && ctx->items->mode == KEYDB_SEARCH_MODE_FIRST) ctx->items->mode = KEYDB_SEARCH_MODE_NEXT; @@ -2949,6 +2990,7 @@ } } +/* Returns false on error. */ int parse_auto_key_locate(char *options) { @@ -2964,7 +3006,11 @@ akl=xmalloc_clear(sizeof(*akl)); - if(ascii_strcasecmp(tok,"ldap")==0) + if(ascii_strcasecmp(tok,"nodefault")==0) + akl->type=AKL_NODEFAULT; + else if(ascii_strcasecmp(tok,"local")==0) + akl->type=AKL_LOCAL; + else if(ascii_strcasecmp(tok,"ldap")==0) akl->type=AKL_LDAP; else if(ascii_strcasecmp(tok,"keyserver")==0) akl->type=AKL_KEYSERVER; Modified: trunk/g10/gpg.c =================================================================== --- trunk/g10/gpg.c 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/g10/gpg.c 2008-04-08 11:04:16 UTC (rev 4740) @@ -704,6 +704,7 @@ I'm returning the favor. */ { oLocalUser, "sign-with", 2, "@" }, { oRecipient, "user", 2, "@" }, + { oRequireCrossCert, "require-backsigs", 0, "@"}, { oRequireCrossCert, "require-cross-certification", 0, "@"}, { oNoRequireCrossCert, "no-require-backsigs", 0, "@"}, @@ -1549,6 +1550,8 @@ printf ("reader-port:%lu:\n", GC_OPT_FLAG_NONE); printf ("default-key:%lu:\n", GC_OPT_FLAG_NONE); printf ("encrypt-to:%lu:\n", GC_OPT_FLAG_NONE); + printf ("auto-key-locate:%lu:\n", GC_OPT_FLAG_NONE); + printf ("allow-pka-lookup:%lu:\n", GC_OPT_FLAG_NONE); xfree (configfile_esc); } Modified: trunk/g10/import.c =================================================================== --- trunk/g10/import.c 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/g10/import.c 2008-04-08 11:04:16 UTC (rev 4740) @@ -682,7 +682,7 @@ * Try to import one keyblock. Return an error only in serious cases, but * never for an invalid keyblock. It uses log_error to increase the * internal errorcount, so that invalid input can be detected by programs - * which called g10. + * which called gpg. */ static int import_one( const char *fname, KBNODE keyblock, struct stats_s *stats, @@ -697,6 +697,7 @@ int rc = 0; int new_key = 0; int mod_key = 0; + int same_key = 0; int non_self = 0; /* get the key and print some info about it */ @@ -715,12 +716,14 @@ nbits_from_pk( pk ), pubkey_letter( pk->pubkey_algo ), keystr_from_pk(pk), datestr_from_pk(pk) ); - if( uidnode ) - print_utf8_string( stderr, uidnode->pkt->pkt.user_id->name, + if (uidnode) + print_utf8_string (log_get_stream (), + uidnode->pkt->pkt.user_id->name, uidnode->pkt->pkt.user_id->len ); log_printf ("\n"); } + if( !uidnode ) { log_error( _("key %s: no user ID\n"), keystr_from_pk(pk)); @@ -958,7 +961,8 @@ } else { - if (is_status_enabled ()) + same_key = 1; + if (is_status_enabled ()) print_import_ok (pk, NULL, 0); if( !opt.quiet ) @@ -975,6 +979,33 @@ } leave: + if (mod_key || new_key || same_key) + { + /* A little explanation for this: we fill in the fingerprint + when importing keys as it can be useful to know the + fingerprint in certain keyserver-related cases (a keyserver + asked for a particular name, but the key doesn't have that + name). However, in cases where we're importing more than + one key at a time, we cannot know which key to fingerprint. + In these cases, rather than guessing, we do not + fingerprinting at all, and we must hope the user ID on the + keys are useful. Note that we need to do this for new + keys, merged keys and even for unchanged keys. This is + required because for example the --auto-key-locate feature + may import an already imported key and needs to know the + fingerprint of the key in all cases. */ + if (fpr) + { + xfree (*fpr); + /* Note that we need to compare against 0 here because + COUNT gets only incremented after returning form this + function. */ + if (stats->count == 0) + *fpr = fingerprint_from_pk (pk, NULL, fpr_len); + else + *fpr = NULL; + } + } /* Now that the key is definitely incorporated into the keydb, we need to check if a designated revocation is present or if the @@ -988,24 +1019,6 @@ } else if(new_key) { - /* A little explanation for this: we fill in the fingerprint - when importing keys as it can be useful to know the - fingerprint in certain keyserver-related cases (a keyserver - asked for a particular name, but the key doesn't have that - name). However, in cases where we're importing more than - one key at a time, we cannot know which key to fingerprint. - In these cases, rather than guessing, we do not fingerpring - at all, and we must hope the user ID on the keys are - useful. */ - if(fpr) - { - xfree(*fpr); - if(stats->imported==1) - *fpr=fingerprint_from_pk(pk,NULL,fpr_len); - else - *fpr=NULL; - } - revocation_present(keyblock); if(!from_sk && seckey_available(keyid)==0) check_prefs(keyblock); Modified: trunk/g10/keydb.h =================================================================== --- trunk/g10/keydb.h 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/g10/keydb.h 2008-04-08 11:04:16 UTC (rev 4740) @@ -223,7 +223,7 @@ KBNODE get_pubkeyblock( u32 *keyid ); int get_pubkey_byname( PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, KEYDB_HANDLE *ret_kdbhd, - int include_unusable ); + int include_unusable, int no_akl ); int get_pubkey_bynames( GETKEY_CTX *rx, PKT_public_key *pk, strlist_t names, KBNODE *ret_keyblock ); int get_pubkey_next( GETKEY_CTX ctx, PKT_public_key *pk, KBNODE *ret_keyblock ); Modified: trunk/g10/keyedit.c =================================================================== --- trunk/g10/keyedit.c 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/g10/keyedit.c 2008-04-08 11:04:16 UTC (rev 4740) @@ -1544,7 +1544,7 @@ #endif /* Get the public key */ - rc = get_pubkey_byname (NULL, username, &keyblock, &kdbhd, 1); + rc = get_pubkey_byname (NULL, username, &keyblock, &kdbhd, 1, 1); if( rc ) goto leave; if( fix_keyblock( keyblock ) ) @@ -3396,7 +3396,7 @@ GnuPG both can handle a designated revokation from a subkey. */ revoker_pk->req_usage=PUBKEY_USAGE_CERT; - rc=get_pubkey_byname(revoker_pk,answer,NULL,NULL,1); + rc=get_pubkey_byname(revoker_pk,answer,NULL,NULL,1, 1); if(rc) { log_error (_("key \"%s\" not found: %s\n"),answer,g10_errstr(rc)); Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2008-04-07 19:55:44 UTC (rev 4739) +++ trunk/g10/keyserver.c 2008-04-08 11:04:16 UTC (rev 4740) @@ -1,6 +1,6 @@ /* keyserver.c - generic keyserver code * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, - * 2007 Free Software Foundation, Inc. + * 2007, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. From cvs at cvs.gnupg.org Sun Apr 13 03:56:04 2008 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Sun, 13 Apr 2008 03:56:04 +0200 Subject: [svn] GnuPG - r4741 - branches/STABLE-BRANCH-1-4/g10 Message-ID: Author: dshaw Date: 2008-04-13 03:56:01 +0200 (Sun, 13 Apr 2008) New Revision: 4741 Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog branches/STABLE-BRANCH-1-4/g10/getkey.c Log: * getkey.c (merge_selfsigs_subkey): If there are multiple 0x19 backsigs, take the most recent one. Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2008-04-08 11:04:16 UTC (rev 4740) +++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2008-04-13 01:56:01 UTC (rev 4741) @@ -1,3 +1,8 @@ +2008-04-12 David Shaw + + * getkey.c (merge_selfsigs_subkey): If there are multiple 0x19 + backsigs, take the most recent one. + 2008-03-25 Werner Koch * keyserver.c (parse_keyrec): Take care of char defaulting to Modified: branches/STABLE-BRANCH-1-4/g10/getkey.c =================================================================== --- branches/STABLE-BRANCH-1-4/g10/getkey.c 2008-04-08 11:04:16 UTC (rev 4740) +++ branches/STABLE-BRANCH-1-4/g10/getkey.c 2008-04-13 01:56:01 UTC (rev 4741) @@ -2037,7 +2037,27 @@ } } +/* Convert a buffer to a signature. Useful for 0x19 embedded sigs. + Caller must free the signature when they are done. */ +static PKT_signature * +buf_to_sig(const byte *buf,size_t len) +{ + PKT_signature *sig=xmalloc_clear(sizeof(PKT_signature)); + IOBUF iobuf=iobuf_temp_with_content(buf,len); + int save_mode=set_packet_list_mode(0); + if(parse_signature(iobuf,PKT_SIGNATURE,len,sig)!=0) + { + xfree(sig); + sig=NULL; + } + + set_packet_list_mode(save_mode); + iobuf_close(iobuf); + + return sig; +} + static void merge_selfsigs_subkey( KBNODE keyblock, KBNODE subnode ) { @@ -2146,48 +2166,74 @@ subpk->is_valid = 1; - /* Find the first 0x19 embedded signature on our self-sig. */ + /* Find the most recent 0x19 embedded signature on our self-sig. */ if(subpk->backsig==0) { int seq=0; size_t n; + PKT_signature *backsig=NULL; + sigdate=0; + /* We do this while() since there may be other embedded signatures in the future. We only want 0x19 here. */ + while((p=enum_sig_subpkt(sig->hashed, SIGSUBPKT_SIGNATURE,&n,&seq,NULL))) if(n>3 && ((p[0]==3 && p[2]==0x19) || (p[0]==4 && p[1]==0x19))) - break; + { + PKT_signature *tempsig=buf_to_sig(p,n); + if(tempsig) + { + if(tempsig->timestamp>sigdate) + { + if(backsig) + free_seckey_enc(backsig); - if(p==NULL) - { - seq=0; - /* It is safe to have this in the unhashed area since the - 0x19 is located on the selfsig for convenience, not - security. */ - while((p=enum_sig_subpkt(sig->unhashed,SIGSUBPKT_SIGNATURE, - &n,&seq,NULL))) - if(n>3 && ((p[0]==3 && p[2]==0x19) || (p[0]==4 && p[1]==0x19))) - break; - } + backsig=tempsig; + sigdate=backsig->timestamp; + } + else + free_seckey_enc(tempsig); + } + } - if(p) + seq=0; + + /* It is safe to have this in the unhashed area since the 0x19 + is located on the selfsig for convenience, not security. */ + + while((p=enum_sig_subpkt(sig->unhashed,SIGSUBPKT_SIGNATURE, + &n,&seq,NULL))) + if(n>3 && ((p[0]==3 && p[2]==0x19) || (p[0]==4 && p[1]==0x19))) + { + PKT_signature *tempsig=buf_to_sig(p,n); + if(tempsig) + { + if(tempsig->timestamp>sigdate) + { + if(backsig) + free_seckey_enc(backsig); + + backsig=tempsig; + sigdate=backsig->timestamp; + } + else + free_seckey_enc(tempsig); + } + } + + if(backsig) { - PKT_signature *backsig=xmalloc_clear(sizeof(PKT_signature)); - IOBUF backsig_buf=iobuf_temp_with_content(p,n); - int save_mode=set_packet_list_mode(0); + /* At ths point, backsig contains the most recent 0x19 sig. + Let's see if it is good. */ - if(parse_signature(backsig_buf,PKT_SIGNATURE,n,backsig)==0) - { - if(check_backsig(mainpk,subpk,backsig)==0) - subpk->backsig=2; - else - subpk->backsig=1; - } + /* 2==valid, 1==invalid, 0==didn't check */ + if(check_backsig(mainpk,subpk,backsig)==0) + subpk->backsig=2; + else + subpk->backsig=1; - set_packet_list_mode(save_mode); - - iobuf_close(backsig_buf); free_seckey_enc(backsig); } } From cvs at cvs.gnupg.org Mon Apr 14 18:08:01 2008 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Mon, 14 Apr 2008 18:08:01 +0200 Subject: [svn] GnuPG - r4742 - branches/STABLE-BRANCH-1-4/keyserver Message-ID: Author: dshaw Date: 2008-04-14 18:08:00 +0200 (Mon, 14 Apr 2008) New Revision: 4742 Modified: branches/STABLE-BRANCH-1-4/keyserver/ChangeLog branches/STABLE-BRANCH-1-4/keyserver/curl-shim.c Log: * curl-shim.c (curl_easy_setopt): Minor tweak to match the real curl better - libcurl uses 'long', not 'unsigned int'. Modified: branches/STABLE-BRANCH-1-4/keyserver/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/ChangeLog 2008-04-13 01:56:01 UTC (rev 4741) +++ branches/STABLE-BRANCH-1-4/keyserver/ChangeLog 2008-04-14 16:08:00 UTC (rev 4742) @@ -1,3 +1,8 @@ +2008-04-14 David Shaw + + * curl-shim.c (curl_easy_setopt): Minor tweak to match the real + curl better - libcurl uses 'long', not 'unsigned int'. + 2008-03-25 Werner Koch * gpgkeys_ldap.c (build_attrs): Take care of char defaulting to Modified: branches/STABLE-BRANCH-1-4/keyserver/curl-shim.c =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/curl-shim.c 2008-04-13 01:56:01 UTC (rev 4741) +++ branches/STABLE-BRANCH-1-4/keyserver/curl-shim.c 2008-04-14 16:08:00 UTC (rev 4742) @@ -129,16 +129,16 @@ curl->proxy=va_arg(ap,char *); break; case CURLOPT_POST: - curl->flags.post=va_arg(ap,unsigned int); + curl->flags.post=va_arg(ap,long)?1:0; break; case CURLOPT_POSTFIELDS: curl->postfields=va_arg(ap,char *); break; case CURLOPT_FAILONERROR: - curl->flags.failonerror=va_arg(ap,unsigned int); + curl->flags.failonerror=va_arg(ap,long)?1:0; break; case CURLOPT_VERBOSE: - curl->flags.verbose=va_arg(ap,unsigned int); + curl->flags.verbose=va_arg(ap,long)?1:0; break; case CURLOPT_STDERR: curl->errors=va_arg(ap,FILE *); From cvs at cvs.gnupg.org Mon Apr 14 19:41:48 2008 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Mon, 14 Apr 2008 19:41:48 +0200 Subject: [svn] GnuPG - r4743 - branches/STABLE-BRANCH-1-4/keyserver Message-ID: Author: dshaw Date: 2008-04-14 19:41:47 +0200 (Mon, 14 Apr 2008) New Revision: 4743 Modified: branches/STABLE-BRANCH-1-4/keyserver/ChangeLog branches/STABLE-BRANCH-1-4/keyserver/curl-shim.c branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_curl.c branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_hkp.c Log: * gpgkeys_curl.c (main), gpgkeys_hkp.c (main): Make sure all libcurl number options are passed as long. Modified: branches/STABLE-BRANCH-1-4/keyserver/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/ChangeLog 2008-04-14 16:08:00 UTC (rev 4742) +++ branches/STABLE-BRANCH-1-4/keyserver/ChangeLog 2008-04-14 17:41:47 UTC (rev 4743) @@ -1,5 +1,8 @@ 2008-04-14 David Shaw + * gpgkeys_curl.c (main), gpgkeys_hkp.c (main): Make sure all + libcurl number options are passed as long. + * curl-shim.c (curl_easy_setopt): Minor tweak to match the real curl better - libcurl uses 'long', not 'unsigned int'. Modified: branches/STABLE-BRANCH-1-4/keyserver/curl-shim.c =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/curl-shim.c 2008-04-14 16:08:00 UTC (rev 4742) +++ branches/STABLE-BRANCH-1-4/keyserver/curl-shim.c 2008-04-14 17:41:47 UTC (rev 4743) @@ -1,7 +1,7 @@ /* curl-shim.c - Implement a small subset of the curl API in terms of * the iobuf HTTP API * - * Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. + * Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * Modified: branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_curl.c =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_curl.c 2008-04-14 16:08:00 UTC (rev 4742) +++ branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_curl.c 2008-04-14 17:41:47 UTC (rev 4743) @@ -1,5 +1,5 @@ /* gpgkeys_curl.c - fetch a key via libcurl - * Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + * Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -286,7 +286,7 @@ if(follow_redirects) { - curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1); + curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1L); if(follow_redirects>0) curl_easy_setopt(curl,CURLOPT_MAXREDIRS,follow_redirects); } @@ -298,10 +298,10 @@ { fprintf(console,"gpgkeys: curl version = %s\n",curl_version()); curl_easy_setopt(curl,CURLOPT_STDERR,console); - curl_easy_setopt(curl,CURLOPT_VERBOSE,1); + curl_easy_setopt(curl,CURLOPT_VERBOSE,1L); } - curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,opt->flags.check_cert); + curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,(long)opt->flags.check_cert); curl_easy_setopt(curl,CURLOPT_CAINFO,opt->ca_cert_file); if(proxy) Modified: branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_hkp.c =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_hkp.c 2008-04-14 16:08:00 UTC (rev 4742) +++ branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_hkp.c 2008-04-14 17:41:47 UTC (rev 4743) @@ -1,6 +1,6 @@ /* gpgkeys_hkp.c - talk to an HKP keyserver - * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, - * 2007 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -202,9 +202,9 @@ fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); curl_easy_setopt(curl,CURLOPT_URL,request); - curl_easy_setopt(curl,CURLOPT_POST,1); + curl_easy_setopt(curl,CURLOPT_POST,1L); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,key); - curl_easy_setopt(curl,CURLOPT_FAILONERROR,1); + curl_easy_setopt(curl,CURLOPT_FAILONERROR,1L); res=curl_easy_perform(curl); if(res!=0) @@ -661,7 +661,7 @@ { fprintf(console,"gpgkeys: curl version = %s\n",curl_version()); curl_easy_setopt(curl,CURLOPT_STDERR,console); - curl_easy_setopt(curl,CURLOPT_VERBOSE,1); + curl_easy_setopt(curl,CURLOPT_VERBOSE,1L); } if(proxy) From cvs at cvs.gnupg.org Mon Apr 14 21:41:41 2008 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Mon, 14 Apr 2008 21:41:41 +0200 Subject: [svn] GnuPG - r4744 - trunk/keyserver Message-ID: Author: dshaw Date: 2008-04-14 21:41:40 +0200 (Mon, 14 Apr 2008) New Revision: 4744 Modified: trunk/keyserver/ChangeLog trunk/keyserver/curl-shim.c trunk/keyserver/gpgkeys_curl.c trunk/keyserver/gpgkeys_hkp.c Log: * gpgkeys_curl.c (main), gpgkeys_hkp.c (main): Make sure all libcurl number options are passed as long. * curl-shim.c (curl_easy_setopt): Minor tweak to match the real curl better - libcurl uses 'long', not 'unsigned int'. Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2008-04-14 17:41:47 UTC (rev 4743) +++ trunk/keyserver/ChangeLog 2008-04-14 19:41:40 UTC (rev 4744) @@ -1,3 +1,11 @@ +2008-04-14 David Shaw + + * gpgkeys_curl.c (main), gpgkeys_hkp.c (main): Make sure all + libcurl number options are passed as long. + + * curl-shim.c (curl_easy_setopt): Minor tweak to match the real + curl better - libcurl uses 'long', not 'unsigned int'. + 2008-04-07 Werner Koch * gpgkeys_kdns.c: New. Modified: trunk/keyserver/curl-shim.c =================================================================== --- trunk/keyserver/curl-shim.c 2008-04-14 17:41:47 UTC (rev 4743) +++ trunk/keyserver/curl-shim.c 2008-04-14 19:41:40 UTC (rev 4744) @@ -1,7 +1,7 @@ /* curl-shim.c - Implement a small subset of the curl API in terms of * the iobuf HTTP API * - * Copyright (C) 2005, 2006 Free Software Foundation, Inc. + * Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -134,16 +134,16 @@ curl->proxy=va_arg(ap,char *); break; case CURLOPT_POST: - curl->flags.post=va_arg(ap,unsigned int); + curl->flags.post=va_arg(ap,long)?1:0; break; case CURLOPT_POSTFIELDS: curl->postfields=va_arg(ap,char *); break; case CURLOPT_FAILONERROR: - curl->flags.failonerror=va_arg(ap,unsigned int); + curl->flags.failonerror=va_arg(ap,long)?1:0; break; case CURLOPT_VERBOSE: - curl->flags.verbose=va_arg(ap,unsigned int); + curl->flags.verbose=va_arg(ap,long)?1:0; break; case CURLOPT_STDERR: curl->errors=va_arg(ap,FILE *); Modified: trunk/keyserver/gpgkeys_curl.c =================================================================== --- trunk/keyserver/gpgkeys_curl.c 2008-04-14 17:41:47 UTC (rev 4743) +++ trunk/keyserver/gpgkeys_curl.c 2008-04-14 19:41:40 UTC (rev 4744) @@ -1,5 +1,5 @@ /* gpgkeys_curl.c - fetch a key via libcurl - * Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + * Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -285,7 +285,7 @@ if(follow_redirects) { - curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1); + curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1L); if(follow_redirects>0) curl_easy_setopt(curl,CURLOPT_MAXREDIRS,follow_redirects); } @@ -297,10 +297,10 @@ { fprintf(console,"gpgkeys: curl version = %s\n",curl_version()); curl_easy_setopt(curl,CURLOPT_STDERR,console); - curl_easy_setopt(curl,CURLOPT_VERBOSE,1); + curl_easy_setopt(curl,CURLOPT_VERBOSE,1L); } - curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,opt->flags.check_cert); + curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,(long)opt->flags.check_cert); curl_easy_setopt(curl,CURLOPT_CAINFO,opt->ca_cert_file); if(proxy) Modified: trunk/keyserver/gpgkeys_hkp.c =================================================================== --- trunk/keyserver/gpgkeys_hkp.c 2008-04-14 17:41:47 UTC (rev 4743) +++ trunk/keyserver/gpgkeys_hkp.c 2008-04-14 19:41:40 UTC (rev 4744) @@ -1,6 +1,6 @@ /* gpgkeys_hkp.c - talk to an HKP keyserver - * Copyright (C) 2001, 2002, 2003, 2004, 2005 - * 2006 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -197,9 +197,9 @@ fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); curl_easy_setopt(curl,CURLOPT_URL,request); - curl_easy_setopt(curl,CURLOPT_POST,1); + curl_easy_setopt(curl,CURLOPT_POST,1L); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,key); - curl_easy_setopt(curl,CURLOPT_FAILONERROR,1); + curl_easy_setopt(curl,CURLOPT_FAILONERROR,1L); res=curl_easy_perform(curl); if(res!=0) @@ -656,7 +656,7 @@ { fprintf(console,"gpgkeys: curl version = %s\n",curl_version()); curl_easy_setopt(curl,CURLOPT_STDERR,console); - curl_easy_setopt(curl,CURLOPT_VERBOSE,1); + curl_easy_setopt(curl,CURLOPT_VERBOSE,1L); } if(proxy) From cvs at cvs.gnupg.org Tue Apr 15 17:32:20 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 15 Apr 2008 17:32:20 +0200 Subject: [svn] GpgOL - r246 - in trunk: po src Message-ID: Author: wk Date: 2008-04-15 17:32:15 +0200 (Tue, 15 Apr 2008) New Revision: 246 Added: trunk/src/Outlook.gpl trunk/src/cryptostate.bmp trunk/src/kleopatra.bmp trunk/src/proto-auto.bmp trunk/src/proto-pgpmime.bmp trunk/src/proto-smime.bmp Removed: trunk/src/gpgmsg.cpp trunk/src/gpgmsg.hh Modified: trunk/po/de.po trunk/po/sv.po trunk/src/ChangeLog trunk/src/Makefile.am trunk/src/dialogs.h trunk/src/dialogs.rc trunk/src/display.cpp trunk/src/display.h trunk/src/ext-commands.cpp trunk/src/ext-commands.h trunk/src/item-events.cpp trunk/src/main.c trunk/src/mapihelp.cpp trunk/src/mapihelp.h trunk/src/message-events.cpp trunk/src/message.cpp trunk/src/message.h trunk/src/mimemaker.c trunk/src/mimeparser.c trunk/src/ol-ext-callback.cpp trunk/src/ol-ext-callback.h trunk/src/olflange.cpp trunk/src/user-events.cpp Log: Created icons. Various changes to try deleting the PR_BODY. [The diff below has been truncated] Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-04-04 14:18:04 UTC (rev 245) +++ trunk/src/ChangeLog 2008-04-15 15:32:15 UTC (rev 246) @@ -1,3 +1,37 @@ +2008-04-15 Werner Koch + + * Outlook.gpl: New. + +2008-04-14 Werner Koch + + * display.cpp (is_inspector_display): New. + (find_message_window): Rewrote. + + * message-events.cpp (OnRead): Use it. + * message.cpp (message_incoming_handler): Add arg FORCE. + * message-events.cpp (OnRead): Pass false for FORCE. + * item-events.cpp (OnOpen): Ditto. + * ext-commands.cpp (DoCommand): Let CmdCryptoState process and + display the current message again. + (GpgolExtCommands): Remove m_nCmdCheckSig and m_nCmdDecrypt. + +2008-04-10 Werner Koch + + * ol-ext-callback.cpp (is_preview_pane_visible) + (show_preview_pane): New. + + * display.cpp (update_display): Add arg IS_SENSITIVE and do not + use the OOM method if this is set. + + * mapihelp.h (mapi_save_changes): New. Use if everywhere. + (mapi_delete_body_props): Use it to delete body parts. + * mapihelp.cpp (mapi_do_save_changes): New. + * mimemaker.c (finalize_message): Do no delete body parts because + mapi_save_changes does this now. + + * mimeparser.c (finish_message): Remove the body property in + protect mode. + 2008-04-04 Werner Koch * engine-assuan.c (worker_start_read, worker_check_read): Factor Modified: trunk/po/de.po [not shown] Modified: trunk/po/sv.po [not shown] Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2008-04-04 14:18:04 UTC (rev 245) +++ trunk/src/Makefile.am 2008-04-15 15:32:15 UTC (rev 246) @@ -14,8 +14,10 @@ unused_sources = item-events.cpp bin_PROGRAMS = gpgol -EXTRA_DIST = versioninfo.rc.in mapi32.def $(unused_sources) \ - logo.bmp decrypt.bmp encrypt.bmp sign.bmp key_mana.bmp +EXTRA_DIST = versioninfo.rc.in mapi32.def $(unused_sources) Outlook.gpl \ + logo.bmp decrypt.bmp encrypt.bmp sign.bmp key_mana.bmp \ + proto-auto.bmp proto-pgpmime.bmp proto-smime.bmp \ + cryptostate.bmp EXEEXT = .dll Added: trunk/src/Outlook.gpl =================================================================== --- trunk/src/Outlook.gpl 2008-04-04 14:18:04 UTC (rev 245) +++ trunk/src/Outlook.gpl 2008-04-15 15:32:15 UTC (rev 246) @@ -0,0 +1,20 @@ +GIMP Palette +Name: Outlook +Columns: 16 +# + 0 0 0 Untitled +128 0 0 Untitled + 0 128 0 Untitled +128 128 0 Untitled + 0 0 128 Untitled +128 0 128 Untitled + 0 128 128 Untitled +192 192 192 Untitled +128 128 128 Untitled +255 0 0 Untitled + 0 255 0 Untitled +255 255 0 Untitled + 0 0 255 Untitled +255 0 255 Untitled + 0 255 255 Untitled +255 255 255 Untitled Added: trunk/src/cryptostate.bmp =================================================================== (Binary files differ) Property changes on: trunk/src/cryptostate.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/dialogs.h =================================================================== --- trunk/src/dialogs.h 2008-04-04 14:18:04 UTC (rev 245) +++ trunk/src/dialogs.h 2008-04-15 15:32:15 UTC (rev 246) @@ -8,18 +8,19 @@ /* Ids used for bitmaps. */ -#define IDB_DECRYPT 3001 +#define IDB_DECRYPT 3001 /* Not used. */ #define IDB_ENCRYPT 3002 #define IDB_SIGN 3003 #define IDB_ADD_KEYS 3004 #define IDB_KEY_MANAGER 3005 -#define IDB_BANNER 3006 -#define IDB_BANNER_HI 3007 -#define IDB_SELECT_SMIME 3008 -#define IDB_KEY_MANAGER_PNG 3105 -#define IDB_CRYPTO_STATE 3005 /* We use the keymanager - icon for now*/ +#define IDB_BANNER 3006 /* The g10 Code logo. */ +#define IDB_BANNER_HI 3007 /* Not used. */ +#define IDB_CRYPTO_STATE 3008 +#define IDB_PROTO_AUTO 3009 +#define IDB_PROTO_PGPMIME 3010 +#define IDB_PROTO_SMIME 3011 + /* Ids used for the main config dialog. */ #define IDD_GPG_OPTIONS 4001 #define IDC_TIME_PHRASES 4010 Modified: trunk/src/dialogs.rc =================================================================== --- trunk/src/dialogs.rc 2008-04-04 14:18:04 UTC (rev 245) +++ trunk/src/dialogs.rc 2008-04-15 15:32:15 UTC (rev 246) @@ -22,12 +22,19 @@ #include "afxres.h" +/* To create these bitmaps, you need to use an Outlook specific + palette. A palette file for The Gimp is included as + Outlook.gpl. */ -IDB_DECRYPT BITMAP DISCARDABLE "decrypt.bmp" +/*IDB_DECRYPT BITMAP DISCARDABLE "decrypt.bmp"*/ IDB_ENCRYPT BITMAP DISCARDABLE "encrypt.bmp" IDB_SIGN BITMAP DISCARDABLE "sign.bmp" IDB_KEY_MANAGER BITMAP DISCARDABLE "key_mana.bmp" IDB_BANNER BITMAP DISCARDABLE "logo.bmp" +IDB_CRYPTO_STATE BITMAP DISCARDABLE "cryptostate.bmp" +IDB_PROTO_AUTO BITMAP DISCARDABLE "proto-auto.bmp" +IDB_PROTO_PGPMIME BITMAP DISCARDABLE "proto-pgpmime.bmp" +IDB_PROTO_SMIME BITMAP DISCARDABLE "proto-smime.bmp" IDD_GPG_OPTIONS DIALOG DISCARDABLE 0, 0, 266, 274 Modified: trunk/src/display.cpp =================================================================== --- trunk/src/display.cpp 2008-04-04 14:18:04 UTC (rev 245) +++ trunk/src/display.cpp 2008-04-15 15:32:15 UTC (rev 246) @@ -81,11 +81,20 @@ } +/* A helper object for find_message_window. */ +struct find_message_window_state +{ + int level; + int seen_32770:1; + int seen_afxwndw:1; +}; + + + /* We need this to find the mailer window because we directly change - the text of the window instead of the MAPI object itself. To do - this we walk all windows to find a PGP signature. */ + the text of the window instead of the MAPI object itself. */ static HWND -find_message_window (HWND parent, int level) +find_message_window (HWND parent, struct find_message_window_state *findstate) { HWND child; @@ -98,7 +107,6 @@ char buf[1024+1]; HWND w; size_t len; - const char *s; /* OL 2003 SP1 German uses this class name for the main inspector window. We hope that no other windows uses this @@ -107,8 +115,11 @@ decrypted messages. */ len = GetClassName (child, buf, sizeof buf - 1); // if (len) -// log_debug (" %*sgot class `%s'", level*2, "", buf); - if (level && len >= 10 && !strncmp (buf, "MsoCommand", 10)) +// log_debug (" %*sgot class `%s'", 2 * findstate->level, "", buf); + if (!len) + ; + else if (findstate->level && len >= 10 + && !strncmp (buf, "MsoCommand", 10)) { /* We won't find anything below MsoCommand windows. Ignoring them fixes a bug where we return a RichEdit20W @@ -149,46 +160,70 @@ */ break; /* Not found at this level. */ } - - if (len && !strcmp (buf, "RichEdit20W")) + else if (findstate->level == 2 && !strcmp (buf, "#32770")) { - log_debug ("found class `%s'", "RichEdit20W"); + /* An inspector window has the #32770 class window at level + 2 whereas the preview window has it at level 4. (OL2003 + SP2, German). */ + findstate->seen_32770 = 1; + findstate->seen_afxwndw = 0; + } + else if (findstate->seen_afxwndw && !strcmp (buf, "AfxWndW")) + { + findstate->seen_afxwndw = 1; + } + else if (findstate->seen_32770 && findstate->seen_afxwndw + && !strcmp (buf, "RichEdit20W")) + { + log_debug ("found window class `%s' at level %d", + "RichEdit20W", findstate->level); return child; } - memset (buf, 0, sizeof (buf)); - GetWindowText (child, buf, sizeof (buf)-1); - len = strlen (buf); - if (len > 22 - && (s = strstr (buf, "-----BEGIN PGP ")) - && (!strncmp (s+15, "MESSAGE-----", 12) - || !strncmp (s+15, "SIGNED MESSAGE-----", 19))) - return child; - w = find_message_window (child, level+1); + findstate->level++; + w = find_message_window (child, findstate); + findstate->level--; + findstate->seen_32770 = 0; /* Only interested in windows below. */ + findstate->seen_afxwndw = 0; if (w) return w; - child = GetNextWindow (child, GW_HWNDNEXT); + child = GetNextWindow (child, GW_HWNDNEXT); } return NULL; } +/* Returns true if the the current display (as described by HWND) is a + real inspector and not the preview window. This is not 100% + reliable. */ +int +is_inspector_display (HWND hwnd) +{ + struct find_message_window_state findstate; + + memset (&findstate, 0, sizeof findstate); + return !!find_message_window (hwnd, &findstate); +} + + /* Update the display with TEXT using the message MSG. Return 0 on success. */ int -update_display (HWND hwnd, void *exchange_cb, +update_display (HWND hwnd, void *exchange_cb, int is_sensitive, bool is_html, const char *text) { HWND window; + struct find_message_window_state findstate; - /*show_window_hierarchy (hwnd, 0);*/ - window = find_message_window (hwnd, 0); + memset (&findstate, 0, sizeof findstate); + window = find_message_window (hwnd, &findstate); if (window && !is_html) { const char *s; - log_debug ("%s:%s: window handle %p\n", SRCNAME, __func__, window); + log_debug ("%s:%s: updating display using handle %p\n", + SRCNAME, __func__, window); /* Decide whether we need to use the Unicode version. */ for (s=text; *s && !(*s & 0x80); s++) @@ -201,10 +236,18 @@ } else SetWindowTextA (window, text); - log_debug ("%s:%s: window text is now `%s'", - SRCNAME, __func__, text); return 0; } +// else if (exchange_cb && is_sensitive && !opt.compat.no_oom_write) +// { +// log_debug ("%s:%s: updating display using OOM (note)\n", +// SRCNAME, __func__); +// if (is_html) +// put_outlook_property (exchange_cb, "Body", "" ); +// return put_outlook_property +// (exchange_cb, "Body", +// _("[Encrypted body not shown - please open the message]")); +// } else if (exchange_cb && !opt.compat.no_oom_write) { log_debug ("%s:%s: updating display using OOM\n", SRCNAME, __func__); @@ -213,7 +256,7 @@ if (is_html) put_outlook_property (exchange_cb, "Body", "" ); return put_outlook_property (exchange_cb, is_html? "HTMLBody":"Body", - text); + text); } else { @@ -224,58 +267,61 @@ } + /* Set the body of MESSAGE to STRING. Returns 0 on success or an error code otherwise. */ -int -set_message_body (LPMESSAGE message, const char *string, bool is_html) -{ - HRESULT hr; - SPropValue prop; - //SPropTagArray proparray; - const char *s; +#if 0 /* Not anymore used. */ + int + set_message_body (LPMESSAGE message, const char *string, bool is_html) + { + HRESULT hr; + SPropValue prop; + //SPropTagArray proparray; + const char *s; + + assert (message); - assert (message); - -// if (!is_html) -// { -// prop.ulPropTag = PR_BODY_HTML_A; -// prop.Value.lpszA = ""; -// hr = HrSetOneProp (message, &prop); -// } + // if (!is_html) + // { + // prop.ulPropTag = PR_BODY_HTML_A; + // prop.Value.lpszA = ""; + // hr = HrSetOneProp (message, &prop); + // } + + /* Decide whether we need to use the Unicode version. */ + for (s=string; *s && !(*s & 0x80); s++) + ; + if (*s) + { + prop.ulPropTag = is_html? PR_BODY_HTML_W : PR_BODY_W; + prop.Value.lpszW = utf8_to_wchar (string); + hr = HrSetOneProp (message, &prop); + xfree (prop.Value.lpszW); + } + else /* Only plain ASCII. */ + { + prop.ulPropTag = is_html? PR_BODY_HTML_A : PR_BODY_A; + prop.Value.lpszA = (CHAR*)string; + hr = HrSetOneProp (message, &prop); + } + if (hr != S_OK) + { + log_debug ("%s:%s: HrSetOneProp failed: hr=%#lx\n", + SRCNAME, __func__, hr); + return gpg_error (GPG_ERR_GENERAL); + } - /* Decide whether we need to use the Unicode version. */ - for (s=string; *s && !(*s & 0x80); s++) - ; - if (*s) - { - prop.ulPropTag = is_html? PR_BODY_HTML_W : PR_BODY_W; - prop.Value.lpszW = utf8_to_wchar (string); - hr = HrSetOneProp (message, &prop); - xfree (prop.Value.lpszW); - } - else /* Only plain ASCII. */ - { - prop.ulPropTag = is_html? PR_BODY_HTML_A : PR_BODY_A; - prop.Value.lpszA = (CHAR*)string; - hr = HrSetOneProp (message, &prop); - } - if (hr != S_OK) - { - log_debug ("%s:%s: HrSetOneProp failed: hr=%#lx\n", - SRCNAME, __func__, hr); - return gpg_error (GPG_ERR_GENERAL); - } + /* Note: we once tried to delete the RTF property here to avoid any + syncing mess and more important to make sure that no RTF rendered + plaintext is left over. The side effect of this was that the + entire PR_BODY got deleted too. */ + + return 0; + } +#endif /* Not anymore used. */ - /* Note: we once tried to delete the RTF property here to avoid any - syncing mess and more important to make sure that no RTF rendered - plaintext is left over. The side effect of this was that the - entire PR_BODY got deleted too. */ - return 0; -} - - int open_inspector (LPEXCHEXTCALLBACK peecb, LPMESSAGE message) { Modified: trunk/src/display.h =================================================================== --- trunk/src/display.h 2008-04-04 14:18:04 UTC (rev 245) +++ trunk/src/display.h 2008-04-15 15:32:15 UTC (rev 246) @@ -24,7 +24,8 @@ char *add_html_line_endings (const char *body); -int update_display (HWND hwnd, void *exchange_cb, +int is_inspector_display (HWND hwnd); +int update_display (HWND hwnd, void *exchange_cb, int is_sensitive, bool is_html, const char *text); int set_message_body (LPMESSAGE message, const char *string, bool is_html); Modified: trunk/src/ext-commands.cpp =================================================================== --- trunk/src/ext-commands.cpp 2008-04-04 14:18:04 UTC (rev 245) +++ trunk/src/ext-commands.cpp 2008-04-15 15:32:15 UTC (rev 246) @@ -102,9 +102,7 @@ m_nCmdProtoPgpmime = 0; m_nCmdProtoSmime = 0; m_nCmdEncrypt = 0; - m_nCmdDecrypt = 0; m_nCmdSign = 0; - m_nCmdCheckSig = 0; m_nCmdKeyManager = 0; m_nCmdCryptoState = 0; m_nCmdDebug0 = 0; @@ -212,7 +210,30 @@ MF_BYCOMMAND | (checked?MF_CHECKED:MF_UNCHECKED)); } +void +GpgolExtCommands::update_protocol_menu (LPEXCHEXTCALLBACK eecb) +{ + switch (m_pExchExt->m_protoSelection) + { + case PROTOCOL_OPENPGP: + check_menu (eecb, m_nCmdProtoAuto, FALSE); + check_menu (eecb, m_nCmdProtoPgpmime, TRUE); + check_menu (eecb, m_nCmdProtoSmime, FALSE); + break; + case PROTOCOL_SMIME: + check_menu (eecb, m_nCmdProtoAuto, FALSE); + check_menu (eecb, m_nCmdProtoPgpmime, FALSE); + check_menu (eecb, m_nCmdProtoSmime, TRUE); + break; + default: + check_menu (eecb, m_nCmdProtoAuto, TRUE); + check_menu (eecb, m_nCmdProtoPgpmime, FALSE); + check_menu (eecb, m_nCmdProtoSmime, FALSE); + break; + } +} + void GpgolExtCommands::add_toolbar (LPTBENTRY tbearr, UINT n_tbearr, ...) { @@ -379,7 +400,6 @@ && (body = msgcache_get (key, keylen, &refhandle)) && (pDisp = find_outlook_property (eecb, "Body", &dispid))) { -#if 1 dispparams.cNamedArgs = 1; dispparams.rgdispidNamedArgs = &dispid_put; dispparams.cArgs = 1; @@ -392,10 +412,7 @@ xfree (dispparams.rgvarg[0].bstrVal); log_debug ("%s:%s: PROPERTYPUT(body) result -> %#lx\n", SRCNAME, __func__, hr); -#else - log_window_hierarchy (hWnd, "%s:%s:%d: Windows hierarchy:", - SRCNAME, __func__, __LINE__); -#endif + pDisp->Release(); pDisp = NULL; @@ -416,7 +433,7 @@ /* Now install menu and toolbar items. */ if (m_lContext == EECONTEXT_READNOTEMESSAGE) { - int need_dvm = 0; + int is_encrypted = 0; LPMDB mdb = NULL; LPMESSAGE message = NULL; @@ -430,7 +447,7 @@ case MSGTYPE_GPGOL_MULTIPART_ENCRYPTED: case MSGTYPE_GPGOL_OPAQUE_ENCRYPTED: case MSGTYPE_GPGOL_PGP_MESSAGE: - need_dvm = 1; + is_encrypted = 1; break; default: break; @@ -443,17 +460,15 @@ an already decrypted message. */ add_menu (eecb, pnCommandIDBase, "@", NULL, - need_dvm? _("&Decrypt and verify message"):"", &m_nCmdDecrypt, - _("&Verify signature"), &m_nCmdCheckSig, + _("GpgOL Decrypt/Verify"), &m_nCmdCryptoState, opt.enable_debug? "GpgOL Debug-0 (display crypto info)":"", &m_nCmdDebug0, opt.enable_debug? "GpgOL Debug-1 (open_inspector)":"", &m_nCmdDebug1, opt.enable_debug? "GpgOL Debug-2 (change msg class)":"", &m_nCmdDebug2, NULL); From cvs at cvs.gnupg.org Tue Apr 15 17:57:40 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 15 Apr 2008 17:57:40 +0200 Subject: [svn] GnuPG - r4745 - trunk/tests/pkits Message-ID: Author: wk Date: 2008-04-15 17:57:39 +0200 (Tue, 15 Apr 2008) New Revision: 4745 Modified: trunk/tests/pkits/basic-certificate-revocation trunk/tests/pkits/certificate-policies trunk/tests/pkits/delta-crls trunk/tests/pkits/distribution-points trunk/tests/pkits/inhibit-any-policy trunk/tests/pkits/inhibit-policy-mapping trunk/tests/pkits/key-usage trunk/tests/pkits/name-constraints trunk/tests/pkits/policy-mappings trunk/tests/pkits/private-certificate-extensions trunk/tests/pkits/require-explicit-policy trunk/tests/pkits/signature-verification trunk/tests/pkits/validity-periods trunk/tests/pkits/verifying-basic-constraints trunk/tests/pkits/verifying-name-chaining trunk/tests/pkits/verifying-paths-self-issued Log: Add executable flag to test scripts. Property changes on: trunk/tests/pkits/basic-certificate-revocation ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/certificate-policies ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/delta-crls ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/distribution-points ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/inhibit-any-policy ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/inhibit-policy-mapping ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/key-usage ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/name-constraints ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/policy-mappings ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/private-certificate-extensions ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/require-explicit-policy ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/signature-verification ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/validity-periods ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/verifying-basic-constraints ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/verifying-name-chaining ___________________________________________________________________ Name: svn:executable + * Property changes on: trunk/tests/pkits/verifying-paths-self-issued ___________________________________________________________________ Name: svn:executable + * From cvs at cvs.gnupg.org Wed Apr 16 10:23:25 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 16 Apr 2008 10:23:25 +0200 Subject: [svn] GnuPG - r4746 - trunk/g10 Message-ID: Author: wk Date: 2008-04-16 10:23:23 +0200 (Wed, 16 Apr 2008) New Revision: 4746 Modified: trunk/g10/ChangeLog trunk/g10/getkey.c trunk/g10/gpg.c Log: If there are multiple 0x19 backsigs, take the most recent one. (from 1.4). add log-file and debug-level to the --gpgconf-list. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2008-04-15 15:57:39 UTC (rev 4745) +++ trunk/g10/ChangeLog 2008-04-16 08:23:23 UTC (rev 4746) @@ -1,3 +1,8 @@ +2008-04-15 David Shaw + + * getkey.c (merge_selfsigs_subkey): If there are multiple 0x19 + backsigs, take the most recent one. + 2008-04-08 Werner Koch * options.h (opt): Add AKL_NODEFAULT and AKL_LOCAL. Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2008-04-15 15:57:39 UTC (rev 4745) +++ trunk/g10/getkey.c 2008-04-16 08:23:23 UTC (rev 4746) @@ -2081,7 +2081,27 @@ } } +/* Convert a buffer to a signature. Useful for 0x19 embedded sigs. + Caller must free the signature when they are done. */ +static PKT_signature * +buf_to_sig(const byte *buf,size_t len) +{ + PKT_signature *sig=xmalloc_clear(sizeof(PKT_signature)); + IOBUF iobuf=iobuf_temp_with_content(buf,len); + int save_mode=set_packet_list_mode(0); + if(parse_signature(iobuf,PKT_SIGNATURE,len,sig)!=0) + { + xfree(sig); + sig=NULL; + } + + set_packet_list_mode(save_mode); + iobuf_close(iobuf); + + return sig; +} + static void merge_selfsigs_subkey( KBNODE keyblock, KBNODE subnode ) { @@ -2187,48 +2207,74 @@ subpk->is_valid = 1; - /* Find the first 0x19 embedded signature on our self-sig. */ + /* Find the most recent 0x19 embedded signature on our self-sig. */ if(subpk->backsig==0) { int seq=0; size_t n; + PKT_signature *backsig=NULL; + sigdate=0; + /* We do this while() since there may be other embedded signatures in the future. We only want 0x19 here. */ + while((p=enum_sig_subpkt(sig->hashed, SIGSUBPKT_SIGNATURE,&n,&seq,NULL))) if(n>3 && ((p[0]==3 && p[2]==0x19) || (p[0]==4 && p[1]==0x19))) - break; + { + PKT_signature *tempsig=buf_to_sig(p,n); + if(tempsig) + { + if(tempsig->timestamp>sigdate) + { + if(backsig) + free_seckey_enc(backsig); - if(p==NULL) - { - seq=0; - /* It is safe to have this in the unhashed area since the - 0x19 is located on the selfsig for convenience, not - security. */ - while((p=enum_sig_subpkt(sig->unhashed,SIGSUBPKT_SIGNATURE, - &n,&seq,NULL))) - if(n>3 && ((p[0]==3 && p[2]==0x19) || (p[0]==4 && p[1]==0x19))) - break; - } + backsig=tempsig; + sigdate=backsig->timestamp; + } + else + free_seckey_enc(tempsig); + } + } - if(p) + seq=0; + + /* It is safe to have this in the unhashed area since the 0x19 + is located on the selfsig for convenience, not security. */ + + while((p=enum_sig_subpkt(sig->unhashed,SIGSUBPKT_SIGNATURE, + &n,&seq,NULL))) + if(n>3 && ((p[0]==3 && p[2]==0x19) || (p[0]==4 && p[1]==0x19))) + { + PKT_signature *tempsig=buf_to_sig(p,n); + if(tempsig) + { + if(tempsig->timestamp>sigdate) + { + if(backsig) + free_seckey_enc(backsig); + + backsig=tempsig; + sigdate=backsig->timestamp; + } + else + free_seckey_enc(tempsig); + } + } + + if(backsig) { - PKT_signature *backsig=xmalloc_clear(sizeof(PKT_signature)); - IOBUF backsig_buf=iobuf_temp_with_content(p,n); - int save_mode=set_packet_list_mode(0); + /* At ths point, backsig contains the most recent 0x19 sig. + Let's see if it is good. */ - if(parse_signature(backsig_buf,PKT_SIGNATURE,n,backsig)==0) - { - if(check_backsig(mainpk,subpk,backsig)==0) - subpk->backsig=2; - else - subpk->backsig=1; - } + /* 2==valid, 1==invalid, 0==didn't check */ + if(check_backsig(mainpk,subpk,backsig)==0) + subpk->backsig=2; + else + subpk->backsig=1; - set_packet_list_mode(save_mode); - - iobuf_close(backsig_buf); free_seckey_enc(backsig); } } Modified: trunk/g10/gpg.c =================================================================== --- trunk/g10/gpg.c 2008-04-15 15:57:39 UTC (rev 4745) +++ trunk/g10/gpg.c 2008-04-16 08:23:23 UTC (rev 4746) @@ -1552,7 +1552,10 @@ printf ("encrypt-to:%lu:\n", GC_OPT_FLAG_NONE); printf ("auto-key-locate:%lu:\n", GC_OPT_FLAG_NONE); printf ("allow-pka-lookup:%lu:\n", GC_OPT_FLAG_NONE); + printf ("log-file:%lu:\n", GC_OPT_FLAG_NONE); + printf ("debug-level:%lu:\"none:\n", GC_OPT_FLAG_DEFAULT); + xfree (configfile_esc); } From cvs at cvs.gnupg.org Wed Apr 16 18:11:42 2008 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Wed, 16 Apr 2008 18:11:42 +0200 Subject: [svn] GnuPG - r4747 - trunk/g10 Message-ID: Author: dshaw Date: 2008-04-16 18:11:41 +0200 (Wed, 16 Apr 2008) New Revision: 4747 Modified: trunk/g10/getkey.c Log: Test commit Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2008-04-16 08:23:23 UTC (rev 4746) +++ trunk/g10/getkey.c 2008-04-16 16:11:41 UTC (rev 4747) @@ -1,6 +1,6 @@ /* getkey.c - Get a key from the database - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007, 2008 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + * 2007, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * From cvs at cvs.gnupg.org Wed Apr 16 20:20:40 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 16 Apr 2008 20:20:40 +0200 Subject: [svn] GpgOL - r247 - in trunk: . po src Message-ID: Author: wk Date: 2008-04-16 20:20:37 +0200 (Wed, 16 Apr 2008) New Revision: 247 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac trunk/po/de.po trunk/po/sv.po trunk/src/ChangeLog trunk/src/ext-commands.cpp trunk/src/message-events.cpp trunk/src/message-events.h trunk/src/message.cpp trunk/src/message.h Log: Preparing a release Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/ChangeLog 2008-04-16 18:20:37 UTC (rev 247) @@ -1,3 +1,7 @@ +2008-04-16 Werner Koch + + * Release 0.10.12. + 2008-04-04 Werner Koch * Release 0.10.11. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/src/ChangeLog 2008-04-16 18:20:37 UTC (rev 247) @@ -1,3 +1,11 @@ +2008-04-16 Werner Koch + + * message-events.h (class GpgolMessageEvents): Add M_GOTINSPECTOR. + * message.cpp (message_incoming_handler): Change return type. + + * ext-commands.cpp (check_toolbar, check_menu_toolbar): New. + (update_protocol_menu): Explicitly update the toolbar. + 2008-04-15 Werner Koch * Outlook.gpl: New. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/NEWS 2008-04-16 18:20:37 UTC (rev 247) @@ -1,7 +1,15 @@ +Noteworthy changes for version 0.10.12 (2008-04-16) +=================================================== + + * Added icons. + + * Minor usuability changes. + + Noteworthy changes for version 0.10.11 (2008-04-04) =================================================== - * Fixed a performavce problem with signed+encrypted. + * Fixed a performance problem with signed+encrypted. Noteworthy changes for version 0.10.10 (2008-04-02) Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/configure.ac 2008-04-16 18:20:37 UTC (rev 247) @@ -16,7 +16,7 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [0.10.11]) +m4_define([my_version], [0.10.12]) m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ Modified: trunk/po/de.po [not shown] Modified: trunk/po/sv.po [not shown] Modified: trunk/src/ext-commands.cpp =================================================================== --- trunk/src/ext-commands.cpp 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/src/ext-commands.cpp 2008-04-16 18:20:37 UTC (rev 247) @@ -21,6 +21,7 @@ #include #endif +#define _WIN32_IE 0x400 /* Need TBIF_COMMAND et al. */ #include #include "mymapi.h" @@ -55,6 +56,7 @@ UINT cmd_id; /* The ID of the command to send on a click. */ const char *desc;/* The description text. */ ULONG context; /* Context under which this entry will be used. */ + int did_qbi; /* Has been processed by QueryButtonInfo. */ }; @@ -210,25 +212,85 @@ MF_BYCOMMAND | (checked?MF_CHECKED:MF_UNCHECKED)); } + +static void +check_toolbar (LPEXCHEXTCALLBACK eecb, struct toolbar_info_s *toolbar_info, + UINT cmd_id, int checked) +{ + HWND hwnd; + toolbar_info_t tb_info; + TBBUTTONINFOA tbb; + + eecb->GetToolbar (EETBID_STANDARD, &hwnd); + if (debug_commands) + log_debug ("check_toolbar: eecb=%p cmd_id=%u checked=%d -> hwnd=%p\n", + eecb, cmd_id, checked, hwnd); + + for (tb_info = toolbar_info; tb_info; tb_info = tb_info->next ) + if (tb_info->cmd_id == cmd_id) + break; + if (!tb_info) + { + log_error ("check_toolbar: no such toolbar button"); + return; + } + if (!tb_info->did_qbi) + { + if(debug_commands) + log_debug ("check_toolbar: button(cmd_id=%d) not yet initialized", + cmd_id); + return; + } + + tbb.cbSize = sizeof (tbb); + tbb.dwMask = TBIF_COMMAND | TBIF_STATE | TBIF_STYLE; + if (!SendMessage (hwnd, TB_GETBUTTONINFO, cmd_id, (LPARAM)&tbb)) + log_error_w32 (-1, "TB_GETBUTTONINFO failed"); + else + { + tbb.cbSize = sizeof (tbb); + tbb.dwMask = TBIF_STATE; + if (checked) + tbb.fsState |= TBSTATE_CHECKED; + else + tbb.fsState &= ~TBSTATE_CHECKED; + if (!SendMessage (hwnd, TB_SETBUTTONINFO, cmd_id, (LPARAM)&tbb)) + log_error_w32 (-1, "TB_SETBUTTONINFO failed"); + } +} + + +static void +check_menu_toolbar (LPEXCHEXTCALLBACK eecb, + struct toolbar_info_s *toolbar_info, + UINT cmd_id, int checked) +{ + check_menu (eecb, cmd_id, checked); + check_toolbar (eecb, toolbar_info, cmd_id, checked); +} + + void GpgolExtCommands::update_protocol_menu (LPEXCHEXTCALLBACK eecb) { + if (debug_commands) + log_debug ("update_protocol_menu called\n"); switch (m_pExchExt->m_protoSelection) { case PROTOCOL_OPENPGP: - check_menu (eecb, m_nCmdProtoAuto, FALSE); - check_menu (eecb, m_nCmdProtoPgpmime, TRUE); - check_menu (eecb, m_nCmdProtoSmime, FALSE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoAuto, FALSE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoPgpmime, TRUE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoSmime, FALSE); break; case PROTOCOL_SMIME: - check_menu (eecb, m_nCmdProtoAuto, FALSE); - check_menu (eecb, m_nCmdProtoPgpmime, FALSE); - check_menu (eecb, m_nCmdProtoSmime, TRUE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoAuto, FALSE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoPgpmime, FALSE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoSmime, TRUE); break; default: - check_menu (eecb, m_nCmdProtoAuto, TRUE); - check_menu (eecb, m_nCmdProtoPgpmime, FALSE); - check_menu (eecb, m_nCmdProtoSmime, FALSE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoAuto, TRUE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoPgpmime, FALSE); + check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoSmime, FALSE); break; } } @@ -267,6 +329,11 @@ if (!*desc) ; /* Empty description - ignore this item. */ + else if (*desc == '|' && !desc[1]) + { + /* Separator. Ignore BMAPID and CMDID. */ + /* Not yet implemented. */ + } else { TBADDBITMAP tbab; @@ -290,10 +357,10 @@ log_debug ("%s:%s: ctx=%lx button_id=%d cmd_id=%d '%s'\n", SRCNAME, __func__, m_lContext, tb_info->button_id, tb_info->cmd_id, tb_info->desc); - } } va_end (arg_ptr); + } @@ -690,9 +757,6 @@ { log_debug ("%s:%s: command Debug0 (showInfo) called\n", SRCNAME, __func__); -// log_window_hierarchy (GetDesktopWindow(), -// "%s:%s:%d: Window hierarchy:", -// SRCNAME, __func__, __LINE__); hr = eecb->GetObject (&mdb, (LPMAPIPROP *)&message); if (SUCCEEDED (hr)) { @@ -888,7 +952,7 @@ /* Called by Exchange to get toolbar button infos. TOOLBARID is the toolbar identifier. BUTTONID is the toolbar button index. PTBB is - a pointer to toolbar button structure. DESCRIPTION is a pointer to + a pointer to the toolbar button structure. DESCRIPTION is a pointer to buffer receiving the text for the button. DESCRIPTION_SIZE is the maximum size of DESCRIPTION. FLAGS are flags which might have the EXCHEXT_UNICODE bit set. @@ -915,6 +979,9 @@ " cmd_id=%d '%s'\n", SRCNAME, __func__, m_lContext, toolbarid, buttonid, tb_info->button_id, tb_info->cmd_id, tb_info->desc); + + /* Mark that this button has passed this function. */ + tb_info->did_qbi = 1; pTBB->iBitmap = tb_info->bitmap; pTBB->idCommand = tb_info->cmd_id; Modified: trunk/src/message-events.cpp =================================================================== --- trunk/src/message-events.cpp 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/src/message-events.cpp 2008-04-16 18:20:37 UTC (rev 247) @@ -73,6 +73,7 @@ m_want_html = false; m_processed = false; m_wasencrypted = false; + m_gotinspector = false; } @@ -107,17 +108,15 @@ HWND hwnd = NULL; LPMDB mdb = NULL; LPMESSAGE message = NULL; - int got_inspector = 0; m_wasencrypted = false; if (FAILED (eecb->GetWindow (&hwnd))) hwnd = NULL; - if (is_inspector_display (hwnd)) - got_inspector = 1; + m_gotinspector = !!is_inspector_display (hwnd); log_debug ("%s:%s: received (hwnd=%p) %s\n", - SRCNAME, __func__, hwnd, got_inspector? "got_inspector":""); + SRCNAME, __func__, hwnd, m_gotinspector? "got_inspector":""); /* Fixme: If preview decryption is not enabled and we have an encrypted message, we might want to show a greyed out preview @@ -128,11 +127,22 @@ shows a grey window with a notice that the message can't be shown due to active content. */ - if (got_inspector || opt.preview_decrypt) + if (m_gotinspector || opt.preview_decrypt) { eecb->GetObject (&mdb, (LPMAPIPROP *)&message); - if (message_incoming_handler (message, hwnd, false)) - m_processed = true; + switch (message_incoming_handler (message, hwnd, false)) + { + case 1: + m_processed = true; + break; + case 2: + m_processed = true; + m_wasencrypted = true; + break; + default: + ; + } + ul_release (message, __func__, __LINE__); ul_release (mdb, __func__, __LINE__); } @@ -159,8 +169,7 @@ if (FAILED (eecb->GetWindow (&hwnd))) hwnd = NULL; log_debug ("%s:%s: (hwnd=%p)\n", SRCNAME, __func__, hwnd); - if (message_display_handler (eecb, hwnd)) - m_wasencrypted = true; + message_display_handler (eecb, hwnd); } Modified: trunk/src/message-events.h =================================================================== --- trunk/src/message-events.h 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/src/message-events.h 2008-04-16 18:20:37 UTC (rev 247) @@ -42,6 +42,7 @@ bool m_want_html; /* Encryption of HTML is desired. */ bool m_processed; /* The message has been porcessed by us. */ bool m_wasencrypted; /* The original message was encrypted. */ + bool m_gotinspector; /* We are working on a real inspector. */ public: STDMETHODIMP QueryInterface (REFIID riid, LPVOID *ppvObj); Modified: trunk/src/message.cpp =================================================================== --- trunk/src/message.cpp 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/src/message.cpp 2008-04-16 18:20:37 UTC (rev 247) @@ -54,12 +54,15 @@ /* A helper function used by OnRead and OnOpen to dispatch the message. If FORCE is true, the force flag is passed to the - verification or decryption. Returns true if the message has been - processed. */ -bool + verification or decryption. Returns: + 0 = Message has not been processed by us. + 1 = Message has been processed and was not encrypted. + 2 = Message has been processed by us and was possibly encrypted. +*/ +int message_incoming_handler (LPMESSAGE message, HWND hwnd, bool force) { - bool retval = false; + int retval = 0; msgtype_t msgtype; int pass = 0; @@ -101,36 +104,36 @@ case MSGTYPE_GPGOL_MULTIPART_SIGNED: log_debug ("%s:%s: processing multipart signed message\n", SRCNAME, __func__); - retval = true; + retval = 1; message_verify (message, msgtype, force, hwnd); break; case MSGTYPE_GPGOL_MULTIPART_ENCRYPTED: log_debug ("%s:%s: processing multipart encrypted message\n", SRCNAME, __func__); - retval = true; + retval = 2; message_decrypt (message, msgtype, force, hwnd); break; case MSGTYPE_GPGOL_OPAQUE_SIGNED: log_debug ("%s:%s: processing opaque signed message\n", SRCNAME, __func__); - retval = true; + retval = 1; message_verify (message, msgtype, force, hwnd); break; case MSGTYPE_GPGOL_CLEAR_SIGNED: log_debug ("%s:%s: processing clear signed pgp message\n", SRCNAME, __func__); - retval = true; + retval = 1; message_verify (message, msgtype, force, hwnd); break; case MSGTYPE_GPGOL_OPAQUE_ENCRYPTED: log_debug ("%s:%s: processing opaque encrypted message\n", SRCNAME, __func__); - retval = true; + retval = 2; message_decrypt (message, msgtype, force, hwnd); break; case MSGTYPE_GPGOL_PGP_MESSAGE: log_debug ("%s:%s: processing pgp message\n", SRCNAME, __func__); - retval = true; + retval = 2; message_decrypt (message, msgtype, force, hwnd); break; } Modified: trunk/src/message.h =================================================================== --- trunk/src/message.h 2008-04-15 15:32:15 UTC (rev 246) +++ trunk/src/message.h 2008-04-16 18:20:37 UTC (rev 247) @@ -21,7 +21,7 @@ #define MESSAGE_H -bool message_incoming_handler (LPMESSAGE message, HWND hwnd, bool force); +int message_incoming_handler (LPMESSAGE message, HWND hwnd, bool force); bool message_display_handler (LPEXCHEXTCALLBACK eecb, HWND hwnd); void message_wipe_body_cruft (LPEXCHEXTCALLBACK eecb); void message_show_info (LPMESSAGE message, HWND hwnd); From cvs at cvs.gnupg.org Wed Apr 16 20:24:37 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 16 Apr 2008 20:24:37 +0200 Subject: [svn] GpgOL - r248 - tags Message-ID: Author: wk Date: 2008-04-16 20:24:36 +0200 (Wed, 16 Apr 2008) New Revision: 248 Added: tags/gpgol-0.10.12/ Log: From cvs at cvs.gnupg.org Thu Apr 17 19:40:32 2008 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu, 17 Apr 2008 19:40:32 +0200 Subject: [svn] GnuPG - r4748 - in branches/STABLE-BRANCH-1-4: cipher g10 include Message-ID: Author: dshaw Date: 2008-04-17 19:40:30 +0200 (Thu, 17 Apr 2008) New Revision: 4748 Modified: branches/STABLE-BRANCH-1-4/cipher/ChangeLog branches/STABLE-BRANCH-1-4/cipher/camellia-glue.c branches/STABLE-BRANCH-1-4/cipher/cipher.c branches/STABLE-BRANCH-1-4/g10/ChangeLog branches/STABLE-BRANCH-1-4/g10/parse-packet.c branches/STABLE-BRANCH-1-4/include/ChangeLog branches/STABLE-BRANCH-1-4/include/cipher.h Log: Add Camellia-192. Modified: branches/STABLE-BRANCH-1-4/cipher/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/cipher/ChangeLog 2008-04-16 16:11:41 UTC (rev 4747) +++ branches/STABLE-BRANCH-1-4/cipher/ChangeLog 2008-04-17 17:40:30 UTC (rev 4748) @@ -1,3 +1,8 @@ +2008-04-17 David Shaw + + * camellia-glue.c (selftest, camellia_get_info), cipher.c + (setup_cipher_table): Add Camellia-192. + 2008-03-22 Werner Koch * cipher.c (struct cipher_handle_s): Make sure IV is u32 Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2008-04-16 16:11:41 UTC (rev 4747) +++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2008-04-17 17:40:30 UTC (rev 4748) @@ -1,3 +1,7 @@ +2008-04-17 David Shaw + + * parse-packet.c (parse_key): Add constant for Camellia-192. + 2008-04-12 David Shaw * getkey.c (merge_selfsigs_subkey): If there are multiple 0x19 Modified: branches/STABLE-BRANCH-1-4/include/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/include/ChangeLog 2008-04-16 16:11:41 UTC (rev 4747) +++ branches/STABLE-BRANCH-1-4/include/ChangeLog 2008-04-17 17:40:30 UTC (rev 4748) @@ -1,3 +1,7 @@ +2008-04-17 David Shaw + + * cipher.h: Add the 192-bit variant of Camellia. + 2007-11-29 David Shaw * cipher.h: Add the 128-bit variant of Camellia. Modified: branches/STABLE-BRANCH-1-4/cipher/camellia-glue.c =================================================================== --- branches/STABLE-BRANCH-1-4/cipher/camellia-glue.c 2008-04-16 16:11:41 UTC (rev 4747) +++ branches/STABLE-BRANCH-1-4/cipher/camellia-glue.c 2008-04-17 17:40:30 UTC (rev 4748) @@ -1,5 +1,5 @@ /* camellia-glue.c - Glue for the Camellia cipher - * Copyright (C) 2007 Free Software Foundation, Inc. + * Copyright (C) 2007, 2008 Free Software Foundation, Inc. * * This file is part of GNUPG. * @@ -58,7 +58,7 @@ static int initialized=0; static const char *selftest_failed=NULL; - if(keylen!=16 && keylen!=32) + if(keylen!=16 && keylen!=24 && keylen!=32) return G10ERR_WRONG_KEYLEN; if(!initialized) @@ -133,6 +133,16 @@ 0x67,0x67,0x31,0x38,0x54,0x96,0x69,0x73, 0x08,0x57,0x06,0x56,0x48,0xea,0xbe,0x43 }; + const byte key_192[]= + { + 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98, + 0x76,0x54,0x32,0x10,0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77 + }; + const byte ciphertext_192[]= + { + 0xb4,0x99,0x34,0x01,0xb3,0xe9,0x96,0xf8, + 0x4e,0xe5,0xce,0xe7,0xd7,0x9b,0x09,0xb9 + }; const byte key_256[]= { 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba, @@ -154,6 +164,14 @@ if(memcmp(scratch,plaintext,sizeof(scratch))!=0) return "CAMELLIA128 test decryption failed."; + camellia_setkey(&ctx,key_192,sizeof(key_192)); + camellia_encrypt(&ctx,scratch,plaintext); + if(memcmp(scratch,ciphertext_192,sizeof(scratch))!=0) + return "CAMELLIA192 test encryption failed."; + camellia_decrypt(&ctx,scratch,scratch); + if(memcmp(scratch,plaintext,sizeof(scratch))!=0) + return "CAMELLIA192 test decryption failed."; + camellia_setkey(&ctx,key_256,sizeof(key_256)); camellia_encrypt(&ctx,scratch,plaintext); if(memcmp(scratch,ciphertext_256,sizeof(scratch))!=0) @@ -185,6 +203,11 @@ *keylen = 128; return "CAMELLIA128"; } + else if(algo==CIPHER_ALGO_CAMELLIA192) + { + *keylen = 192; + return "CAMELLIA192"; + } else if(algo==CIPHER_ALGO_CAMELLIA256) { *keylen = 256; Modified: branches/STABLE-BRANCH-1-4/cipher/cipher.c =================================================================== --- branches/STABLE-BRANCH-1-4/cipher/cipher.c 2008-04-16 16:11:41 UTC (rev 4747) +++ branches/STABLE-BRANCH-1-4/cipher/cipher.c 2008-04-17 17:40:30 UTC (rev 4748) @@ -1,6 +1,6 @@ /* cipher.c - cipher dispatcher - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 - * 2007, 2008 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -198,6 +198,17 @@ if( !cipher_table[i].name ) BUG(); i++; + cipher_table[i].algo = CIPHER_ALGO_CAMELLIA192; + cipher_table[i].name = camellia_get_info( cipher_table[i].algo, + &cipher_table[i].keylen, + &cipher_table[i].blocksize, + &cipher_table[i].contextsize, + &cipher_table[i].setkey, + &cipher_table[i].encrypt, + &cipher_table[i].decrypt ); + if( !cipher_table[i].name ) + BUG(); + i++; cipher_table[i].algo = CIPHER_ALGO_CAMELLIA256; cipher_table[i].name = camellia_get_info( cipher_table[i].algo, &cipher_table[i].keylen, Modified: branches/STABLE-BRANCH-1-4/g10/parse-packet.c =================================================================== --- branches/STABLE-BRANCH-1-4/g10/parse-packet.c 2008-04-16 16:11:41 UTC (rev 4747) +++ branches/STABLE-BRANCH-1-4/g10/parse-packet.c 2008-04-17 17:40:30 UTC (rev 4748) @@ -1,6 +1,6 @@ /* parse-packet.c - read packets - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - * 2007 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -1856,7 +1856,7 @@ switch( sk->protect.algo ) { case 7: case 8: case 9: /* AES */ case 10: /* Twofish */ - case 11: case 12: /* Camellia */ + case 11: case 12: case 13: /* Camellia */ sk->protect.ivlen = 16; break; default: Modified: branches/STABLE-BRANCH-1-4/include/cipher.h =================================================================== --- branches/STABLE-BRANCH-1-4/include/cipher.h 2008-04-16 16:11:41 UTC (rev 4747) +++ branches/STABLE-BRANCH-1-4/include/cipher.h 2008-04-17 17:40:30 UTC (rev 4748) @@ -1,6 +1,6 @@ /* cipher.h - * Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, - * 2007 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, + * 2008 Free Software Foundation, Inc. * * This file is part of GNUPG. * @@ -37,7 +37,8 @@ #define CIPHER_ALGO_AES256 9 #define CIPHER_ALGO_TWOFISH 10 /* twofish 256 bit */ #define CIPHER_ALGO_CAMELLIA128 11 -#define CIPHER_ALGO_CAMELLIA256 12 +#define CIPHER_ALGO_CAMELLIA192 12 +#define CIPHER_ALGO_CAMELLIA256 13 #define CIPHER_ALGO_DUMMY 110 /* no encryption at all */ From cvs at cvs.gnupg.org Fri Apr 18 11:20:31 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 18 Apr 2008 11:20:31 +0200 Subject: [svn] GnuPG - r4749 - in trunk: common g10 include jnlib po scd sm Message-ID: Author: wk Date: 2008-04-18 11:20:25 +0200 (Fri, 18 Apr 2008) New Revision: 4749 Modified: trunk/common/ChangeLog trunk/common/i18n.c trunk/g10/ChangeLog trunk/g10/main.h trunk/g10/misc.c trunk/g10/parse-packet.c trunk/include/ChangeLog trunk/include/cipher.h trunk/jnlib/ChangeLog trunk/jnlib/w32-gettext.c trunk/jnlib/w32help.h trunk/po/de.po trunk/scd/ccid-driver.c trunk/sm/ChangeLog trunk/sm/verify.c Log: Adjust for the changed Camellia draft. W32 gettext changes. Comment and typo fixes. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/common/ChangeLog 2008-04-18 09:20:25 UTC (rev 4749) @@ -1,3 +1,8 @@ +2008-04-08 Werner Koch + + * i18n.c (i18n_switchto_utf8, i18n_switchback) + [USE_SIMPLE_GETTEXT]: Implement. + 2008-04-07 Werner Koch * b64enc.c (b64enc_start): Detect PGP mode. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/g10/ChangeLog 2008-04-18 09:20:25 UTC (rev 4749) @@ -1,3 +1,10 @@ +2008-04-18 Werner Koch + + * misc.c (map_cipher_openpgp_to_gcry, map_cipher_gcry_to_openpgp) + (openpgp_cipher_test_algo): Add camellia-192. + (openpgp_cipher_blocklen): New. + * parse-packet.c (parse_key): Use new function here. + 2008-04-15 David Shaw * getkey.c (merge_selfsigs_subkey): If there are multiple 0x19 Modified: trunk/include/ChangeLog =================================================================== --- trunk/include/ChangeLog 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/include/ChangeLog 2008-04-18 09:20:25 UTC (rev 4749) @@ -1,3 +1,8 @@ +2008-04-18 Werner Koch + + * cipher.h (CIPHER_ALGO_CAMELLIA256): Change ID to 13. + (CIPHER_ALGO_CAMELLIA192): New. + 2007-12-12 Werner Koch * cipher.h (CIPHER_ALGO_CAMELLIA128, CIPHER_ALGO_CAMELLIA256): New. Modified: trunk/jnlib/ChangeLog =================================================================== --- trunk/jnlib/ChangeLog 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/jnlib/ChangeLog 2008-04-18 09:20:25 UTC (rev 4749) @@ -1,3 +1,9 @@ +2008-04-08 Werner Koch + + * w32-gettext.c (gettext_select_utf8): New. + (get_string): Support switching encodings. + (load_domain): Allocate space for DATA_NATIVE. + 2008-03-25 Werner Koch * w32-gettext.c (_nl_locale_name): New. Taken from @@ -555,7 +561,7 @@ *********************************************************** Copyright 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without Modified: trunk/sm/ChangeLog =================================================================== --- trunk/sm/ChangeLog 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/sm/ChangeLog 2008-04-18 09:20:25 UTC (rev 4749) @@ -1,3 +1,7 @@ +2008-04-09 Werner Koch + + * verify.c (gpgsm_verify): Print the message hash values on error. + 2008-03-31 Werner Koch * call-dirmngr.c (start_dirmngr): Use log_info instead of Modified: trunk/common/i18n.c =================================================================== --- trunk/common/i18n.c 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/common/i18n.c 2008-04-18 09:20:25 UTC (rev 4749) @@ -45,17 +45,19 @@ /* The Assuan agent protocol requires us to transmit utf-8 strings - thus we need a fuctnion to temporary switch gettext from native to + thus we need a way to temporary switch gettext from native to utf8. */ char * i18n_switchto_utf8 (void) { -#ifdef ENABLE_NLS +#ifdef USE_SIMPLE_GETTEXT + gettext_select_utf8 (1); +#elif define(ENABLE_NLS) char *orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL); -#ifdef HAVE_LANGINFO_CODESET +# ifdef HAVE_LANGINFO_CODESET if (!orig_codeset) orig_codeset = nl_langinfo (CODESET); -#endif +# endif if (orig_codeset) { /* We only switch when we are able to restore the codeset later. Note that bind_textdomain_codeset does only return on memory @@ -78,7 +80,9 @@ void i18n_switchback (char *saved_codeset) { -#ifdef ENABLE_NLS +#ifdef USE_SIMPLE_GETTEXT + gettext_select_utf8 (0); +#elif defined(ENABLE_NLS) if (saved_codeset) { bind_textdomain_codeset (PACKAGE_GT, saved_codeset); Modified: trunk/g10/main.h =================================================================== --- trunk/g10/main.h 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/g10/main.h 2008-04-18 09:20:25 UTC (rev 4749) @@ -82,6 +82,7 @@ u16 checksum_mpi( gcry_mpi_t a ); u32 buffer_to_u32( const byte *buffer ); const byte *get_session_marker( size_t *rlen ); +int openpgp_cipher_blocklen (int algo); int openpgp_cipher_test_algo( int algo ); const char *openpgp_cipher_algo_name (int algo); int openpgp_pk_test_algo( int algo ); Modified: trunk/g10/misc.c =================================================================== --- trunk/g10/misc.c 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/g10/misc.c 2008-04-18 09:20:25 UTC (rev 4749) @@ -1,6 +1,6 @@ /* misc.c - miscellaneous functions - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, - * 2005, 2006, 2007 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, + * 2005, 2006, 2007, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -338,6 +338,7 @@ switch (algo) { case CIPHER_ALGO_CAMELLIA128: return 310; + case CIPHER_ALGO_CAMELLIA192: return 311; case CIPHER_ALGO_CAMELLIA256: return 312; default: return algo; } @@ -350,11 +351,36 @@ switch (algo) { case 310: return CIPHER_ALGO_CAMELLIA128; + case 311: return CIPHER_ALGO_CAMELLIA192; case 312: return CIPHER_ALGO_CAMELLIA256; default: return algo; } } + +/* Return the block length of an OpenPGP cipher algorithm. */ +int +openpgp_cipher_blocklen (int algo) +{ + /* We use the numbers from OpenPGP to be sure that we get the right + block length. This is so that the packet parsing code works even + for unknown algorithms (for which we assume 8 due to tradition). + + NOTE: If you change the the returned blocklen above 16, check + the callers because they may use a fixed size buffer of that + size. */ + switch (algo) + { + case 7: case 8: case 9: /* AES */ + case 10: /* Twofish */ + case 11: case 12: case 13: /* Camellia */ + return 16; + + default: + return 8; + } +} + /**************** * Wrapper around the libgcrypt function with additonal checks on * the OpenPGP contraints for the algo ID. @@ -370,7 +396,8 @@ requested. */ #ifndef USE_CAMELLIA if (algo == CIPHER_ALGO_CAMELLIA128 - || algo == CIPHER_ALGO_CAMELLIA256) + || algo == CIPHER_ALGO_CAMELLIA192 + || algo == CIPHER_ALGO_CAMELLIA256) return gpg_error (GPG_ERR_CIPHER_ALGO); #endif @@ -386,8 +413,6 @@ return gcry_cipher_algo_name (map_cipher_openpgp_to_gcry (algo)); } - - int openpgp_pk_test_algo( int algo ) { Modified: trunk/g10/parse-packet.c =================================================================== --- trunk/g10/parse-packet.c 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/g10/parse-packet.c 2008-04-18 09:20:25 UTC (rev 4749) @@ -1901,19 +1901,13 @@ * of the IV here in cases we are not aware of the algorithm. * so a * sk->protect.ivlen = cipher_get_blocksize(sk->protect.algo); - * won't work. The only solution I see is to hardwire it here. + * won't work. The only solution I see is to hardwire it. * NOTE: if you change the ivlen above 16, don't forget to * enlarge temp. */ - switch( sk->protect.algo ) { - case 7: case 8: case 9: /* AES */ - case 10: /* Twofish */ - case 11: case 12: /* Camellia */ - sk->protect.ivlen = 16; - break; - default: - sk->protect.ivlen = 8; - } + sk->protect.ivlen = openpgp_cipher_blocklen (sk->protect.algo); + assert (sk->protect.ivlen <= sizeof (temp)); + if( sk->protect.s2k.mode == 1001 ) sk->protect.ivlen = 0; else if( sk->protect.s2k.mode == 1002 ) Modified: trunk/include/cipher.h =================================================================== --- trunk/include/cipher.h 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/include/cipher.h 2008-04-18 09:20:25 UTC (rev 4749) @@ -47,7 +47,8 @@ #define CIPHER_ALGO_TWOFISH /* 10 */ GCRY_CIPHER_TWOFISH /* 256 bit */ /* Note: Camellia ids don't match those used by libgcrypt. */ #define CIPHER_ALGO_CAMELLIA128 11 -#define CIPHER_ALGO_CAMELLIA256 12 +#define CIPHER_ALGO_CAMELLIA192 12 +#define CIPHER_ALGO_CAMELLIA256 13 #define CIPHER_ALGO_DUMMY 110 /* No encryption at all. */ #define PUBKEY_ALGO_RSA /* 1 */ GCRY_PK_RSA Modified: trunk/jnlib/w32-gettext.c =================================================================== --- trunk/jnlib/w32-gettext.c 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/jnlib/w32-gettext.c 2008-04-18 09:20:25 UTC (rev 4749) @@ -1,6 +1,6 @@ /* w32-gettext.c - A simplified version of gettext for use under W32. * Copyright (C) 1995, 1996, 1997, 1999, 2000, 2003, - * 2005, 2007, 2088 Free Software Foundation, Inc. + * 2005, 2007, 2008 Free Software Foundation, Inc. * * This file is part of JNLIB. * @@ -96,11 +96,13 @@ struct loaded_domain { char *data; + char *data_native; /* Data mapped to the native version of the + string. (Allocated along with DATA). */ int must_swap; u32 nstrings; - char *mapped; /* 0 = not yet mapped, 1 = mapped, - 2 = mapped to - overflow space */ + char *mapped; /* 0 = not mapped (original utf8), + 1 = mapped to native encoding, + 2 = mapped to native encoding in overflow space. */ struct overflow_space_s *overflow_space; struct string_desc *orig_tab; struct string_desc *trans_tab; @@ -111,7 +113,9 @@ static struct loaded_domain *the_domain; static char *the_langid; +static int want_utf8; /* True if the user want's utf-8 strings. */ + static __inline__ u32 do_swap_u32( u32 i ) { @@ -1236,7 +1240,7 @@ return NULL; } - data = jnlib_malloc (size); + data = (2*size <= size)? NULL : jnlib_malloc (2*size); if (!data) { fclose (fp); @@ -1278,38 +1282,39 @@ return NULL; } domain->data = (char *) data; + domain->data_native = (char *) data + size; domain->must_swap = data->magic != MAGIC; /* Fill in the information about the available tables. */ - switch (SWAPIT(domain->must_swap, data->revision)) - { - case 0: - domain->nstrings = SWAPIT(domain->must_swap, data->nstrings); - domain->orig_tab = (struct string_desc *) + switch (SWAPIT(domain->must_swap, data->revision)) + { + case 0: + domain->nstrings = SWAPIT(domain->must_swap, data->nstrings); + domain->orig_tab = (struct string_desc *) ((char *) data + SWAPIT(domain->must_swap, data->orig_tab_offset)); - domain->trans_tab = (struct string_desc *) - ((char *) data + SWAPIT(domain->must_swap, data->trans_tab_offset)); - domain->hash_size = SWAPIT(domain->must_swap, data->hash_tab_size); - domain->hash_tab = (u32 *) - ((char *) data + SWAPIT(domain->must_swap, data->hash_tab_offset)); - break; + domain->trans_tab = (struct string_desc *) + ((char *) data + SWAPIT(domain->must_swap, data->trans_tab_offset)); + domain->hash_size = SWAPIT(domain->must_swap, data->hash_tab_size); + domain->hash_tab = (u32 *) + ((char *) data + SWAPIT(domain->must_swap, data->hash_tab_offset)); + break; - default: /* This is an invalid revision. */ - jnlib_free( data ); - jnlib_free( domain ); - return NULL; + default: /* This is an invalid revision. */ + jnlib_free( data ); + jnlib_free( domain ); + return NULL; } - - /* Allocate an array to keep track of code page mappings. */ - domain->mapped = jnlib_calloc (1, domain->nstrings); - if (!domain->mapped) - { - jnlib_free (data); - jnlib_free (domain); - return NULL; - } - - return domain; + + /* Allocate an array to keep track of code page mappings. */ + domain->mapped = jnlib_calloc (1, domain->nstrings); + if (!domain->mapped) + { + jnlib_free (data); + jnlib_free (domain); + return NULL; + } + + return domain; } @@ -1510,30 +1515,45 @@ static const char* -get_string( struct loaded_domain *domain, u32 idx ) +get_string (struct loaded_domain *domain, u32 idx) { struct overflow_space_s *os; char *p; - p = domain->data + SWAPIT(domain->must_swap, domain->trans_tab[idx].offset); - if (!domain->mapped[idx]) + if (want_utf8) { + p = (domain->data + + SWAPIT(domain->must_swap, domain->trans_tab[idx].offset)); + } + else if (!domain->mapped[idx]) + { + /* Not yet mapped - map utf-8 to native encoding. */ + const char *p_orig; size_t plen, buflen; char *buf; - domain->mapped[idx] = 1; + p_orig = (domain->data + + SWAPIT(domain->must_swap, domain->trans_tab[idx].offset)); + p = (domain->data_native + + SWAPIT(domain->must_swap, domain->trans_tab[idx].offset)); - plen = strlen (p); - buf = utf8_to_native (p, plen, -1); + plen = strlen (p_orig); + buf = utf8_to_native (p_orig, plen, -1); buflen = strlen (buf); if (buflen <= plen) - strcpy (p, buf); + { + /* Copy into the DATA_NATIVE area. */ + strcpy (p, buf); + domain->mapped[idx] = 1; + } else { /* There is not enough space for the translation - store it - in the overflow_space else and mark that in the mapped - array. Because we expect that this won't happen too - often, we use a simple linked list. */ + in the overflow_space and mark that in the mapped array. + Because UTF-8 strings are in general longer than the + Windows 2 byte encodings, we expect that this won't + happen too often (if at all) and thus we use a linked + list to manage this space. */ os = jnlib_malloc (sizeof *os + buflen); if (os) { @@ -1545,9 +1565,16 @@ } else p = "ERROR in GETTEXT MALLOC"; + domain->mapped[idx] = 2; } jnlib_free (buf); } + else if (domain->mapped[idx] == 1) + { + p = (domain->data_native + + SWAPIT(domain->must_swap, domain->trans_tab[idx].offset)); + + } else if (domain->mapped[idx] == 2) { /* We need to get the string from the overflow_space. */ for (os=domain->overflow_space; os; os = os->next) @@ -1555,6 +1582,9 @@ return (const char*)os->d; p = "ERROR in GETTEXT\n"; } + else + p = "ERROR in GETEXT mapping"; + return (const char*)p; } @@ -1660,4 +1690,11 @@ } +void +gettext_select_utf8 (int value) +{ + want_utf8 = value; +} + + #endif /* USE_SIMPLE_GETTEXT */ Modified: trunk/jnlib/w32help.h =================================================================== --- trunk/jnlib/w32help.h 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/jnlib/w32help.h 2008-04-18 09:20:25 UTC (rev 4749) @@ -33,6 +33,7 @@ const char *ngettext (const char *msgid1, const char *msgid2, unsigned long int n); const char *gettext_localename (void); +void gettext_select_utf8 (int value); #endif /*USE_SIMPLE_GETTEXT*/ Modified: trunk/po/de.po [not shown] Modified: trunk/scd/ccid-driver.c =================================================================== --- trunk/scd/ccid-driver.c 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/scd/ccid-driver.c 2008-04-18 09:20:25 UTC (rev 4749) @@ -282,7 +282,7 @@ /* Pint an error message for a failed CCID command including a textual - error code. MSG is shall be the CCID message of at least 10 bytes. */ + error code. MSG shall be the CCID message at a minimum of 10 bytes. */ static void print_command_failed (const unsigned char *msg) { Modified: trunk/sm/verify.c =================================================================== --- trunk/sm/verify.c 2008-04-17 17:40:30 UTC (rev 4748) +++ trunk/sm/verify.c 2008-04-18 09:20:25 UTC (rev 4749) @@ -467,8 +467,16 @@ { char *fpr; - log_error ("invalid signature: message digest attribute " - "does not match calculated one\n"); + log_error (_("invalid signature: message digest attribute " + "does not match computed one\n")); + if (DBG_X509) + { + if (msgdigest) + log_printhex ("message: ", msgdigest, msgdigestlen); + if (s) + log_printhex ("computed: ", + s, gcry_md_get_algo_dlen (algo)); + } fpr = gpgsm_fpr_and_name_for_status (cert); gpgsm_status (ctrl, STATUS_BADSIG, fpr); xfree (fpr); From cvs at cvs.gnupg.org Fri Apr 18 13:44:12 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 18 Apr 2008 13:44:12 +0200 Subject: [svn] gcry - r1284 - in trunk: . cipher src tests Message-ID: Author: wk Date: 2008-04-18 13:44:07 +0200 (Fri, 18 Apr 2008) New Revision: 1284 Modified: trunk/ChangeLog trunk/NEWS trunk/cipher/ChangeLog trunk/cipher/ac.c trunk/cipher/camellia-glue.c trunk/cipher/camellia.h trunk/cipher/cipher.c trunk/cipher/rndw32.c trunk/cipher/sha1.c trunk/configure.ac trunk/src/ChangeLog trunk/src/missing-string.c trunk/tests/basic.c trunk/tests/pubkey.c Log: Collected changes. See ChnageLogs. [The diff below has been truncated] Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/ChangeLog 2008-04-18 11:44:07 UTC (rev 1284) @@ -1,3 +1,20 @@ +2008-04-18 Werner Koch + + * configure.ac (AH_BOTTOM): Add CAMELLIA_EXT_SYM_PREFIX. + +2008-04-01 Werner Koch + + * configure.ac (AC_INIT): Fix quoting. + +2008-03-19 Werner Koch + + * configure.ac: Fix the tests for USE_ to either define or + undef the macros. Suggested by Dirk Stoecker. + +2008-03-18 Werner Koch + + * configure.ac: Test for uintptr_t. + 2008-02-18 Werner Koch * configure.ac (IS_DEVELOPMENT_VERSION): Set depending on the my_svn. @@ -1248,7 +1265,7 @@ Copyright 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2006 Free Software Foundation, Inc. + 2004, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without Modified: trunk/cipher/ChangeLog =================================================================== --- trunk/cipher/ChangeLog 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/cipher/ChangeLog 2008-04-18 11:44:07 UTC (rev 1284) @@ -1,3 +1,27 @@ +2008-04-18 Werner Koch + + * ac.c (ac_data_extract): Make static. + + * camellia.h [HAVE_CONFIG_H]: Include config.h. + + * rndw32.c (registry_poll): Only print the performance data + problem warning once. Suggested by Simon Josefsson. + +2008-03-19 Werner Koch + + * cipher.c (gcry_cipher_open) [USE_AES]: Init bulk encryption only + if requested. Suggested by Dirk Stoecker. + +2008-03-18 Werner Koch + + * sha1.c: Include stdint.h. + (transform): Add arg NBLOCKS so that we can work on more than one + block and avoid updates of the chaining variables. Changed all + callers to use 1. + (sha1_write): Replace loop around transform. + (transform_aligned) [WORDS_BIGENDIAN]: New. + (TRANSFORM): New macro to replace all direct calls of transform. + 2008-03-17 Werner Koch * rijndael.c (_gcry_aes_cfb_dec): New. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/src/ChangeLog 2008-04-18 11:44:07 UTC (rev 1284) @@ -1,3 +1,8 @@ +2008-04-18 Werner Koch + + * missing-string.c (vasprintf): Remove. It is not used. Reported + by Simon Josefsson. + 2008-03-11 Werner Koch * gcrypt.h.in (gcry_ac_em_t, gcry_ac_scheme_t): Remove trailing Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/NEWS 2008-04-18 11:44:07 UTC (rev 1284) @@ -4,7 +4,7 @@ * Fixed a bug introduced by 1.3.1 which led to the comsumption of far too much entropy for the intial seeding. - * Improved AES performance for CFB and CBS modes. + * Improved AES performance for CFB and CBC modes. Noteworthy changes in version 1.4.0 (2007-12-10) Modified: trunk/cipher/ac.c =================================================================== --- trunk/cipher/ac.c 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/cipher/ac.c 2008-04-18 11:44:07 UTC (rev 1284) @@ -1117,7 +1117,7 @@ (IDENTIFIER [...] (ALGORITHM )) */ -gcry_error_t +static gcry_error_t ac_data_extract (const char *identifier, const char *algorithm, gcry_sexp_t sexp, gcry_ac_data_t *data) { Modified: trunk/cipher/camellia-glue.c =================================================================== --- trunk/cipher/camellia-glue.c 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/cipher/camellia-glue.c 2008-04-18 11:44:07 UTC (rev 1284) @@ -27,18 +27,33 @@ There is one small change which needs to be done: Include the following code at the top of camellia.h: */ #if 0 -/* Need to redefine the external symbols to keep the libgcrypt name - space clean. */ -#define Camellia_Ekeygen _gcry_Camellia_Ekeygen -#define Camellia_EncryptBlock _gcry_Camellia_EncryptBlock -#define Camellia_DecryptBlock _gcry_Camellia_DecryptBlock -#define camellia_decrypt128 _gcry_camellia_decrypt128 -#define camellia_decrypt256 _gcry_camellia_decrypt256 -#define camellia_encrypt128 _gcry_camellia_encrypt128 -#define camellia_encrypt256 _gcry_camellia_encrypt256 -#define camellia_setup128 _gcry_camellia_setup128 -#define camellia_setup192 _gcry_camellia_setup192 -#define camellia_setup256 _gcry_camellia_setup256 + +/* To use Camellia with libraries it is often useful to keep the name + * space of the library clean. The following macro is thus useful: + * + * #define CAMELLIA_EXT_SYM_PREFIX foo_ + * + * This prefixes all external symbols with "foo_". + */ +#ifdef HAVE_CONFIG_H +#include +#endif +#ifdef CAMELLIA_EXT_SYM_PREFIX +#define CAMELLIA_PREFIX1(x,y) x ## y +#define CAMELLIA_PREFIX2(x,y) CAMELLIA_PREFIX1(x,y) +#define CAMELLIA_PREFIX(x) CAMELLIA_PREFIX2(CAMELLIA_EXT_SYM_PREFIX,x) +#define Camellia_Ekeygen CAMELLIA_PREFIX(Camellia_Ekeygen) +#define Camellia_EncryptBlock CAMELLIA_PREFIX(Camellia_EncryptBlock) +#define Camellia_DecryptBlock CAMELLIA_PREFIX(Camellia_DecryptBlock) +#define camellia_decrypt128 CAMELLIA_PREFIX(camellia_decrypt128) +#define camellia_decrypt256 CAMELLIA_PREFIX(camellia_decrypt256) +#define camellia_encrypt128 CAMELLIA_PREFIX(camellia_encrypt128) +#define camellia_encrypt256 CAMELLIA_PREFIX(camellia_encrypt256) +#define camellia_setup128 CAMELLIA_PREFIX(camellia_setup128) +#define camellia_setup192 CAMELLIA_PREFIX(camellia_setup192) +#define camellia_setup256 CAMELLIA_PREFIX(camellia_setup256) +#endif /*CAMELLIA_EXT_SYM_PREFIX*/ + #endif /* Code sample. */ Modified: trunk/cipher/camellia.h =================================================================== --- trunk/cipher/camellia.h 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/cipher/camellia.h 2008-04-18 11:44:07 UTC (rev 1284) @@ -28,6 +28,9 @@ * * This prefixes all external symbols with "foo_". */ +#ifdef HAVE_CONFIG_H +#include +#endif #ifdef CAMELLIA_EXT_SYM_PREFIX #define CAMELLIA_PREFIX1(x,y) x ## y #define CAMELLIA_PREFIX2(x,y) CAMELLIA_PREFIX1(x,y) @@ -44,6 +47,7 @@ #define camellia_setup256 CAMELLIA_PREFIX(camellia_setup256) #endif /*CAMELLIA_EXT_SYM_PREFIX*/ + #ifdef __cplusplus extern "C" { #endif Modified: trunk/cipher/cipher.c =================================================================== --- trunk/cipher/cipher.c 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/cipher/cipher.c 2008-04-18 11:44:07 UTC (rev 1284) @@ -750,6 +750,7 @@ /* Setup bulk encryption routines. */ switch (algo) { +#ifdef USE_AES case GCRY_CIPHER_AES128: case GCRY_CIPHER_AES192: case GCRY_CIPHER_AES256: @@ -758,6 +759,7 @@ h->bulk.cbc_enc = _gcry_aes_cbc_enc; h->bulk.cbc_dec = _gcry_aes_cbc_dec; break; +#endif /*USE_AES*/ default: break; Modified: trunk/cipher/rndw32.c =================================================================== --- trunk/cipher/rndw32.c 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/cipher/rndw32.c 2008-04-18 11:44:07 UTC (rev 1284) @@ -440,8 +440,17 @@ } else { - log_debug ("rndw32: get performance data problem: ec=%ld\n", - status); + static int been_here; + + /* Silence the error message. In particular under Wine (as + of 2008) we would get swamped with such diagnotiscs. One + such diagnotiscs should be enough. */ + if (been_here != status) + { + been_here = status; + log_debug ("rndw32: get performance data problem: ec=%ld\n", + status); + } break; } } Modified: trunk/cipher/sha1.c =================================================================== --- trunk/cipher/sha1.c 2008-03-17 18:08:15 UTC (rev 1283) +++ trunk/cipher/sha1.c 2008-04-18 11:44:07 UTC (rev 1284) @@ -1,5 +1,5 @@ /* sha1.c - SHA1 hash function - * Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc. + * Copyright (C) 1998, 2001, 2002, 2003, 2008 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -14,8 +14,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * License along with this program; if not, see . */ @@ -33,20 +32,47 @@ #include #include #include +#ifdef HAVE_STDINT_H +# include +#endif #include "g10lib.h" #include "memory.h" #include "bithelp.h" #include "cipher.h" -typedef struct { - u32 h0,h1,h2,h3,h4; - u32 nblocks; - byte buf[64]; - int count; + +/* A macro to test whether P is properly aligned for an u32 type. + Note that config.h provides a suitable replacement for uintptr_t if + it does not exist in stdint.h. */ +#if __GNUC__ >= 2 +# define U32_ALIGNED_P(p) (!(((uintptr_t)p) % __alignof__ (u32))) +#else +# define U32_ALIGNED_P(p) (!(((uintptr_t)p) % sizeof (u32))) +#endif + +#if WORDS_BIGENDIAN +#define TRANSFORM(x,d,n) do { if (U32_ALIGNED_P ((x))) \ + transform_aligned ((x), (d), (n)); \ + else \ + transform ((x), (d), (n)); \ + } while (0) +#else +#define TRANSFORM(x,d,n) transform ((x), (d), (n)) +#endif + + + +typedef struct +{ + u32 h0,h1,h2,h3,h4; + u32 nblocks; + unsigned char buf[64]; + int count; } SHA1_CONTEXT; + static void sha1_init (void *context) { @@ -62,147 +88,275 @@ } -/**************** - * Transform the message X which consists of 16 32-bit-words +/* Round function macros. */ +#define K1 0x5A827999L +#define K2 0x6ED9EBA1L +#define K3 0x8F1BBCDCL +#define K4 0xCA62C1D6L +#define F1(x,y,z) ( z ^ ( x & ( y ^ z ) ) ) +#define F2(x,y,z) ( x ^ y ^ z ) +#define F3(x,y,z) ( ( x & y ) | ( z & ( x | y ) ) ) +#define F4(x,y,z) ( x ^ y ^ z ) +#define M(i) ( tm = x[ i &0x0f] \ + ^ x[(i-14)&0x0f] \ + ^ x[(i-8) &0x0f] \ + ^ x[(i-3) &0x0f], \ + (x[i&0x0f] = rol(tm, 1))) +#define R(a,b,c,d,e,f,k,m) do { e += rol( a, 5 ) \ + + f( b, c, d ) \ + + k \ + + m; \ + b = rol( b, 30 ); \ + } while(0) + + +/* + * Transform NBLOCKS of each 64 bytes (16 32-bit words) at DATA. + * Unaligned version. */ static void -transform ( SHA1_CONTEXT *hd, const unsigned char *data ) +transform (SHA1_CONTEXT *hd, const unsigned char *data, size_t nblocks) { - register u32 a,b,c,d,e,tm; - u32 x[16]; - - /* Get values from the chaining vars. */ - a = hd->h0; - b = hd->h1; - c = hd->h2; - d = hd->h3; - e = hd->h4; - + register u32 a, b, c, d, e; /* Local copies of the chaining variables. */ + register u32 tm; /* Helper. */ + u32 x[16]; /* The array we work on. */ + + /* Loop over all blocks. */ + for ( ;nblocks; nblocks--) + { #ifdef WORDS_BIGENDIAN - memcpy( x, data, 64 ); + memcpy (x, data, 64); + data += 64; #else - { - int i; - byte *p2; - for(i=0, p2=(byte*)x; i < 16; i++, p2 += 4 ) { - p2[3] = *data++; - p2[2] = *data++; - p2[1] = *data++; - p2[0] = *data++; + int i; + unsigned char *p; + + for(i=0, p=(unsigned char*)x; i < 16; i++, p += 4 ) + { + p[3] = *data++; + p[2] = *data++; + p[1] = *data++; + p[0] = *data++; + } } - } #endif + /* Get the values of the chaining variables. */ + a = hd->h0; + b = hd->h1; + c = hd->h2; + d = hd->h3; + e = hd->h4; + /* Transform. */ + R( a, b, c, d, e, F1, K1, x[ 0] ); + R( e, a, b, c, d, F1, K1, x[ 1] ); + R( d, e, a, b, c, F1, K1, x[ 2] ); + R( c, d, e, a, b, F1, K1, x[ 3] ); + R( b, c, d, e, a, F1, K1, x[ 4] ); + R( a, b, c, d, e, F1, K1, x[ 5] ); + R( e, a, b, c, d, F1, K1, x[ 6] ); + R( d, e, a, b, c, F1, K1, x[ 7] ); + R( c, d, e, a, b, F1, K1, x[ 8] ); + R( b, c, d, e, a, F1, K1, x[ 9] ); + R( a, b, c, d, e, F1, K1, x[10] ); + R( e, a, b, c, d, F1, K1, x[11] ); + R( d, e, a, b, c, F1, K1, x[12] ); + R( c, d, e, a, b, F1, K1, x[13] ); + R( b, c, d, e, a, F1, K1, x[14] ); + R( a, b, c, d, e, F1, K1, x[15] ); + R( e, a, b, c, d, F1, K1, M(16) ); + R( d, e, a, b, c, F1, K1, M(17) ); + R( c, d, e, a, b, F1, K1, M(18) ); + R( b, c, d, e, a, F1, K1, M(19) ); + R( a, b, c, d, e, F2, K2, M(20) ); + R( e, a, b, c, d, F2, K2, M(21) ); + R( d, e, a, b, c, F2, K2, M(22) ); + R( c, d, e, a, b, F2, K2, M(23) ); + R( b, c, d, e, a, F2, K2, M(24) ); + R( a, b, c, d, e, F2, K2, M(25) ); + R( e, a, b, c, d, F2, K2, M(26) ); + R( d, e, a, b, c, F2, K2, M(27) ); + R( c, d, e, a, b, F2, K2, M(28) ); + R( b, c, d, e, a, F2, K2, M(29) ); + R( a, b, c, d, e, F2, K2, M(30) ); + R( e, a, b, c, d, F2, K2, M(31) ); + R( d, e, a, b, c, F2, K2, M(32) ); + R( c, d, e, a, b, F2, K2, M(33) ); + R( b, c, d, e, a, F2, K2, M(34) ); + R( a, b, c, d, e, F2, K2, M(35) ); + R( e, a, b, c, d, F2, K2, M(36) ); + R( d, e, a, b, c, F2, K2, M(37) ); + R( c, d, e, a, b, F2, K2, M(38) ); + R( b, c, d, e, a, F2, K2, M(39) ); + R( a, b, c, d, e, F3, K3, M(40) ); + R( e, a, b, c, d, F3, K3, M(41) ); + R( d, e, a, b, c, F3, K3, M(42) ); + R( c, d, e, a, b, F3, K3, M(43) ); + R( b, c, d, e, a, F3, K3, M(44) ); + R( a, b, c, d, e, F3, K3, M(45) ); + R( e, a, b, c, d, F3, K3, M(46) ); + R( d, e, a, b, c, F3, K3, M(47) ); + R( c, d, e, a, b, F3, K3, M(48) ); + R( b, c, d, e, a, F3, K3, M(49) ); + R( a, b, c, d, e, F3, K3, M(50) ); + R( e, a, b, c, d, F3, K3, M(51) ); + R( d, e, a, b, c, F3, K3, M(52) ); + R( c, d, e, a, b, F3, K3, M(53) ); + R( b, c, d, e, a, F3, K3, M(54) ); + R( a, b, c, d, e, F3, K3, M(55) ); + R( e, a, b, c, d, F3, K3, M(56) ); + R( d, e, a, b, c, F3, K3, M(57) ); + R( c, d, e, a, b, F3, K3, M(58) ); + R( b, c, d, e, a, F3, K3, M(59) ); + R( a, b, c, d, e, F4, K4, M(60) ); + R( e, a, b, c, d, F4, K4, M(61) ); + R( d, e, a, b, c, F4, K4, M(62) ); + R( c, d, e, a, b, F4, K4, M(63) ); + R( b, c, d, e, a, F4, K4, M(64) ); + R( a, b, c, d, e, F4, K4, M(65) ); + R( e, a, b, c, d, F4, K4, M(66) ); + R( d, e, a, b, c, F4, K4, M(67) ); + R( c, d, e, a, b, F4, K4, M(68) ); + R( b, c, d, e, a, F4, K4, M(69) ); + R( a, b, c, d, e, F4, K4, M(70) ); + R( e, a, b, c, d, F4, K4, M(71) ); + R( d, e, a, b, c, F4, K4, M(72) ); + R( c, d, e, a, b, F4, K4, M(73) ); + R( b, c, d, e, a, F4, K4, M(74) ); + R( a, b, c, d, e, F4, K4, M(75) ); + R( e, a, b, c, d, F4, K4, M(76) ); + R( d, e, a, b, c, F4, K4, M(77) ); + R( c, d, e, a, b, F4, K4, M(78) ); + R( b, c, d, e, a, F4, K4, M(79) ); -#define K1 0x5A827999L -#define K2 0x6ED9EBA1L -#define K3 0x8F1BBCDCL -#define K4 0xCA62C1D6L -#define F1(x,y,z) ( z ^ ( x & ( y ^ z ) ) ) -#define F2(x,y,z) ( x ^ y ^ z ) -#define F3(x,y,z) ( ( x & y ) | ( z & ( x | y ) ) ) -#define F4(x,y,z) ( x ^ y ^ z ) + /* Update the chaining variables. */ + hd->h0 += a; + hd->h1 += b; + hd->h2 += c; + hd->h3 += d; + hd->h4 += e; + } +} -#define M(i) ( tm = x[i&0x0f] ^ x[(i-14)&0x0f] \ - ^ x[(i-8)&0x0f] ^ x[(i-3)&0x0f] \ - , (x[i&0x0f] = rol(tm, 1)) ) +#ifdef WORDS_BIGENDIAN +/* + * Transform NBLOCKS of each 64 bytes (16 32-bit words) at DATA. This + * version requires that DATA is aligned on a u32 boundary. Note that + * we can do this only on big endian machines because we need to sawp + * bytes on little endian anyway. + */ +static void +transform_aligned (SHA1_CONTEXT *hd, const unsigned char *data, size_t nblocks) +{ + register u32 a, b, c, d, e; /* Local copies of the chaining variables. */ + register u32 tm; /* Helper. */ + const u32 *x; /* 32 bit pointer we use for processing. */ + + x = (const u32*)data; -#define R(a,b,c,d,e,f,k,m) do { e += rol( a, 5 ) \ - + f( b, c, d ) \ - + k \ - + m; \ - b = rol( b, 30 ); \ - } while(0) - R( a, b, c, d, e, F1, K1, x[ 0] ); - R( e, a, b, c, d, F1, K1, x[ 1] ); - R( d, e, a, b, c, F1, K1, x[ 2] ); - R( c, d, e, a, b, F1, K1, x[ 3] ); - R( b, c, d, e, a, F1, K1, x[ 4] ); - R( a, b, c, d, e, F1, K1, x[ 5] ); - R( e, a, b, c, d, F1, K1, x[ 6] ); - R( d, e, a, b, c, F1, K1, x[ 7] ); - R( c, d, e, a, b, F1, K1, x[ 8] ); - R( b, c, d, e, a, F1, K1, x[ 9] ); - R( a, b, c, d, e, F1, K1, x[10] ); - R( e, a, b, c, d, F1, K1, x[11] ); - R( d, e, a, b, c, F1, K1, x[12] ); - R( c, d, e, a, b, F1, K1, x[13] ); - R( b, c, d, e, a, F1, K1, x[14] ); - R( a, b, c, d, e, F1, K1, x[15] ); - R( e, a, b, c, d, F1, K1, M(16) ); - R( d, e, a, b, c, F1, K1, M(17) ); - R( c, d, e, a, b, F1, K1, M(18) ); - R( b, c, d, e, a, F1, K1, M(19) ); - R( a, b, c, d, e, F2, K2, M(20) ); - R( e, a, b, c, d, F2, K2, M(21) ); - R( d, e, a, b, c, F2, K2, M(22) ); - R( c, d, e, a, b, F2, K2, M(23) ); - R( b, c, d, e, a, F2, K2, M(24) ); - R( a, b, c, d, e, F2, K2, M(25) ); - R( e, a, b, c, d, F2, K2, M(26) ); - R( d, e, a, b, c, F2, K2, M(27) ); - R( c, d, e, a, b, F2, K2, M(28) ); - R( b, c, d, e, a, F2, K2, M(29) ); - R( a, b, c, d, e, F2, K2, M(30) ); - R( e, a, b, c, d, F2, K2, M(31) ); - R( d, e, a, b, c, F2, K2, M(32) ); - R( c, d, e, a, b, F2, K2, M(33) ); - R( b, c, d, e, a, F2, K2, M(34) ); - R( a, b, c, d, e, F2, K2, M(35) ); - R( e, a, b, c, d, F2, K2, M(36) ); - R( d, e, a, b, c, F2, K2, M(37) ); - R( c, d, e, a, b, F2, K2, M(38) ); - R( b, c, d, e, a, F2, K2, M(39) ); - R( a, b, c, d, e, F3, K3, M(40) ); - R( e, a, b, c, d, F3, K3, M(41) ); - R( d, e, a, b, c, F3, K3, M(42) ); - R( c, d, e, a, b, F3, K3, M(43) ); - R( b, c, d, e, a, F3, K3, M(44) ); - R( a, b, c, d, e, F3, K3, M(45) ); - R( e, a, b, c, d, F3, K3, M(46) ); - R( d, e, a, b, c, F3, K3, M(47) ); - R( c, d, e, a, b, F3, K3, M(48) ); - R( b, c, d, e, a, F3, K3, M(49) ); - R( a, b, c, d, e, F3, K3, M(50) ); - R( e, a, b, c, d, F3, K3, M(51) ); - R( d, e, a, b, c, F3, K3, M(52) ); - R( c, d, e, a, b, F3, K3, M(53) ); - R( b, c, d, e, a, F3, K3, M(54) ); - R( a, b, c, d, e, F3, K3, M(55) ); - R( e, a, b, c, d, F3, K3, M(56) ); - R( d, e, a, b, c, F3, K3, M(57) ); - R( c, d, e, a, b, F3, K3, M(58) ); - R( b, c, d, e, a, F3, K3, M(59) ); - R( a, b, c, d, e, F4, K4, M(60) ); - R( e, a, b, c, d, F4, K4, M(61) ); - R( d, e, a, b, c, F4, K4, M(62) ); - R( c, d, e, a, b, F4, K4, M(63) ); - R( b, c, d, e, a, F4, K4, M(64) ); - R( a, b, c, d, e, F4, K4, M(65) ); From cvs at cvs.gnupg.org Mon Apr 21 09:53:21 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 21 Apr 2008 09:53:21 +0200 Subject: [svn] GnuPG - r4750 - trunk/scd Message-ID: Author: wk Date: 2008-04-21 09:53:20 +0200 (Mon, 21 Apr 2008) New Revision: 4750 Modified: trunk/scd/ChangeLog trunk/scd/app-openpgp.c Log: Use default PIN flag Modified: trunk/scd/ChangeLog =================================================================== --- trunk/scd/ChangeLog 2008-04-18 09:20:25 UTC (rev 4749) +++ trunk/scd/ChangeLog 2008-04-21 07:53:20 UTC (rev 4750) @@ -1,3 +1,7 @@ +2008-04-21 Werner Koch + + * app-openpgp.c (verify_a_chv): Make use of the default CHV flag. + 2008-03-26 Werner Koch * app-openpgp.c (verify_chv3): Support the keypad. Modified: trunk/scd/app-openpgp.c =================================================================== --- trunk/scd/app-openpgp.c 2008-04-18 09:20:25 UTC (rev 4749) +++ trunk/scd/app-openpgp.c 2008-04-21 07:53:20 UTC (rev 4750) @@ -481,7 +481,7 @@ return n; } -/* GnuPG makes special use of the login-data DO, this fucntion parses +/* GnuPG makes special use of the login-data DO, this function parses the login data to store the flags for later use. It may be called at any time and should be called after changing the login-data DO. @@ -1300,6 +1300,25 @@ *pinvalue = NULL; + if (chvno == 2 && app->app_local->flags.def_chv2) + { + /* Special case for def_chv2 mechanism. */ + if (opt.verbose) + log_info (_("using default PIN as %s\n"), "CHV2"); + rc = iso7816_verify (app->slot, 0x82, "123456", 6); + if (rc) + { + /* Verification of CHV2 with the default PIN failed, + although the card pretends to have the default PIN set as + CHV2. We better disable the def_chv2 flag now. */ + log_info (_("failed to use default PIN as %s: %s" + " - disabling further default use\n"), + "CHV2", gpg_strerror (rc)); + app->app_local->flags.def_chv2 = 0; + } + return rc; + } + memset (&pininfo, 0, sizeof pininfo); pininfo.mode = 1; pininfo.minlen = minlen; From cvs at cvs.gnupg.org Mon Apr 21 21:13:38 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 21 Apr 2008 21:13:38 +0200 Subject: [svn] GnuPG - r4751 - in trunk: . common keyserver scd Message-ID: Author: wk Date: 2008-04-21 21:13:36 +0200 (Mon, 21 Apr 2008) New Revision: 4751 Modified: trunk/NEWS trunk/common/ChangeLog trunk/common/http.c trunk/common/i18n.c trunk/keyserver/ChangeLog trunk/keyserver/curl-shim.c trunk/keyserver/gpgkeys_finger.c trunk/keyserver/ksutil.c trunk/keyserver/ksutil.h trunk/scd/ChangeLog Log: W32 related keyserver fixes. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/common/ChangeLog 2008-04-21 19:13:36 UTC (rev 4751) @@ -1,3 +1,9 @@ +2008-04-21 Werner Koch + + * http.c (http_wait_response) [W32]: Use DuplicateHandle because + it is a socket. + (cookie_read) [W32]: Use recv in place of read. + 2008-04-08 Werner Koch * i18n.c (i18n_switchto_utf8, i18n_switchback) Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/keyserver/ChangeLog 2008-04-21 19:13:36 UTC (rev 4751) @@ -1,3 +1,11 @@ +2008-04-21 Werner Koch + + * ksutil.c (w32_init_sockets) [HAVE_W32_SYSTEM]: New. + * curl-shim.c (curl_easy_init) [HAVE_W32_SYSTEM]: Call it. + * gpgkeys_finger.c: s/_WIN32/HAVE_W32_SYSTEM/. + (init_sockets): Remove. + (connect_server) [HAVE_W32_SYSTEM]: Call new function. + 2008-04-14 David Shaw * gpgkeys_curl.c (main), gpgkeys_hkp.c (main): Make sure all Modified: trunk/scd/ChangeLog =================================================================== --- trunk/scd/ChangeLog 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/scd/ChangeLog 2008-04-21 19:13:36 UTC (rev 4751) @@ -1,4 +1,4 @@ -2008-04-21 Werner Koch +2008-04-21 Moritz Schulte (wk) * app-openpgp.c (verify_a_chv): Make use of the default CHV flag. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/NEWS 2008-04-21 19:13:36 UTC (rev 4751) @@ -7,7 +7,9 @@ * New mechanisms "local" and "nodefault" for --auto-key-locate [gpg]. Fixed a few problems with this option. + * [W32] Initialize the socket subsystem for all keyserver helpers. + Noteworthy changes in version 2.0.9 (2008-03-26) ------------------------------------------------ Modified: trunk/common/http.c =================================================================== --- trunk/common/http.c 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/common/http.c 2008-04-21 19:13:36 UTC (rev 4751) @@ -396,7 +396,16 @@ else #endif /*HTTP_USE_ESTREAM*/ { +#ifdef HAVE_W32_SYSTEM + HANDLE handle = (HANDLE)hd->sock; + if (!DuplicateHandle (GetCurrentProcess(), handle, + GetCurrentProcess(), &handle, 0, + TRUE, DUPLICATE_SAME_ACCESS )) + return gpg_error_from_syserror (); + hd->sock = (int)handle; +#else hd->sock = dup (hd->sock); +#endif if (hd->sock == -1) return gpg_error_from_syserror (); } @@ -1490,7 +1499,7 @@ } #endif -/* Actually connect to a server. Returns the file descripto or -1 on +/* Actually connect to a server. Returns the file descriptor or -1 on error. ERRNO is set on error. */ static int connect_server (const char *server, unsigned short port, @@ -1765,7 +1774,12 @@ { do { +#ifdef HAVE_W32_SYSTEM + /* Under Windows we need to use recv for a socket. */ + nread = recv (c->fd, buffer, size, 0); +#else nread = read (c->fd, buffer, size); +#endif } while (nread == -1 && errno == EINTR); } Modified: trunk/common/i18n.c =================================================================== --- trunk/common/i18n.c 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/common/i18n.c 2008-04-21 19:13:36 UTC (rev 4751) @@ -52,7 +52,7 @@ { #ifdef USE_SIMPLE_GETTEXT gettext_select_utf8 (1); -#elif define(ENABLE_NLS) +#elif defined(ENABLE_NLS) char *orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL); # ifdef HAVE_LANGINFO_CODESET if (!orig_codeset) Modified: trunk/keyserver/curl-shim.c =================================================================== --- trunk/keyserver/curl-shim.c 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/keyserver/curl-shim.c 2008-04-21 19:13:36 UTC (rev 4751) @@ -89,6 +89,10 @@ { CURL *handle; +#ifdef HAVE_W32_SYSTEM + w32_init_sockets (); +#endif + handle=calloc(1,sizeof(CURL)); if(handle) handle->errors=stderr; Modified: trunk/keyserver/gpgkeys_finger.c =================================================================== --- trunk/keyserver/gpgkeys_finger.c 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/keyserver/gpgkeys_finger.c 2008-04-21 19:13:36 UTC (rev 4751) @@ -27,7 +27,7 @@ #include #endif -#ifdef _WIN32 +#ifdef HAVE_W32_SYSTEM #include #else #include @@ -46,7 +46,7 @@ #include "ksutil.h" #include "iobuf.h" -#ifdef _WIN32 +#ifdef HAVE_W32_SYSTEM #define sock_close(a) closesocket(a) #else #define sock_close(a) close(a) @@ -58,41 +58,7 @@ static FILE *input,*output,*console; static struct ks_options *opt; -#ifdef _WIN32 -static void -deinit_sockets (void) -{ - WSACleanup(); -} -static void -init_sockets (void) -{ - static int initialized; - static WSADATA wsdata; - - if (initialized) - return; - - if (WSAStartup (0x0101, &wsdata) ) - { - fprintf (console, "error initializing socket library: ec=%d\n", - (int)WSAGetLastError () ); - return; - } - if (wsdata.wVersion < 0x0001) - { - fprintf (console, "socket library version is %x.%x - but 1.1 needed\n", - LOBYTE(wsdata.wVersion), HIBYTE(wsdata.wVersion)); - WSACleanup(); - return; - } - atexit (deinit_sockets); - initialized = 1; -} -#endif /*_WIN32*/ - - /* Connect to SERVER at PORT and return a file descriptor or -1 on error. */ static int @@ -100,12 +66,12 @@ { int sock = -1; -#ifdef _WIN32 +#ifdef HAVE_W32_SYSTEM struct hostent *hp; struct sockaddr_in addr; unsigned long l; - init_sockets (); + w32_init_sockets (); memset (&addr, 0, sizeof addr); addr.sin_family = AF_INET; @@ -201,7 +167,7 @@ { int nwritten; -#ifdef _WIN32 +#ifdef HAVE_W32_SYSTEM nwritten = send (sock, data, nleft, 0); if ( nwritten == SOCKET_ERROR ) { Modified: trunk/keyserver/ksutil.c =================================================================== --- trunk/keyserver/ksutil.c 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/keyserver/ksutil.c 2008-04-21 19:13:36 UTC (rev 4751) @@ -35,6 +35,10 @@ #include #include +#ifdef HAVE_W32_SYSTEM +#include +#endif + #ifdef HAVE_LIBCURL #include #else @@ -83,6 +87,22 @@ #endif /* !HAVE_DOSISH_SYSTEM */ +#ifdef HAVE_W32_SYSTEM +void +w32_init_sockets (void) +{ + static int initialized; + static WSADATA wsdata; + + if (!initialized) + { + WSAStartup (0x0202, &wsdata); + initialized = 1; + } +} +#endif /*HAVE_W32_SYSTEM*/ + + struct ks_options * init_ks_options(void) { Modified: trunk/keyserver/ksutil.h =================================================================== --- trunk/keyserver/ksutil.h 2008-04-21 07:53:20 UTC (rev 4750) +++ trunk/keyserver/ksutil.h 2008-04-21 19:13:36 UTC (rev 4751) @@ -79,6 +79,11 @@ unsigned int set_timeout(unsigned int seconds); int register_timeout(void); +#ifdef HAVE_W32_SYSTEM +void w32_init_sockets (void); +#endif + + enum ks_action {KS_UNKNOWN=0,KS_GET,KS_GETNAME,KS_SEND,KS_SEARCH}; enum ks_search_type {KS_SEARCH_SUBSTR,KS_SEARCH_EXACT, From cvs at cvs.gnupg.org Tue Apr 22 12:25:39 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 22 Apr 2008 12:25:39 +0200 Subject: [svn] gcry - r1285 - in trunk: . cipher tests Message-ID: Author: wk Date: 2008-04-22 12:25:35 +0200 (Tue, 22 Apr 2008) New Revision: 1285 Added: trunk/cipher/rijndael-tables.h Modified: trunk/ChangeLog trunk/NEWS trunk/TODO trunk/autogen.sh trunk/cipher/ChangeLog trunk/cipher/Makefile.am trunk/cipher/rijndael.c trunk/cipher/sha1.c trunk/configure.ac trunk/tests/ChangeLog trunk/tests/basic.c Log: Preapring a release candidate [The diff below has been truncated] Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-04-18 11:44:07 UTC (rev 1284) +++ trunk/ChangeLog 2008-04-22 10:25:35 UTC (rev 1285) @@ -1,6 +1,12 @@ +2008-04-22 Werner Koch + + * configure.ac: Set version to 1.4.1rc1. + 2008-04-18 Werner Koch * configure.ac (AH_BOTTOM): Add CAMELLIA_EXT_SYM_PREFIX. + (NAME_OF_DEV_RANDOM): Remove special cases for Solaris etc. This + matches the gnupg 1.4.9 version. 2008-04-01 Werner Koch Modified: trunk/cipher/ChangeLog =================================================================== --- trunk/cipher/ChangeLog 2008-04-18 11:44:07 UTC (rev 1284) +++ trunk/cipher/ChangeLog 2008-04-22 10:25:35 UTC (rev 1285) @@ -1,5 +1,17 @@ +2008-04-22 Werner Koch + + * rijndael.c (_gcry_aes_cfb_enc, _gcry_aes_cbc_enc) + (_gcry_aes_cfb_dec, _gcry_aes_cbc_dec): Use Padlock if possible. + 2008-04-18 Werner Koch + * sha1.c (transform_aligned): Remove. That is will obviosuly not + work becuase we need a scratch working area and our internal API + does not allow to modify the buffers. + + * rijndael.c: Factor tables out to .. + * rijndael-tables.h: .. new. + * ac.c (ac_data_extract): Make static. * camellia.h [HAVE_CONFIG_H]: Include config.h. @@ -412,7 +424,7 @@ 2006-11-03 Werner Koch * random.c [HAVE_GETTIMEOFDAY]: Included sys/time.h and not - sys/times.h. Reported by Rafa?l Carr?. + sys/times.h. Reported by Rafa??l Carr??. 2006-11-05 Moritz Schulte @@ -2521,7 +2533,7 @@ 2002-02-20 Werner Koch * sha1.c: Removed a left over comment note. The code has been - rewritten from scratch in 1998. Thanks to Niels M?ller for + rewritten from scratch in 1998. Thanks to Niels M??ller for reporting this misleading comment. 2002-02-18 Werner Koch Modified: trunk/tests/ChangeLog =================================================================== --- trunk/tests/ChangeLog 2008-04-18 11:44:07 UTC (rev 1284) +++ trunk/tests/ChangeLog 2008-04-22 10:25:35 UTC (rev 1285) @@ -1,3 +1,7 @@ +2008-04-22 Werner Koch + + * basic.c (check_one_cipher): Also check in-place encryption. + 2008-03-17 Werner Koch * benchmark.c (main): Add option --cipher-repetition. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-04-18 11:44:07 UTC (rev 1284) +++ trunk/NEWS 2008-04-22 10:25:35 UTC (rev 1285) @@ -1,4 +1,4 @@ -Noteworthy changes in version 1.4.1 +Noteworthy changes in version 1.4.1 (unreleased) ------------------------------------------------ * Fixed a bug introduced by 1.3.1 which led to the comsumption of far @@ -6,7 +6,9 @@ * Improved AES performance for CFB and CBC modes. + * Removed build problems for the Padlock support. + Noteworthy changes in version 1.4.0 (2007-12-10) ------------------------------------------------ Modified: trunk/TODO =================================================================== --- trunk/TODO 2008-04-18 11:44:07 UTC (rev 1284) +++ trunk/TODO 2008-04-22 10:25:35 UTC (rev 1285) @@ -100,7 +100,4 @@ We have some code to allow using libgcrypt from C++, so we also should have a test case. -* /dev/urandom and Solaris - Make the configure check similar to GnuPG. - * Use aliases for symbol instead of the wrappers in visibility.c. Modified: trunk/autogen.sh =================================================================== --- trunk/autogen.sh 2008-04-18 11:44:07 UTC (rev 1284) +++ trunk/autogen.sh 2008-04-22 10:25:35 UTC (rev 1285) @@ -77,8 +77,7 @@ ./configure --enable-maintainer-mode --prefix=${w32root} \ --host=${host} --build=${build} \ - --with-gpg-error-prefix=${w32root} \ - --disable-padlock-support + --with-gpg-error-prefix=${w32root} exit $? fi # ***** end W32 build script ******* Modified: trunk/cipher/Makefile.am =================================================================== --- trunk/cipher/Makefile.am 2008-04-18 11:44:07 UTC (rev 1284) +++ trunk/cipher/Makefile.am 2008-04-22 10:25:35 UTC (rev 1285) @@ -61,7 +61,7 @@ ecc.c \ md4.c \ md5.c \ -rijndael.c \ +rijndael.c rijndael-tables.h \ rmd160.c \ rndlinux.c \ rndegd.c \ Added: trunk/cipher/rijndael-tables.h =================================================================== --- trunk/cipher/rijndael-tables.h 2008-04-18 11:44:07 UTC (rev 1284) +++ trunk/cipher/rijndael-tables.h 2008-04-22 10:25:35 UTC (rev 1285) @@ -0,0 +1,1687 @@ +/* rijndael-tables.h - Rijndael (AES) for GnuPG, + * Copyright (C) 2000, 2001, 2002, 2003, 2007, + * 2008 Free Software Foundation, Inc. + * + * This file is part of Libgcrypt. + * + * Libgcrypt is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * Libgcrypt is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, see . + */ + +/* To keep the actual implementation at a readable size we use this + include file to define the tables. */ + +static const unsigned char S[256] = + { + 99, 124, 119, 123, 242, 107, 111, 197, + 48, 1, 103, 43, 254, 215, 171, 118, + 202, 130, 201, 125, 250, 89, 71, 240, + 173, 212, 162, 175, 156, 164, 114, 192, + 183, 253, 147, 38, 54, 63, 247, 204, + 52, 165, 229, 241, 113, 216, 49, 21, + 4, 199, 35, 195, 24, 150, 5, 154, + 7, 18, 128, 226, 235, 39, 178, 117, + 9, 131, 44, 26, 27, 110, 90, 160, + 82, 59, 214, 179, 41, 227, 47, 132, + 83, 209, 0, 237, 32, 252, 177, 91, + 106, 203, 190, 57, 74, 76, 88, 207, + 208, 239, 170, 251, 67, 77, 51, 133, + 69, 249, 2, 127, 80, 60, 159, 168, + 81, 163, 64, 143, 146, 157, 56, 245, + 188, 182, 218, 33, 16, 255, 243, 210, + 205, 12, 19, 236, 95, 151, 68, 23, + 196, 167, 126, 61, 100, 93, 25, 115, + 96, 129, 79, 220, 34, 42, 144, 136, + 70, 238, 184, 20, 222, 94, 11, 219, + 224, 50, 58, 10, 73, 6, 36, 92, + 194, 211, 172, 98, 145, 149, 228, 121, + 231, 200, 55, 109, 141, 213, 78, 169, + 108, 86, 244, 234, 101, 122, 174, 8, + 186, 120, 37, 46, 28, 166, 180, 198, + 232, 221, 116, 31, 75, 189, 139, 138, + 112, 62, 181, 102, 72, 3, 246, 14, + 97, 53, 87, 185, 134, 193, 29, 158, + 225, 248, 152, 17, 105, 217, 142, 148, + 155, 30, 135, 233, 206, 85, 40, 223, + 140, 161, 137, 13, 191, 230, 66, 104, + 65, 153, 45, 15, 176, 84, 187, 22 + }; + + +static const unsigned char T1[256][4] = + { + { 0xc6,0x63,0x63,0xa5 }, { 0xf8,0x7c,0x7c,0x84 }, + { 0xee,0x77,0x77,0x99 }, { 0xf6,0x7b,0x7b,0x8d }, + { 0xff,0xf2,0xf2,0x0d }, { 0xd6,0x6b,0x6b,0xbd }, + { 0xde,0x6f,0x6f,0xb1 }, { 0x91,0xc5,0xc5,0x54 }, + { 0x60,0x30,0x30,0x50 }, { 0x02,0x01,0x01,0x03 }, + { 0xce,0x67,0x67,0xa9 }, { 0x56,0x2b,0x2b,0x7d }, + { 0xe7,0xfe,0xfe,0x19 }, { 0xb5,0xd7,0xd7,0x62 }, + { 0x4d,0xab,0xab,0xe6 }, { 0xec,0x76,0x76,0x9a }, + { 0x8f,0xca,0xca,0x45 }, { 0x1f,0x82,0x82,0x9d }, + { 0x89,0xc9,0xc9,0x40 }, { 0xfa,0x7d,0x7d,0x87 }, + { 0xef,0xfa,0xfa,0x15 }, { 0xb2,0x59,0x59,0xeb }, + { 0x8e,0x47,0x47,0xc9 }, { 0xfb,0xf0,0xf0,0x0b }, + { 0x41,0xad,0xad,0xec }, { 0xb3,0xd4,0xd4,0x67 }, + { 0x5f,0xa2,0xa2,0xfd }, { 0x45,0xaf,0xaf,0xea }, + { 0x23,0x9c,0x9c,0xbf }, { 0x53,0xa4,0xa4,0xf7 }, + { 0xe4,0x72,0x72,0x96 }, { 0x9b,0xc0,0xc0,0x5b }, + { 0x75,0xb7,0xb7,0xc2 }, { 0xe1,0xfd,0xfd,0x1c }, + { 0x3d,0x93,0x93,0xae }, { 0x4c,0x26,0x26,0x6a }, + { 0x6c,0x36,0x36,0x5a }, { 0x7e,0x3f,0x3f,0x41 }, + { 0xf5,0xf7,0xf7,0x02 }, { 0x83,0xcc,0xcc,0x4f }, + { 0x68,0x34,0x34,0x5c }, { 0x51,0xa5,0xa5,0xf4 }, + { 0xd1,0xe5,0xe5,0x34 }, { 0xf9,0xf1,0xf1,0x08 }, + { 0xe2,0x71,0x71,0x93 }, { 0xab,0xd8,0xd8,0x73 }, + { 0x62,0x31,0x31,0x53 }, { 0x2a,0x15,0x15,0x3f }, + { 0x08,0x04,0x04,0x0c }, { 0x95,0xc7,0xc7,0x52 }, + { 0x46,0x23,0x23,0x65 }, { 0x9d,0xc3,0xc3,0x5e }, + { 0x30,0x18,0x18,0x28 }, { 0x37,0x96,0x96,0xa1 }, + { 0x0a,0x05,0x05,0x0f }, { 0x2f,0x9a,0x9a,0xb5 }, + { 0x0e,0x07,0x07,0x09 }, { 0x24,0x12,0x12,0x36 }, + { 0x1b,0x80,0x80,0x9b }, { 0xdf,0xe2,0xe2,0x3d }, + { 0xcd,0xeb,0xeb,0x26 }, { 0x4e,0x27,0x27,0x69 }, + { 0x7f,0xb2,0xb2,0xcd }, { 0xea,0x75,0x75,0x9f }, + { 0x12,0x09,0x09,0x1b }, { 0x1d,0x83,0x83,0x9e }, + { 0x58,0x2c,0x2c,0x74 }, { 0x34,0x1a,0x1a,0x2e }, + { 0x36,0x1b,0x1b,0x2d }, { 0xdc,0x6e,0x6e,0xb2 }, + { 0xb4,0x5a,0x5a,0xee }, { 0x5b,0xa0,0xa0,0xfb }, + { 0xa4,0x52,0x52,0xf6 }, { 0x76,0x3b,0x3b,0x4d }, + { 0xb7,0xd6,0xd6,0x61 }, { 0x7d,0xb3,0xb3,0xce }, + { 0x52,0x29,0x29,0x7b }, { 0xdd,0xe3,0xe3,0x3e }, + { 0x5e,0x2f,0x2f,0x71 }, { 0x13,0x84,0x84,0x97 }, + { 0xa6,0x53,0x53,0xf5 }, { 0xb9,0xd1,0xd1,0x68 }, + { 0x00,0x00,0x00,0x00 }, { 0xc1,0xed,0xed,0x2c }, + { 0x40,0x20,0x20,0x60 }, { 0xe3,0xfc,0xfc,0x1f }, + { 0x79,0xb1,0xb1,0xc8 }, { 0xb6,0x5b,0x5b,0xed }, + { 0xd4,0x6a,0x6a,0xbe }, { 0x8d,0xcb,0xcb,0x46 }, + { 0x67,0xbe,0xbe,0xd9 }, { 0x72,0x39,0x39,0x4b }, + { 0x94,0x4a,0x4a,0xde }, { 0x98,0x4c,0x4c,0xd4 }, + { 0xb0,0x58,0x58,0xe8 }, { 0x85,0xcf,0xcf,0x4a }, + { 0xbb,0xd0,0xd0,0x6b }, { 0xc5,0xef,0xef,0x2a }, + { 0x4f,0xaa,0xaa,0xe5 }, { 0xed,0xfb,0xfb,0x16 }, + { 0x86,0x43,0x43,0xc5 }, { 0x9a,0x4d,0x4d,0xd7 }, + { 0x66,0x33,0x33,0x55 }, { 0x11,0x85,0x85,0x94 }, + { 0x8a,0x45,0x45,0xcf }, { 0xe9,0xf9,0xf9,0x10 }, + { 0x04,0x02,0x02,0x06 }, { 0xfe,0x7f,0x7f,0x81 }, + { 0xa0,0x50,0x50,0xf0 }, { 0x78,0x3c,0x3c,0x44 }, + { 0x25,0x9f,0x9f,0xba }, { 0x4b,0xa8,0xa8,0xe3 }, + { 0xa2,0x51,0x51,0xf3 }, { 0x5d,0xa3,0xa3,0xfe }, + { 0x80,0x40,0x40,0xc0 }, { 0x05,0x8f,0x8f,0x8a }, + { 0x3f,0x92,0x92,0xad }, { 0x21,0x9d,0x9d,0xbc }, + { 0x70,0x38,0x38,0x48 }, { 0xf1,0xf5,0xf5,0x04 }, + { 0x63,0xbc,0xbc,0xdf }, { 0x77,0xb6,0xb6,0xc1 }, + { 0xaf,0xda,0xda,0x75 }, { 0x42,0x21,0x21,0x63 }, + { 0x20,0x10,0x10,0x30 }, { 0xe5,0xff,0xff,0x1a }, + { 0xfd,0xf3,0xf3,0x0e }, { 0xbf,0xd2,0xd2,0x6d }, + { 0x81,0xcd,0xcd,0x4c }, { 0x18,0x0c,0x0c,0x14 }, + { 0x26,0x13,0x13,0x35 }, { 0xc3,0xec,0xec,0x2f }, + { 0xbe,0x5f,0x5f,0xe1 }, { 0x35,0x97,0x97,0xa2 }, + { 0x88,0x44,0x44,0xcc }, { 0x2e,0x17,0x17,0x39 }, + { 0x93,0xc4,0xc4,0x57 }, { 0x55,0xa7,0xa7,0xf2 }, + { 0xfc,0x7e,0x7e,0x82 }, { 0x7a,0x3d,0x3d,0x47 }, + { 0xc8,0x64,0x64,0xac }, { 0xba,0x5d,0x5d,0xe7 }, + { 0x32,0x19,0x19,0x2b }, { 0xe6,0x73,0x73,0x95 }, + { 0xc0,0x60,0x60,0xa0 }, { 0x19,0x81,0x81,0x98 }, + { 0x9e,0x4f,0x4f,0xd1 }, { 0xa3,0xdc,0xdc,0x7f }, + { 0x44,0x22,0x22,0x66 }, { 0x54,0x2a,0x2a,0x7e }, + { 0x3b,0x90,0x90,0xab }, { 0x0b,0x88,0x88,0x83 }, + { 0x8c,0x46,0x46,0xca }, { 0xc7,0xee,0xee,0x29 }, + { 0x6b,0xb8,0xb8,0xd3 }, { 0x28,0x14,0x14,0x3c }, + { 0xa7,0xde,0xde,0x79 }, { 0xbc,0x5e,0x5e,0xe2 }, + { 0x16,0x0b,0x0b,0x1d }, { 0xad,0xdb,0xdb,0x76 }, + { 0xdb,0xe0,0xe0,0x3b }, { 0x64,0x32,0x32,0x56 }, + { 0x74,0x3a,0x3a,0x4e }, { 0x14,0x0a,0x0a,0x1e }, + { 0x92,0x49,0x49,0xdb }, { 0x0c,0x06,0x06,0x0a }, + { 0x48,0x24,0x24,0x6c }, { 0xb8,0x5c,0x5c,0xe4 }, + { 0x9f,0xc2,0xc2,0x5d }, { 0xbd,0xd3,0xd3,0x6e }, + { 0x43,0xac,0xac,0xef }, { 0xc4,0x62,0x62,0xa6 }, + { 0x39,0x91,0x91,0xa8 }, { 0x31,0x95,0x95,0xa4 }, + { 0xd3,0xe4,0xe4,0x37 }, { 0xf2,0x79,0x79,0x8b }, + { 0xd5,0xe7,0xe7,0x32 }, { 0x8b,0xc8,0xc8,0x43 }, + { 0x6e,0x37,0x37,0x59 }, { 0xda,0x6d,0x6d,0xb7 }, + { 0x01,0x8d,0x8d,0x8c }, { 0xb1,0xd5,0xd5,0x64 }, + { 0x9c,0x4e,0x4e,0xd2 }, { 0x49,0xa9,0xa9,0xe0 }, + { 0xd8,0x6c,0x6c,0xb4 }, { 0xac,0x56,0x56,0xfa }, + { 0xf3,0xf4,0xf4,0x07 }, { 0xcf,0xea,0xea,0x25 }, + { 0xca,0x65,0x65,0xaf }, { 0xf4,0x7a,0x7a,0x8e }, + { 0x47,0xae,0xae,0xe9 }, { 0x10,0x08,0x08,0x18 }, + { 0x6f,0xba,0xba,0xd5 }, { 0xf0,0x78,0x78,0x88 }, + { 0x4a,0x25,0x25,0x6f }, { 0x5c,0x2e,0x2e,0x72 }, + { 0x38,0x1c,0x1c,0x24 }, { 0x57,0xa6,0xa6,0xf1 }, + { 0x73,0xb4,0xb4,0xc7 }, { 0x97,0xc6,0xc6,0x51 }, + { 0xcb,0xe8,0xe8,0x23 }, { 0xa1,0xdd,0xdd,0x7c }, + { 0xe8,0x74,0x74,0x9c }, { 0x3e,0x1f,0x1f,0x21 }, + { 0x96,0x4b,0x4b,0xdd }, { 0x61,0xbd,0xbd,0xdc }, + { 0x0d,0x8b,0x8b,0x86 }, { 0x0f,0x8a,0x8a,0x85 }, + { 0xe0,0x70,0x70,0x90 }, { 0x7c,0x3e,0x3e,0x42 }, + { 0x71,0xb5,0xb5,0xc4 }, { 0xcc,0x66,0x66,0xaa }, + { 0x90,0x48,0x48,0xd8 }, { 0x06,0x03,0x03,0x05 }, + { 0xf7,0xf6,0xf6,0x01 }, { 0x1c,0x0e,0x0e,0x12 }, + { 0xc2,0x61,0x61,0xa3 }, { 0x6a,0x35,0x35,0x5f }, + { 0xae,0x57,0x57,0xf9 }, { 0x69,0xb9,0xb9,0xd0 }, + { 0x17,0x86,0x86,0x91 }, { 0x99,0xc1,0xc1,0x58 }, + { 0x3a,0x1d,0x1d,0x27 }, { 0x27,0x9e,0x9e,0xb9 }, + { 0xd9,0xe1,0xe1,0x38 }, { 0xeb,0xf8,0xf8,0x13 }, + { 0x2b,0x98,0x98,0xb3 }, { 0x22,0x11,0x11,0x33 }, + { 0xd2,0x69,0x69,0xbb }, { 0xa9,0xd9,0xd9,0x70 }, + { 0x07,0x8e,0x8e,0x89 }, { 0x33,0x94,0x94,0xa7 }, + { 0x2d,0x9b,0x9b,0xb6 }, { 0x3c,0x1e,0x1e,0x22 }, + { 0x15,0x87,0x87,0x92 }, { 0xc9,0xe9,0xe9,0x20 }, + { 0x87,0xce,0xce,0x49 }, { 0xaa,0x55,0x55,0xff }, + { 0x50,0x28,0x28,0x78 }, { 0xa5,0xdf,0xdf,0x7a }, + { 0x03,0x8c,0x8c,0x8f }, { 0x59,0xa1,0xa1,0xf8 }, + { 0x09,0x89,0x89,0x80 }, { 0x1a,0x0d,0x0d,0x17 }, + { 0x65,0xbf,0xbf,0xda }, { 0xd7,0xe6,0xe6,0x31 }, + { 0x84,0x42,0x42,0xc6 }, { 0xd0,0x68,0x68,0xb8 }, + { 0x82,0x41,0x41,0xc3 }, { 0x29,0x99,0x99,0xb0 }, + { 0x5a,0x2d,0x2d,0x77 }, { 0x1e,0x0f,0x0f,0x11 }, + { 0x7b,0xb0,0xb0,0xcb }, { 0xa8,0x54,0x54,0xfc }, + { 0x6d,0xbb,0xbb,0xd6 }, { 0x2c,0x16,0x16,0x3a } + }; + +static const unsigned char T2[256][4] = + { + { 0xa5,0xc6,0x63,0x63 }, { 0x84,0xf8,0x7c,0x7c }, + { 0x99,0xee,0x77,0x77 }, { 0x8d,0xf6,0x7b,0x7b }, + { 0x0d,0xff,0xf2,0xf2 }, { 0xbd,0xd6,0x6b,0x6b }, + { 0xb1,0xde,0x6f,0x6f }, { 0x54,0x91,0xc5,0xc5 }, + { 0x50,0x60,0x30,0x30 }, { 0x03,0x02,0x01,0x01 }, + { 0xa9,0xce,0x67,0x67 }, { 0x7d,0x56,0x2b,0x2b }, + { 0x19,0xe7,0xfe,0xfe }, { 0x62,0xb5,0xd7,0xd7 }, + { 0xe6,0x4d,0xab,0xab }, { 0x9a,0xec,0x76,0x76 }, + { 0x45,0x8f,0xca,0xca }, { 0x9d,0x1f,0x82,0x82 }, + { 0x40,0x89,0xc9,0xc9 }, { 0x87,0xfa,0x7d,0x7d }, + { 0x15,0xef,0xfa,0xfa }, { 0xeb,0xb2,0x59,0x59 }, + { 0xc9,0x8e,0x47,0x47 }, { 0x0b,0xfb,0xf0,0xf0 }, + { 0xec,0x41,0xad,0xad }, { 0x67,0xb3,0xd4,0xd4 }, + { 0xfd,0x5f,0xa2,0xa2 }, { 0xea,0x45,0xaf,0xaf }, + { 0xbf,0x23,0x9c,0x9c }, { 0xf7,0x53,0xa4,0xa4 }, + { 0x96,0xe4,0x72,0x72 }, { 0x5b,0x9b,0xc0,0xc0 }, + { 0xc2,0x75,0xb7,0xb7 }, { 0x1c,0xe1,0xfd,0xfd }, + { 0xae,0x3d,0x93,0x93 }, { 0x6a,0x4c,0x26,0x26 }, + { 0x5a,0x6c,0x36,0x36 }, { 0x41,0x7e,0x3f,0x3f }, + { 0x02,0xf5,0xf7,0xf7 }, { 0x4f,0x83,0xcc,0xcc }, + { 0x5c,0x68,0x34,0x34 }, { 0xf4,0x51,0xa5,0xa5 }, + { 0x34,0xd1,0xe5,0xe5 }, { 0x08,0xf9,0xf1,0xf1 }, + { 0x93,0xe2,0x71,0x71 }, { 0x73,0xab,0xd8,0xd8 }, + { 0x53,0x62,0x31,0x31 }, { 0x3f,0x2a,0x15,0x15 }, + { 0x0c,0x08,0x04,0x04 }, { 0x52,0x95,0xc7,0xc7 }, + { 0x65,0x46,0x23,0x23 }, { 0x5e,0x9d,0xc3,0xc3 }, + { 0x28,0x30,0x18,0x18 }, { 0xa1,0x37,0x96,0x96 }, + { 0x0f,0x0a,0x05,0x05 }, { 0xb5,0x2f,0x9a,0x9a }, + { 0x09,0x0e,0x07,0x07 }, { 0x36,0x24,0x12,0x12 }, + { 0x9b,0x1b,0x80,0x80 }, { 0x3d,0xdf,0xe2,0xe2 }, + { 0x26,0xcd,0xeb,0xeb }, { 0x69,0x4e,0x27,0x27 }, + { 0xcd,0x7f,0xb2,0xb2 }, { 0x9f,0xea,0x75,0x75 }, + { 0x1b,0x12,0x09,0x09 }, { 0x9e,0x1d,0x83,0x83 }, + { 0x74,0x58,0x2c,0x2c }, { 0x2e,0x34,0x1a,0x1a }, + { 0x2d,0x36,0x1b,0x1b }, { 0xb2,0xdc,0x6e,0x6e }, + { 0xee,0xb4,0x5a,0x5a }, { 0xfb,0x5b,0xa0,0xa0 }, + { 0xf6,0xa4,0x52,0x52 }, { 0x4d,0x76,0x3b,0x3b }, + { 0x61,0xb7,0xd6,0xd6 }, { 0xce,0x7d,0xb3,0xb3 }, + { 0x7b,0x52,0x29,0x29 }, { 0x3e,0xdd,0xe3,0xe3 }, + { 0x71,0x5e,0x2f,0x2f }, { 0x97,0x13,0x84,0x84 }, + { 0xf5,0xa6,0x53,0x53 }, { 0x68,0xb9,0xd1,0xd1 }, + { 0x00,0x00,0x00,0x00 }, { 0x2c,0xc1,0xed,0xed }, + { 0x60,0x40,0x20,0x20 }, { 0x1f,0xe3,0xfc,0xfc }, + { 0xc8,0x79,0xb1,0xb1 }, { 0xed,0xb6,0x5b,0x5b }, + { 0xbe,0xd4,0x6a,0x6a }, { 0x46,0x8d,0xcb,0xcb }, + { 0xd9,0x67,0xbe,0xbe }, { 0x4b,0x72,0x39,0x39 }, + { 0xde,0x94,0x4a,0x4a }, { 0xd4,0x98,0x4c,0x4c }, + { 0xe8,0xb0,0x58,0x58 }, { 0x4a,0x85,0xcf,0xcf }, + { 0x6b,0xbb,0xd0,0xd0 }, { 0x2a,0xc5,0xef,0xef }, + { 0xe5,0x4f,0xaa,0xaa }, { 0x16,0xed,0xfb,0xfb }, + { 0xc5,0x86,0x43,0x43 }, { 0xd7,0x9a,0x4d,0x4d }, + { 0x55,0x66,0x33,0x33 }, { 0x94,0x11,0x85,0x85 }, + { 0xcf,0x8a,0x45,0x45 }, { 0x10,0xe9,0xf9,0xf9 }, + { 0x06,0x04,0x02,0x02 }, { 0x81,0xfe,0x7f,0x7f }, + { 0xf0,0xa0,0x50,0x50 }, { 0x44,0x78,0x3c,0x3c }, + { 0xba,0x25,0x9f,0x9f }, { 0xe3,0x4b,0xa8,0xa8 }, + { 0xf3,0xa2,0x51,0x51 }, { 0xfe,0x5d,0xa3,0xa3 }, + { 0xc0,0x80,0x40,0x40 }, { 0x8a,0x05,0x8f,0x8f }, + { 0xad,0x3f,0x92,0x92 }, { 0xbc,0x21,0x9d,0x9d }, + { 0x48,0x70,0x38,0x38 }, { 0x04,0xf1,0xf5,0xf5 }, + { 0xdf,0x63,0xbc,0xbc }, { 0xc1,0x77,0xb6,0xb6 }, + { 0x75,0xaf,0xda,0xda }, { 0x63,0x42,0x21,0x21 }, + { 0x30,0x20,0x10,0x10 }, { 0x1a,0xe5,0xff,0xff }, + { 0x0e,0xfd,0xf3,0xf3 }, { 0x6d,0xbf,0xd2,0xd2 }, + { 0x4c,0x81,0xcd,0xcd }, { 0x14,0x18,0x0c,0x0c }, + { 0x35,0x26,0x13,0x13 }, { 0x2f,0xc3,0xec,0xec }, + { 0xe1,0xbe,0x5f,0x5f }, { 0xa2,0x35,0x97,0x97 }, + { 0xcc,0x88,0x44,0x44 }, { 0x39,0x2e,0x17,0x17 }, + { 0x57,0x93,0xc4,0xc4 }, { 0xf2,0x55,0xa7,0xa7 }, + { 0x82,0xfc,0x7e,0x7e }, { 0x47,0x7a,0x3d,0x3d }, + { 0xac,0xc8,0x64,0x64 }, { 0xe7,0xba,0x5d,0x5d }, + { 0x2b,0x32,0x19,0x19 }, { 0x95,0xe6,0x73,0x73 }, + { 0xa0,0xc0,0x60,0x60 }, { 0x98,0x19,0x81,0x81 }, + { 0xd1,0x9e,0x4f,0x4f }, { 0x7f,0xa3,0xdc,0xdc }, + { 0x66,0x44,0x22,0x22 }, { 0x7e,0x54,0x2a,0x2a }, + { 0xab,0x3b,0x90,0x90 }, { 0x83,0x0b,0x88,0x88 }, + { 0xca,0x8c,0x46,0x46 }, { 0x29,0xc7,0xee,0xee }, + { 0xd3,0x6b,0xb8,0xb8 }, { 0x3c,0x28,0x14,0x14 }, + { 0x79,0xa7,0xde,0xde }, { 0xe2,0xbc,0x5e,0x5e }, + { 0x1d,0x16,0x0b,0x0b }, { 0x76,0xad,0xdb,0xdb }, + { 0x3b,0xdb,0xe0,0xe0 }, { 0x56,0x64,0x32,0x32 }, + { 0x4e,0x74,0x3a,0x3a }, { 0x1e,0x14,0x0a,0x0a }, + { 0xdb,0x92,0x49,0x49 }, { 0x0a,0x0c,0x06,0x06 }, + { 0x6c,0x48,0x24,0x24 }, { 0xe4,0xb8,0x5c,0x5c }, + { 0x5d,0x9f,0xc2,0xc2 }, { 0x6e,0xbd,0xd3,0xd3 }, + { 0xef,0x43,0xac,0xac }, { 0xa6,0xc4,0x62,0x62 }, + { 0xa8,0x39,0x91,0x91 }, { 0xa4,0x31,0x95,0x95 }, + { 0x37,0xd3,0xe4,0xe4 }, { 0x8b,0xf2,0x79,0x79 }, + { 0x32,0xd5,0xe7,0xe7 }, { 0x43,0x8b,0xc8,0xc8 }, + { 0x59,0x6e,0x37,0x37 }, { 0xb7,0xda,0x6d,0x6d }, + { 0x8c,0x01,0x8d,0x8d }, { 0x64,0xb1,0xd5,0xd5 }, + { 0xd2,0x9c,0x4e,0x4e }, { 0xe0,0x49,0xa9,0xa9 }, + { 0xb4,0xd8,0x6c,0x6c }, { 0xfa,0xac,0x56,0x56 }, + { 0x07,0xf3,0xf4,0xf4 }, { 0x25,0xcf,0xea,0xea }, + { 0xaf,0xca,0x65,0x65 }, { 0x8e,0xf4,0x7a,0x7a }, + { 0xe9,0x47,0xae,0xae }, { 0x18,0x10,0x08,0x08 }, + { 0xd5,0x6f,0xba,0xba }, { 0x88,0xf0,0x78,0x78 }, + { 0x6f,0x4a,0x25,0x25 }, { 0x72,0x5c,0x2e,0x2e }, + { 0x24,0x38,0x1c,0x1c }, { 0xf1,0x57,0xa6,0xa6 }, + { 0xc7,0x73,0xb4,0xb4 }, { 0x51,0x97,0xc6,0xc6 }, + { 0x23,0xcb,0xe8,0xe8 }, { 0x7c,0xa1,0xdd,0xdd }, + { 0x9c,0xe8,0x74,0x74 }, { 0x21,0x3e,0x1f,0x1f }, + { 0xdd,0x96,0x4b,0x4b }, { 0xdc,0x61,0xbd,0xbd }, + { 0x86,0x0d,0x8b,0x8b }, { 0x85,0x0f,0x8a,0x8a }, + { 0x90,0xe0,0x70,0x70 }, { 0x42,0x7c,0x3e,0x3e }, + { 0xc4,0x71,0xb5,0xb5 }, { 0xaa,0xcc,0x66,0x66 }, + { 0xd8,0x90,0x48,0x48 }, { 0x05,0x06,0x03,0x03 }, + { 0x01,0xf7,0xf6,0xf6 }, { 0x12,0x1c,0x0e,0x0e }, + { 0xa3,0xc2,0x61,0x61 }, { 0x5f,0x6a,0x35,0x35 }, + { 0xf9,0xae,0x57,0x57 }, { 0xd0,0x69,0xb9,0xb9 }, + { 0x91,0x17,0x86,0x86 }, { 0x58,0x99,0xc1,0xc1 }, + { 0x27,0x3a,0x1d,0x1d }, { 0xb9,0x27,0x9e,0x9e }, + { 0x38,0xd9,0xe1,0xe1 }, { 0x13,0xeb,0xf8,0xf8 }, + { 0xb3,0x2b,0x98,0x98 }, { 0x33,0x22,0x11,0x11 }, + { 0xbb,0xd2,0x69,0x69 }, { 0x70,0xa9,0xd9,0xd9 }, + { 0x89,0x07,0x8e,0x8e }, { 0xa7,0x33,0x94,0x94 }, + { 0xb6,0x2d,0x9b,0x9b }, { 0x22,0x3c,0x1e,0x1e }, + { 0x92,0x15,0x87,0x87 }, { 0x20,0xc9,0xe9,0xe9 }, + { 0x49,0x87,0xce,0xce }, { 0xff,0xaa,0x55,0x55 }, + { 0x78,0x50,0x28,0x28 }, { 0x7a,0xa5,0xdf,0xdf }, + { 0x8f,0x03,0x8c,0x8c }, { 0xf8,0x59,0xa1,0xa1 }, + { 0x80,0x09,0x89,0x89 }, { 0x17,0x1a,0x0d,0x0d }, + { 0xda,0x65,0xbf,0xbf }, { 0x31,0xd7,0xe6,0xe6 }, + { 0xc6,0x84,0x42,0x42 }, { 0xb8,0xd0,0x68,0x68 }, + { 0xc3,0x82,0x41,0x41 }, { 0xb0,0x29,0x99,0x99 }, + { 0x77,0x5a,0x2d,0x2d }, { 0x11,0x1e,0x0f,0x0f }, + { 0xcb,0x7b,0xb0,0xb0 }, { 0xfc,0xa8,0x54,0x54 }, + { 0xd6,0x6d,0xbb,0xbb }, { 0x3a,0x2c,0x16,0x16 } + }; + +static const unsigned char T3[256][4] = + { + { 0x63,0xa5,0xc6,0x63 }, { 0x7c,0x84,0xf8,0x7c }, + { 0x77,0x99,0xee,0x77 }, { 0x7b,0x8d,0xf6,0x7b }, + { 0xf2,0x0d,0xff,0xf2 }, { 0x6b,0xbd,0xd6,0x6b }, + { 0x6f,0xb1,0xde,0x6f }, { 0xc5,0x54,0x91,0xc5 }, + { 0x30,0x50,0x60,0x30 }, { 0x01,0x03,0x02,0x01 }, + { 0x67,0xa9,0xce,0x67 }, { 0x2b,0x7d,0x56,0x2b }, + { 0xfe,0x19,0xe7,0xfe }, { 0xd7,0x62,0xb5,0xd7 }, + { 0xab,0xe6,0x4d,0xab }, { 0x76,0x9a,0xec,0x76 }, + { 0xca,0x45,0x8f,0xca }, { 0x82,0x9d,0x1f,0x82 }, + { 0xc9,0x40,0x89,0xc9 }, { 0x7d,0x87,0xfa,0x7d }, + { 0xfa,0x15,0xef,0xfa }, { 0x59,0xeb,0xb2,0x59 }, + { 0x47,0xc9,0x8e,0x47 }, { 0xf0,0x0b,0xfb,0xf0 }, + { 0xad,0xec,0x41,0xad }, { 0xd4,0x67,0xb3,0xd4 }, + { 0xa2,0xfd,0x5f,0xa2 }, { 0xaf,0xea,0x45,0xaf }, + { 0x9c,0xbf,0x23,0x9c }, { 0xa4,0xf7,0x53,0xa4 }, + { 0x72,0x96,0xe4,0x72 }, { 0xc0,0x5b,0x9b,0xc0 }, + { 0xb7,0xc2,0x75,0xb7 }, { 0xfd,0x1c,0xe1,0xfd }, + { 0x93,0xae,0x3d,0x93 }, { 0x26,0x6a,0x4c,0x26 }, + { 0x36,0x5a,0x6c,0x36 }, { 0x3f,0x41,0x7e,0x3f }, + { 0xf7,0x02,0xf5,0xf7 }, { 0xcc,0x4f,0x83,0xcc }, + { 0x34,0x5c,0x68,0x34 }, { 0xa5,0xf4,0x51,0xa5 }, + { 0xe5,0x34,0xd1,0xe5 }, { 0xf1,0x08,0xf9,0xf1 }, + { 0x71,0x93,0xe2,0x71 }, { 0xd8,0x73,0xab,0xd8 }, + { 0x31,0x53,0x62,0x31 }, { 0x15,0x3f,0x2a,0x15 }, + { 0x04,0x0c,0x08,0x04 }, { 0xc7,0x52,0x95,0xc7 }, + { 0x23,0x65,0x46,0x23 }, { 0xc3,0x5e,0x9d,0xc3 }, + { 0x18,0x28,0x30,0x18 }, { 0x96,0xa1,0x37,0x96 }, + { 0x05,0x0f,0x0a,0x05 }, { 0x9a,0xb5,0x2f,0x9a }, + { 0x07,0x09,0x0e,0x07 }, { 0x12,0x36,0x24,0x12 }, + { 0x80,0x9b,0x1b,0x80 }, { 0xe2,0x3d,0xdf,0xe2 }, + { 0xeb,0x26,0xcd,0xeb }, { 0x27,0x69,0x4e,0x27 }, + { 0xb2,0xcd,0x7f,0xb2 }, { 0x75,0x9f,0xea,0x75 }, + { 0x09,0x1b,0x12,0x09 }, { 0x83,0x9e,0x1d,0x83 }, + { 0x2c,0x74,0x58,0x2c }, { 0x1a,0x2e,0x34,0x1a }, + { 0x1b,0x2d,0x36,0x1b }, { 0x6e,0xb2,0xdc,0x6e }, + { 0x5a,0xee,0xb4,0x5a }, { 0xa0,0xfb,0x5b,0xa0 }, + { 0x52,0xf6,0xa4,0x52 }, { 0x3b,0x4d,0x76,0x3b }, + { 0xd6,0x61,0xb7,0xd6 }, { 0xb3,0xce,0x7d,0xb3 }, + { 0x29,0x7b,0x52,0x29 }, { 0xe3,0x3e,0xdd,0xe3 }, + { 0x2f,0x71,0x5e,0x2f }, { 0x84,0x97,0x13,0x84 }, + { 0x53,0xf5,0xa6,0x53 }, { 0xd1,0x68,0xb9,0xd1 }, + { 0x00,0x00,0x00,0x00 }, { 0xed,0x2c,0xc1,0xed }, + { 0x20,0x60,0x40,0x20 }, { 0xfc,0x1f,0xe3,0xfc }, + { 0xb1,0xc8,0x79,0xb1 }, { 0x5b,0xed,0xb6,0x5b }, + { 0x6a,0xbe,0xd4,0x6a }, { 0xcb,0x46,0x8d,0xcb }, + { 0xbe,0xd9,0x67,0xbe }, { 0x39,0x4b,0x72,0x39 }, + { 0x4a,0xde,0x94,0x4a }, { 0x4c,0xd4,0x98,0x4c }, + { 0x58,0xe8,0xb0,0x58 }, { 0xcf,0x4a,0x85,0xcf }, + { 0xd0,0x6b,0xbb,0xd0 }, { 0xef,0x2a,0xc5,0xef }, + { 0xaa,0xe5,0x4f,0xaa }, { 0xfb,0x16,0xed,0xfb }, + { 0x43,0xc5,0x86,0x43 }, { 0x4d,0xd7,0x9a,0x4d }, + { 0x33,0x55,0x66,0x33 }, { 0x85,0x94,0x11,0x85 }, + { 0x45,0xcf,0x8a,0x45 }, { 0xf9,0x10,0xe9,0xf9 }, + { 0x02,0x06,0x04,0x02 }, { 0x7f,0x81,0xfe,0x7f }, + { 0x50,0xf0,0xa0,0x50 }, { 0x3c,0x44,0x78,0x3c }, + { 0x9f,0xba,0x25,0x9f }, { 0xa8,0xe3,0x4b,0xa8 }, + { 0x51,0xf3,0xa2,0x51 }, { 0xa3,0xfe,0x5d,0xa3 }, + { 0x40,0xc0,0x80,0x40 }, { 0x8f,0x8a,0x05,0x8f }, + { 0x92,0xad,0x3f,0x92 }, { 0x9d,0xbc,0x21,0x9d }, + { 0x38,0x48,0x70,0x38 }, { 0xf5,0x04,0xf1,0xf5 }, + { 0xbc,0xdf,0x63,0xbc }, { 0xb6,0xc1,0x77,0xb6 }, + { 0xda,0x75,0xaf,0xda }, { 0x21,0x63,0x42,0x21 }, + { 0x10,0x30,0x20,0x10 }, { 0xff,0x1a,0xe5,0xff }, + { 0xf3,0x0e,0xfd,0xf3 }, { 0xd2,0x6d,0xbf,0xd2 }, + { 0xcd,0x4c,0x81,0xcd }, { 0x0c,0x14,0x18,0x0c }, + { 0x13,0x35,0x26,0x13 }, { 0xec,0x2f,0xc3,0xec }, + { 0x5f,0xe1,0xbe,0x5f }, { 0x97,0xa2,0x35,0x97 }, + { 0x44,0xcc,0x88,0x44 }, { 0x17,0x39,0x2e,0x17 }, + { 0xc4,0x57,0x93,0xc4 }, { 0xa7,0xf2,0x55,0xa7 }, + { 0x7e,0x82,0xfc,0x7e }, { 0x3d,0x47,0x7a,0x3d }, + { 0x64,0xac,0xc8,0x64 }, { 0x5d,0xe7,0xba,0x5d }, + { 0x19,0x2b,0x32,0x19 }, { 0x73,0x95,0xe6,0x73 }, + { 0x60,0xa0,0xc0,0x60 }, { 0x81,0x98,0x19,0x81 }, + { 0x4f,0xd1,0x9e,0x4f }, { 0xdc,0x7f,0xa3,0xdc }, + { 0x22,0x66,0x44,0x22 }, { 0x2a,0x7e,0x54,0x2a }, + { 0x90,0xab,0x3b,0x90 }, { 0x88,0x83,0x0b,0x88 }, + { 0x46,0xca,0x8c,0x46 }, { 0xee,0x29,0xc7,0xee }, + { 0xb8,0xd3,0x6b,0xb8 }, { 0x14,0x3c,0x28,0x14 }, + { 0xde,0x79,0xa7,0xde }, { 0x5e,0xe2,0xbc,0x5e }, + { 0x0b,0x1d,0x16,0x0b }, { 0xdb,0x76,0xad,0xdb }, + { 0xe0,0x3b,0xdb,0xe0 }, { 0x32,0x56,0x64,0x32 }, + { 0x3a,0x4e,0x74,0x3a }, { 0x0a,0x1e,0x14,0x0a }, + { 0x49,0xdb,0x92,0x49 }, { 0x06,0x0a,0x0c,0x06 }, + { 0x24,0x6c,0x48,0x24 }, { 0x5c,0xe4,0xb8,0x5c }, + { 0xc2,0x5d,0x9f,0xc2 }, { 0xd3,0x6e,0xbd,0xd3 }, + { 0xac,0xef,0x43,0xac }, { 0x62,0xa6,0xc4,0x62 }, + { 0x91,0xa8,0x39,0x91 }, { 0x95,0xa4,0x31,0x95 }, + { 0xe4,0x37,0xd3,0xe4 }, { 0x79,0x8b,0xf2,0x79 }, + { 0xe7,0x32,0xd5,0xe7 }, { 0xc8,0x43,0x8b,0xc8 }, + { 0x37,0x59,0x6e,0x37 }, { 0x6d,0xb7,0xda,0x6d }, + { 0x8d,0x8c,0x01,0x8d }, { 0xd5,0x64,0xb1,0xd5 }, + { 0x4e,0xd2,0x9c,0x4e }, { 0xa9,0xe0,0x49,0xa9 }, + { 0x6c,0xb4,0xd8,0x6c }, { 0x56,0xfa,0xac,0x56 }, + { 0xf4,0x07,0xf3,0xf4 }, { 0xea,0x25,0xcf,0xea }, + { 0x65,0xaf,0xca,0x65 }, { 0x7a,0x8e,0xf4,0x7a }, + { 0xae,0xe9,0x47,0xae }, { 0x08,0x18,0x10,0x08 }, + { 0xba,0xd5,0x6f,0xba }, { 0x78,0x88,0xf0,0x78 }, + { 0x25,0x6f,0x4a,0x25 }, { 0x2e,0x72,0x5c,0x2e }, + { 0x1c,0x24,0x38,0x1c }, { 0xa6,0xf1,0x57,0xa6 }, + { 0xb4,0xc7,0x73,0xb4 }, { 0xc6,0x51,0x97,0xc6 }, + { 0xe8,0x23,0xcb,0xe8 }, { 0xdd,0x7c,0xa1,0xdd }, + { 0x74,0x9c,0xe8,0x74 }, { 0x1f,0x21,0x3e,0x1f }, + { 0x4b,0xdd,0x96,0x4b }, { 0xbd,0xdc,0x61,0xbd }, + { 0x8b,0x86,0x0d,0x8b }, { 0x8a,0x85,0x0f,0x8a }, + { 0x70,0x90,0xe0,0x70 }, { 0x3e,0x42,0x7c,0x3e }, + { 0xb5,0xc4,0x71,0xb5 }, { 0x66,0xaa,0xcc,0x66 }, From cvs at cvs.gnupg.org Tue Apr 22 12:51:31 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 22 Apr 2008 12:51:31 +0200 Subject: [svn] gcry - r1286 - tags Message-ID: Author: wk Date: 2008-04-22 12:51:31 +0200 (Tue, 22 Apr 2008) New Revision: 1286 Added: tags/libgcrypt-1.4.1rc1/ Log: From cvs at cvs.gnupg.org Tue Apr 22 13:20:52 2008 From: cvs at cvs.gnupg.org (svn author marcus) Date: Tue, 22 Apr 2008 13:20:52 +0200 Subject: [svn] gpgme - r1309 - trunk/gpgme Message-ID: Author: marcus Date: 2008-04-22 13:20:50 +0200 (Tue, 22 Apr 2008) New Revision: 1309 Modified: trunk/gpgme/ChangeLog trunk/gpgme/kdpipeiodevice.cpp trunk/gpgme/w32-qt-io.cpp Log: 2008-04-22 Marcus Brinkmann * w32-qt-io.cpp, kdpipeiodevice.cpp: New versions from Frank Osterfeld, implement blocking select. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2008-03-11 16:05:40 UTC (rev 1308) +++ trunk/gpgme/ChangeLog 2008-04-22 11:20:50 UTC (rev 1309) @@ -1,3 +1,8 @@ +2008-04-22 Marcus Brinkmann + + * w32-qt-io.cpp, kdpipeiodevice.cpp: New versions from Frank + Osterfeld, implement blocking select. + 2008-03-11 Marcus Brinkmann * data.c (gpgme_data_read, gpgme_data_write): Retry on EINTR. Modified: trunk/gpgme/kdpipeiodevice.cpp =================================================================== --- trunk/gpgme/kdpipeiodevice.cpp 2008-03-11 16:05:40 UTC (rev 1308) +++ trunk/gpgme/kdpipeiodevice.cpp 2008-04-22 11:20:50 UTC (rev 1309) @@ -480,8 +480,8 @@ LOCKED( r ); if ( r->bytesInBuffer() != 0 || r->eof || r->error ) return true; - assert( false ); - return r->bufferNotEmptyCondition.wait( &r->mutex, msecs ) ; + + return msecs >= 0 ? r->bufferNotEmptyCondition.wait( &r->mutex, msecs ) : r->bufferNotEmptyCondition.wait( &r->mutex ); } template Modified: trunk/gpgme/w32-qt-io.cpp =================================================================== --- trunk/gpgme/w32-qt-io.cpp 2008-03-11 16:05:40 UTC (rev 1308) +++ trunk/gpgme/w32-qt-io.cpp 2008-04-22 11:20:50 UTC (rev 1309) @@ -573,9 +573,6 @@ TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds, "nfds=%u, nonblock=%u", nfds, nonblock); - /* We only implement the special case of nonblock == true. */ - assert (nonblock); - int count = 0; TRACE_SEQ (dbg_help, "select on [ "); @@ -587,9 +584,12 @@ } else if (fds[i].for_read ) { - const KDPipeIODevice * const chan = find_channel (fds[i].fd, 0); - assert (chan); - fds[i].signaled = chan->readWouldBlock() ? 0 : 1; + KDPipeIODevice * const chan = find_channel (fds[i].fd, 0); + assert (chan); + if ( nonblock ) + fds[i].signaled = chan->readWouldBlock() ? 0 : 1; + else + fds[i].signaled = chan->waitForReadyRead( 1000 ) ? 1 : 0; TRACE_ADD1 (dbg_help, "w0x%x ", fds[i].fd); if ( fds[i].signaled ) count++; @@ -598,7 +598,7 @@ { const KDPipeIODevice * const chan = find_channel (fds[i].fd, 0); assert (chan); - fds[i].signaled = chan->writeWouldBlock() ? 0 : 1; + fds[i].signaled = nonblock ? ( chan->writeWouldBlock() ? 0 : 1 ) : 1; TRACE_ADD1 (dbg_help, "w0x%x ", fds[i].fd); if ( fds[i].signaled ) count++; From cvs at cvs.gnupg.org Wed Apr 23 09:07:27 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 23 Apr 2008 09:07:27 +0200 Subject: [svn] gcry - r1287 - trunk/src Message-ID: Author: wk Date: 2008-04-23 09:07:27 +0200 (Wed, 23 Apr 2008) New Revision: 1287 Removed: trunk/src/libgcrypt.pc.in Log: According to the changelog thsi file has been removed 3 years ago. Tell svn about it. From cvs at cvs.gnupg.org Wed Apr 23 19:23:06 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 23 Apr 2008 19:23:06 +0200 Subject: [svn] GnuPG - r4752 - in trunk: . m4 sm Message-ID: Author: wk Date: 2008-04-23 19:23:04 +0200 (Wed, 23 Apr 2008) New Revision: 4752 Added: trunk/m4/socklen.m4 trunk/m4/sys_socket_h.m4 Modified: trunk/ChangeLog trunk/configure.ac trunk/m4/ChangeLog trunk/m4/Makefile.am trunk/sm/ChangeLog trunk/sm/certchain.c Log: Fixed a C-89 incompatibility. Minor changes to make it build on Debian bo. Thanks to Alain Guibert. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-04-21 19:13:36 UTC (rev 4751) +++ trunk/ChangeLog 2008-04-23 17:23:04 UTC (rev 4752) @@ -1,3 +1,7 @@ +2008-04-23 Werner Koch + + * configure.ac: Call gl_HEADER_SYS_SOCKET and gl_TYPE_SOCKLEN_T. + 2008-04-07 Werner Koch * configure.ac (ADNSLIBS): Test for adns. Modified: trunk/m4/ChangeLog =================================================================== --- trunk/m4/ChangeLog 2008-04-21 19:13:36 UTC (rev 4751) +++ trunk/m4/ChangeLog 2008-04-23 17:23:04 UTC (rev 4752) @@ -1,3 +1,8 @@ +2008-04-23 Werner Koch + + * socklen.m4, sys_socket_h.m4: New. Taken from libassuan. + * Makefile.am (EXTRA_DIST): Add them. + 2008-02-15 gettextize * gettext.m4: Upgrade to gettext-0.17. Modified: trunk/sm/ChangeLog =================================================================== --- trunk/sm/ChangeLog 2008-04-21 19:13:36 UTC (rev 4751) +++ trunk/sm/ChangeLog 2008-04-23 17:23:04 UTC (rev 4752) @@ -1,3 +1,8 @@ +2008-04-23 Werner Koch + + * certchain.c (find_up): Make correct C89 code. Declare variable + at the top of the block. Reported by Alain Guibert. + 2008-04-09 Werner Koch * verify.c (gpgsm_verify): Print the message hash values on error. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-04-21 19:13:36 UTC (rev 4751) +++ trunk/configure.ac 2008-04-23 17:23:04 UTC (rev 4752) @@ -992,6 +992,9 @@ AC_TYPE_SIGNAL AC_DECL_SYS_SIGLIST +gl_HEADER_SYS_SOCKET +gl_TYPE_SOCKLEN_T + AC_ARG_ENABLE(endian-check, AC_HELP_STRING([--disable-endian-check], [disable the endian check and trust the OS provided macros]), Modified: trunk/m4/Makefile.am =================================================================== --- trunk/m4/Makefile.am 2008-04-21 19:13:36 UTC (rev 4751) +++ trunk/m4/Makefile.am 2008-04-23 17:23:04 UTC (rev 4752) @@ -10,5 +10,9 @@ EXTRA_DIST += estream.m4 +EXTRA_DIST += sys_socket_h.m4 socklen.m4 + + + Added: trunk/m4/socklen.m4 =================================================================== --- trunk/m4/socklen.m4 2008-04-21 19:13:36 UTC (rev 4751) +++ trunk/m4/socklen.m4 2008-04-23 17:23:04 UTC (rev 4752) @@ -0,0 +1,52 @@ +# socklen.m4 serial 4 +dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Albert Chin, Windows fixes from Simon Josefsson. + +dnl Check for socklen_t: historically on BSD it is an int, and in +dnl POSIX 1g it is a type of its own, but some platforms use different +dnl types for the argument to getsockopt, getpeername, etc. So we +dnl have to test to find something that will work. + +dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find +dnl it there first. That file is included by gnulib's socket_.h, which +dnl all users of this module should include. Cygwin must not include +dnl ws2tcpip.h. +AC_DEFUN([gl_TYPE_SOCKLEN_T], + [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl + AC_CHECK_TYPE([socklen_t], , + [AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv], + [# Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + gl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t "unsigned int" "long int" "unsigned long int"; do + AC_TRY_COMPILE( + [#include + #include + + int getpeername (int, $arg2 *, $t *);], + [$t len; + getpeername (0, 0, &len);], + [gl_cv_socklen_t_equiv="$t"]) + test "$gl_cv_socklen_t_equiv" != "" && break + done + test "$gl_cv_socklen_t_equiv" != "" && break + done + ]) + if test "$gl_cv_socklen_t_equiv" = ""; then + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + fi + AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) + AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], + [type to use in place of socklen_t if not defined])], + [#include + #if HAVE_SYS_SOCKET_H + # include + #elif HAVE_WS2TCPIP_H + # include + #endif])]) Added: trunk/m4/sys_socket_h.m4 =================================================================== --- trunk/m4/sys_socket_h.m4 2008-04-21 19:13:36 UTC (rev 4751) +++ trunk/m4/sys_socket_h.m4 2008-04-23 17:23:04 UTC (rev 4752) @@ -0,0 +1,23 @@ +# sys_socket_h.m4 serial 2 +dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson. + +AC_DEFUN([gl_HEADER_SYS_SOCKET], +[ + AC_CHECK_HEADERS_ONCE([sys/socket.h]) + if test $ac_cv_header_sys_socket_h = yes; then + SYS_SOCKET_H='' + else + dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make + dnl the check for those headers unconditional; yet cygwin reports + dnl that the headers are present but cannot be compiled (since on + dnl cygwin, all socket information should come from sys/socket.h). + AC_CHECK_HEADERS([winsock2.h ws2tcpip.h]) + SYS_SOCKET_H='sys/socket.h' + fi + AC_SUBST(SYS_SOCKET_H) +]) Modified: trunk/sm/certchain.c =================================================================== --- trunk/sm/certchain.c 2008-04-21 19:13:36 UTC (rev 4751) +++ trunk/sm/certchain.c 2008-04-23 17:23:04 UTC (rev 4752) @@ -702,12 +702,14 @@ rc = keydb_search_subject (kh, issuer); if (rc == -1 && !find_next) { + int old; + /* Also try to get it from the Dirmngr cache. The function merely puts it into the ephemeral database. */ find_up_dirmngr (ctrl, kh, NULL, issuer, 0); /* Not found, let us see whether we have one in the ephemeral key DB. */ - int old = keydb_set_ephemeral (kh, 1); + old = keydb_set_ephemeral (kh, 1); if (!old) { keydb_search_reset (kh); From cvs at cvs.gnupg.org Fri Apr 25 18:19:17 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 25 Apr 2008 18:19:17 +0200 Subject: [svn] gcry - r1288 - in trunk: . cipher Message-ID: Author: wk Date: 2008-04-25 18:19:16 +0200 (Fri, 25 Apr 2008) New Revision: 1288 Modified: trunk/AUTHORS trunk/ChangeLog trunk/NEWS trunk/README trunk/cipher/ChangeLog trunk/configure.ac Log: Preparing the release Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-04-23 07:07:27 UTC (rev 1287) +++ trunk/ChangeLog 2008-04-25 16:19:16 UTC (rev 1288) @@ -1,3 +1,9 @@ +2008-04-25 Werner Koch + + Release 1.4.1. + + * configure.ac: Bump LT version to C15/A4/R4. + 2008-04-22 Werner Koch * configure.ac: Set version to 1.4.1rc1. Modified: trunk/cipher/ChangeLog =================================================================== --- trunk/cipher/ChangeLog 2008-04-23 07:07:27 UTC (rev 1287) +++ trunk/cipher/ChangeLog 2008-04-25 16:19:16 UTC (rev 1288) @@ -6,7 +6,7 @@ 2008-04-18 Werner Koch * sha1.c (transform_aligned): Remove. That is will obviosuly not - work becuase we need a scratch working area and our internal API + work because we need a scratch working area and our internal API does not allow to modify the buffers. * rijndael.c: Factor tables out to .. Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2008-04-23 07:07:27 UTC (rev 1287) +++ trunk/AUTHORS 2008-04-25 16:19:16 UTC (rev 1288) @@ -2,6 +2,7 @@ Maintainer: Werner Koch Bug reports: or http://bugs.gnupg.org Security related bug reports: +License: LGPLv2.1+ Libgcrypt used to be part of GnuPG but has been taken out into its own package on 2000-12-21. @@ -110,7 +111,7 @@ Copyright 1998, 1999, 2000, 2001, 2002, 2003, - 2006, 2007 Free Software Foundation, Inc. + 2006, 2007, 2008 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-04-23 07:07:27 UTC (rev 1287) +++ trunk/NEWS 2008-04-25 16:19:16 UTC (rev 1288) @@ -1,4 +1,4 @@ -Noteworthy changes in version 1.4.1 (unreleased) +Noteworthy changes in version 1.4.1 (2008-04-25) ------------------------------------------------ * Fixed a bug introduced by 1.3.1 which led to the comsumption of far @@ -512,7 +512,7 @@ into into libgcrypt and GnuPG. -Copyright 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. +Copyright 2001, 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without Modified: trunk/README =================================================================== --- trunk/README 2008-04-23 07:07:27 UTC (rev 1287) +++ trunk/README 2008-04-25 16:19:16 UTC (rev 1288) @@ -1,8 +1,9 @@ libgcrypt - The GNU crypto library ------------------------------------ - Version 1.4.0 + Version 1.4.1 - Copyright 2000, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. + Copyright 2000, 2002, 2003, 2004, 2007, + 2008 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-04-23 07:07:27 UTC (rev 1287) +++ trunk/configure.ac 2008-04-25 16:19:16 UTC (rev 1288) @@ -15,9 +15,8 @@ # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -# +# License along with this program; if not, see . + # (Process this file with autoconf to produce a configure script.) AC_REVISION($Revision$) AC_PREREQ(2.60) @@ -27,7 +26,7 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [1.4.1rc1]) +m4_define([my_version], [1.4.1]) m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ @@ -41,7 +40,7 @@ # (No interfaces changed: REVISION++) LIBGCRYPT_LT_CURRENT=15 LIBGCRYPT_LT_AGE=4 -LIBGCRYPT_LT_REVISION=3 +LIBGCRYPT_LT_REVISION=4 # If the API is changed in an incompatible way: increment the next counter. From cvs at cvs.gnupg.org Fri Apr 25 18:48:49 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 25 Apr 2008 18:48:49 +0200 Subject: [svn] gcry - r1289 - tags Message-ID: Author: wk Date: 2008-04-25 18:48:49 +0200 (Fri, 25 Apr 2008) New Revision: 1289 Added: tags/libgcrypt-1.4.1/ Log: Release tag. From cvs at cvs.gnupg.org Fri Apr 25 18:53:40 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 25 Apr 2008 18:53:40 +0200 Subject: [svn] gcry - r1290 - trunk Message-ID: Author: wk Date: 2008-04-25 18:53:39 +0200 (Fri, 25 Apr 2008) New Revision: 1290 Modified: trunk/NEWS trunk/configure.ac Log: post release updates Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-04-25 16:48:49 UTC (rev 1289) +++ trunk/NEWS 2008-04-25 16:53:39 UTC (rev 1290) @@ -1,3 +1,7 @@ +Noteworthy changes in version 1.4.2 +------------------------------------------------ + + Noteworthy changes in version 1.4.1 (2008-04-25) ------------------------------------------------ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-04-25 16:48:49 UTC (rev 1289) +++ trunk/configure.ac 2008-04-25 16:53:39 UTC (rev 1290) @@ -26,8 +26,8 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [1.4.1]) -m4_define([my_issvn], [no]) +m4_define([my_version], [1.4.2]) +m4_define([my_issvn], [yes]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) From cvs at cvs.gnupg.org Mon Apr 28 20:42:58 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 28 Apr 2008 20:42:58 +0200 Subject: [svn] gpgme - r1310 - in trunk: . gpgme Message-ID: Author: wk Date: 2008-04-28 20:42:56 +0200 (Mon, 28 Apr 2008) New Revision: 1310 Modified: trunk/ChangeLog trunk/configure.ac trunk/gpgme/ChangeLog trunk/gpgme/engine-gpgconf.c trunk/gpgme/gpgme.h Log: Fixed a bug reading from gpgconf. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-04-22 11:20:50 UTC (rev 1309) +++ trunk/ChangeLog 2008-04-28 18:42:56 UTC (rev 1310) @@ -1,3 +1,7 @@ +2008-04-01 Werner Koch + + * configure.ac (AC_INIT): Fix quoting. + 2008-01-30 Marcus Brinkmann * configure.ac: Bump required version of automake up to 1.10. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2008-04-22 11:20:50 UTC (rev 1309) +++ trunk/gpgme/ChangeLog 2008-04-28 18:42:56 UTC (rev 1310) @@ -1,3 +1,8 @@ +2008-04-28 Werner Koch + + * engine-gpgconf.c (gpgconf_read): Fixed segv. Avoid memmove for + each line. + 2008-04-22 Marcus Brinkmann * w32-qt-io.cpp, kdpipeiodevice.cpp: New versions from Frank Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-04-22 11:20:50 UTC (rev 1309) +++ trunk/configure.ac 2008-04-28 18:42:56 UTC (rev 1310) @@ -36,7 +36,8 @@ m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) -AC_INIT([gpgme], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]), +AC_INIT([gpgme], + [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])], [bug-gpgme at gnupg.org]) Modified: trunk/gpgme/engine-gpgconf.c =================================================================== --- trunk/gpgme/engine-gpgconf.c 2008-04-22 11:20:50 UTC (rev 1309) +++ trunk/gpgme/engine-gpgconf.c 2008-04-28 18:42:56 UTC (rev 1310) @@ -198,7 +198,7 @@ struct engine_gpgconf *gpgconf = engine; gpgme_error_t err = 0; #define LINELENGTH 1024 - char line[LINELENGTH] = ""; + char linebuf[LINELENGTH] = ""; int linelen = 0; char *argv[] = { NULL /* file_name */, arg1, arg2, 0 }; int rp[2]; @@ -229,28 +229,33 @@ do { - nread = _gpgme_io_read (rp[0], &line[linelen], LINELENGTH - linelen - 1); + nread = _gpgme_io_read (rp[0], + linebuf + linelen, LINELENGTH - linelen - 1); if (nread > 0) { + char *line; + const char *lastmark = NULL; + size_t nused; + linelen += nread; - line[linelen] = '\0'; + linebuf[linelen] = '\0'; - while ((mark = strchr (line, '\n'))) + for (line=linebuf; (mark = strchr (line, '\n')); line = mark+1 ) { - char *eol = mark; - - if (eol > line && eol[-1] == '\r') - eol--; - *eol = '\0'; + lastmark = mark; + if (mark > line && mark[-1] == '\r') + mark--; + *mark = '\0'; /* Got a full line. */ err = (*cb) (hook, line); if (err) - break; - - linelen -= mark + 1 - line; - memmove (line, mark + 1, linelen); + goto leave; } + + nused = lastmark? (lastmark + 1 - linebuf) : 0; + memmove (linebuf, linebuf + nused, nused); + linelen -= nused; } } while (nread > 0 && linelen < LINELENGTH - 1); @@ -260,6 +265,7 @@ if (!err && nread > 0) err = gpg_error (GPG_ERR_LINE_TOO_LONG); + leave: _gpgme_io_close (rp[0]); return err; Modified: trunk/gpgme/gpgme.h =================================================================== --- trunk/gpgme/gpgme.h 2008-04-22 11:20:50 UTC (rev 1309) +++ trunk/gpgme/gpgme.h 2008-04-28 18:42:56 UTC (rev 1310) @@ -72,7 +72,7 @@ AM_PATH_GPGME macro) check that this header matches the installed library. Warning: Do not edit the next line. configure will do that for you! */ -#define GPGME_VERSION "1.1.7-svn1301" +#define GPGME_VERSION "1.1.7-svn1307" From cvs at cvs.gnupg.org Wed Apr 30 13:46:37 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 30 Apr 2008 13:46:37 +0200 Subject: [svn] GnuPG - r4753 - in branches/STABLE-BRANCH-1-4: . g10 scripts Message-ID: Author: wk Date: 2008-04-30 13:46:35 +0200 (Wed, 30 Apr 2008) New Revision: 4753 Modified: branches/STABLE-BRANCH-1-4/ChangeLog branches/STABLE-BRANCH-1-4/NEWS branches/STABLE-BRANCH-1-4/configure.ac branches/STABLE-BRANCH-1-4/g10/ChangeLog branches/STABLE-BRANCH-1-4/g10/getkey.c branches/STABLE-BRANCH-1-4/scripts/w32installer.nsi Log: Ignore gpg2 introduced keywords for --auto-key-locate. Minor W32 installer fix. Modified: branches/STABLE-BRANCH-1-4/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/ChangeLog 2008-04-23 17:23:04 UTC (rev 4752) +++ branches/STABLE-BRANCH-1-4/ChangeLog 2008-04-30 11:46:35 UTC (rev 4753) @@ -1,3 +1,7 @@ +2008-04-01 Werner Koch + + * configure.ac (AC_INIT): Fix quoting. + 2008-03-31 David Shaw * configure.ac: Require curl 7.10 (Oct 1 2002) or later as we use Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2008-04-23 17:23:04 UTC (rev 4752) +++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2008-04-30 11:46:35 UTC (rev 4753) @@ -1,3 +1,8 @@ +2008-04-30 Werner Koch + + * getkey.c (parse_auto_key_locate): Ignore nodefault and local + methods. + 2008-04-17 David Shaw * parse-packet.c (parse_key): Add constant for Camellia-192. Modified: branches/STABLE-BRANCH-1-4/NEWS =================================================================== --- branches/STABLE-BRANCH-1-4/NEWS 2008-04-23 17:23:04 UTC (rev 4752) +++ branches/STABLE-BRANCH-1-4/NEWS 2008-04-30 11:46:35 UTC (rev 4753) @@ -10,7 +10,7 @@ Decryption is also a bit faster. * Fixed possible memory corruption bug in 1.4.8 while importing - OpenPGP keys. + OpenPGP keys. [CVE-2008-1530] Noteworthy changes in version 1.4.8 (2007-12-20) Modified: branches/STABLE-BRANCH-1-4/configure.ac =================================================================== --- branches/STABLE-BRANCH-1-4/configure.ac 2008-04-23 17:23:04 UTC (rev 4752) +++ branches/STABLE-BRANCH-1-4/configure.ac 2008-04-30 11:46:35 UTC (rev 4753) @@ -31,7 +31,8 @@ m4_define([svn_revision], m4_esyscmd([echo $((svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)| \ tr -d '\n'])) -AC_INIT([gnupg], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]), +AC_INIT([gnupg], + [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])], [bug-gnupg at gnu.org]) # Set development_version to yes if the minor number is odd or you # feel that the default check for a development version is not Modified: branches/STABLE-BRANCH-1-4/g10/getkey.c =================================================================== --- branches/STABLE-BRANCH-1-4/g10/getkey.c 2008-04-23 17:23:04 UTC (rev 4752) +++ branches/STABLE-BRANCH-1-4/g10/getkey.c 2008-04-30 11:46:35 UTC (rev 4753) @@ -3008,6 +3008,12 @@ if(tok[0]=='\0') continue; + /* For now we silently ignore the new methods introduced with + 2.0.10. */ + if (!ascii_strcasecmp (tok,"nodefault") + || !ascii_strcasecmp (tok,"local")) + continue; + akl=xmalloc_clear(sizeof(*akl)); if(ascii_strcasecmp(tok,"ldap")==0) Modified: branches/STABLE-BRANCH-1-4/scripts/w32installer.nsi =================================================================== --- branches/STABLE-BRANCH-1-4/scripts/w32installer.nsi 2008-04-23 17:23:04 UTC (rev 4752) +++ branches/STABLE-BRANCH-1-4/scripts/w32installer.nsi 2008-04-30 11:46:35 UTC (rev 4753) @@ -570,7 +570,7 @@ "GnuPG is GNU's tool for secure communication and data storage. \ It can be used to encrypt data and to create digital signatures. \ It includes an advanced key management facility and is compliant \ - with the proposed OpenPGP Internet standard as described in RFC2440. \ + with the proposed OpenPGP Internet standard as described in RFC4880. \ \r\n\r\n$_CLICK \ \r\n\r\n\r\n\r\n\r\nThis is GnuPG version ${VERSION}\r\n\ built on $%BUILDINFO%\r\n\ From cvs at cvs.gnupg.org Wed Apr 30 18:05:58 2008 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Wed, 30 Apr 2008 18:05:58 +0200 Subject: [svn] GnuPG - r4754 - branches/STABLE-BRANCH-1-4/doc Message-ID: Author: dshaw Date: 2008-04-30 18:05:57 +0200 (Wed, 30 Apr 2008) New Revision: 4754 Added: branches/STABLE-BRANCH-1-4/doc/gpg-zip.1 Modified: branches/STABLE-BRANCH-1-4/doc/ChangeLog branches/STABLE-BRANCH-1-4/doc/Makefile.am Log: * gpg-zip.1: Add man page thanks to Colin Tuckley and Daniel Leidert. Modified: branches/STABLE-BRANCH-1-4/doc/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/doc/ChangeLog 2008-04-30 11:46:35 UTC (rev 4753) +++ branches/STABLE-BRANCH-1-4/doc/ChangeLog 2008-04-30 16:05:57 UTC (rev 4754) @@ -1,3 +1,8 @@ +2008-04-30 David Shaw + + * gpg-zip.1: Add man page thanks to Colin Tuckley and Daniel + Leidert. + 2008-04-02 Werner Koch * opt-homedir.texi: Remove special case for Registry key. Modified: branches/STABLE-BRANCH-1-4/doc/Makefile.am =================================================================== --- branches/STABLE-BRANCH-1-4/doc/Makefile.am 2008-04-30 11:46:35 UTC (rev 4753) +++ branches/STABLE-BRANCH-1-4/doc/Makefile.am 2008-04-30 16:05:57 UTC (rev 4754) @@ -20,14 +20,14 @@ HACKING OpenPGP README.W32 samplekeys.asc gnupg.7 \ TRANSLATE gpg.ru.sgml gpg.ru.1 highlights-1.4.txt \ gpg.texi gpgv.texi specify-user-id.texi see-also-note.texi \ - opt-homedir.texi texi.css yat2m.c gpl.texi + opt-homedir.texi texi.css yat2m.c gpl.texi gpg-zip.1 myman_sources = gpg.texi gpgv.texi myman_pages = gpg.1 gpgv.1 info_TEXINFOS = gnupg1.texi -man_MANS = $(myman_pages) gnupg.7 gpg.ru.1 +man_MANS = $(myman_pages) gnupg.7 gpg.ru.1 gpg-zip.1 gnupg1_TEXINFOS = gnupg1.texi Added: branches/STABLE-BRANCH-1-4/doc/gpg-zip.1 =================================================================== --- branches/STABLE-BRANCH-1-4/doc/gpg-zip.1 2008-04-30 11:46:35 UTC (rev 4753) +++ branches/STABLE-BRANCH-1-4/doc/gpg-zip.1 2008-04-30 16:05:57 UTC (rev 4754) @@ -0,0 +1,102 @@ +.TH "gpg-zip" 1 "November 2006" + +.SH NAME +gpg\-zip \- encrypt or sign files into an archive + +.SH SYNOPSIS +.B gpg\-zip +.RB [ OPTIONS ] +.IR filename1 " [" "filename2, ..." ] +.IR directory1 " [" "directory2, ..." ] + +.SH DESCRIPTION +This manual page documents briefly the +.B gpg\-zip +command. +.PP +.B gpg\-zip +encrypts or signs files into an archive. It is an gpg-ized tar using the +same format as PGP's PGP Zip. + +.SH OPTIONS +.TP +.BR \-e ", " \-\-encrypt +Encrypt data. This option may be combined with +.B \-\-symmetric +(for output that may be decrypted via a secret key or a passphrase). +.TP +.BR \-d ", " \-\-decrypt +Decrypt data. +.TP +.BR \-c ", " \-\-symmetric +Encrypt with a symmetric cipher using a passphrase. The default +symmetric cipher used is CAST5, but may be chosen with the +.B \-\-cipher\-algo +option to +.BR gpg (1). +.TP +.BR \-s ", " \-\-sign +Make a signature. See +.BR gpg (1). +.TP +.BR \-r ", " \-\-recipient " \fIUSER\fR" +Encrypt for user id \fIUSER\fR. See +.BR gpg (1). +.TP +.BR \-u ", " \-\-local\-user " \fIUSER\fR" +Use \fIUSER\fR as the key to sign with. See +.BR gpg (1). +.TP +.B \-\-list\-archive +List the contents of the specified archive. +.TP +.BR \-o ", " \-\-output " " \fIFILE\fR +Write output to specified file +.IR FILE . +.TP +.BI \-\-gpg " GPG" +Use the specified command instead of +.BR gpg . +.TP +.BI \-\-gpg\-args " ARGS" +Pass the specified options to +.BR gpg (1). +.TP +.BI \-\-tar " TAR" +Use the specified command instead of +.BR tar . +.TP +.BI \-\-tar\-args " ARGS" +Pass the specified options to +.BR tar (1). +.TP +.BR \-h ", " \-\-help +Output a short usage information. +.TP +.B \-\-version +Output the program version. + +.SH DIAGNOSTICS +The program returns \fB0\fR if everything was fine, \fB1\fR otherwise. + +.SH EXAMPLES +Encrypt the contents of directory \fImydocs\fR for user Bob to file \fItest1\fR: +.IP +.B gpg\-zip \-\-encrypt \-\-output test1 \-\-gpg-args ""\-r Bob"" mydocs +.PP +List the contents of archive \fItest1\fR: +.IP +.B gpg\-zip \-\-list\-archive test1 + +.SH SEE ALSO +.BR gpg (1), +.BR tar (1) + +.SH AUTHOR +Copyright (C) 2005 Free Software Foundation, Inc. Please report bugs to +<\&bug-gnupg at gnu.org\&>. + +This manpage was written by \fBColin Tuckley\fR <\&colin at tuckley.org\&> +and \fBDaniel Leidert\fR <\&daniel.leidert at wgdd.de\&> for the Debian +distribution (but may be used by others). +