From cvs at cvs.gnupg.org Tue Mar 1 00:53:25 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Tue Mar 1 00:53:28 2005 Subject: gnupg/m4 (ChangeLog libcurl.m4) Message-ID: Date: Tuesday, March 1, 2005 @ 01:05:16 Author: dshaw Path: /cvs/gnupg/gnupg/m4 Modified: ChangeLog libcurl.m4 * libcurl.m4: Use $LIBS instead of $LDFLAGS. This should help build problems on Mingw32. ------------+ ChangeLog | 5 +++++ libcurl.m4 | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) Index: gnupg/m4/ChangeLog diff -u gnupg/m4/ChangeLog:1.14 gnupg/m4/ChangeLog:1.15 --- gnupg/m4/ChangeLog:1.14 Fri Feb 4 05:01:35 2005 +++ gnupg/m4/ChangeLog Tue Mar 1 01:05:16 2005 @@ -1,3 +1,8 @@ +2005-02-28 David Shaw + + * libcurl.m4: Use $LIBS instead of $LDFLAGS. This should help + build problems on Mingw32. + 2005-02-03 David Shaw * libcurl.m4: More comments. Index: gnupg/m4/libcurl.m4 diff -u gnupg/m4/libcurl.m4:1.9 gnupg/m4/libcurl.m4:1.10 --- gnupg/m4/libcurl.m4:1.9 Fri Feb 4 05:01:35 2005 +++ gnupg/m4/libcurl.m4 Tue Mar 1 01:05:16 2005 @@ -132,8 +132,8 @@ [ _libcurl_save_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" - _libcurl_save_ldflags=$LDFLAGS - LDFLAGS="$LDFLAGS $LIBCURL" + _libcurl_save_libs=$LIBS + LIBS="$LIBS $LIBCURL" AC_LINK_IFELSE(AC_LANG_PROGRAM([#include ],[ /* Try and use a few common options to force a failure if we are @@ -149,9 +149,9 @@ ]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) CPPFLAGS=$_libcurl_save_cppflags - LDFLAGS=$_libcurl_save_ldflags + LIBS=$_libcurl_save_libs unset _libcurl_save_cppflags - unset _libcurl_save_ldflags + unset _libcurl_save_libs ]) if test $libcurl_cv_lib_curl_usable = yes ; then From cvs at cvs.gnupg.org Wed Mar 2 21:24:49 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Wed Mar 2 21:24:52 2005 Subject: GNUPG-1-9-BRANCH gnupg/agent (ChangeLog command-ssh.c) Message-ID: Date: Wednesday, March 2, 2005 @ 21:36:51 Author: mo Path: /cvs/gnupg/gnupg/agent Tag: GNUPG-1-9-BRANCH Modified: ChangeLog command-ssh.c 2005-03-02 Moritz Schulte * command-ssh.c (sexp_key_extract): Removed FIXME, since xtrymallos does set errno correctly by now. (sexp_extract_identifier): Remove const attribute from identifier. (ssh_handler_request_identities): Remove const attribute from key_type; removes ugly casts and FIXME. (sexp_key_extract): Remove const attribute from comment. (ssh_send_key_public): Remove const attribute from key_type/comment; removes ugly cast. (data_sign): Remove const attribute from identifier; removes ugly cast. (key_secret_to_public): Remove const attribute from comment; removes ugly cast. (ssh_handler_sign_request): Remove const attribute from p. (sexp_key_extract): Use make_cstring(). (ssh_key_extract_comment): Likewise. (ssh_key_to_buffer): Use secure memory for memory area to hold the key S-Expression. Added more comments. ---------------+ ChangeLog | 21 +++++++++++++++ command-ssh.c | 77 +++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 70 insertions(+), 28 deletions(-) Index: gnupg/agent/ChangeLog diff -u gnupg/agent/ChangeLog:1.59.2.71 gnupg/agent/ChangeLog:1.59.2.72 --- gnupg/agent/ChangeLog:1.59.2.71 Fri Feb 25 17:14:55 2005 +++ gnupg/agent/ChangeLog Wed Mar 2 21:36:50 2005 @@ -1,3 +1,24 @@ +2005-03-02 Moritz Schulte + + * command-ssh.c (sexp_key_extract): Removed FIXME, since + xtrymallos does set errno correctly by now. + (sexp_extract_identifier): Remove const attribute from identifier. + (ssh_handler_request_identities): Remove const attribute from + key_type; removes ugly casts and FIXME. + (sexp_key_extract): Remove const attribute from comment. + (ssh_send_key_public): Remove const attribute from + key_type/comment; removes ugly cast. + (data_sign): Remove const attribute from identifier; removes ugly + cast. + (key_secret_to_public): Remove const attribute from comment; + removes ugly cast. + (ssh_handler_sign_request): Remove const attribute from p. + (sexp_key_extract): Use make_cstring(). + (ssh_key_extract_comment): Likewise. + (ssh_key_to_buffer): Use secure memory for memory area to hold the + key S-Expression. + Added more comments. + 2005-02-25 Werner Koch * findkey.c (modify_description): Keep invalid % escapes, so that Index: gnupg/agent/command-ssh.c diff -u gnupg/agent/command-ssh.c:1.1.4.13 gnupg/agent/command-ssh.c:1.1.4.14 --- gnupg/agent/command-ssh.c:1.1.4.13 Fri Feb 25 17:14:55 2005 +++ gnupg/agent/command-ssh.c Wed Mar 2 21:36:50 2005 @@ -1075,7 +1075,7 @@ static gpg_error_t sexp_key_extract (gcry_sexp_t sexp, ssh_key_type_spec_t key_spec, int *secret, - gcry_mpi_t **mpis, const char **comment) + gcry_mpi_t **mpis, char **comment) { gpg_error_t err; gcry_sexp_t value_list; @@ -1127,7 +1127,7 @@ mpis_new = xtrymalloc (sizeof (*mpis_new) * (elems_n + 1)); if (! mpis_new) { - err = gpg_error_from_errno (errno); /* FIXME, xtrymalloc+errno. */ + err = gpg_error_from_errno (errno); goto out; } memset (mpis_new, 0, sizeof (*mpis_new) * (elems_n + 1)); @@ -1176,14 +1176,12 @@ data_n = 6; } - comment_new = xtrymalloc (data_n + 1); + comment_new = make_cstring (data, data_n); if (! comment_new) { err = gpg_error_from_errno (errno); goto out; } - strncpy (comment_new, data, data_n); - comment_new[data_n] = 0; if (secret) *secret = is_secret; @@ -1208,7 +1206,7 @@ /* Extract the car from SEXP, and create a newly created C-string which is to be stored in IDENTIFIER. */ static gpg_error_t -sexp_extract_identifier (gcry_sexp_t sexp, const char **identifier) +sexp_extract_identifier (gcry_sexp_t sexp, char **identifier) { char *identifier_new; gcry_sexp_t sublist; @@ -1251,8 +1249,16 @@ -/* Key I/O. */ +/* + + Key I/O. + +*/ +/* Search for a key specification entry. If SSH_NAME is not NULL, + search for an entry whose "ssh_name" is equal to SSH_NAME; + otherwise, search for an entry whose "name" is equal to NAME. + Store found entry in SPEC on success, return error otherwise. */ static gpg_error_t ssh_key_type_lookup (const char *ssh_name, const char *name, ssh_key_type_spec_t *spec) @@ -1276,6 +1282,11 @@ return err; } +/* Receive a key from STREAM, according to the key specification given + as KEY_SPEC. Depending on SECRET, receive a secret or a public + key. If READ_COMMENT is true, receive a comment string as well. + Constructs a new S-Expression from received data and stores it in + KEY_NEW. Returns zero on success or an error code. */ static gpg_error_t ssh_receive_key (estream_t stream, gcry_sexp_t *key_new, int secret, int read_comment, ssh_key_type_spec_t *key_spec) @@ -1342,6 +1353,9 @@ return err; } +/* Converts a key of type TYPE, whose key material is given in MPIS, + into a newly created binary blob, which is to be stored in + BLOB/BLOB_SIZE. Returns zero on success or an error code. */ static gpg_error_t ssh_convert_key_to_blob (unsigned char **blob, size_t *blob_size, const char *type, gcry_mpi_t *mpis) @@ -1417,8 +1431,8 @@ { ssh_key_type_spec_t spec; gcry_mpi_t *mpi_list; - const char *key_type; - const char *comment; + char *key_type; + char *comment; unsigned char *blob; size_t blob_n; gpg_error_t err; @@ -1455,13 +1469,16 @@ out: mpint_list_free (mpi_list); - xfree ((void *) key_type); - xfree ((void *) comment); + xfree (key_type); + xfree (comment); xfree (blob); return err; } +/* Read a public key out of BLOB/BLOB_SIZE according to the key + specification given as KEY_SPEC, storing the new key in KEY_PUBLIC. + Returns zero on success or an error code. */ static gpg_error_t ssh_read_key_public_from_blob (unsigned char *blob, size_t blob_size, gcry_sexp_t *key_public, @@ -1499,11 +1516,14 @@ +/* Converts the secret key KEY_SECRET into a public key, storing it in + KEY_PUBLIC. SPEC is the according key specification. Returns zero + on success or an error code. */ static gpg_error_t key_secret_to_public (gcry_sexp_t *key_public, ssh_key_type_spec_t spec, gcry_sexp_t key_secret) { - const char *comment; + char *comment; gcry_mpi_t *mpis; gpg_error_t err; int is_secret; @@ -1520,13 +1540,13 @@ out: mpint_list_free (mpis); - xfree ((char *) comment); + xfree (comment); return err; } -/* Chec whether a smartcard is available and whether it has a usable +/* Check whether a smartcard is available and whether it has a usable key. Store a copy of that key at R_PK and return 0. If no key is available store NULL at R_PK and return an error code. If CARDSN is no NULL, a string with the serial number of the card will be @@ -1685,16 +1705,21 @@ } + /* + Request handler. - */ +*/ + + +/* Handler for the "request_identities" command. */ static gpg_error_t ssh_handler_request_identities (ctrl_t ctrl, estream_t request, estream_t response) { - const char *key_type; + char *key_type; ssh_key_type_spec_t spec; struct dirent *dir_entry; char *key_directory; @@ -1828,7 +1853,7 @@ if (err) goto out; - xfree ((void *) key_type); + xfree (key_type); key_type = NULL; err = key_secret_to_public (&key_public, spec, key_secret); @@ -1894,13 +1919,12 @@ free (key_directory); xfree (key_path); xfree (buffer); - /* FIXME: Ist is for sure is a Bad Thing to use the const qualifier - and later cast it away. You can't do that!!! */ - xfree ((void *) key_type); /* FIXME? */ + xfree (key_type); return ret_err; } +/* */ static gpg_error_t data_hash (unsigned char *data, size_t data_n, int md_algorithm, unsigned char *hash) @@ -1923,7 +1947,7 @@ gcry_mpi_t sig_value; unsigned char *sig_blob; size_t sig_blob_n; - const char *identifier; + char *identifier; const char *identifier_raw; size_t identifier_n; ssh_key_type_spec_t spec; @@ -2064,7 +2088,7 @@ gcry_sexp_release (signature_sexp); gcry_sexp_release (sublist); mpint_list_free (mpis); - xfree ((void *) identifier); + xfree (identifier); return err; } @@ -2084,7 +2108,7 @@ size_t sig_n; u32 data_size; u32 flags; - const void *p; + void *p; gpg_error_t err; gpg_error_t ret_err; @@ -2197,15 +2221,13 @@ goto out; } - comment_new = xtrymalloc (data_n + 1); + comment_new = make_cstring (data, data_n); if (! comment_new) { err = gpg_error_from_errno (errno); goto out; } - strncpy (comment_new, data, data_n); - comment_new[data_n] = 0; *comment = comment_new; err = 0; @@ -2243,8 +2265,7 @@ err = 0; buffer_new_n = gcry_sexp_sprint (key, GCRYSEXP_FMT_CANON, NULL, 0); - buffer_new = xtrymalloc (buffer_new_n); - /* FIXME: secmem? */ + buffer_new = xtrymalloc_secure (buffer_new_n); if (! buffer_new) { err = gpg_error_from_errno (errno); From cvs at cvs.gnupg.org Thu Mar 3 11:03:02 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Thu Mar 3 11:03:05 2005 Subject: GNUPG-1-9-BRANCH gnupg (9 files) Message-ID: Date: Thursday, March 3, 2005 @ 11:15:07 Author: wk Path: /cvs/gnupg/gnupg Tag: GNUPG-1-9-BRANCH Modified: ChangeLog THANKS TODO acinclude.m4 agent/command-ssh.c common/ChangeLog common/Makefile.am sm/ChangeLog sm/Makefile.am * acinclude.m4 (GNUPG_PTH_VERSION_CHECK): Accidently used --ldflags instead of --cflags. Reported by Kazu Yamamoto. * Makefile.am (AM_CFLAGS): Added PTH_CFLAGS. Noted by Kazu Yamamoto. * Makefile.am (gpgsm_LDADD): Added PTH_LIBS. Noted by Kazu Yamamoto. ---------------------+ ChangeLog | 5 +++++ THANKS | 3 ++- TODO | 2 ++ acinclude.m4 | 2 +- agent/command-ssh.c | 2 +- common/ChangeLog | 4 ++++ common/Makefile.am | 2 +- sm/ChangeLog | 4 ++++ sm/Makefile.am | 2 +- 9 files changed, 21 insertions(+), 5 deletions(-) Index: gnupg/ChangeLog diff -u gnupg/ChangeLog:1.131.2.67 gnupg/ChangeLog:1.131.2.68 --- gnupg/ChangeLog:1.131.2.67 Thu Feb 3 18:40:02 2005 +++ gnupg/ChangeLog Thu Mar 3 11:15:07 2005 @@ -1,3 +1,8 @@ +2005-03-03 Werner Koch + + * acinclude.m4 (GNUPG_PTH_VERSION_CHECK): Accidently used + --ldflags instead of --cflags. Reported by Kazu Yamamoto. + 2005-02-03 Werner Koch * AUTHORS: Copied from 1.4 and edited to refelct the changes in Index: gnupg/THANKS diff -u gnupg/THANKS:1.69.2.4 gnupg/THANKS:1.69.2.5 --- gnupg/THANKS:1.69.2.4 Thu Sep 9 09:27:57 2004 +++ gnupg/THANKS Thu Mar 3 11:15:07 2005 @@ -1,5 +1,6 @@ Alexander Belopolsky belopolsky at mac.com -Richard Lefebvre rick at cerca.umontreal.ca Andrew J. Schorr aschorr at telemetry-investments.com +Kazu Yamamoto kazu@iij.ad.jp Michael Nottebrock michaelnottebrock at gmx.net +Richard Lefebvre rick at cerca.umontreal.ca Index: gnupg/TODO diff -u gnupg/TODO:1.165.2.37 gnupg/TODO:1.165.2.38 --- gnupg/TODO:1.165.2.37 Tue Feb 22 19:08:28 2005 +++ gnupg/TODO Thu Mar 3 11:15:07 2005 @@ -104,3 +104,5 @@ ** No card status notifications. +* [scdaemon] release the card after use so that gpg 1.4 is abale to access it + Index: gnupg/acinclude.m4 diff -u gnupg/acinclude.m4:1.34.4.8 gnupg/acinclude.m4:1.34.4.9 --- gnupg/acinclude.m4:1.34.4.8 Thu Jan 13 19:00:46 2005 +++ gnupg/acinclude.m4 Thu Mar 3 11:15:07 2005 @@ -246,7 +246,7 @@ _gnupg_pth_save_cflags=$CFLAGS _gnupg_pth_save_ldflags=$LDFLAGS _gnupg_pth_save_libs=$LIBS - CFLAGS="$CFLAGS `$PTH_CONFIG --ldflags`" + CFLAGS="$CFLAGS `$PTH_CONFIG --cflags`" LDFLAGS="$LDFLAGS `$PTH_CONFIG --ldflags`" LIBS="$LIBS `$PTH_CONFIG --libs`" AC_LINK_IFELSE([AC_LANG_PROGRAM([#include Index: gnupg/agent/command-ssh.c diff -u gnupg/agent/command-ssh.c:1.1.4.14 gnupg/agent/command-ssh.c:1.1.4.15 --- gnupg/agent/command-ssh.c:1.1.4.14 Wed Mar 2 21:36:50 2005 +++ gnupg/agent/command-ssh.c Thu Mar 3 11:15:07 2005 @@ -1550,7 +1550,7 @@ key. Store a copy of that key at R_PK and return 0. If no key is available store NULL at R_PK and return an error code. If CARDSN is no NULL, a string with the serial number of the card will be - amalloced and stored there. */ + a malloced and stored there. */ static gpg_error_t card_key_available (ctrl_t ctrl, gcry_sexp_t *r_pk, char **cardsn) { Index: gnupg/common/ChangeLog diff -u gnupg/common/ChangeLog:1.30.2.44 gnupg/common/ChangeLog:1.30.2.45 --- gnupg/common/ChangeLog:1.30.2.44 Fri Feb 25 17:14:55 2005 +++ gnupg/common/ChangeLog Thu Mar 3 11:15:07 2005 @@ -1,3 +1,7 @@ +2005-03-03 Werner Koch + + * Makefile.am (AM_CFLAGS): Added PTH_CFLAGS. Noted by Kazu Yamamoto. + 2005-02-25 Werner Koch * xasprintf.c (xtryasprintf): New. Index: gnupg/common/Makefile.am diff -u gnupg/common/Makefile.am:1.15.2.12 gnupg/common/Makefile.am:1.15.2.13 --- gnupg/common/Makefile.am:1.15.2.12 Wed Jan 26 23:24:59 2005 +++ gnupg/common/Makefile.am Thu Mar 3 11:15:07 2005 @@ -21,7 +21,7 @@ noinst_LIBRARIES = libcommon.a libsimple-pwquery.a -AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS) +AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS) $(PTH_CFLAGS) libcommon_a_SOURCES = \ util.h i18n.h \ Index: gnupg/sm/ChangeLog diff -u gnupg/sm/ChangeLog:1.101.2.88 gnupg/sm/ChangeLog:1.101.2.89 --- gnupg/sm/ChangeLog:1.101.2.88 Thu Jan 13 19:00:44 2005 +++ gnupg/sm/ChangeLog Thu Mar 3 11:15:07 2005 @@ -1,3 +1,7 @@ +2005-03-03 Werner Koch + + * Makefile.am (gpgsm_LDADD): Added PTH_LIBS. Noted by Kazu Yamamoto. + 2005-01-13 Werner Koch * certreqgen.c (proc_parameters): Cast printf arg. Index: gnupg/sm/Makefile.am diff -u gnupg/sm/Makefile.am:1.27.2.4 gnupg/sm/Makefile.am:1.27.2.5 --- gnupg/sm/Makefile.am:1.27.2.4 Wed Dec 15 15:15:08 2004 +++ gnupg/sm/Makefile.am Thu Mar 3 11:15:07 2005 @@ -54,6 +54,6 @@ gpgsm_LDADD = ../jnlib/libjnlib.a ../kbx/libkeybox.a \ ../common/libcommon.a \ $(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_LIBS) -lgpg-error \ - $(LIBINTL) + $(LIBINTL) $(PTH_LIBS) From cvs at cvs.gnupg.org Mon Mar 7 13:26:40 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Tue Mar 8 14:48:39 2005 Subject: STABLE-BRANCH-1-2 gnupg (6 files) Message-ID: Date: Monday, March 7, 2005 @ 13:39:09 Author: wk Path: /cvs/gnupg/gnupg Tag: STABLE-BRANCH-1-2 Modified: ChangeLog README cipher/ChangeLog cipher/primegen.c g10/ChangeLog g10/seckey-cert.c (is_prime): Free A2. Fixed bug #423. -------------------+ ChangeLog | 2 ++ README | 6 +++--- cipher/ChangeLog | 4 ++++ cipher/primegen.c | 1 + g10/ChangeLog | 4 ++++ g10/seckey-cert.c | 2 +- 6 files changed, 15 insertions(+), 4 deletions(-) Index: gnupg/ChangeLog diff -u gnupg/ChangeLog:1.118.2.88 gnupg/ChangeLog:1.118.2.89 --- gnupg/ChangeLog:1.118.2.88 Mon Jan 17 11:12:13 2005 +++ gnupg/ChangeLog Mon Mar 7 13:39:09 2005 @@ -1,5 +1,7 @@ 2005-01-17 Werner Koch + * README: Updated for SHA1 checkums. + * configure.ac: Make --without-included-zlib work as expected. Reported by Norihiko Murase. Index: gnupg/README diff -u gnupg/README:1.71.2.17 gnupg/README:1.71.2.18 --- gnupg/README:1.71.2.17 Mon Dec 27 18:27:11 2004 +++ gnupg/README Mon Mar 7 13:39:09 2005 @@ -108,13 +108,13 @@ b) If you don't have any of the above programs, you have to verify - the MD5 checksum: + the SHA1 checksum: - $ md5sum gnupg-x.y.z.tar.gz + $ sha1sum gnupg-x.y.z.tar.gz This should yield an output _similar_ to this: - fd9351b26b3189c1d577f0970f9dcadc gnupg-x.y.z.tar.gz + fd935112345678b26b3189c1d577f0970f9dcadc gnupg-x.y.z.tar.gz Now check that this checksum is _exactly_ the same as the one published via the announcement list and probably via Usenet. Index: gnupg/cipher/ChangeLog diff -u gnupg/cipher/ChangeLog:1.111.2.22 gnupg/cipher/ChangeLog:1.111.2.23 --- gnupg/cipher/ChangeLog:1.111.2.22 Mon Mar 29 15:56:57 2004 +++ gnupg/cipher/ChangeLog Mon Mar 7 13:39:09 2005 @@ -1,3 +1,7 @@ +2005-03-07 Werner Koch + + * primegen.c (is_prime): Free A2. Fixed bug #423. + 2004-03-29 Werner Koch * elgamal.c (verify): s/exp/exponent/ to shutup a compiler Index: gnupg/cipher/primegen.c diff -u gnupg/cipher/primegen.c:1.32.2.2 gnupg/cipher/primegen.c:1.32.2.3 --- gnupg/cipher/primegen.c:1.32.2.2 Fri Oct 10 11:19:48 2003 +++ gnupg/cipher/primegen.c Mon Mar 7 13:39:09 2005 @@ -497,6 +497,7 @@ mpi_free( z ); mpi_free( nminus1 ); mpi_free( q ); + mpi_free (a2); return rc; } Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.249.2.234 gnupg/g10/ChangeLog:1.249.2.235 --- gnupg/g10/ChangeLog:1.249.2.234 Thu Feb 10 05:11:35 2005 +++ gnupg/g10/ChangeLog Mon Mar 7 13:39:08 2005 @@ -1,3 +1,7 @@ +2005-02-21 Werner Koch + + * seckey-cert.c (do_check): Detect card diversion protection. + 2005-02-09 David Shaw * mainproc.c (proc_symkey_enc): Set a flag to indicate that a Index: gnupg/g10/seckey-cert.c diff -u gnupg/g10/seckey-cert.c:1.67.2.4 gnupg/g10/seckey-cert.c:1.67.2.5 --- gnupg/g10/seckey-cert.c:1.67.2.4 Sun Jun 27 20:26:49 2004 +++ gnupg/g10/seckey-cert.c Mon Mar 7 13:39:08 2005 @@ -49,7 +49,7 @@ CIPHER_HANDLE cipher_hd=NULL; PKT_secret_key *save_sk; - if( sk->protect.s2k.mode == 1001 ) { + if( sk->protect.s2k.mode == 1001 || sk->protect.s2k.mode == 1002 ) { log_info(_("secret key parts are not available\n")); return G10ERR_GENERAL; } From cvs at cvs.gnupg.org Wed Mar 9 10:08:01 2005 From: cvs at cvs.gnupg.org (cvs user stefan) Date: Wed Mar 9 10:40:23 2005 Subject: gnupgjava/src/junit/com/freiheit/gnupg (1 file) Message-ID: Date: Wednesday, March 9, 2005 @ 10:08:01 Author: stefan Path: /cvs/gnupg/gnupgjava/src/junit/com/freiheit/gnupg Modified: GnuPGTestSuite.java Added a method to import Keys and changed the default signing behavior from NORMAL to CLEAR. In next release I will provide all signing alternatives (NORMAL, DETACH, CLEAR) ---------------------+ GnuPGTestSuite.java | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) From cvs at cvs.gnupg.org Wed Mar 9 10:08:00 2005 From: cvs at cvs.gnupg.org (cvs user stefan) Date: Wed Mar 9 10:41:55 2005 Subject: gnupgjava/src/java/com/freiheit/gnupg (GnuPGContext.java) Message-ID: Date: Wednesday, March 9, 2005 @ 10:08:00 Author: stefan Path: /cvs/gnupg/gnupgjava/src/java/com/freiheit/gnupg Modified: GnuPGContext.java Added a method to import Keys and changed the default signing behavior from NORMAL to CLEAR. In next release I will provide all signing alternatives (NORMAL, DETACH, CLEAR) -------------------+ GnuPGContext.java | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletion(-) From cvs at cvs.gnupg.org Wed Mar 9 10:08:00 2005 From: cvs at cvs.gnupg.org (cvs user stefan) Date: Wed Mar 9 10:42:35 2005 Subject: gnupgjava/src/c (2 files) Message-ID: Date: Wednesday, March 9, 2005 @ 10:08:00 Author: stefan Path: /cvs/gnupg/gnupgjava/src/c Modified: GnuPGContext.c com_freiheit_gnupg_GnuPGContext.h Added a method to import Keys and changed the default signing behavior from NORMAL to CLEAR. In next release I will provide all signing alternatives (NORMAL, DETACH, CLEAR) -----------------------------------+ GnuPGContext.c | 168 +++++++++++++++++++++++++++++++++++- com_freiheit_gnupg_GnuPGContext.h | 8 + 2 files changed, 175 insertions(+), 1 deletion(-) From cvs at cvs.gnupg.org Wed Mar 9 10:58:32 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 9 10:58:36 2005 Subject: GNUPG-1-9-BRANCH gnupg/tools (ChangeLog gpgconf-comp.c) Message-ID: Date: Wednesday, March 9, 2005 @ 11:11:14 Author: wk Path: /cvs/gnupg/gnupg/tools Tag: GNUPG-1-9-BRANCH Modified: ChangeLog gpgconf-comp.c Add honor-http-proxy. ----------------+ ChangeLog | 4 ++++ gpgconf-comp.c | 3 +++ 2 files changed, 7 insertions(+) Index: gnupg/tools/ChangeLog diff -u gnupg/tools/ChangeLog:1.25.2.63 gnupg/tools/ChangeLog:1.25.2.64 --- gnupg/tools/ChangeLog:1.25.2.63 Fri Feb 25 17:14:54 2005 +++ gnupg/tools/ChangeLog Wed Mar 9 11:11:14 2005 @@ -1,3 +1,7 @@ +2005-03-09 Werner Koch + + * gpgconf-comp.c : Add honor-http-proxy. + 2005-02-25 Werner Koch * no-libgcrypt.c (gcry_strdup): New. Index: gnupg/tools/gpgconf-comp.c diff -u gnupg/tools/gpgconf-comp.c:1.1.2.49 gnupg/tools/gpgconf-comp.c:1.1.2.50 --- gnupg/tools/gpgconf-comp.c:1.1.2.49 Tue Dec 21 20:05:14 2004 +++ gnupg/tools/gpgconf-comp.c Wed Mar 9 11:11:14 2005 @@ -746,6 +746,9 @@ { "http-proxy", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, "dirmngr", "|URL|redirect all HTTP requests to URL", GC_ARG_TYPE_STRING, GC_BACKEND_DIRMNGR }, + { "honor-http-proxy", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, + "dirmngr", N_("use system's HTTP proxy setting"), + GC_ARG_TYPE_STRING, GC_BACKEND_DIRMNGR }, { "LDAP", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, From cvs at cvs.gnupg.org Wed Mar 9 12:34:38 2005 From: cvs at cvs.gnupg.org (cvs user twoaday) Date: Wed Mar 9 12:34:40 2005 Subject: gpgme/gpgme (11 files) Message-ID: Date: Wednesday, March 9, 2005 @ 12:47:21 Author: twoaday Path: /cvs/gpgme/gpgme/gpgme Modified: ChangeLog ath-compat.c ath.h data.h engine-gpgsm.c gpgme.c gpgme.h io.h w32-io.c w32-sema.c w32-util.c 2005-03-07 Timo Schulz * gpgme.h: [_WIN32] Removed ssize_t typedef. * ath.h: [_WIN32] Added some (dummy) types. * io.h: [_WIN32] include stdio.h. * data.h: [_WIN32] Define EOPNOTSUPP. * w32-io.c [_WIN32] (_gpgme_io_subsystem_init): New. * gpgme.c [_WIN32] (gpgme_set_locale): Disabled. ----------------+ ChangeLog | 9 +++++++++ ath-compat.c | 1 + ath.h | 18 +++++++++++++----- data.h | 4 ++++ engine-gpgsm.c | 2 ++ gpgme.c | 4 +++- gpgme.h | 3 --- io.h | 4 ++++ w32-io.c | 12 ++++++++++-- w32-sema.c | 1 + w32-util.c | 5 +++-- 11 files changed, 50 insertions(+), 13 deletions(-) Index: gpgme/gpgme/ChangeLog diff -u gpgme/gpgme/ChangeLog:1.390 gpgme/gpgme/ChangeLog:1.391 --- gpgme/gpgme/ChangeLog:1.390 Sun Dec 12 15:58:12 2004 +++ gpgme/gpgme/ChangeLog Wed Mar 9 12:47:20 2005 @@ -1,3 +1,12 @@ +2005-03-07 Timo Schulz + + * gpgme.h: [_WIN32] Removed ssize_t typedef. + * ath.h: [_WIN32] Added some (dummy) types. + * io.h: [_WIN32] include stdio.h. + * data.h: [_WIN32] Define EOPNOTSUPP. + * w32-io.c [_WIN32] (_gpgme_io_subsystem_init): New. + * gpgme.c [_WIN32] (gpgme_set_locale): Disabled. + 2004-12-12 Marcus Brinkmann * engine.c (_gpgme_set_engine_info): Fix assertion. Index: gpgme/gpgme/ath-compat.c diff -u gpgme/gpgme/ath-compat.c:1.4 gpgme/gpgme/ath-compat.c:1.5 --- gpgme/gpgme/ath-compat.c:1.4 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/ath-compat.c Wed Mar 9 12:47:21 2005 @@ -23,6 +23,7 @@ #endif #include +#include #ifdef HAVE_SYS_SELECT_H # include #else Index: gpgme/gpgme/ath.h diff -u gpgme/gpgme/ath.h:1.7 gpgme/gpgme/ath.h:1.8 --- gpgme/gpgme/ath.h:1.7 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/ath.h Wed Mar 9 12:47:21 2005 @@ -21,13 +21,21 @@ #ifndef ATH_H #define ATH_H -#ifdef HAVE_SYS_SELECT_H -# include +#ifdef _WIN32 +struct msghdr { int dummy; }; +typedef int socklen_t; +# include +# include #else -# include +# ifdef HAVE_SYS_SELECT_H +# include +# else +# include +# endif +# include +# include #endif -#include -#include + /* Define _ATH_EXT_SYM_PREFIX if you want to give all external symbols Index: gpgme/gpgme/data.h diff -u gpgme/gpgme/data.h:1.6 gpgme/gpgme/data.h:1.7 --- gpgme/gpgme/data.h:1.6 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/data.h Wed Mar 9 12:47:21 2005 @@ -30,6 +30,10 @@ #include "gpgme.h" +#ifdef _WIN32 +# define EOPNOTSUPP 95 +#endif + /* Read up to SIZE bytes into buffer BUFFER from the data object with the handle DH. Return the number of characters read, 0 on EOF and Index: gpgme/gpgme/engine-gpgsm.c diff -u gpgme/gpgme/engine-gpgsm.c:1.102 gpgme/gpgme/engine-gpgsm.c:1.103 --- gpgme/gpgme/engine-gpgsm.c:1.102 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/engine-gpgsm.c Wed Mar 9 12:47:21 2005 @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _WIN32 #if HAVE_CONFIG_H #include #endif @@ -1596,3 +1597,4 @@ gpgsm_io_event, gpgsm_cancel }; +#endif Index: gpgme/gpgme/gpgme.c diff -u gpgme/gpgme/gpgme.c:1.78 gpgme/gpgme/gpgme.c:1.79 --- gpgme/gpgme/gpgme.c:1.78 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/gpgme.c Wed Mar 9 12:47:21 2005 @@ -344,6 +344,7 @@ gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value) { +#ifndef _WIN32 int failed = 0; char *new_lc_ctype; char *new_lc_messages; @@ -397,7 +398,8 @@ SET_ONE_LOCALE (messages, MESSAGES); if (!ctx) UNLOCK (def_lc_lock); - +#endif + return 0; } Index: gpgme/gpgme/gpgme.h diff -u gpgme/gpgme/gpgme.h:1.151 gpgme/gpgme/gpgme.h:1.152 --- gpgme/gpgme/gpgme.h:1.151 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/gpgme.h Wed Mar 9 12:47:21 2005 @@ -38,9 +38,6 @@ typedef long ssize_t; #else # include -#ifdef _WIN32 -typedef long ssize_t; -#endif #endif #ifdef __cplusplus Index: gpgme/gpgme/io.h diff -u gpgme/gpgme/io.h:1.12 gpgme/gpgme/io.h:1.13 --- gpgme/gpgme/io.h:1.12 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/io.h Wed Mar 9 12:47:21 2005 @@ -22,6 +22,10 @@ #ifndef IO_H #define IO_H +#ifdef _WIN32 +#include +#endif + /* A single file descriptor passed to spawn. For child fds, dup_to specifies the fd it should become in the child. */ struct spawn_fd_item_s Index: gpgme/gpgme/w32-io.c diff -u gpgme/gpgme/w32-io.c:1.30 gpgme/gpgme/w32-io.c:1.31 --- gpgme/gpgme/w32-io.c:1.30 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/w32-io.c Wed Mar 9 12:47:21 2005 @@ -37,7 +37,7 @@ #include "util.h" #include "sema.h" #include "io.h" - +#include "debug.h" /* We assume that a HANDLE can be represented by an int which should be true for all i386 systems (HANDLE is defined as void *) and @@ -1064,7 +1064,7 @@ */ any = 0; for (i=code - WAIT_OBJECT_0; i < nwait; i++ ) { - if (WaitForSingleObject ( waitbuf[i], NULL ) == WAIT_OBJECT_0) { + if (WaitForSingleObject (waitbuf[i], 0) == WAIT_OBJECT_0) { assert (waitidx[i] >=0 && waitidx[i] < nfds); fds[waitidx[i]].signaled = 1; any = 1; @@ -1116,3 +1116,11 @@ return count; } + +void +_gpgme_io_subsystem_init (void) +{ + +} + + Index: gpgme/gpgme/w32-sema.c diff -u gpgme/gpgme/w32-sema.c:1.7 gpgme/gpgme/w32-sema.c:1.8 --- gpgme/gpgme/w32-sema.c:1.7 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/w32-sema.c Wed Mar 9 12:47:21 2005 @@ -36,6 +36,7 @@ #include "util.h" #include "sema.h" +#include "debug.h" static void sema_fatal (const char *text) Index: gpgme/gpgme/w32-util.c diff -u gpgme/gpgme/w32-util.c:1.11 gpgme/gpgme/w32-util.c:1.12 --- gpgme/gpgme/w32-util.c:1.11 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/w32-util.c Wed Mar 9 12:47:21 2005 @@ -37,6 +37,7 @@ #include "util.h" #include "sema.h" +#include "debug.h" DEFINE_STATIC_LOCK (get_path_lock); @@ -119,7 +120,7 @@ LOCK (get_path_lock); if (!gpg_program) - gpg_program = find_program_in_registry ("gpgProgram"); + gpg_program = (char*)find_program_in_registry ("gpgProgram"); #ifdef GPG_PATH if (!gpg_program) gpg_program = GPG_PATH; @@ -135,7 +136,7 @@ LOCK (get_path_lock); if (!gpgsm_program) - gpgsm_program = find_program_in_registry ("gpgsmProgram"); + gpgsm_program = (char*)find_program_in_registry ("gpgsmProgram"); #ifdef GPGSM_PATH if (!gpgsm_program) gpgsm_program = GPGSM_PATH; From cvs at cvs.gnupg.org Tue Mar 8 20:18:59 2005 From: cvs at cvs.gnupg.org (cvs user twoaday) Date: Wed Mar 9 13:22:56 2005 Subject: gpgme/tests/gpg (t-eventloop.c t-support.h t-thread1.c) Message-ID: Date: Tuesday, March 8, 2005 @ 20:18:59 Author: twoaday Path: /cvs/gnupg/gpgme/tests/gpg Modified: t-eventloop.c t-support.h t-thread1.c W32 updates. ---------------+ t-eventloop.c | 2 ++ t-support.h | 15 +++++++++++++-- t-thread1.c | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) From cvs at cvs.gnupg.org Tue Mar 8 20:18:34 2005 From: cvs at cvs.gnupg.org (cvs user twoaday) Date: Wed Mar 9 13:25:21 2005 Subject: gpgme/gpgme (11 files) Message-ID: Date: Tuesday, March 8, 2005 @ 20:18:34 Author: twoaday Path: /cvs/gnupg/gpgme/gpgme Modified: ChangeLog ath-compat.c ath.h data.h engine-gpgsm.c gpgme.c gpgme.h io.h w32-io.c w32-sema.c w32-util.c 2005-03-07 Timo Schulz * gpgme.h: [_WIN32] Removed ssize_t typedef. * ath.h: [_WIN32] Added some (dummy) types. * io.h: [_WIN32] include stdio.h. * data.h: [_WIN32] Define EOPNOTSUPP. * w32-io.c [_WIN32] (_gpgme_io_subsystem_init): New. * gpgme.c [_WIN32] (gpgme_set_locale): Disabled. ----------------+ ChangeLog | 9 +++++++++ ath-compat.c | 1 + ath.h | 18 +++++++++++++----- data.h | 4 ++++ engine-gpgsm.c | 2 ++ gpgme.c | 4 +++- gpgme.h | 3 --- io.h | 4 ++++ w32-io.c | 12 ++++++++++-- w32-sema.c | 1 + w32-util.c | 5 +++-- 11 files changed, 50 insertions(+), 13 deletions(-) From cvs at cvs.gnupg.org Wed Mar 9 16:50:21 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 9 16:50:23 2005 Subject: gpgme (16 files) Message-ID: Date: Wednesday, March 9, 2005 @ 17:03:05 Author: wk Path: /cvs/gpgme/gpgme Modified: ChangeLog Makefile.am acinclude.m4 autogen.sh complus/gpgcom.c configure.ac gpgme/ChangeLog gpgme/ath-compat.c gpgme/ath.h gpgme/data-compat.c gpgme/data.c gpgme/engine-gpgsm.c gpgme/gpgme.c gpgme/gpgme.h gpgme/io.h gpgme/w32-util.c * acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling. * Makefile.am (EXTRA_DIST): Include autogen.sh * autogen.sh: Added the usual code to build for W32 (--build-w32). * configure.ac: Fixed the mingw32 host string, removed OS/2 stuff. (HAVE_DRIVE_LETTERS): Removed. (HAVE_W32_SYSTEM): Added. (AC_GNU_SOURCE): New to replace the identical AH_VERBATIM. (AH_BOTTOM): Added. * w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Do not cast away type checks. * io.h [W32]: Do not include stdio.h. If it is needed do it at the right place. * data.h [W32]: Removed kludge for EOPNOTSUP. * data.c, data-compat.c [W32]: Explicitly test for it here. ----------------------+ ChangeLog | 16 +++++++++++++- Makefile.am | 2 - acinclude.m4 | 16 ++++++++++---- autogen.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ complus/gpgcom.c | 2 - configure.ac | 50 ++++++++++++++++++++++++++++--------------- gpgme/ChangeLog | 14 ++++++++++++ gpgme/ath-compat.c | 7 +++--- gpgme/ath.h | 14 +++++++----- gpgme/data-compat.c | 5 ++++ gpgme/data.c | 5 ++++ gpgme/engine-gpgsm.c | 6 +++-- gpgme/gpgme.c | 5 ++-- gpgme/gpgme.h | 3 +- gpgme/io.h | 3 -- gpgme/w32-util.c | 8 +++++-- 16 files changed, 170 insertions(+), 42 deletions(-) Index: gpgme/ChangeLog diff -u gpgme/ChangeLog:1.111 gpgme/ChangeLog:1.112 --- gpgme/ChangeLog:1.111 Wed Jan 12 11:28:42 2005 +++ gpgme/ChangeLog Wed Mar 9 17:03:05 2005 @@ -1,3 +1,17 @@ +2005-03-09 Werner Koch + + * acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling. + + * Makefile.am (EXTRA_DIST): Include autogen.sh + + * autogen.sh: Added the usual code to build for W32 (--build-w32). + + * configure.ac: Fixed the mingw32 host string, removed OS/2 stuff. + (HAVE_DRIVE_LETTERS): Removed. + (HAVE_W32_SYSTEM): Added. + (AC_GNU_SOURCE): New to replace the identical AH_VERBATIM. + (AH_BOTTOM): Added. + 2004-12-28 Werner Koch Released 1.0.2. @@ -564,7 +578,7 @@ * autogen.sh: Added option --build-w32. - Copyright 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without Index: gpgme/Makefile.am diff -u gpgme/Makefile.am:1.19 gpgme/Makefile.am:1.20 --- gpgme/Makefile.am:1.19 Wed Jan 12 11:28:42 2005 +++ gpgme/Makefile.am Wed Mar 9 17:03:05 2005 @@ -23,7 +23,7 @@ ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = dist-bzip2 -EXTRA_DIST = gpgme.spec.in +EXTRA_DIST = gpgme.spec.in autogen.sh if BUILD_ASSUAN assuan = assuan Index: gpgme/acinclude.m4 diff -u gpgme/acinclude.m4:1.14 gpgme/acinclude.m4:1.15 --- gpgme/acinclude.m4:1.14 Wed Jan 12 11:28:42 2005 +++ gpgme/acinclude.m4 Wed Mar 9 17:03:05 2005 @@ -50,8 +50,11 @@ AC_DEFUN([GNUPG_CHECK_VA_COPY], [ AC_MSG_CHECKING(whether va_lists must be copied by value) AC_CACHE_VAL(gnupg_cv_must_copy_va_byval,[ - gnupg_cv_must_copy_va_byval=no - AC_TRY_RUN([ + if test "$cross_compiling" = yes; then + gnupg_cv_must_copy_va_byval=no + else + gnupg_cv_must_copy_va_byval=no + AC_TRY_RUN([ #include void f (int i, ...) { @@ -69,10 +72,15 @@ f (0, 42); return 0; } - ],gnupg_cv_must_copy_va_byval=yes) + ],gnupg_cv_must_copy_va_byval=yes) + fi ]) if test "$gnupg_cv_must_copy_va_byval" = yes; then AC_DEFINE(MUST_COPY_VA_BYVAL,1,[used to implement the va_copy macro]) fi - AC_MSG_RESULT($gnupg_cv_must_copy_va_byval) + if test "$cross_compiling" = yes; then + AC_MSG_RESULT(assuming $gnupg_cv_must_copy_va_byval) + else + AC_MSG_RESULT($gnupg_cv_must_copy_va_byval) + fi ]) Index: gpgme/autogen.sh diff -u gpgme/autogen.sh:1.14 gpgme/autogen.sh:1.15 --- gpgme/autogen.sh:1.14 Mon Apr 19 16:09:29 2004 +++ gpgme/autogen.sh Wed Mar 9 17:03:05 2005 @@ -29,6 +29,62 @@ } +DIE=no + +# Used to cross-compile for Windows. +if test "$1" = "--build-w32"; then + tmp=`dirname $0` + tsdir=`cd "$tmp"; pwd` + shift + if [ ! -f $tsdir/config.guess ]; then + echo "$tsdir/config.guess not found" >&2 + exit 1 + fi + build=`$tsdir/config.guess` + + [ -z "$w32root" ] && w32root="$HOME/w32root" + echo "Using $w32root as standard install directory" >&2 + + # See whether we have the Debian cross compiler package or the + # old mingw32/cpd system + if i586-mingw32msvc-gcc --version >/dev/null 2>&1 ; then + host=i586-mingw32msvc + crossbindir=/usr/$host/bin + else + host=i386--mingw32 + if ! mingw32 --version >/dev/null; then + echo "We need at least version 0.3 of MingW32/CPD" >&2 + exit 1 + fi + crossbindir=`mingw32 --install-dir`/bin + # Old autoconf version required us to setup the environment + # with the proper tool names. + CC=`mingw32 --get-path gcc` + CPP=`mingw32 --get-path cpp` + AR=`mingw32 --get-path ar` + RANLIB=`mingw32 --get-path ranlib` + export CC CPP AR RANLIB + fi + + if [ -f "$tsdir/config.log" ]; then + if ! head $tsdir/config.log | grep "$host" >/dev/null; then + echo "Pease run a 'make distclean' first" >&2 + exit 1 + fi + fi + + ./configure --enable-maintainer-mode --prefix=${w32root} \ + --host=i586-mingw32msvc --build=${build} \ + --with-gpg-error-prefix=${w32root} \ + --disable-shared --with-gpgsm=c:/gnupg/gpgsm.exe + + exit $? +fi + + + + + # Grep the required versions from configure.ac autoconf_vers=`sed -n '/^AC_PREREQ(/ { s/^.*(\(.*\))/\1/p Index: gpgme/complus/gpgcom.c diff -u gpgme/complus/gpgcom.c:1.2 gpgme/complus/gpgcom.c:1.3 --- gpgme/complus/gpgcom.c:1.2 Tue Jul 31 11:44:22 2001 +++ gpgme/complus/gpgcom.c Wed Mar 9 17:03:04 2005 @@ -123,7 +123,7 @@ opt.homedir = getenv("GNUPGHOME"); if( !opt.homedir || !*opt.homedir ) { - #ifdef HAVE_DRIVE_LETTERS + #ifdef HAVE_DOSISH_SYSTEM opt.homedir = "c:/gnupg"; #else opt.homedir = "~/.gnupg"; Index: gpgme/configure.ac diff -u gpgme/configure.ac:1.96 gpgme/configure.ac:1.97 --- gpgme/configure.ac:1.96 Wed Jan 12 11:28:42 2005 +++ gpgme/configure.ac Wed Mar 9 17:03:05 2005 @@ -1,6 +1,6 @@ # configure.ac for GPGME # Copyright (C) 2000 Werner Koch (dd9jn) -# Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH +# Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH # # This file is part of GPGME. # @@ -43,8 +43,7 @@ NEED_GPG_VERSION=1.2.2 NEED_GPGSM_VERSION=1.9.6 ############################################## -AC_PREREQ(2.52) -AC_REVISION($Revision: 1.96 $) + PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION @@ -57,11 +56,8 @@ AM_MAINTAINER_MODE AC_CANONICAL_HOST -AH_VERBATIM([_GNU_SOURCE], -[/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif]) +# Enable GNU extensions on systems that have them. +AC_GNU_SOURCE AH_VERBATIM([_REENTRANT], [/* To allow the use of GPGME in multithreaded programs we have to use @@ -72,6 +68,16 @@ # define _REENTRANT 1 #endif]) +AH_BOTTOM([ +/* Some environments miss the definition for EOPNOTSUPP. We provide + the error code here and test where neded whether it should be + defined. Can't do the test here due to the order of includes. */ +#ifdef HAVE_W32_SYSTEM +#define VALUE_FOR_EOPNOTSUPP 95 +#endif /*!HAVE_W32_SYSTEM*/ + +]) + AC_PROG_CC @@ -109,17 +115,13 @@ GPG_DEFAULT=no GPGSM_DEFAULT=no component_system=None +have_dosish_system=no +have_w32_system=no case "${host}" in - *-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* ) + *-mingw32*) # special stuff for Windoze NT - # OS/2 with the EMX environment - # DOS with the DJGPP environment - AC_DEFINE(HAVE_DRIVE_LETTERS, , - [Defined if we run on some of the PCDOS like systems (DOS, - Windoze, OS/2) with special properties like no file modes.]) - AC_DEFINE(HAVE_DOSISH_SYSTEM, , - [Defined if the filesystem uses driver letters.]) have_dosish_system=yes + have_w32_system=yes GPG_DEFAULT='c:\\gnupg\\gpg.exe' # XXX Assuan is not supported in this configuration. #GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe' @@ -141,7 +143,21 @@ # GPGSM_DEFAULT='/usr/bin/gpgsm' ;; esac -AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = "yes") + +if test "$have_dosish_system" = yes; then + AC_DEFINE(HAVE_DOSISH_SYSTEM,1, + [Defined if we run on some of the PCDOS like systems + (DOS, Windoze. OS/2) with special properties like + no file modes]) +fi +AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes) + +if test "$have_w32_system" = yes; then + AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system]) +fi +AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes) + + AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes") AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes") Index: gpgme/gpgme/ChangeLog diff -u gpgme/gpgme/ChangeLog:1.391 gpgme/gpgme/ChangeLog:1.392 --- gpgme/gpgme/ChangeLog:1.391 Wed Mar 9 12:47:20 2005 +++ gpgme/gpgme/ChangeLog Wed Mar 9 17:03:04 2005 @@ -1,3 +1,17 @@ +2005-03-09 Werner Koch + + * w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Do not + cast away type checks. + + * io.h [W32]: Do not include stdio.h. If it is needed do it at + the right place. + + * data.h [W32]: Removed kludge for EOPNOTSUP. + * data.c, data-compat.c [W32]: Explicitly test for it here. + + Replaced use of _WIN32 by HAVE_W32_SYSTEM except for public header + files. + 2005-03-07 Timo Schulz * gpgme.h: [_WIN32] Removed ssize_t typedef. Index: gpgme/gpgme/ath-compat.c diff -u gpgme/gpgme/ath-compat.c:1.5 gpgme/gpgme/ath-compat.c:1.6 --- gpgme/gpgme/ath-compat.c:1.5 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/ath-compat.c Wed Mar 9 17:03:04 2005 @@ -22,17 +22,18 @@ #include #endif -#include #include +#include #ifdef HAVE_SYS_SELECT_H # include #else # include #endif #include -#ifndef _WIN32 +#ifndef HAVE_W32_SYSTEM #include -#endif +#endif /*!HAVE_W32_SYSTEM*/ + #include "ath.h" Index: gpgme/gpgme/ath.h diff -u gpgme/gpgme/ath.h:1.8 gpgme/gpgme/ath.h:1.9 --- gpgme/gpgme/ath.h:1.8 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/ath.h Wed Mar 9 17:03:04 2005 @@ -21,12 +21,15 @@ #ifndef ATH_H #define ATH_H -#ifdef _WIN32 -struct msghdr { int dummy; }; -typedef int socklen_t; +#ifdef HAVE_W32_SYSTEM + /* fixme: Check how we did it in libgcrypt. */ + struct msghdr { int dummy; }; + typedef int socklen_t; # include # include -#else + +#else /*!HAVE_W32_SYSTEM*/ + # ifdef HAVE_SYS_SELECT_H # include # else @@ -34,7 +37,8 @@ # endif # include # include -#endif + +#endif /*!HAVE_W32_SYSTEM*/ Index: gpgme/gpgme/data-compat.c diff -u gpgme/gpgme/data-compat.c:1.9 gpgme/gpgme/data-compat.c:1.10 --- gpgme/gpgme/data-compat.c:1.9 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/data-compat.c Wed Mar 9 17:03:04 2005 @@ -30,6 +30,11 @@ #include "data.h" #include "util.h" +#if defined(HAVE_W32_SYSTEM) && !defined(EOPNOTSUPP) +#define EOPNOTSUPP VALUE_FOR_EOPNOTSUPP +#endif + + /* Create a new data buffer filled with LENGTH bytes starting from OFFSET within the file FNAME or stream STREAM (exactly one must be Index: gpgme/gpgme/data.c diff -u gpgme/gpgme/data.c:1.42 gpgme/gpgme/data.c:1.43 --- gpgme/gpgme/data.c:1.42 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/data.c Wed Mar 9 17:03:04 2005 @@ -33,6 +33,11 @@ #include "ops.h" #include "io.h" +#if defined(HAVE_W32_SYSTEM) && !defined(EOPNOTSUPP) +#define EOPNOTSUPP VALUE_FOR_EOPNOTSUPP +#endif + + gpgme_error_t _gpgme_data_new (gpgme_data_t *r_dh, struct _gpgme_data_cbs *cbs) Index: gpgme/gpgme/engine-gpgsm.c diff -u gpgme/gpgme/engine-gpgsm.c:1.103 gpgme/gpgme/engine-gpgsm.c:1.104 --- gpgme/gpgme/engine-gpgsm.c:1.103 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/engine-gpgsm.c Wed Mar 9 17:03:04 2005 @@ -19,11 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _WIN32 #if HAVE_CONFIG_H #include #endif +#ifndef HAVE_W32_SYSTEM + #include #include #include @@ -1597,4 +1598,5 @@ gpgsm_io_event, gpgsm_cancel }; -#endif + +#endif /*!HAVE_W32_SYSTEM*/ Index: gpgme/gpgme/gpgme.c diff -u gpgme/gpgme/gpgme.c:1.79 gpgme/gpgme/gpgme.c:1.80 --- gpgme/gpgme/gpgme.c:1.79 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/gpgme.c Wed Mar 9 17:03:04 2005 @@ -344,7 +344,7 @@ gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value) { -#ifndef _WIN32 +#ifndef HAVE_W32_SYSTEM int failed = 0; char *new_lc_ctype; char *new_lc_messages; @@ -398,7 +398,8 @@ SET_ONE_LOCALE (messages, MESSAGES); if (!ctx) UNLOCK (def_lc_lock); -#endif + +#endif /*!HAVE_W32_SYSTEM*/ return 0; } Index: gpgme/gpgme/gpgme.h diff -u gpgme/gpgme/gpgme.h:1.152 gpgme/gpgme/gpgme.h:1.153 --- gpgme/gpgme/gpgme.h:1.152 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/gpgme.h Wed Mar 9 17:03:04 2005 @@ -72,7 +72,8 @@ 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.0.1" +#define GPGME_VERSION "1.1.0-cvs" + /* Some opaque data types used by GPGME. */ Index: gpgme/gpgme/io.h diff -u gpgme/gpgme/io.h:1.13 gpgme/gpgme/io.h:1.14 --- gpgme/gpgme/io.h:1.13 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/io.h Wed Mar 9 17:03:04 2005 @@ -22,9 +22,6 @@ #ifndef IO_H #define IO_H -#ifdef _WIN32 -#include -#endif /* A single file descriptor passed to spawn. For child fds, dup_to specifies the fd it should become in the child. */ Index: gpgme/gpgme/w32-util.c diff -u gpgme/gpgme/w32-util.c:1.12 gpgme/gpgme/w32-util.c:1.13 --- gpgme/gpgme/w32-util.c:1.12 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/w32-util.c Wed Mar 9 17:03:04 2005 @@ -51,6 +51,10 @@ DWORD n1, nbytes; char *result = NULL; +#ifdef HAVE_W32_SYSTEM +#warning Check that this code matches the one used by gnupg +#endif + if (!root) root_key = HKEY_CURRENT_USER; else if (!strcmp (root, "HKEY_CLASSES_ROOT")) @@ -120,7 +124,7 @@ LOCK (get_path_lock); if (!gpg_program) - gpg_program = (char*)find_program_in_registry ("gpgProgram"); + gpg_program = find_program_in_registry ("gpgProgram"); #ifdef GPG_PATH if (!gpg_program) gpg_program = GPG_PATH; @@ -136,7 +140,7 @@ LOCK (get_path_lock); if (!gpgsm_program) - gpgsm_program = (char*)find_program_in_registry ("gpgsmProgram"); + gpgsm_program = find_program_in_registry ("gpgsmProgram"); #ifdef GPGSM_PATH if (!gpgsm_program) gpgsm_program = GPGSM_PATH; From cvs at cvs.gnupg.org Wed Mar 9 17:01:28 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 9 17:01:30 2005 Subject: dirmngr/src (ChangeLog dirmngr.c) Message-ID: Date: Wednesday, March 9, 2005 @ 17:14:13 Author: wk Path: /cvs/dirmngr/dirmngr/src Modified: ChangeLog dirmngr.c Add a note to the help listing check the man page for other options. -----------+ ChangeLog | 5 +++++ dirmngr.c | 5 +++++ 2 files changed, 10 insertions(+) Index: dirmngr/src/ChangeLog diff -u dirmngr/src/ChangeLog:1.42 dirmngr/src/ChangeLog:1.43 --- dirmngr/src/ChangeLog:1.42 Tue Feb 1 17:49:15 2005 +++ dirmngr/src/ChangeLog Wed Mar 9 17:14:13 2005 @@ -1,3 +1,8 @@ +2005-03-09 Werner Koch + + * dirmngr.c: Add a note to the help listing check the man page for + other options. + 2005-02-01 Werner Koch * crlcache.c (crl_parse_insert): Renamed a few variables and Index: dirmngr/src/dirmngr.c diff -u dirmngr/src/dirmngr.c:1.55 dirmngr/src/dirmngr.c:1.56 --- dirmngr/src/dirmngr.c:1.55 Tue Feb 1 17:49:15 2005 +++ dirmngr/src/dirmngr.c Wed Mar 9 17:14:13 2005 @@ -171,6 +171,11 @@ { oLDAPWrapperProgram, "ldap-wrapper-program", 2, "@"}, { oHTTPWrapperProgram, "http-wrapper-program", 2, "@"}, { oHonorHTTPProxy, "honor-http-proxy", 0, "@" }, + + { 302, NULL, 0, N_( + "@\n(See the man page for a complete listing of all commands and options)\n" + )}, + {0} }; From cvs at cvs.gnupg.org Wed Mar 9 20:10:08 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 9 20:10:12 2005 Subject: GNUPG-1-9-BRANCH gnupg/tools (gpgconf-comp.c) Message-ID: Date: Wednesday, March 9, 2005 @ 20:22:54 Author: wk Path: /cvs/gnupg/gnupg/tools Tag: GNUPG-1-9-BRANCH Modified: gpgconf-comp.c Fixed description for dirmngr:honor-http-proxy ----------------+ gpgconf-comp.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: gnupg/tools/gpgconf-comp.c diff -u gnupg/tools/gpgconf-comp.c:1.1.2.50 gnupg/tools/gpgconf-comp.c:1.1.2.51 --- gnupg/tools/gpgconf-comp.c:1.1.2.50 Wed Mar 9 11:11:14 2005 +++ gnupg/tools/gpgconf-comp.c Wed Mar 9 20:22:54 2005 @@ -748,7 +748,7 @@ GC_ARG_TYPE_STRING, GC_BACKEND_DIRMNGR }, { "honor-http-proxy", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, "dirmngr", N_("use system's HTTP proxy setting"), - GC_ARG_TYPE_STRING, GC_BACKEND_DIRMNGR }, + GC_ARG_TYPE_NONE, GC_BACKEND_DIRMNGR }, { "LDAP", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, From cvs at cvs.gnupg.org Thu Mar 10 10:39:18 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Thu Mar 10 10:39:20 2005 Subject: gnupg/util (ChangeLog miscutil.c secmem.c) Message-ID: Date: Thursday, March 10, 2005 @ 10:52:05 Author: wk Path: /cvs/gnupg/gnupg/util Modified: ChangeLog miscutil.c secmem.c (secmem_realloc): Take control information into account when checking whether a resize is needed. ------------+ ChangeLog | 12 +++++++++++- miscutil.c | 8 +++++++- secmem.c | 13 ++++++++++--- 3 files changed, 28 insertions(+), 5 deletions(-) Index: gnupg/util/ChangeLog diff -u gnupg/util/ChangeLog:1.181 gnupg/util/ChangeLog:1.182 --- gnupg/util/ChangeLog:1.181 Fri Feb 4 11:18:46 2005 +++ gnupg/util/ChangeLog Thu Mar 10 10:52:05 2005 @@ -1,3 +1,12 @@ +2005-03-10 Werner Koch + + * secmem.c (secmem_realloc): Take control information into account + when checking whether a resize is needed. + +2005-03-08 Werner Koch + + * miscutil.c (asctimestamp) [W32]: Don't use %Z. + 2005-02-03 Werner Koch * w32reg.c (read_w32_registry_string): Fallback to HKLM also for a @@ -1468,7 +1477,8 @@ - Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 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 Index: gnupg/util/miscutil.c diff -u gnupg/util/miscutil.c:1.33 gnupg/util/miscutil.c:1.34 --- gnupg/util/miscutil.c:1.33 Sat Feb 21 23:12:29 2004 +++ gnupg/util/miscutil.c Thu Mar 10 10:52:05 2005 @@ -167,7 +167,13 @@ * These locales from glibc don't put the " %Z": * fi_FI hr_HR ja_JP lt_LT lv_LV POSIX ru_RU ru_SU sv_FI sv_SE zh_CN */ - strftime( buffer, DIM(buffer)-1, "%c %Z", tp ); + strftime( buffer, DIM(buffer)-1, +#ifdef HAVE_W32_SYSTEM + "%c" +#else + "%c %Z" +#endif + , tp ); #endif buffer[DIM(buffer)-1] = 0; #else Index: gnupg/util/secmem.c diff -u gnupg/util/secmem.c:1.42 gnupg/util/secmem.c:1.43 --- gnupg/util/secmem.c:1.42 Thu Dec 16 06:16:09 2004 +++ gnupg/util/secmem.c Thu Mar 10 10:52:05 2005 @@ -349,7 +349,10 @@ print_warn(); } - /* blocks are always a multiple of 32 */ + /* Blocks are always a multiple of 32. Note that we allocate an + extra of the size of an entire MEMBLOCK. This is required + becuase we do not only need the SIZE info but also extra space + to chain up unused memory blocks. */ size += sizeof(MEMBLOCK); size = ((size + 31) / 32) * 32; @@ -398,8 +401,12 @@ mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.aligned.c)); size = mb->size; - if( newsize < size ) - return p; /* it is easier not to shrink the memory */ + if (size < sizeof(MEMBLOCK)) + log_bug ("secure memory corrupted at block %p\n", mb); + size -= ((size_t) &((MEMBLOCK*)0)->u.aligned.c); + + if( newsize <= size ) + return p; /* It is easier not to shrink the memory. */ a = secmem_malloc( newsize ); if ( a ) { memcpy(a, p, size); From cvs at cvs.gnupg.org Thu Mar 10 10:41:38 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Thu Mar 10 10:41:45 2005 Subject: STABLE-BRANCH-1-2 gnupg/util (ChangeLog secmem.c) Message-ID: Date: Thursday, March 10, 2005 @ 10:54:27 Author: wk Path: /cvs/gnupg/gnupg/util Tag: STABLE-BRANCH-1-2 Modified: ChangeLog secmem.c (secmem_realloc): Take control information into account when testing for a resize. -----------+ ChangeLog | 5 +++++ secmem.c | 4 ++++ 2 files changed, 9 insertions(+) Index: gnupg/util/ChangeLog diff -u gnupg/util/ChangeLog:1.100.2.29 gnupg/util/ChangeLog:1.100.2.30 --- gnupg/util/ChangeLog:1.100.2.29 Fri Dec 3 21:04:08 2004 +++ gnupg/util/ChangeLog Thu Mar 10 10:54:27 2005 @@ -1,3 +1,8 @@ +2005-03-10 Werner Koch + + * secmem.c (secmem_realloc): Take control information into account + when testing for a resize. + 2004-12-03 David Shaw * http.c (send_request): Include the port if non-80 in the Host: Index: gnupg/util/secmem.c diff -u gnupg/util/secmem.c:1.35.2.5 gnupg/util/secmem.c:1.35.2.6 --- gnupg/util/secmem.c:1.35.2.5 Tue Feb 24 17:04:37 2004 +++ gnupg/util/secmem.c Thu Mar 10 10:54:27 2005 @@ -393,6 +393,10 @@ mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.aligned.c)); size = mb->size; + if (size < sizeof(MEMBLOCK)) + log_bug ("secure memory corrupted at block %p\n", mb); + size -= ((size_t) &((MEMBLOCK*)0)->u.aligned.c); + if( newsize < size ) return p; /* it is easier not to shrink the memory */ a = secmem_malloc( newsize ); From cvs at cvs.gnupg.org Thu Mar 10 19:28:07 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Thu Mar 10 19:28:11 2005 Subject: gnupg/g10 (ChangeLog keyedit.c) Message-ID: Date: Thursday, March 10, 2005 @ 19:40:58 Author: wk Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog keyedit.c (keyedit_menu) [W32]: Run the trustdb stale check earlier. -----------+ ChangeLog | 5 +++++ keyedit.c | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.700 gnupg/g10/ChangeLog:1.701 --- gnupg/g10/ChangeLog:1.700 Mon Mar 7 14:59:59 2005 +++ gnupg/g10/ChangeLog Thu Mar 10 19:40:57 2005 @@ -1,3 +1,8 @@ +2005-03-10 Werner Koch + + * keyedit.c (keyedit_menu) [W32]: Run the trustdb stale check + earlier. + 2005-03-07 Werner Koch * cardglue.c (agent_scd_pkdecrypt, agent_scd_pksign) Index: gnupg/g10/keyedit.c diff -u gnupg/g10/keyedit.c:1.172 gnupg/g10/keyedit.c:1.173 --- gnupg/g10/keyedit.c:1.172 Thu Feb 24 22:21:14 2005 +++ gnupg/g10/keyedit.c Thu Mar 10 19:40:57 2005 @@ -1431,7 +1431,20 @@ goto leave; } - /* get the public key */ +#ifdef HAVE_W32_SYSTEM + /* Due to Windows peculiarities we need to make sure that the + trustdb stale check is done before we open another file + (i.e. by searching for a key). In theory we could make sure + that the files are closed after use but the open/close caches + inhibits that and flushing the cache right before the stale + check is not easy to implement. Thus we take the easy way out + and run the stale check as early as possible. Note, that for + non- W32 platforms it is run indirectly trough a call to + get_validity (). */ + check_trustdb_stale (); +#endif + + /* Get the public key */ rc = get_pubkey_byname (NULL, username, &keyblock, &kdbhd, 1); if( rc ) goto leave; From cvs at cvs.gnupg.org Thu Mar 10 19:30:46 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 10 19:30:49 2005 Subject: gnupg/g10 (ChangeLog delkey.c) Message-ID: Date: Thursday, March 10, 2005 @ 19:43:37 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog delkey.c * delkey.c (do_delete_key, delete_keys): Fix problem with --expert preventing --delete-secret-and-public-keys from deleting secret keys. -----------+ ChangeLog | 6 ++++++ delkey.c | 54 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 38 insertions(+), 22 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.701 gnupg/g10/ChangeLog:1.702 --- gnupg/g10/ChangeLog:1.701 Thu Mar 10 19:40:57 2005 +++ gnupg/g10/ChangeLog Thu Mar 10 19:43:36 2005 @@ -1,3 +1,9 @@ +2005-03-10 David Shaw + + * delkey.c (do_delete_key, delete_keys): Fix problem with --expert + preventing --delete-secret-and-public-keys from deleting secret + keys. + 2005-03-10 Werner Koch * keyedit.c (keyedit_menu) [W32]: Run the trustdb stale check Index: gnupg/g10/delkey.c diff -u gnupg/g10/delkey.c:1.19 gnupg/g10/delkey.c:1.20 --- gnupg/g10/delkey.c:1.19 Thu Oct 28 05:57:30 2004 +++ gnupg/g10/delkey.c Thu Mar 10 19:43:36 2005 @@ -1,6 +1,6 @@ /* delkey.c - delete keys - * Copyright (C) 1998, 1999, 2000, 2001, 2002, - * 2004 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, + * 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -48,7 +48,7 @@ * key can't be deleted for that reason. */ static int -do_delete_key( const char *username, int secret, int *r_sec_avail ) +do_delete_key( const char *username, int secret, int force, int *r_sec_avail ) { int rc = 0; KBNODE keyblock = NULL; @@ -91,25 +91,32 @@ goto leave; } - if( secret ) { + if( secret ) + { sk = node->pkt->pkt.secret_key; keyid_from_sk( sk, keyid ); - } - else { + } + else + { + /* public */ pk = node->pkt->pkt.public_key; keyid_from_pk( pk, keyid ); - rc = seckey_available( keyid ); - if( !rc && !opt.expert ) { - *r_sec_avail = 1; - rc = -1; - goto leave; - } - else if( rc != G10ERR_NO_SECKEY ) { - log_error("%s: get secret key: %s\n", username, g10_errstr(rc) ); - } - else - rc = 0; - } + + if(!force) + { + rc = seckey_available( keyid ); + if( !rc ) + { + *r_sec_avail = 1; + rc = -1; + goto leave; + } + else if( rc != G10ERR_NO_SECKEY ) + log_error("%s: get secret key: %s\n", username, g10_errstr(rc) ); + else + rc = 0; + } + } if( rc ) rc = 0; @@ -180,15 +187,18 @@ int delete_keys( STRLIST names, int secret, int allow_both ) { - int rc, avail; + int rc, avail, force=(!allow_both && !secret && opt.expert); + + /* Force allows us to delete a public key even if a secret key + exists. */ for(;names;names=names->next) { - rc = do_delete_key (names->d, secret, &avail ); + rc = do_delete_key (names->d, secret, force, &avail ); if ( rc && avail ) { if ( allow_both ) { - rc = do_delete_key (names->d, 1, &avail ); + rc = do_delete_key (names->d, 1, 0, &avail ); if ( !rc ) - rc = do_delete_key (names->d, 0, &avail ); + rc = do_delete_key (names->d, 0, 0, &avail ); } else { log_error(_( From cvs at cvs.gnupg.org Thu Mar 10 20:12:21 2005 From: cvs at cvs.gnupg.org (cvs user twoaday) Date: Thu Mar 10 20:12:23 2005 Subject: gpgme/w32-dll [new] Message-ID: Date: Thursday, March 10, 2005 @ 20:25:13 Author: twoaday Path: /cvs/gpgme/gpgme/w32-dll Directory /cvs/gpgme/gpgme/w32-dll added to the repository From cvs at cvs.gnupg.org Thu Mar 10 20:13:03 2005 From: cvs at cvs.gnupg.org (cvs user twoaday) Date: Thu Mar 10 20:13:07 2005 Subject: gpgme/w32-dll (ChangeLog build-dll gpgme.def) Message-ID: Date: Thursday, March 10, 2005 @ 20:25:55 Author: twoaday Path: /cvs/gpgme/gpgme/w32-dll Added: ChangeLog build-dll gpgme.def 2005-03-10 Timo Schulz * gpgme.def: New. Exported GPGME functions. * build-dll: New. -----------+ ChangeLog | 5 +++ build-dll | 58 ++++++++++++++++++++++++++++++++++++ gpgme.def | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) Index: gpgme/w32-dll/ChangeLog diff -u /dev/null gpgme/w32-dll/ChangeLog:1.1 --- /dev/null Thu Mar 10 20:25:55 2005 +++ gpgme/w32-dll/ChangeLog Thu Mar 10 20:25:55 2005 @@ -0,0 +1,5 @@ +2005-03-10 Timo Schulz + + * gpgme.def: New. Exported GPGME functions. + * build-dll: New. + \ No newline at end of file Index: gpgme/w32-dll/build-dll diff -u /dev/null gpgme/w32-dll/build-dll:1.1 --- /dev/null Thu Mar 10 20:25:55 2005 +++ gpgme/w32-dll/build-dll Thu Mar 10 20:25:55 2005 @@ -0,0 +1,58 @@ +#!/bin/sh +# Run this to generate the libgcrypt W32 DLL +# +# Copyright (C) 2001, 2002 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 +# modifications, as long as this notice is preserved. +# +# This program 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. + +AS=i586-mingw32msvc-as +OBJS= + +grep "#define HAVE_DOSISH_SYSTEM" ../config.h +if [ $? = 1 ]; then + exit +fi + +for i in $(ls ../gpgme/*.o); do + OBJS="$OBJS $i" +done +OBJS="$OBJS /home/twoaday/w32root/lib/libgpg-error.a" +OBJS="$OBJS ../gpgme/stpcpy.o ../gpgme/vasprintf.o" + +echo 'running dlltool the first time' >&2 +mingw32 dlltool --nodelete \ + --as $AS \ + --def gpgme.def \ + --output-exp gpgme.exp \ + --output-lib gpgme.imp \ + --dllname gpgme.dll $OBJS +echo 'doing dummy link to create the base file' >&2 +mingw32 gcc -mdll -Wl,--base-file -Wl,gpgme.base \ + -o gpgme.dll gpgme.exp $OBJS +echo 'running dlltool the second time' >&2 +mingw32 dlltool --nodelete \ + --as $AS \ + --def gpgme.def \ + --output-exp gpgme.exp \ + --output-lib gpgme.imp \ + --base-file gpgme.base \ + --dllname gpgme.dll $OBJS + +echo 'doing final link' >&2 +mingw32 gcc -mdll -o gpgme.dll gpgme.exp $OBJS +mingw32 strip gpgme.dll + +mingw32 dlltool --def gpgme.def \ + --as $AS \ + --dllname gpgme.dll \ + --output-lib gpgme.lib + +echo 'clean up' +rm -f dh.o dh.s dt.o dt.s +rm -f gpgme.base gpgme.exp gpgme.imp tgpgme.exp \ No newline at end of file Index: gpgme/w32-dll/gpgme.def diff -u /dev/null gpgme/w32-dll/gpgme.def:1.1 --- /dev/null Thu Mar 10 20:25:55 2005 +++ gpgme/w32-dll/gpgme.def Thu Mar 10 20:25:55 2005 @@ -0,0 +1,95 @@ +;; gpgme.def - Exported symbols for W32 +;; Copyright (C) 2005 g10 Code GmbH +;; +;; This file is part of GPGME. +;; +;; GPGME 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. +;; +;; GPGME 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, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +;; + +;; Note: This file should be updated manually and the ordinals shall +;; never be changed. + +EXPORTS + gpgme_strerror @5 + gpgme_strerror_r @6 + gpgme_strsource @7 + gpgme_err_code_from_errno @8 + gpgme_err_code_to_errno @9 + gpgme_err_make_from_errno @10 + gpgme_error_from_errno @11 + gpgme_new @12 + gpgme_release @13 + gpgme_set_protocol @14 + gpgme_get_protocol @15 + gpgme_get_protocol_name @16 + gpgme_set_armor @17 + gpgme_get_armor @18 + gpgme_set_textmode @19 + gpgme_get_textmode @20 + gpgme_set_include_certs @21 + gpgme_get_include_certs @22 + gpgme_get_keylist_mode @23 + gpgme_ctx_get_engine_info @24 + gpgme_pubkey_algo_name @25 + gpgme_hash_algo_name @26 + gpgme_signers_clear @27 + gpgme_signers_add @28 + gpgme_signers_enum @29 + gpgme_get_sig_key @30 + gpgme_set_io_cbs @31 + gpgme_get_io_cbs @32 + gpgme_wait @33 + gpgme_data_read @34 + gpgme_data_write @35 + gpgme_data_seek @36 + gpgme_data_new @37 + gpgme_data_release @38 + gpgme_data_release_and_get_mem @39 + gpgme_data_new_from_fd @40 + gpgme_data_new_from_stream @41 + gpgme_data_get_encoding @42 + gpgme_data_rewind @43 + gpgme_key_ref @44 + gpgme_key_unref @45 + gpgme_key_release @46 + gpgme_cancel @47 + gpgme_op_encrypt_result @48 + gpgme_op_decrypt_result @49 + gpgme_op_sign_result @50 + gpgme_op_verify_result @51 + gpgme_op_import_result @52 + gpgme_op_import_start @53 + gpgme_op_import @54 + gpgme_op_genkey_result @55 + gpgme_op_keylist_result @56 + gpgme_op_keylist_next @57 + gpgme_op_keylist_end @58 + gpgme_op_trustlist_end @59 + gpgme_trust_item_ref @60 + gpgme_trust_item_unref @61 + gpgme_trust_item_release @62 + gpgme_check_version @63 + gpgme_get_engine_info @64 + gpgme_engine_check_version @65 + + + + + + + + + + From cvs at cvs.gnupg.org Thu Mar 10 20:21:49 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 10 20:21:53 2005 Subject: gnupg/g10 (ChangeLog keyserver.c) Message-ID: Date: Thursday, March 10, 2005 @ 20:34:40 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog keyserver.c * keyserver.c (parse_keyserver_options): Accept honor-http-proxy as an alias for http-proxy. -------------+ ChangeLog | 3 +++ keyserver.c | 8 ++++++++ 2 files changed, 11 insertions(+) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.702 gnupg/g10/ChangeLog:1.703 --- gnupg/g10/ChangeLog:1.702 Thu Mar 10 19:43:36 2005 +++ gnupg/g10/ChangeLog Thu Mar 10 20:34:40 2005 @@ -1,5 +1,8 @@ 2005-03-10 David Shaw + * keyserver.c (parse_keyserver_options): Accept honor-http-proxy + as an alias for http-proxy. + * delkey.c (do_delete_key, delete_keys): Fix problem with --expert preventing --delete-secret-and-public-keys from deleting secret keys. Index: gnupg/g10/keyserver.c diff -u gnupg/g10/keyserver.c:1.80 gnupg/g10/keyserver.c:1.81 --- gnupg/g10/keyserver.c:1.80 Sun Feb 6 18:38:43 2005 +++ gnupg/g10/keyserver.c Thu Mar 10 20:34:40 2005 @@ -83,6 +83,14 @@ if(tok[0]=='\0') continue; + /* For backwards compatibility. 1.2.x used honor-http-proxy and + there are a good number of documents published that recommend + it. */ + if(ascii_strcasecmp(tok,"honor-http-proxy")==0) + tok="http-proxy"; + else if(ascii_strcasecmp(tok,"no-honor-http-proxy")==0) + tok="no-http-proxy"; + /* We accept quite a few possible options here - some options to handle specially, the keyserver_options list, and import and export options that pertain to keyserver operations. Note From cvs at cvs.gnupg.org Fri Mar 11 11:49:19 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Fri Mar 11 11:49:23 2005 Subject: gnupg (8 files) Message-ID: Date: Friday, March 11, 2005 @ 12:02:12 Author: wk Path: /cvs/gnupg/gnupg Modified: ChangeLog NEWS README configure.ac doc/ChangeLog doc/gpg.sgml mpi/ChangeLog mpi/Makefile.am * configure.ac: New option --enable-noexecstack. * Makefile.am (ASFLAGS): Renamed to AM_CCASFLAGS and added the variable for non exectubale stack options. Adapted users. -----------------+ ChangeLog | 4 ++++ NEWS | 2 ++ README | 4 ++++ configure.ac | 27 ++++++++++++++++++++++++++- doc/ChangeLog | 2 ++ doc/gpg.sgml | 4 ++++ mpi/ChangeLog | 5 +++++ mpi/Makefile.am | 6 +++--- 8 files changed, 50 insertions(+), 4 deletions(-) Index: gnupg/ChangeLog diff -u gnupg/ChangeLog:1.242 gnupg/ChangeLog:1.243 --- gnupg/ChangeLog:1.242 Wed Feb 16 21:08:14 2005 +++ gnupg/ChangeLog Fri Mar 11 12:02:12 2005 @@ -1,3 +1,7 @@ +2005-03-11 Werner Koch + + * configure.ac: New option --enable-noexecstack. + 2005-02-16 Werner Koch Released 1.4.1rc2. Index: gnupg/NEWS diff -u gnupg/NEWS:1.235 gnupg/NEWS:1.236 --- gnupg/NEWS:1.235 Wed Feb 16 21:08:14 2005 +++ gnupg/NEWS Fri Mar 11 12:02:12 2005 @@ -53,6 +53,8 @@ * The "fetch" command of --card-edit now retrieves the key using the default keyserver if no URL has been stored on the card. + * New configure option --enable-noexecstack. + Noteworthy changes in version 1.4.0 (2004-12-16) ------------------------------------------------ Index: gnupg/README diff -u gnupg/README:1.93 gnupg/README:1.94 --- gnupg/README:1.93 Sun Jan 23 02:19:32 2005 +++ gnupg/README Fri Mar 11 12:02:12 2005 @@ -607,6 +607,10 @@ This prevents access to certain files and won't allow import or export of secret keys. + --enable-noexecstack + Pass option --noexecstack to as. Works only when + using gcc. + --disable-gnupg-iconv If iconv is available it is used to convert between utf-8 and the system character set. This Index: gnupg/configure.ac diff -u gnupg/configure.ac:1.133 gnupg/configure.ac:1.134 --- gnupg/configure.ac:1.133 Wed Feb 16 21:08:14 2005 +++ gnupg/configure.ac Fri Mar 11 12:02:12 2005 @@ -19,7 +19,7 @@ dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA dnl dnl (Process this file with autoconf to produce a configure script.) -dnlAC_REVISION($Revision: 1.133 $)dnl +dnlAC_REVISION($Revision: 1.134 $)dnl AC_PREREQ(2.59) min_automake_version="1.9.3" @@ -102,6 +102,18 @@ AC_DEFINE(M_GUARD,1,[Define to use the (obsolete) malloc guarding feature]) fi +# We don't have a test to check whetyer as(1) knows about the +# non executable stackioption. Thus we provide an option to enable +# it. +AC_MSG_CHECKING([whether non excutable stack support is requested]) +AC_ARG_ENABLE(noexecstack, + AC_HELP_STRING([--enable-noexecstack], + [enable non executable stack support (gcc only)]), + noexecstack_support=$enableval, noexecstack_support=no) +AC_MSG_RESULT($noexecstack_support) + +# SELinux support includes tracking of sensitive files to avoid +# leaking their contents through processing these files by gpg itself AC_MSG_CHECKING([whether SELinux support is requested]) AC_ARG_ENABLE(selinux-support, AC_HELP_STRING([--enable-selinux-support], @@ -109,6 +121,7 @@ selinux_support=$enableval, selinux_support=no) AC_MSG_RESULT($selinux_support) + AC_MSG_CHECKING([whether OpenPGP card support is requested]) AC_ARG_ENABLE(card-support, AC_HELP_STRING([--disable-card-support], @@ -1234,14 +1247,26 @@ AC_SUBST(NETLIBS) AC_SUBST(W32LIBS) +# Special options used fith gcc. if test "$GCC" = yes; then + # Note that it is okay to use CFLAGS here because this are just + # warning options and the user should have a chance of overriding + #them. if test "$USE_MAINTAINER_MODE" = "yes"; then CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes" CFLAGS="$CFLAGS -Wformat-nonliteral" else CFLAGS="$CFLAGS -Wall" fi + + # Non exec stack hack. Fixme: Write a test to check whether as + # can cope with it and use the enable-noexecstack option only to + # disable it in case it is required on sime platforms. + if test "$noexecstack_support" = yes; then + NOEXECSTACK_FLAGS="-Wa,--noexecstack" + fi fi +AC_SUBST(NOEXECSTACK_FLAGS) if test "$print_egd_warning" = yes; then Index: gnupg/doc/ChangeLog diff -u gnupg/doc/ChangeLog:1.97 gnupg/doc/ChangeLog:1.98 --- gnupg/doc/ChangeLog:1.97 Mon Mar 7 14:59:59 2005 +++ gnupg/doc/ChangeLog Fri Mar 11 12:02:12 2005 @@ -1,5 +1,7 @@ 2005-03-07 Werner Koch + * gpg.sgml (comment): Add note to keep the comment short. + * DETAILS: Document new status codes. 2005-02-15 Werner Koch Index: gnupg/doc/gpg.sgml diff -u gnupg/doc/gpg.sgml:1.80 gnupg/doc/gpg.sgml:1.81 --- gnupg/doc/gpg.sgml:1.80 Tue Feb 15 12:02:31 2005 +++ gnupg/doc/gpg.sgml Fri Mar 11 12:02:12 2005 @@ -1769,6 +1769,10 @@ ASCII armored messages or keys (see --armor). The default behavior is not to use a comment string. --comment may be repeated multiple times to get multiple comment strings. --no-comments removes all comments. +It is a good idea to keep the length of a single comment below 60 +characters to avoid problems with mail programs wrapping such lines. +Note, that those comment lines, like all other header lines, are not +protected by the signature. Index: gnupg/mpi/ChangeLog diff -u gnupg/mpi/ChangeLog:1.80 gnupg/mpi/ChangeLog:1.81 --- gnupg/mpi/ChangeLog:1.80 Mon Dec 20 11:05:20 2004 +++ gnupg/mpi/ChangeLog Fri Mar 11 12:02:12 2005 @@ -1,3 +1,8 @@ +2005-03-11 Werner Koch + + * Makefile.am (ASFLAGS): Renamed to AM_CCASFLAGS and added the + variable for non exectubale stack options. Adapted users. + 2004-12-20 Werner Koch * mpicoder.c (mpi_read_from_buffer): Don't abort in case of an Index: gnupg/mpi/Makefile.am diff -u gnupg/mpi/Makefile.am:1.30 gnupg/mpi/Makefile.am:1.31 --- gnupg/mpi/Makefile.am:1.30 Wed Oct 13 09:11:10 2004 +++ gnupg/mpi/Makefile.am Fri Mar 11 12:02:12 2005 @@ -20,8 +20,8 @@ INCLUDES = -I.. -I$(top_srcdir)/include -AM_CFLAGS = @MPI_OPT_FLAGS@ -ASFLAGS = @MPI_SFLAGS@ +AM_CFLAGS = $(MPI_OPT_FLAGS) +AM_CCASFLAGS = $(NOEXECSTACK_FLAGS) $(MPI_SFLAGS) EXTRA_DIST = config.links DISTCLEANFILES = mpi-asm-defs.h \ @@ -73,7 +73,7 @@ # work and add one to cpp .S files .S.o: $(CPP) $(INCLUDES) $(DEFS) $< | grep -v '^#' > _$*.s - $(COMPILE) $(ASFLAGS) -c _$*.s + $(COMPILE) $(AM_CCASFLAGS) -c _$*.s mv -f _$*.o $*.o .S.lo: From cvs at cvs.gnupg.org Mon Mar 14 20:06:09 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Mon Mar 14 20:06:12 2005 Subject: gnupg (14 files) Message-ID: Date: Monday, March 14, 2005 @ 20:19:21 Author: wk Path: /cvs/gnupg/gnupg Modified: TODO doc/ChangeLog doc/DETAILS doc/Makefile.am doc/README.W32 g10/ChangeLog g10/card-util.c g10/cardglue.c g10/keygen.c g10/status.c g10/status.h scripts/ChangeLog scripts/mk-w32-dist scripts/w32installer.nsi * cardglue.c (pin_cb): Disable debug output. * mk-w32-dist: Check for patch files. * w32installer.nsi: Translated a few more strings. Print a warning if permssions are not suitable for the installation. Add Uninstaller entries. --------------------------+ TODO | 12 ----- doc/ChangeLog | 4 + doc/DETAILS | 6 ++ doc/Makefile.am | 2 doc/README.W32 | 2 g10/ChangeLog | 11 +++++ g10/card-util.c | 2 g10/cardglue.c | 2 g10/keygen.c | 16 +++++++ g10/status.c | 3 - g10/status.h | 2 scripts/ChangeLog | 7 +++ scripts/mk-w32-dist | 20 +++++---- scripts/w32installer.nsi | 92 ++++++++++++++++++++++++++++++++++++++------- 14 files changed, 141 insertions(+), 40 deletions(-) Index: gnupg/TODO diff -u gnupg/TODO:1.176 gnupg/TODO:1.177 --- gnupg/TODO:1.176 Thu Jan 27 11:30:28 2005 +++ gnupg/TODO Mon Mar 14 20:19:21 2005 @@ -1,8 +1,3 @@ -* BACKUP Filename requires a status message. !!!! - -* Delete a card key as well as a wiping. - - * From: Nicolas Sierro Date: Thu, 17 Jun 2004 12:31:24 +0200 @@ -11,12 +6,8 @@ 20% faster and the crc32 code about 50% faster. Some memory leaks were also fixed according to the ChangeLog. - * Reword the "Not enough entropy" messages. - * Do we need a configure test for putenv? - * Replace "user id not found" in getkey.c by "no valid user ID found"? - * Describe some pitfalls when using EGD. Check that ~/.gnupg/entropy really is the default. What about needed permission? @@ -117,8 +108,7 @@ given with an indication of the surname and the usable characters are also restricted. - * We status lines at least for bad PINs. BAD_PASSPHARSE requires a - keyID though. + * Delete a card key as well as a wiping. Things we won't do Index: gnupg/doc/ChangeLog diff -u gnupg/doc/ChangeLog:1.98 gnupg/doc/ChangeLog:1.99 --- gnupg/doc/ChangeLog:1.98 Fri Mar 11 12:02:12 2005 +++ gnupg/doc/ChangeLog Mon Mar 14 20:19:21 2005 @@ -1,3 +1,7 @@ +2005-03-14 Werner Koch + + * gnupg-w32.reg: Removed. + 2005-03-07 Werner Koch * gpg.sgml (comment): Add note to keep the comment short. Index: gnupg/doc/DETAILS diff -u gnupg/doc/DETAILS:1.89 gnupg/doc/DETAILS:1.90 --- gnupg/doc/DETAILS:1.89 Mon Mar 7 14:59:59 2005 +++ gnupg/doc/DETAILS Mon Mar 14 20:19:21 2005 @@ -473,7 +473,7 @@ SESSION_KEY : The session key used to decrypt the message. This message will - only be emmited when the special option --show-session-key + only be emitted when the special option --show-session-key is used. The format is suitable to be passed to the option --override-session-key @@ -583,6 +583,10 @@ for certain operation and is mostly useful to check whether a PIN change really worked. + BACKUP_KEY_CREATED fingerprint fname + A backup key named FNAME has been created for the key wityh + KEYID. + Format of the "--attribute-fd" output ===================================== Index: gnupg/doc/Makefile.am diff -u gnupg/doc/Makefile.am:1.26 gnupg/doc/Makefile.am:1.27 --- gnupg/doc/Makefile.am:1.26 Thu Dec 16 11:28:50 2004 +++ gnupg/doc/Makefile.am Mon Mar 14 20:19:21 2005 @@ -21,7 +21,7 @@ AUTOMAKE_OPTIONS = no-texinfo.tex EXTRA_DIST = DETAILS gpg.sgml gpg.1 gpgv.sgml gpgv.1 faq.raw FAQ faq.html \ - HACKING OpenPGP README.W32 samplekeys.asc gnupg.7 gnupg-w32.reg \ + HACKING OpenPGP README.W32 samplekeys.asc gnupg.7 \ TRANSLATE gpg.ru.sgml gpg.ru.1 highlights-1.4.txt man_MANS = gpg.1 gpgv.1 gnupg.7 gpg.ru.1 Index: gnupg/doc/README.W32 diff -u gnupg/doc/README.W32:1.8 gnupg/doc/README.W32:1.9 --- gnupg/doc/README.W32:1.8 Thu Feb 3 11:21:25 2005 +++ gnupg/doc/README.W32 Mon Mar 14 20:19:21 2005 @@ -33,7 +33,7 @@ HKEY_CURRENT_USER\Software\GNU\GnuPG with the name "Lang". This must match one of the installed languages files in the directory named "gnupg.nls" below the installation directory. Note, that the ".mo" -extension is not part of the lcoale id. +extension is not part of the locale id. Home directory: Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.703 gnupg/g10/ChangeLog:1.704 --- gnupg/g10/ChangeLog:1.703 Thu Mar 10 20:34:40 2005 +++ gnupg/g10/ChangeLog Mon Mar 14 20:19:20 2005 @@ -1,3 +1,14 @@ +2005-03-14 Werner Koch + + * cardglue.c (pin_cb): Disable debug output. + +2005-03-11 Werner Koch + + * keygen.c (gen_card_key_with_backup): Write status line with the + backup filename. + + * status.h, status.h (STATUS_BACKUP_KEY_CREATED): New. + 2005-03-10 David Shaw * keyserver.c (parse_keyserver_options): Accept honor-http-proxy Index: gnupg/g10/card-util.c diff -u gnupg/g10/card-util.c:1.28 gnupg/g10/card-util.c:1.29 --- gnupg/g10/card-util.c:1.28 Mon Mar 7 14:59:59 2005 +++ gnupg/g10/card-util.c Mon Mar 14 20:19:20 2005 @@ -578,7 +578,7 @@ } -/* Fetch the key from the URL given on teh card or try to get it from +/* Fetch the key from the URL given on the card or try to get it from the default keyserver. */ static int fetch_url(void) Index: gnupg/g10/cardglue.c diff -u gnupg/g10/cardglue.c:1.23 gnupg/g10/cardglue.c:1.24 --- gnupg/g10/cardglue.c:1.23 Mon Mar 7 14:59:59 2005 +++ gnupg/g10/cardglue.c Mon Mar 14 20:19:20 2005 @@ -659,7 +659,7 @@ const char *ends, *s; *retstr = NULL; - log_debug ("asking for PIN '%s'\n", info); + /* log_debug ("asking for PIN '%s'\n", info); */ /* We use a special prefix to check whether the Admin PIN has been requested. */ Index: gnupg/g10/keygen.c diff -u gnupg/g10/keygen.c:1.146 gnupg/g10/keygen.c:1.147 --- gnupg/g10/keygen.c:1.146 Tue Feb 15 12:02:31 2005 +++ gnupg/g10/keygen.c Mon Mar 14 20:19:20 2005 @@ -3420,9 +3420,25 @@ } else { + byte array[MAX_FINGERPRINT_LEN]; + char *fprbuf, *p; + iobuf_close (fp); iobuf_ioctl (NULL, 2, 0, (char*)fname); log_info (_("NOTE: backup of card key saved to `%s'\n"), fname); + + fingerprint_from_sk (sk, array, &n); + p = fprbuf = xmalloc (MAX_FINGERPRINT_LEN*2 + 1 + 1); + for (i=0; i < n ; i++, p += 2) + sprintf (p, "%02X", array[i]); + *p++ = ' '; + *p = 0; + + write_status_text_and_buffer (STATUS_BACKUP_KEY_CREATED, + fprbuf, + fname, strlen (fname), + 0); + xfree (fprbuf); } free_packet (pkt); m_free (pkt); Index: gnupg/g10/status.c diff -u gnupg/g10/status.c:1.49 gnupg/g10/status.c:1.50 --- gnupg/g10/status.c:1.49 Mon Mar 7 14:59:59 2005 +++ gnupg/g10/status.c Mon Mar 14 20:19:20 2005 @@ -1,6 +1,6 @@ /* status.c * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, - * 2004 Free Software Foundation, Inc. + * 2004, 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -162,6 +162,7 @@ case STATUS_SIG_SUBPACKET : s = "SIG_SUBPACKET"; break; case STATUS_SC_OP_SUCCESS : s = "SC_OP_SUCCESS"; break; case STATUS_SC_OP_FAILURE : s = "SC_OP_FAILURE"; break; + case STATUS_BACKUP_KEY_CREATED:s="BACKUP_KEY_CREATED"; break; default: s = "?"; break; } return s; Index: gnupg/g10/status.h diff -u gnupg/g10/status.h:1.32 gnupg/g10/status.h:1.33 --- gnupg/g10/status.h:1.32 Mon Mar 7 14:59:59 2005 +++ gnupg/g10/status.h Mon Mar 14 20:19:20 2005 @@ -113,6 +113,8 @@ #define STATUS_SC_OP_FAILURE 79 #define STATUS_SC_OP_SUCCESS 80 +#define STATUS_BACKUP_KEY_CREATED 81 + /*-- status.c --*/ void set_status_fd ( int fd ); Index: gnupg/scripts/ChangeLog diff -u gnupg/scripts/ChangeLog:1.65 gnupg/scripts/ChangeLog:1.66 --- gnupg/scripts/ChangeLog:1.65 Mon Mar 7 14:59:59 2005 +++ gnupg/scripts/ChangeLog Mon Mar 14 20:19:20 2005 @@ -1,3 +1,10 @@ +2005-03-14 Werner Koch + + * mk-w32-dist: Check for patch files. + * w32installer.nsi: Translated a few more strings. Print a + warning if permssions are not suitable for the installation. + Add Uninstaller entries. + 2005-02-16 David Shaw * gnupg.spec.in: Fix problem with storing the gpgkeys helpers in Index: gnupg/scripts/mk-w32-dist diff -u gnupg/scripts/mk-w32-dist:1.18 gnupg/scripts/mk-w32-dist:1.19 --- gnupg/scripts/mk-w32-dist:1.18 Wed Feb 16 14:27:57 2005 +++ gnupg/scripts/mk-w32-dist Mon Mar 14 20:19:20 2005 @@ -122,15 +122,17 @@ cp ${srcdir}/$i $i.txt todos $i.txt done -for i in README.W32 ; do - cp ${srcdir}/doc/$i $i.txt - todos $i.txt -done -for i in gnupg-w32.reg; do - cp ${srcdir}/doc/$i . - todos $i + +cp ${srcdir}/doc/README.W32 README-W32.txt +todos README-W32.txt + +patches_defs= +for i in `find "$topdir/patches" -type f -name '*.diff'`; do + cp $i . + patches_defs="-DWITH_PATCHES" done + # We must distribute the MO files in UTF-8, the conversion is done by # gpg at runtime. To include English at the right position in the list we # need a special case. @@ -217,11 +219,11 @@ echo makensis -v2 -nocd -DVERSION="${version}" \ -DPROD_VERSION="${prod_version}" \ -DGNUPG_SRCDIR="${srcdir}" ${winpt_defs} ${src_defs} \ - ${srcdir}/scripts/w32installer.nsi + ${patches_defs} ${srcdir}/scripts/w32installer.nsi BUILDINFO=$buildinfo makensis -v2 -nocd -DVERSION="${version}" \ -DPROD_VERSION="${prod_version}" \ -DGNUPG_SRCDIR="${srcdir}" ${winpt_defs} ${src_defs} \ - ${srcdir}/scripts/w32installer.nsi + ${patches_defs} ${srcdir}/scripts/w32installer.nsi echo "Installer created" >&2 else zip -9 "gnupg-w32cli-${version}.zip" * Index: gnupg/scripts/w32installer.nsi diff -u gnupg/scripts/w32installer.nsi:1.7 gnupg/scripts/w32installer.nsi:1.8 --- gnupg/scripts/w32installer.nsi:1.7 Wed Feb 16 21:08:12 2005 +++ gnupg/scripts/w32installer.nsi Mon Mar 14 20:19:20 2005 @@ -83,20 +83,15 @@ !insertmacro MUI_PAGE_WELCOME -!define MUI_PAGE_HEADER_SUBTEXT \ - "This software is licensed under the terms of the GNU General Public \ - License (GPL) which guarantees your freedom to share and change Free \ - Software." +!define MUI_PAGE_HEADER_SUBTEXT "$(T_GPLHeader)" -!define MUI_LICENSEPAGE_TEXT_BOTTOM \ - "In short: You are allowed to run this software for any purpose. \ - You may distribute it as long as you give the recipients the same \ - rights you have received." +!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(T_GPLShort)" !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)" !insertmacro MUI_PAGE_LICENSE "COPYING.txt" +!define MUI_PAGE_CUSTOMFUNCTION_SHOW PrintNonAdminWarning !insertmacro MUI_PAGE_COMPONENTS Page custom CustomPageOptions @@ -111,10 +106,9 @@ !insertmacro MUI_PAGE_INSTFILES -!define MUI_FINISHPAGE_SHOWREADME "README.W32.txt" +!define MUI_FINISHPAGE_SHOWREADME "README-W32.txt" !define MUI_FINISHPAGE_SHOWREADME_TEXT "$(T_ShowReadme)" -!define MUI_FINISHPAGE_LINK \ - "Visit the GnuPG website for latest news and support" +!define MUI_FINISHPAGE_LINK "$(T_FiniLink)" !define MUI_FINISHPAGE_LINK_LOCATION "http://www.gnupg.org/" !insertmacro MUI_PAGE_FINISH @@ -138,6 +132,8 @@ !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ReserveFile "opt.ini" ReserveFile "COPYING.txt" +ReserveFile "${NSISDIR}/Plugins/UserInfo.dll" + ${StrStr} # Supportable for Install Sections and Functions ${StrTok} # Supportable for Install Sections and Functions @@ -164,7 +160,7 @@ SetOutPath "$INSTDIR\Doc" File "README.txt" - File "README.W32.txt" + File "README-W32.txt" File "COPYING.txt" Call InstallIconv @@ -230,6 +226,11 @@ File "NEWS.winpt.txt" !endif ; WITH_WINPT +!ifdef WITH_PATCHES + SetOutPath "$INSTDIR\Src" + File '*.diff' +!endif + SectionEnd ; Section Documentation @@ -260,6 +261,18 @@ ;;-------------------------- WriteUninstaller "$INSTDIR\uninst-gnupg.exe" + StrCpy $MYTMP "Software\Microsoft\Windows\CurrentVersion\Uninstall\GnuPG" + WriteRegExpandStr HKLM $MYTMP "UninstallString" '"$INSTDIR\uninst-gnupg.exe"' + WriteRegExpandStr HKLM $MYTMP "InstallLocation" "$INSTDIR" + WriteRegStr HKLM $MYTMP "DisplayName" "GNU Privacy Guard" + WriteRegStr HKLM $MYTMP "DisplayIcon" "$INSTDIR\gpg.exe,0" + WriteRegStr HKLM $MYTMP "DisplayVersion" "${VERSION}" + WriteRegStr HKLM $MYTMP "Publisher" "Free Software Foundation" + WriteRegStr HKLM $MYTMP "URLInfoAbout" "http://www.gnupg.org/" + WriteRegDWORD HKLM $MYTMP "NoModify" "1" + WriteRegDWORD HKLM $MYTMP "NoRepair" "1" + + ;;--------------------- ;; Create Menu entries ;;--------------------- @@ -270,7 +283,7 @@ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GnuPG README.lnk" \ "$INSTDIR\Doc\README.txt" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GnuPG README.Windows.lnk" \ - "$INSTDIR\Doc\README.W32.txt" + "$INSTDIR\Doc\README-W32.txt" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GnuPG NEWS.lnk" \ "$INSTDIR\Doc\NEWS.txt" @@ -353,7 +366,7 @@ Delete "$INSTDIR\gpgkeys_ldap.exe" Delete "$INSTDIR\Doc\README.txt" - Delete "$INSTDIR\Doc\README.W32.txt" + Delete "$INSTDIR\Doc\README-W32.txt" Delete "$INSTDIR\Doc\COPYING.txt" Delete "$INSTDIR\Doc\COPYING.LIB.txt" Delete "$INSTDIR\Doc\README.iconv.txt" @@ -408,6 +421,7 @@ DeleteRegValue HKCU "Software\GNU\GnuPG" "Start Menu Folder" DeleteRegValue HKLM "Software\GNU\GnuPG" "Install Directory" DeleteRegKey /ifempty HKLM "Software\GNU\GnuPG" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GnuPG" SectionEnd ; Uninstall @@ -438,6 +452,22 @@ FunctionEnd +;; Check whether the current user is in the Administrator group or +;; an OS version without the need for an Administrator is in use. +;; Print a warning if this is not the case. +Function PrintNonAdminWarning + ClearErrors + UserInfo::GetName + IfErrors leave + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" leave +1 + MessageBox MB_OK "$(T_AdminNeeded)" + + leave: +FunctionEnd + Function CustomPageOptions SectionGetFlags ${SecNLS} $R0 @@ -531,6 +561,40 @@ \r\n\r\n\r\n\r\n\r\nDies ist GnuPG version ${VERSION}\r\n\ erstellt am $%BUILDINFO%" +; Startup page +LangString T_GPLHeader ${LANG_ENGLISH} \ + "This software is licensed under the terms of the GNU General Public \ + License (GPL) which guarantees your freedom to share and change Free \ + Software." +LangString T_GPLHeader ${LANG_GERMAN}} \ + "Diese Software ist unter der GNU General Public License \ + (GPL) lizensiert; dies gibt Ihnen die Freiheit, sie \ + zu ändern und weiterzugeben." + +LangString T_GPLShort ${LANG_ENGLISH} \ + "In short: You are allowed to run this software for any purpose. \ + You may distribute it as long as you give the recipients the same \ + rights you have received." +LangString T_GPLShort ${LANG_GERMAN} \ + "In aller Kürze: Sie haben das Recht, die Software zu jedem Zweck \ + einzusetzen. Sie können die Software weitergeben, sofern Sie dem \ + Empfänger dieselben Rechte einräumen, die auch Sie erhalten haben." + + +; Finish page +LangString T_FiniLink ${LANG_ENGLISH} \ + "Visit the GnuPG website for latest news and support" +LangString T_FiniLink ${LANG_GERMAN}} \ + "Zur GnuPG Website mit Neuigkeiten und Hilfsangeboten" + +; From Function PrintNonAdminWarning +LangString T_AdminNeeded ${LANG_ENGLISH} \ + "Warning: Administrator permissions required for a successful installation" +LangString T_AdminNeeded ${LANG_GERMAN} \ + "Warnung: Administrator Reche werden für eine erfolgreiche \ + Installation benötigt." + + ; Installation options like language used for GnuPG LangString T_InstallOptions ${LANG_ENGLISH} "Install Options" LangString T_InstallOptions ${LANG_GERMAN} "Installationsoptionen" From cvs at cvs.gnupg.org Mon Mar 14 20:08:28 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Mon Mar 14 20:08:31 2005 Subject: gnupg/scripts/conf-w32 [new] Message-ID: Date: Monday, March 14, 2005 @ 20:21:44 Author: wk Path: /cvs/gnupg/gnupg/scripts/conf-w32 Directory /cvs/gnupg/gnupg/scripts/conf-w32 added to the repository From cvs at cvs.gnupg.org Mon Mar 14 21:28:05 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Mon Mar 14 21:28:08 2005 Subject: gnupg (7 files) Message-ID: Date: Monday, March 14, 2005 @ 21:41:20 Author: wk Path: /cvs/gnupg/gnupg Added: scripts/conf-w32/README scripts/conf-w32/bzip2-1.diff Modified: g10/ChangeLog g10/card-util.c include/util.h util/ChangeLog util/miscutil.c * card-util.c (card_status): Use isotimestamp and not the localized asctimestamp to match the timezone used in the key information. * miscutil.c (isotimestamp): New. -------------------------------+ g10/ChangeLog | 4 ++++ g10/card-util.c | 6 +++--- include/util.h | 1 + scripts/conf-w32/README | 2 ++ scripts/conf-w32/bzip2-1.diff | 39 +++++++++++++++++++++++++++++++++++++++ util/ChangeLog | 4 ++++ util/miscutil.c | 25 ++++++++++++++++++++++++- 7 files changed, 77 insertions(+), 4 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.704 gnupg/g10/ChangeLog:1.705 --- gnupg/g10/ChangeLog:1.704 Mon Mar 14 20:19:20 2005 +++ gnupg/g10/ChangeLog Mon Mar 14 21:41:20 2005 @@ -1,5 +1,9 @@ 2005-03-14 Werner Koch + * card-util.c (card_status): Use isotimestamp and not the + localized asctimestamp to match the timezone used in the key + information. + * cardglue.c (pin_cb): Disable debug output. 2005-03-11 Werner Koch Index: gnupg/g10/card-util.c diff -u gnupg/g10/card-util.c:1.29 gnupg/g10/card-util.c:1.30 --- gnupg/g10/card-util.c:1.29 Mon Mar 14 20:19:20 2005 +++ gnupg/g10/card-util.c Mon Mar 14 21:41:20 2005 @@ -426,17 +426,17 @@ print_sha1_fpr (fp, info.fpr1valid? info.fpr1:NULL); if (info.fpr1valid && info.fpr1time) tty_fprintf (fp, " created ....: %s\n", - asctimestamp (info.fpr1time)); + isotimestamp (info.fpr1time)); tty_fprintf (fp, "Encryption key....:"); print_sha1_fpr (fp, info.fpr2valid? info.fpr2:NULL); if (info.fpr2valid && info.fpr2time) tty_fprintf (fp, " created ....: %s\n", - asctimestamp (info.fpr2time)); + isotimestamp (info.fpr2time)); tty_fprintf (fp, "Authentication key:"); print_sha1_fpr (fp, info.fpr3valid? info.fpr3:NULL); if (info.fpr3valid && info.fpr3time) tty_fprintf (fp, " created ....: %s\n", - asctimestamp (info.fpr3time)); + isotimestamp (info.fpr3time)); tty_fprintf (fp, "General key info..: "); thefpr = (info.fpr1valid? info.fpr1 : info.fpr2valid? info.fpr2 : Index: gnupg/include/util.h diff -u gnupg/include/util.h:1.78 gnupg/include/util.h:1.79 --- gnupg/include/util.h:1.78 Thu Oct 21 18:56:22 2004 +++ gnupg/include/util.h Mon Mar 14 21:41:20 2005 @@ -152,6 +152,7 @@ u32 add_days_to_timestamp( u32 stamp, u16 days ); const char *strtimevalue( u32 stamp ); const char *strtimestamp( u32 stamp ); /* GMT */ +const char *isotimestamp( u32 stamp ); /* GMT with hh:mm:ss */ const char *asctimestamp( u32 stamp ); /* localized */ void print_string( FILE *fp, const byte *p, size_t n, int delim ); void print_string2( FILE *fp, const byte *p, size_t n, int delim, int delim2 ); Index: gnupg/scripts/conf-w32/README diff -u /dev/null gnupg/scripts/conf-w32/README:1.1 --- /dev/null Mon Mar 14 21:41:21 2005 +++ gnupg/scripts/conf-w32/README Mon Mar 14 21:41:20 2005 @@ -0,0 +1,2 @@ +Files useful for building W32 versions. + Index: gnupg/scripts/conf-w32/bzip2-1.diff diff -u /dev/null gnupg/scripts/conf-w32/bzip2-1.diff:1.1 --- /dev/null Mon Mar 14 21:41:21 2005 +++ gnupg/scripts/conf-w32/bzip2-1.diff Mon Mar 14 21:41:20 2005 @@ -0,0 +1,39 @@ +To include support for BZIP2 compression in GunPG for W32, the patch +below should be applied to a stock bzip2-1.0.2 source. The Build as +usual using the mingw32 cross compiler package from Debian and install +the library and header file on top of the cross compiler installation +(/usr/i586-mingw32msvc/lib/). Note that for ease of maintenance we +don't used a DLL. [wk 2005-03-14] + + +diff -u orig/bzip2-1.0.2/Makefile bzip2-1.0.2/Makefile +--- orig/bzip2-1.0.2/Makefile 2002-01-26 00:34:53.000000000 +0100 ++++ bzip2-1.0.2/Makefile 2004-11-03 14:10:45.000000000 +0100 +@@ -2,9 +2,9 @@ + SHELL=/bin/sh + + # To assist in cross-compiling +-CC=gcc +-AR=ar +-RANLIB=ranlib ++CC=i586-mingw32msvc-gcc ++AR=i586-mingw32msvc-ar ++RANLIB=i586-mingw32msvc-ranlib + LDFLAGS= + + # Suitably paranoid flags to avoid bugs in gcc-2.7 +diff -u orig/bzip2-1.0.2/bzlib.h bzip2-1.0.2/bzlib.h +--- orig/bzip2-1.0.2/bzlib.h 2001-12-30 03:19:45.000000000 +0100 ++++ bzip2-1.0.2/bzlib.h 2004-11-03 14:32:41.000000000 +0100 +@@ -113,7 +114,7 @@ + /* Need a definitition for FILE */ + #include + +-#ifdef _WIN32 ++#if defined( _WIN32 ) && 0 + # include + # ifdef small + /* windows.h define small to char */ + + + Index: gnupg/util/ChangeLog diff -u gnupg/util/ChangeLog:1.182 gnupg/util/ChangeLog:1.183 --- gnupg/util/ChangeLog:1.182 Thu Mar 10 10:52:05 2005 +++ gnupg/util/ChangeLog Mon Mar 14 21:41:20 2005 @@ -1,3 +1,7 @@ +2005-03-14 Werner Koch + + * miscutil.c (isotimestamp): New. + 2005-03-10 Werner Koch * secmem.c (secmem_realloc): Take control information into account Index: gnupg/util/miscutil.c diff -u gnupg/util/miscutil.c:1.34 gnupg/util/miscutil.c:1.35 --- gnupg/util/miscutil.c:1.34 Thu Mar 10 10:52:05 2005 +++ gnupg/util/miscutil.c Mon Mar 14 21:41:20 2005 @@ -1,6 +1,6 @@ /* miscutil.c - miscellaneous utilities * Copyright (C) 1998, 1999, 2000, 2001, 2003, - * 2004 Free Software Foundation, Inc. + * 2004, 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -137,6 +137,29 @@ return buffer; } + +/**************** + * Note: this function returns GMT + */ +const char * +isotimestamp (u32 stamp) +{ + static char buffer[25+5]; + struct tm *tp; + time_t atime = stamp; + + if (atime < 0) { + strcpy (buffer, "????" "-??" "-??" " " "??" ":" "??" ":" "??"); + } + else { + tp = gmtime( &atime ); + sprintf(buffer,"%04d-%02d-%02d %02d:%02d:%02d", + 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday, + tp->tm_hour, tp->tm_min, tp->tm_sec); + } + return buffer; +} + /**************** * Note: this function returns local time */ From cvs at cvs.gnupg.org Tue Mar 15 17:15:17 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Tue Mar 15 17:15:19 2005 Subject: gnupg (NEWS README configure.ac) Message-ID: Date: Tuesday, March 15, 2005 @ 17:28:37 Author: wk Path: /cvs/gnupg/gnupg Modified: NEWS README configure.ac Post release preparations --------------+ NEWS | 4 ++++ README | 2 +- configure.ac | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) Index: gnupg/NEWS diff -u gnupg/NEWS:1.237 gnupg/NEWS:1.238 --- gnupg/NEWS:1.237 Tue Mar 15 16:51:52 2005 +++ gnupg/NEWS Tue Mar 15 17:28:37 2005 @@ -1,3 +1,7 @@ +Noteworthy changes in version 1.4.2 +------------------------------------------------ + + Noteworthy changes in version 1.4.1 (2005-03-15) ------------------------------------------------ Index: gnupg/README diff -u gnupg/README:1.94 gnupg/README:1.95 --- gnupg/README:1.94 Fri Mar 11 12:02:12 2005 +++ gnupg/README Tue Mar 15 17:28:37 2005 @@ -1,7 +1,7 @@ GnuPG - The GNU Privacy Guard ------------------------------- - Version 1.4.1 + Version 1.4.2 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Index: gnupg/configure.ac diff -u gnupg/configure.ac:1.135 gnupg/configure.ac:1.136 --- gnupg/configure.ac:1.135 Tue Mar 15 16:51:52 2005 +++ gnupg/configure.ac Tue Mar 15 17:28:37 2005 @@ -19,14 +19,14 @@ dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA dnl dnl (Process this file with autoconf to produce a configure script.) -dnlAC_REVISION($Revision: 1.135 $)dnl +dnlAC_REVISION($Revision: 1.136 $)dnl AC_PREREQ(2.59) min_automake_version="1.9.3" # Remember to change the version number immediately *after* a release # and remove the "-cvs" or "rc" suffix immediately *before* a release. -AC_INIT(gnupg, 1.4.1, bug-gnupg@gnu.org) +AC_INIT(gnupg, 1.4.2-cvs, bug-gnupg@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 # sufficient. From cvs at cvs.gnupg.org Tue Mar 15 18:29:09 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Tue Mar 15 18:29:11 2005 Subject: dirmngr/src (ChangeLog ldap.c) Message-ID: Date: Tuesday, March 15, 2005 @ 18:42:30 Author: wk Path: /cvs/dirmngr/dirmngr/src Modified: ChangeLog ldap.c Included time.h. Reported by Bernhard Herzog. -----------+ ChangeLog | 4 ++++ ldap.c | 1 + 2 files changed, 5 insertions(+) Index: dirmngr/src/ChangeLog diff -u dirmngr/src/ChangeLog:1.43 dirmngr/src/ChangeLog:1.44 --- dirmngr/src/ChangeLog:1.43 Wed Mar 9 17:14:13 2005 +++ dirmngr/src/ChangeLog Tue Mar 15 18:42:30 2005 @@ -1,3 +1,7 @@ +2005-03-15 Werner Koch + + * ldap.c: Included time.h. Reported by Bernhard Herzog. + 2005-03-09 Werner Koch * dirmngr.c: Add a note to the help listing check the man page for Index: dirmngr/src/ldap.c diff -u dirmngr/src/ldap.c:1.46 dirmngr/src/ldap.c:1.47 --- dirmngr/src/ldap.c:1.46 Tue Feb 1 17:49:15 2005 +++ dirmngr/src/ldap.c Tue Mar 15 18:42:30 2005 @@ -28,6 +28,7 @@ #include #include #include +#include #include /* fixme: remove it */ #include #include From cvs at cvs.gnupg.org Wed Mar 16 16:03:39 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Wed Mar 16 16:03:42 2005 Subject: gnupg/keyserver (ChangeLog ksutil.c ksutil.h) Message-ID: Date: Wednesday, March 16, 2005 @ 16:17:03 Author: dshaw Path: /cvs/gnupg/gnupg/keyserver Modified: ChangeLog ksutil.c ksutil.h * ksutil.h, ksutil.c (init_ks_options, free_ks_options, parse_ks_options): Pull a lot of duplicated code into a single options parser for all keyserver helpers. -----------+ ChangeLog | 6 + ksutil.c | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- ksutil.h | 25 +++++++ 3 files changed, 238 insertions(+), 1 deletion(-) Index: gnupg/keyserver/ChangeLog diff -u gnupg/keyserver/ChangeLog:1.113 gnupg/keyserver/ChangeLog:1.114 --- gnupg/keyserver/ChangeLog:1.113 Sat Feb 12 04:15:02 2005 +++ gnupg/keyserver/ChangeLog Wed Mar 16 16:17:03 2005 @@ -1,3 +1,9 @@ +2005-03-16 David Shaw + + * ksutil.h, ksutil.c (init_ks_options, free_ks_options, + parse_ks_options): Pull a lot of duplicated code into a single + options parser for all keyserver helpers. + 2005-02-11 David Shaw * curl-shim.c (curl_easy_perform): Fix compile warning. Index: gnupg/keyserver/ksutil.c diff -u gnupg/keyserver/ksutil.c:1.1 gnupg/keyserver/ksutil.c:1.2 --- gnupg/keyserver/ksutil.c:1.1 Wed Oct 13 20:30:29 2004 +++ gnupg/keyserver/ksutil.c Wed Mar 16 16:17:03 2005 @@ -1,5 +1,5 @@ /* ksutil.c - general keyserver utility functions - * Copyright (C) 2004 Free Software Foundation, Inc. + * Copyright (C) 2004, 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -21,6 +21,9 @@ #include #include #include +#include +#include +#include #include "keyserver.h" #include "ksutil.h" @@ -61,3 +64,206 @@ #endif #endif } + +struct ks_options * +init_ks_options(void) +{ + struct ks_options *opt; + + opt=calloc(1,sizeof(struct ks_options)); + + if(opt) + { + opt->action=KS_UNKNOWN; + opt->flags.check_cert=1; + opt->timeout=DEFAULT_KEYSERVER_TIMEOUT; + } + + return opt; +} + +void +free_ks_options(struct ks_options *opt) +{ + free(opt->host); + free(opt->port); + free(opt->scheme); + free(opt->auth); + free(opt->path); + free(opt->ca_cert_file); + free(opt); +} + +/* Returns 0 if we "ate" the line. Returns >0, a KEYSERVER_ error + code if that error applies. Returns -1 if we did not match the + line at all. */ +int +parse_ks_options(char *line,struct ks_options *opt) +{ + int version; + char command[MAX_COMMAND+1]; + char host[MAX_HOST+1]; + char port[MAX_PORT+1]; + char scheme[MAX_SCHEME+1]; + char auth[MAX_AUTH+1]; + char path[URLMAX_PATH+1]; + char option[MAX_OPTION+1]; + +#if 0 + if(sscanf(line,"%c",&hash)==1 && hash=='#') + continue; +#endif + + if(line[0]=='#') + return 0; + + if(sscanf(line,"COMMAND %" MKSTRING(MAX_COMMAND) "s\n",command)==1) + { + command[MAX_COMMAND]='\0'; + + if(strcasecmp(command,"get")==0) + opt->action=KS_GET; + else if(strcasecmp(command,"send")==0) + opt->action=KS_SEND; + else if(strcasecmp(command,"search")==0) + opt->action=KS_SEARCH; + + return 0; + } + + if(sscanf(line,"HOST %" MKSTRING(MAX_HOST) "s\n",host)==1) + { + host[MAX_HOST]='\0'; + opt->host=strdup(host); + if(!opt->host) + return KEYSERVER_NO_MEMORY; + return 0; + } + + if(sscanf(line,"PORT %" MKSTRING(MAX_PORT) "s\n",port)==1) + { + port[MAX_PORT]='\0'; + opt->port=strdup(port); + if(!opt->port) + return KEYSERVER_NO_MEMORY; + return 0; + } + + if(sscanf(line,"SCHEME %" MKSTRING(MAX_SCHEME) "s\n",scheme)==1) + { + scheme[MAX_SCHEME]='\0'; + opt->scheme=strdup(scheme); + if(!opt->scheme) + return KEYSERVER_NO_MEMORY; + return 0; + } + + if(sscanf(line,"AUTH %" MKSTRING(MAX_AUTH) "s\n",auth)==1) + { + auth[MAX_AUTH]='\0'; + opt->auth=strdup(auth); + if(!opt->auth) + return KEYSERVER_NO_MEMORY; + return 0; + } + + if(sscanf(line,"PATH %" MKSTRING(URLMAX_PATH) "s\n",path)==1) + { + path[URLMAX_PATH]='\0'; + opt->path=strdup(path); + if(!opt->path) + return KEYSERVER_NO_MEMORY; + return 0; + } + + if(sscanf(line,"VERSION %d\n",&version)==1) + { + if(version!=KEYSERVER_PROTO_VERSION) + return KEYSERVER_VERSION_ERROR; + + return 0; + } + + if(sscanf(line,"OPTION %" MKSTRING(MAX_OPTION) "[^\n]\n",option)==1) + { + int no=0; + char *start=&option[0]; + + option[MAX_OPTION]='\0'; + + if(strncasecmp(option,"no-",3)==0) + { + no=1; + start=&option[3]; + } + + if(strcasecmp(start,"verbose")==0) + { + if(no) + opt->verbose--; + else + opt->verbose++; + } + else if(strcasecmp(start,"include-disabled")==0) + { + if(no) + opt->flags.include_disabled=0; + else + opt->flags.include_disabled=1; + } + else if(strcasecmp(start,"include-revoked")==0) + { + if(no) + opt->flags.include_revoked=0; + else + opt->flags.include_revoked=1; + } + else if(strcasecmp(start,"include-subkeys")==0) + { + if(no) + opt->flags.include_subkeys=0; + else + opt->flags.include_subkeys=1; + } + else if(strcasecmp(start,"check-cert")==0) + { + if(no) + opt->flags.check_cert=0; + else + opt->flags.check_cert=1; + } + else if(strncasecmp(start,"debug",5)==0) + { + if(no) + opt->debug=0; + else if(start[5]=='=') + opt->debug=atoi(&start[6]); + } + else if(strncasecmp(start,"timeout",7)==0) + { + if(no) + opt->timeout=0; + else if(start[7]=='=') + opt->timeout=atoi(&start[8]); + else if(start[7]=='\0') + opt->timeout=DEFAULT_KEYSERVER_TIMEOUT; + } + else if(strncasecmp(start,"ca-cert-file",12)==0) + { + if(no) + { + free(opt->ca_cert_file); + opt->ca_cert_file=NULL; + } + else if(start[12]=='=') + { + free(opt->ca_cert_file); + opt->ca_cert_file=strdup(&start[13]); + if(!opt->ca_cert_file) + return KEYSERVER_NO_MEMORY; + } + } + } + + return -1; +} Index: gnupg/keyserver/ksutil.h diff -u gnupg/keyserver/ksutil.h:1.4 gnupg/keyserver/ksutil.h:1.5 --- gnupg/keyserver/ksutil.h:1.4 Tue Feb 1 18:08:18 2005 +++ gnupg/keyserver/ksutil.h Wed Mar 16 16:17:03 2005 @@ -59,4 +59,29 @@ unsigned int set_timeout(unsigned int seconds); int register_timeout(void); +struct ks_options +{ + enum {KS_UNKNOWN,KS_GET,KS_SEND,KS_SEARCH} action; + char *host; + char *port; + char *scheme; + char *auth; + char *path; + struct + { + unsigned int include_disabled:1; + unsigned int include_revoked:1; + unsigned int include_subkeys:1; + unsigned int check_cert:1; + } flags; + unsigned int verbose; + unsigned int debug; + unsigned int timeout; + char *ca_cert_file; +}; + +struct ks_options *init_ks_options(void); +void free_ks_options(struct ks_options *opt); +int parse_ks_options(char *line,struct ks_options *opt); + #endif /* !_KSUTIL_H_ */ From cvs at cvs.gnupg.org Wed Mar 16 19:57:32 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 16 19:57:34 2005 Subject: gnupg/g10 (ChangeLog ccid-driver.c) Message-ID: Date: Wednesday, March 16, 2005 @ 20:10:54 Author: wk Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog ccid-driver.c (parse_ccid_descriptor): Make SCM workaround reader type specific. (scan_or_find_devices): Do not check the interface subclass in the SPR532 kludge, as this depends on the firmware version. (ccid_get_atr): Get the Slot status first. This solves the problem with readers hanging on recent Linux 2.6.x. (bulk_in): Add argument TIMEOUT and changed all callers to pass an appropriate one. Change the standard timeout from 10 to 5 seconds. (ccid_slot_status): Add a retry code with an initial short timeout. (do_close_reader): Do an usb_reset before closing the reader. ---------------+ ChangeLog | 13 ++++++++ ccid-driver.c | 91 ++++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 76 insertions(+), 28 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.705 gnupg/g10/ChangeLog:1.706 --- gnupg/g10/ChangeLog:1.705 Mon Mar 14 21:41:20 2005 +++ gnupg/g10/ChangeLog Wed Mar 16 20:10:54 2005 @@ -1,3 +1,16 @@ +2005-03-16 Werner Koch + + * ccid-driver.c (parse_ccid_descriptor): Make SCM workaround + reader type specific. + (scan_or_find_devices): Do not check the interface subclass in the + SPR532 kludge, as this depends on the firmware version. + (ccid_get_atr): Get the Slot status first. This solves the + problem with readers hanging on recent Linux 2.6.x. + (bulk_in): Add argument TIMEOUT and changed all callers to pass an + appropriate one. Change the standard timeout from 10 to 5 seconds. + (ccid_slot_status): Add a retry code with an initial short timeout. + (do_close_reader): Do an usb_reset before closing the reader. + 2005-03-14 Werner Koch * card-util.c (card_status): Use isotimestamp and not the Index: gnupg/g10/ccid-driver.c diff -u gnupg/g10/ccid-driver.c:1.21 gnupg/g10/ccid-driver.c:1.22 --- gnupg/g10/ccid-driver.c:1.21 Thu Jan 27 11:30:27 2005 +++ gnupg/g10/ccid-driver.c Wed Mar 16 20:10:54 2005 @@ -1,5 +1,5 @@ /* ccid-driver.c - USB ChipCardInterfaceDevices driver - * Copyright (C) 2003, 2004 Free Software Foundation, Inc. + * Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. * Written by Werner Koch. * * This file is part of GnuPG. @@ -52,7 +52,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: ccid-driver.c,v 1.21 2005/01/27 10:30:27 wk Exp $ + * $Date: 2005/03/16 19:10:54 $ */ @@ -223,7 +223,7 @@ int use_crc); static int bulk_out (ccid_driver_t handle, unsigned char *msg, size_t msglen); static int bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length, - size_t *nread, int expected_type, int seqno); + size_t *nread, int expected_type, int seqno, int timeout); /* Convert a little endian stored 4 byte value into an unsigned integer. */ @@ -403,7 +403,7 @@ if (buf[49] == 0xff) DEBUGOUT_CONT ("echo\n"); else - DEBUGOUT_1 (" %02X\n", buf[48]); + DEBUGOUT_CONT_1 (" %02X\n", buf[48]); DEBUGOUT ( " wlcdLayout "); if (!buf[50] && !buf[51]) @@ -446,12 +446,20 @@ send a frame of n*wMaxPacketSize back to us. Given that wMaxPacketSize is 64 for these readers we set the IFSD to a value lower than that: - 64 - 10 CCID header - 4 T1frame - 2 reserved = 48 */ + 64 - 10 CCID header - 4 T1frame - 2 reserved = 48 + Product Ids: + 0xe001 - SCR 331 + 0x5111 - SCR 331-DI + 0x5115 - SCR 335 + 0xe003 - SPR 532 + */ if (handle->id_vendor == VENDOR_SCM - /* FIXME: check whether it is the same - firmware version for all drivers. */ - && handle->bcd_device < 0x0519 - && handle->max_ifsd > 48) + && handle->max_ifsd > 48 + && ( (handle->id_product == 0xe001 && handle->bcd_device < 0x0516) + ||(handle->id_product == 0x5111 && handle->bcd_device < 0x0620) + ||(handle->id_product == 0x5115 && handle->bcd_device < 0x0519) + ||(handle->id_product == 0xe003 && handle->bcd_device < 0x0504) + )) { DEBUGOUT ("enabling workaround for buggy SCM readers\n"); handle->max_ifsd = 48; @@ -699,9 +707,7 @@ && ifcdesc->bInterfaceProtocol == 0) || (ifcdesc->bInterfaceClass == 255 && dev->descriptor.idVendor == 0x04e6 - && dev->descriptor.idProduct == 0xe003 - && ifcdesc->bInterfaceSubClass == 1 - && ifcdesc->bInterfaceProtocol == 1))) + && dev->descriptor.idProduct == 0xe003))) { idev = usb_open (dev); if (!idev) @@ -974,11 +980,13 @@ rc = bulk_out (handle, msg, msglen); if (!rc) - bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_SlotStatus,seqno); + bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_SlotStatus, + seqno, 2000); handle->powered_off = 1; } if (handle->idev) { + usb_reset (handle->idev); usb_release_interface (handle->idev, handle->ifc_no); usb_close (handle->idev); handle->idev = NULL; @@ -1102,10 +1110,10 @@ BUFFER and return the actual read number if bytes in NREAD. SEQNO is the sequence number used to send the request and EXPECTED_TYPE the type of message we expect. Does checks on the ccid - header. Returns 0 on success. */ + header. TIMEOUT is the timeout value in ms. Returns 0 on success. */ static int bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length, - size_t *nread, int expected_type, int seqno) + size_t *nread, int expected_type, int seqno, int timeout) { int i, rc; size_t msglen; @@ -1117,9 +1125,7 @@ rc = usb_bulk_read (handle->idev, handle->ep_bulk_in, buffer, length, - 10000 /* ms timeout */ ); - /* Fixme: instead of using a 10 second timeout we should better - handle the timeout here and retry if appropriate. */ + timeout); if (rc < 0) { DEBUGOUT_1 ("usb_bulk_read error: %s\n", strerror (errno)); @@ -1175,7 +1181,7 @@ } -/* Note that this fucntion won't return the error codes NO_CARD or +/* Note that this function won't return the error codes NO_CARD or CARD_INACTIVE */ static int send_escape_cmd (ccid_driver_t handle, @@ -1206,7 +1212,8 @@ rc = bulk_out (handle, msg, msglen); if (rc) return rc; - rc = bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_Escape, seqno); + rc = bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_Escape, + seqno, 5000); return rc; } @@ -1276,7 +1283,9 @@ unsigned char msg[100]; size_t msglen; unsigned char seqno; + int retries = 0; + retry: msg[0] = PC_to_RDR_GetSlotStatus; msg[5] = 0; /* slot */ msg[6] = seqno = handle->seqno++; @@ -1288,7 +1297,21 @@ rc = bulk_out (handle, msg, 10); if (rc) return rc; - rc = bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_SlotStatus, seqno); + rc = bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_SlotStatus, + seqno, retries? 1000 : 200); + if (rc == CCID_DRIVER_ERR_CARD_IO_ERROR && retries < 3) + { + if (!retries) + { + fprintf (stderr, "CALLING USB_CLEAR_HALT\n"); + usb_clear_halt (handle->idev, handle->ep_bulk_in); + usb_clear_halt (handle->idev, handle->ep_bulk_out); + } + else + fprintf (stderr, "RETRYING AGIAN\n"); + retries++; + goto retry; + } if (rc && rc != CCID_DRIVER_ERR_NO_CARD && rc != CCID_DRIVER_ERR_CARD_INACTIVE) return rc; @@ -1303,6 +1326,7 @@ unsigned char *atr, size_t maxatrlen, size_t *atrlen) { int rc; + int statusbits; unsigned char msg[100]; unsigned char *tpdu; size_t msglen, tpdulen; @@ -1311,6 +1335,15 @@ unsigned int edc; int i; + /* First check whether a card is available. */ + rc = ccid_slot_status (handle, &statusbits); + if (rc) + return rc; + if (statusbits == 2) + return CCID_DRIVER_ERR_NO_CARD; + + /* For an inactive and also for an active card, issue the PowerOn + command to get the ATR. */ msg[0] = PC_to_RDR_IccPowerOn; msg[5] = 0; /* slot */ msg[6] = seqno = handle->seqno++; @@ -1323,7 +1356,8 @@ rc = bulk_out (handle, msg, msglen); if (rc) return rc; - rc = bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_DataBlock, seqno); + rc = bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_DataBlock, + seqno, 5000); if (rc) return rc; @@ -1367,7 +1401,8 @@ if (rc) return rc; /* Note that we ignore the error code on purpose. */ - bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_Parameters, seqno); + bulk_in (handle, msg, sizeof msg, &msglen, RDR_to_PC_Parameters, + seqno, 5000); handle->t1_ns = 0; handle->t1_nr = 0; @@ -1414,7 +1449,7 @@ rc = bulk_in (handle, msg, sizeof msg, &msglen, - RDR_to_PC_DataBlock, seqno); + RDR_to_PC_DataBlock, seqno, 5000); if (rc) return rc; @@ -1510,7 +1545,7 @@ msg = recv_buffer; rc = bulk_in (handle, msg, sizeof recv_buffer, &msglen, - RDR_to_PC_DataBlock, seqno); + RDR_to_PC_DataBlock, seqno, 5000); if (rc) return rc; @@ -1683,7 +1718,7 @@ msg = recv_buffer; rc = bulk_in (handle, msg, sizeof recv_buffer, &msglen, - RDR_to_PC_DataBlock, seqno); + RDR_to_PC_DataBlock, seqno, 5000); if (rc) return rc; @@ -1692,7 +1727,7 @@ if (tpdulen < 4) { - usb_clear_halt (handle->idev, 0x82); + usb_clear_halt (handle->idev, handle->ep_bulk_in); return CCID_DRIVER_ERR_ABORTED; } #ifdef DEBUG_T1 @@ -1960,7 +1995,7 @@ msg = recv_buffer; rc = bulk_in (handle, msg, sizeof recv_buffer, &msglen, - RDR_to_PC_DataBlock, seqno); + RDR_to_PC_DataBlock, seqno, 5000); if (rc) return rc; From cvs at cvs.gnupg.org Thu Mar 17 00:32:38 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 17 00:32:45 2005 Subject: gnupg/keyserver (ChangeLog ksutil.c ksutil.h) Message-ID: Date: Thursday, March 17, 2005 @ 00:46:07 Author: dshaw Path: /cvs/gnupg/gnupg/keyserver Modified: ChangeLog ksutil.c ksutil.h * ksutil.h, ksutil.c (ks_action_to_string): New. (free_ks_options): Only free if options exist. -----------+ ChangeLog | 3 +++ ksutil.c | 36 ++++++++++++++++++++++++------------ ksutil.h | 5 ++++- 3 files changed, 31 insertions(+), 13 deletions(-) Index: gnupg/keyserver/ChangeLog diff -u gnupg/keyserver/ChangeLog:1.114 gnupg/keyserver/ChangeLog:1.115 --- gnupg/keyserver/ChangeLog:1.114 Wed Mar 16 16:17:03 2005 +++ gnupg/keyserver/ChangeLog Thu Mar 17 00:46:07 2005 @@ -1,5 +1,8 @@ 2005-03-16 David Shaw + * ksutil.h, ksutil.c (ks_action_to_string): New. + (free_ks_options): Only free if options exist. + * ksutil.h, ksutil.c (init_ks_options, free_ks_options, parse_ks_options): Pull a lot of duplicated code into a single options parser for all keyserver helpers. Index: gnupg/keyserver/ksutil.c diff -u gnupg/keyserver/ksutil.c:1.2 gnupg/keyserver/ksutil.c:1.3 --- gnupg/keyserver/ksutil.c:1.2 Wed Mar 16 16:17:03 2005 +++ gnupg/keyserver/ksutil.c Thu Mar 17 00:46:07 2005 @@ -85,13 +85,16 @@ void free_ks_options(struct ks_options *opt) { - free(opt->host); - free(opt->port); - free(opt->scheme); - free(opt->auth); - free(opt->path); - free(opt->ca_cert_file); - free(opt); + if(opt) + { + free(opt->host); + free(opt->port); + free(opt->scheme); + free(opt->auth); + free(opt->path); + free(opt->ca_cert_file); + free(opt); + } } /* Returns 0 if we "ate" the line. Returns >0, a KEYSERVER_ error @@ -109,11 +112,6 @@ char path[URLMAX_PATH+1]; char option[MAX_OPTION+1]; -#if 0 - if(sscanf(line,"%c",&hash)==1 && hash=='#') - continue; -#endif - if(line[0]=='#') return 0; @@ -267,3 +265,17 @@ return -1; } + +const char * +ks_action_to_string(enum ks_action action) +{ + switch(action) + { + case KS_UNKNOWN: return "UNKNOWN"; + case KS_GET: return "GET"; + case KS_SEND: return "SEND"; + case KS_SEARCH: return "SEARCH"; + } + + return "?"; +} Index: gnupg/keyserver/ksutil.h diff -u gnupg/keyserver/ksutil.h:1.5 gnupg/keyserver/ksutil.h:1.6 --- gnupg/keyserver/ksutil.h:1.5 Wed Mar 16 16:17:03 2005 +++ gnupg/keyserver/ksutil.h Thu Mar 17 00:46:07 2005 @@ -59,9 +59,11 @@ unsigned int set_timeout(unsigned int seconds); int register_timeout(void); +enum ks_action {KS_UNKNOWN=0,KS_GET,KS_SEND,KS_SEARCH}; + struct ks_options { - enum {KS_UNKNOWN,KS_GET,KS_SEND,KS_SEARCH} action; + enum ks_action action; char *host; char *port; char *scheme; @@ -83,5 +85,6 @@ struct ks_options *init_ks_options(void); void free_ks_options(struct ks_options *opt); int parse_ks_options(char *line,struct ks_options *opt); +const char *ks_action_to_string(enum ks_action action); #endif /* !_KSUTIL_H_ */ From cvs at cvs.gnupg.org Thu Mar 17 04:48:47 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 17 04:48:51 2005 Subject: gnupg/keyserver (ChangeLog gpgkeys_ldap.c) Message-ID: Date: Thursday, March 17, 2005 @ 05:02:17 Author: dshaw Path: /cvs/gnupg/gnupg/keyserver Modified: ChangeLog gpgkeys_ldap.c * gpgkeys_ldap.c: Include lber.h if configure determines we need it. ----------------+ ChangeLog | 3 +++ gpgkeys_ldap.c | 3 +++ 2 files changed, 6 insertions(+) Index: gnupg/keyserver/ChangeLog diff -u gnupg/keyserver/ChangeLog:1.115 gnupg/keyserver/ChangeLog:1.116 --- gnupg/keyserver/ChangeLog:1.115 Thu Mar 17 00:46:07 2005 +++ gnupg/keyserver/ChangeLog Thu Mar 17 05:02:17 2005 @@ -1,5 +1,8 @@ 2005-03-16 David Shaw + * gpgkeys_ldap.c: Include lber.h if configure determines we need + it. + * ksutil.h, ksutil.c (ks_action_to_string): New. (free_ks_options): Only free if options exist. Index: gnupg/keyserver/gpgkeys_ldap.c diff -u gnupg/keyserver/gpgkeys_ldap.c:1.50 gnupg/keyserver/gpgkeys_ldap.c:1.51 --- gnupg/keyserver/gpgkeys_ldap.c:1.50 Sat Feb 12 04:15:02 2005 +++ gnupg/keyserver/gpgkeys_ldap.c Thu Mar 17 05:02:17 2005 @@ -33,6 +33,9 @@ #include #include #else +#ifdef NEED_LBER_H +#include +#endif #include #endif From cvs at cvs.gnupg.org Thu Mar 17 04:51:45 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 17 04:51:57 2005 Subject: gnupg/m4 (ChangeLog ldap.m4) Message-ID: Date: Thursday, March 17, 2005 @ 05:05:14 Author: dshaw Path: /cvs/gnupg/gnupg/m4 Added: ldap.m4 Modified: ChangeLog * ldap.m4: New. Moved from configure.ac. -----------+ ChangeLog | 4 ++ ldap.m4 | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) Index: gnupg/m4/ChangeLog diff -u gnupg/m4/ChangeLog:1.15 gnupg/m4/ChangeLog:1.16 --- gnupg/m4/ChangeLog:1.15 Tue Mar 1 01:05:16 2005 +++ gnupg/m4/ChangeLog Thu Mar 17 05:05:14 2005 @@ -1,3 +1,7 @@ +2005-03-16 David Shaw + + * ldap.m4: New. Moved from configure.ac. + 2005-02-28 David Shaw * libcurl.m4: Use $LIBS instead of $LDFLAGS. This should help Index: gnupg/m4/ldap.m4 diff -u /dev/null gnupg/m4/ldap.m4:1.1 --- /dev/null Thu Mar 17 05:05:14 2005 +++ gnupg/m4/ldap.m4 Thu Mar 17 05:05:14 2005 @@ -0,0 +1,88 @@ +dnl Check for LDAP +dnl Copyright (C) 2005 Free Software Foundation, Inc. +dnl +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl Defines HAVE_LIBUSB to 1 if a working libusb setup is found, and sets +dnl @LIBUSB@ to the necessary libraries. HAVE_USB_GET_BUSSES is set if +dnl usb_get_busses() exists. + +AC_DEFUN([GNUPG_CHECK_LDAP], +[ +# Try and link a LDAP test program to weed out unusable LDAP +# libraries. -lldap [-llber [-lresolv]] is for older OpenLDAPs. +# OpenLDAP, circa 1999, was terrible with creating weird dependencies. +# This seems to have all been resolved, so I'm simplifying this code +# significantly. If all else fails, the user can play +# guess-the-dependency by using something like ./configure +# LDAPLIBS="-Lfoo -lbar" + + AC_ARG_WITH(ldap, + AC_HELP_STRING([--with-ldap=DIR],[look for the LDAP library in DIR]), + [ + if test -d "$withval" ; then + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi + ]) + + for MY_LDAPLIBS in ${LDAPLIBS+"$LDAPLIBS"} "-lldap" "-lldap -llber" "-lldap -llber -lresolv" "-lwldap32"; do + _ldap_save_libs=$LIBS + LIBS="$MY_LDAPLIBS $1 $LIBS" + + AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane]) + AC_TRY_LINK([ +#ifdef _WIN32 +#include +#include +#else +#include +#endif +],[ldap_open("foobar",1234);], + [gnupg_cv_func_ldap_init=yes],[gnupg_cv_func_ldap_init=no]) + AC_MSG_RESULT([$gnupg_cv_func_ldap_init]) + + if test $gnupg_cv_func_ldap_init = no; then + AC_MSG_CHECKING([whether I can make LDAP be sane with lber.h]) + AC_TRY_LINK([#include +#include ],[ldap_open("foobar",1234);], + [gnupg_cv_func_ldaplber_init=yes],[gnupg_cv_func_ldaplber_init=no]) + AC_MSG_RESULT([$gnupg_cv_func_ldaplber_init]) + fi + + if test "$gnupg_cv_func_ldaplber_init" = yes ; then + AC_DEFINE(NEED_LBER_H,1,[Define if the LDAP library requires including lber.h before ldap.h]) + fi + + if test "$gnupg_cv_func_ldap_init" = yes || \ + test "$gnupg_cv_func_ldaplber_init" = yes ; then + LDAPLIBS=$MY_LDAPLIBS + GPGKEYS_LDAP="gpgkeys_ldap$EXEEXT" + + AC_CHECK_FUNCS(ldap_get_option ldap_set_option ldap_start_tls_s) + + if test "$ac_cv_func_ldap_get_option" != yes ; then + AC_MSG_CHECKING([whether LDAP supports ld_errno]) + AC_TRY_LINK([#include ],[LDAP *ldap; ldap->ld_errno;], + [gnupg_cv_func_ldap_ld_errno=yes], + [gnupg_cv_func_ldap_ld_errno=no]) + AC_MSG_RESULT([$gnupg_cv_func_ldap_ld_errno]) + + if test "$gnupg_cv_func_ldap_ld_errno" = yes ; then + AC_DEFINE(HAVE_LDAP_LD_ERRNO,1,[Define if the LDAP library supports ld_errno]) + fi + fi + fi + + LIBS=$_ldap_save_libs + + if test "$GPGKEYS_LDAP" != "" ; then break; fi + done + + AC_SUBST(GPGKEYS_LDAP) + AC_SUBST(LDAPLIBS) +])dnl From cvs at cvs.gnupg.org Thu Mar 17 04:56:08 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 17 04:56:14 2005 Subject: gnupg (ChangeLog NEWS configure.ac) Message-ID: Date: Thursday, March 17, 2005 @ 05:09:37 Author: dshaw Path: /cvs/gnupg/gnupg Modified: ChangeLog NEWS configure.ac * configure.ac: Move the LDAP detecting code to m4/ldap.m4. --------------+ ChangeLog | 4 +++ NEWS | 6 ++--- configure.ac | 66 +++------------------------------------------------------ 3 files changed, 11 insertions(+), 65 deletions(-) Index: gnupg/ChangeLog diff -u gnupg/ChangeLog:1.244 gnupg/ChangeLog:1.245 --- gnupg/ChangeLog:1.244 Tue Mar 15 16:51:52 2005 +++ gnupg/ChangeLog Thu Mar 17 05:09:37 2005 @@ -1,3 +1,7 @@ +2005-03-16 David Shaw + + * configure.ac: Move the LDAP detecting code to m4/ldap.m4. + 2005-03-15 Werner Koch Released 1.4.1. Index: gnupg/NEWS diff -u gnupg/NEWS:1.238 gnupg/NEWS:1.239 --- gnupg/NEWS:1.238 Tue Mar 15 17:28:37 2005 +++ gnupg/NEWS Thu Mar 17 05:09:37 2005 @@ -12,9 +12,9 @@ . * New "import-unusable-sigs" and "export-unusable-sigs" tags for - --import-options and --export-options. These are off by - default, and cause GnuPG to not import or export key signatures - that are not usable (e.g. expired signatures). + --import-options and --export-options. These are off by default, + which causes GnuPG to not import or export key signatures that + are not usable (e.g. expired signatures). * New experimental HTTP, HTTPS, FTP, and FTPS keyserver helper that uses the cURL library to retrieve Index: gnupg/configure.ac diff -u gnupg/configure.ac:1.136 gnupg/configure.ac:1.137 --- gnupg/configure.ac:1.136 Tue Mar 15 17:28:37 2005 +++ gnupg/configure.ac Thu Mar 17 05:09:37 2005 @@ -19,7 +19,7 @@ dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA dnl dnl (Process this file with autoconf to produce a configure script.) -dnlAC_REVISION($Revision: 1.136 $)dnl +dnlAC_REVISION($Revision: 1.137 $)dnl AC_PREREQ(2.59) min_automake_version="1.9.3" @@ -443,7 +443,6 @@ AC_ISC_POSIX AC_SYS_LARGEFILE AC_PROG_INSTALL -AC_PROG_LN_S AC_PROG_AWK AC_CHECK_PROG(DOCBOOK_TO_MAN, docbook-to-man, yes, no) AM_CONDITIONAL(HAVE_DOCBOOK_TO_MAN, test "$ac_cv_prog_DOCBOOK_TO_MAN" = yes) @@ -452,7 +451,6 @@ MPI_OPT_FLAGS="" - try_gettext=yes have_dosish_system=no need_dlopen=yes @@ -594,69 +592,13 @@ AC_SUBST(SRVLIBS) -# Try and link a LDAP test program to weed out unusable LDAP -# libraries. -lldap [-llber [-lresolv]] is for older OpenLDAPs. -# OpenLDAP, circa 1999, was terrible with creating weird dependencies. -# This seems to have all been resolved, so I'm simplifying this code -# significantly. If all else fails, the user can play -# guess-the-dependency by using something like ./configure -# LDAPLIBS="-Lfoo -lbar" +# Check for LDAP if test "$try_ldap" = yes ; then - - AC_ARG_WITH(ldap, - AC_HELP_STRING([--with-ldap=DIR],[look for the LDAP library in DIR]), - [ - if test -d "$withval" ; then - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - fi - ]) - - for MY_LDAPLIBS in ${LDAPLIBS+"$LDAPLIBS"} "-lldap" "-lldap -llber" "-lldap -llber -lresolv" "-lwldap32"; do - _ldap_save_libs=$LIBS - LIBS="$MY_LDAPLIBS $NETLIBS $LIBS" - - AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane]) - AC_TRY_LINK([ -#ifdef _WIN32 -#include -#include -#else -#include -#endif -],[ldap_open("foobar",1234);], - [gnupg_cv_func_ldap_init=yes],[gnupg_cv_func_ldap_init=no]) - AC_MSG_RESULT([$gnupg_cv_func_ldap_init]) - - if test "$gnupg_cv_func_ldap_init" = yes ; then - LDAPLIBS=$MY_LDAPLIBS - GPGKEYS_LDAP="gpgkeys_ldap$EXEEXT" - - AC_CHECK_FUNCS(ldap_get_option ldap_set_option ldap_start_tls_s) - - if test "$ac_cv_func_ldap_get_option" != yes ; then - AC_MSG_CHECKING([whether LDAP supports ld_errno]) - AC_TRY_LINK([#include ],[LDAP *ldap; ldap->ld_errno;], - [gnupg_cv_func_ldap_ld_errno=yes], - [gnupg_cv_func_ldap_ld_errno=no]) - AC_MSG_RESULT([$gnupg_cv_func_ldap_ld_errno]) - - if test "$gnupg_cv_func_ldap_ld_errno" = yes ; then - AC_DEFINE(HAVE_LDAP_LD_ERRNO,1,[Define if the LDAP library supports ld_errno]) - fi - fi - fi - - LIBS=$_ldap_save_libs - - if test "$GPGKEYS_LDAP" != "" ; then break; fi - done + GNUPG_CHECK_LDAP($NETLIBS) fi -AC_SUBST(GPGKEYS_LDAP) -AC_SUBST(LDAPLIBS) -AM_CONDITIONAL(GPGKEYS_LDAP, test "$GPGKEYS_LDAP" != "") +# Special hack to test curl AC_ARG_ENABLE(fake-curl, AC_HELP_STRING([--enable-fake-curl],[enable EXPERIMENTAL no-curl HTTP code]),fake_curl=$enableval,fake_curl=no) From cvs at cvs.gnupg.org Thu Mar 17 11:32:34 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Thu Mar 17 11:32:39 2005 Subject: dirmngr/src (ChangeLog http.c http.h) Message-ID: Date: Thursday, March 17, 2005 @ 11:46:06 Author: wk Path: /cvs/dirmngr/dirmngr/src Modified: ChangeLog http.c http.h * http.c (parse_response): Changed MAXLEN and LEN to size-t to match the requirement of read_line. * http.h (http_context_s): Ditto for BUFFER_SIZE. -----------+ ChangeLog | 6 ++++++ http.c | 2 +- http.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) Index: dirmngr/src/ChangeLog diff -u dirmngr/src/ChangeLog:1.44 dirmngr/src/ChangeLog:1.45 --- dirmngr/src/ChangeLog:1.44 Tue Mar 15 18:42:30 2005 +++ dirmngr/src/ChangeLog Thu Mar 17 11:46:05 2005 @@ -1,3 +1,9 @@ +2005-03-17 Werner Koch + + * http.c (parse_response): Changed MAXLEN and LEN to size-t to + match the requirement of read_line. + * http.h (http_context_s): Ditto for BUFFER_SIZE. + 2005-03-15 Werner Koch * ldap.c: Included time.h. Reported by Bernhard Herzog. Index: dirmngr/src/http.c diff -u dirmngr/src/http.c:1.7 dirmngr/src/http.c:1.8 --- dirmngr/src/http.c:1.7 Mon Nov 22 22:30:50 2004 +++ dirmngr/src/http.c Thu Mar 17 11:46:05 2005 @@ -666,7 +666,7 @@ parse_response (http_t hd) { unsigned char *line, *p, *p2; - unsigned maxlen, len; + size_t maxlen, len; /* Wait for the status line. */ do Index: dirmngr/src/http.h diff -u dirmngr/src/http.h:1.2 dirmngr/src/http.h:1.3 --- dirmngr/src/http.h:1.2 Mon Nov 22 22:30:50 2004 +++ dirmngr/src/http.h Thu Mar 17 11:46:05 2005 @@ -66,7 +66,7 @@ parsed_uri_t uri; http_req_t req_type; unsigned char *buffer; /* Line buffer. */ - unsigned buffer_size; + size_t buffer_size; unsigned int flags; }; typedef struct http_context_s *http_t; From cvs at cvs.gnupg.org Thu Mar 17 17:29:13 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 17 17:29:16 2005 Subject: gnupg/keyserver (6 files) Message-ID: Date: Thursday, March 17, 2005 @ 17:42:41 Author: dshaw Path: /cvs/gnupg/gnupg/keyserver Modified: ChangeLog gpgkeys_curl.c gpgkeys_finger.c gpgkeys_ldap.c ksutil.c ksutil.h * gpgkeys_curl.c, gpgkeys_finger.c, gpgkeys_ldap.c: Start using parse_ks_options and remove a lot of common code. * ksutil.h, ksutil.c (parse_ks_options): Parse OPAQUE, and default debug with no arguments to 1. ------------------+ ChangeLog | 8 + gpgkeys_curl.c | 198 +++++++--------------------- gpgkeys_finger.c | 114 ++++------------ gpgkeys_ldap.c | 370 +++++++++++++++++++---------------------------------- ksutil.c | 12 + ksutil.h | 1 6 files changed, 239 insertions(+), 464 deletions(-) Index: gnupg/keyserver/ChangeLog diff -u gnupg/keyserver/ChangeLog:1.116 gnupg/keyserver/ChangeLog:1.117 --- gnupg/keyserver/ChangeLog:1.116 Thu Mar 17 05:02:17 2005 +++ gnupg/keyserver/ChangeLog Thu Mar 17 17:42:41 2005 @@ -1,3 +1,11 @@ +2005-03-17 David Shaw + + * gpgkeys_curl.c, gpgkeys_finger.c, gpgkeys_ldap.c: Start using + parse_ks_options and remove a lot of common code. + + * ksutil.h, ksutil.c (parse_ks_options): Parse OPAQUE, and default + debug with no arguments to 1. + 2005-03-16 David Shaw * gpgkeys_ldap.c: Include lber.h if configure determines we need Index: gnupg/keyserver/gpgkeys_curl.c diff -u gnupg/keyserver/gpgkeys_curl.c:1.14 gnupg/keyserver/gpgkeys_curl.c:1.15 --- gnupg/keyserver/gpgkeys_curl.c:1.14 Sat Feb 12 04:15:02 2005 +++ gnupg/keyserver/gpgkeys_curl.c Thu Mar 17 17:42:41 2005 @@ -38,16 +38,10 @@ extern char *optarg; extern int optind; -static int verbose=0; -static char scheme[MAX_SCHEME+1]; -static char auth[MAX_AUTH+1]; -static char host[MAX_HOST+1]; -static char port[MAX_PORT+1]; -static char path[URLMAX_PATH+1]; static char proxy[MAX_PROXY+1]; -static FILE *input, *output, *console; +static FILE *input,*output,*console; static CURL *curl; -static char request[MAX_URL]; +static struct ks_options *opt; static int curl_err_to_gpg_err(CURLcode error) @@ -115,14 +109,18 @@ { CURLcode res; char errorbuffer[CURL_ERROR_SIZE]; + char request[MAX_URL]; if(strncmp(getkey,"0x",2)==0) getkey+=2; fprintf(output,"KEY 0x%s BEGIN\n",getkey); - sprintf(request,"%s://%s%s%s%s%s%s%s",scheme,auth[0]?auth:"",auth[0]?"@":"", - host,port[0]?":":"",port[0]?port:"",path[0]?"":"/",path); + sprintf(request,"%s://%s%s%s%s%s%s",opt->scheme, + opt->auth?opt->auth:"", + opt->auth?"@":"",opt->host, + opt->port?":":"",opt->port?opt->port:"", + opt->path?opt->path:"/"); curl_easy_setopt(curl,CURLOPT_URL,request); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,writer); @@ -132,7 +130,7 @@ res=curl_easy_perform(curl); if(res!=0) { - fprintf(console,"gpgkeys: %s fetch error %d: %s\n",scheme, + fprintf(console,"gpgkeys: %s fetch error %d: %s\n",opt->scheme, res,errorbuffer); fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,curl_err_to_gpg_err(res)); } @@ -153,12 +151,10 @@ int main(int argc,char *argv[]) { - int arg,action=-1,ret=KEYSERVER_INTERNAL_ERROR; + int arg,ret=KEYSERVER_INTERNAL_ERROR; char line[MAX_LINE]; char *thekey=NULL; - unsigned int timeout=DEFAULT_KEYSERVER_TIMEOUT; - long follow_redirects=5,debug=0,check_cert=1; - char *ca_cert_file=NULL; + long follow_redirects=5; console=stderr; @@ -215,71 +211,28 @@ if(output==NULL) output=stdout; + opt=init_ks_options(); + if(!opt) + return KEYSERVER_NO_MEMORY; + /* Get the command and info block */ while(fgets(line,MAX_LINE,input)!=NULL) { - int version; - char command[MAX_COMMAND+1]; + int err; char option[MAX_OPTION+1]; - char hash; if(line[0]=='\n') break; - if(sscanf(line,"%c",&hash)==1 && hash=='#') - continue; - - if(sscanf(line,"COMMAND %" MKSTRING(MAX_COMMAND) "s\n",command)==1) - { - command[MAX_COMMAND]='\0'; - - if(strcasecmp(command,"get")==0) - action=GET; - - continue; - } - - if(sscanf(line,"SCHEME %" MKSTRING(MAX_SCHEME) "s\n",scheme)==1) - { - scheme[MAX_SCHEME]='\0'; - continue; - } - - if(sscanf(line,"AUTH %" MKSTRING(MAX_AUTH) "s\n",auth)==1) - { - auth[MAX_AUTH]='\0'; - continue; - } - - if(sscanf(line,"HOST %" MKSTRING(MAX_HOST) "s\n",host)==1) + err=parse_ks_options(line,opt); + if(err>0) { - host[MAX_HOST]='\0'; - continue; - } - - if(sscanf(line,"PORT %" MKSTRING(MAX_PORT) "s\n",port)==1) - { - port[MAX_PORT]='\0'; - continue; - } - - if(sscanf(line,"PATH %" MKSTRING(URLMAX_PATH) "s\n",path)==1) - { - path[URLMAX_PATH]='\0'; - continue; - } - - if(sscanf(line,"VERSION %d\n",&version)==1) - { - if(version!=KEYSERVER_PROTO_VERSION) - { - ret=KEYSERVER_VERSION_ERROR; - goto fail; - } - - continue; + ret=err; + goto fail; } + else if(err==0) + continue; if(sscanf(line,"OPTION %" MKSTRING(MAX_OPTION) "s\n",option)==1) { @@ -294,14 +247,7 @@ start=&option[3]; } - if(strcasecmp(start,"verbose")==0) - { - if(no) - verbose--; - else - verbose++; - } - else if(strncasecmp(start,"http-proxy",10)==0) + if(strncasecmp(start,"http-proxy",10)==0) { if(no) proxy[0]='\0'; @@ -311,15 +257,6 @@ proxy[MAX_PROXY]='\0'; } } - else if(strncasecmp(start,"timeout",7)==0) - { - if(no) - timeout=0; - else if(start[7]=='=') - timeout=atoi(&start[8]); - else if(start[7]=='\0') - timeout=DEFAULT_KEYSERVER_TIMEOUT; - } else if(strncasecmp(start,"follow-redirects",16)==0) { if(no) @@ -329,75 +266,46 @@ else if(start[16]=='\0') follow_redirects=-1; } - else if(strncasecmp(start,"debug",5)==0) - { - if(no) - debug=0; - else if(start[5]=='=') - debug=atoi(&start[6]); - else if(start[5]=='\0') - debug=1; - } - else if(strcasecmp(start,"check-cert")==0) - { - if(no) - check_cert=0; - else - check_cert=1; - } - else if(strncasecmp(start,"ca-cert-file",12)==0) - { - if(no) - { - free(ca_cert_file); - ca_cert_file=NULL; - } - else if(start[12]=='=') - { - free(ca_cert_file); - ca_cert_file=strdup(&start[13]); - if(!ca_cert_file) - { - fprintf(console,"gpgkeys: out of memory while creating " - "ca_cert_file\n"); - ret=KEYSERVER_NO_MEMORY; - goto fail; - } - } - } continue; } } - if(scheme[0]=='\0') + if(!opt->scheme) { fprintf(console,"gpgkeys: no scheme supplied!\n"); - return KEYSERVER_SCHEME_NOT_FOUND; + ret=KEYSERVER_SCHEME_NOT_FOUND; + goto fail; } #ifdef HTTP_VIA_LIBCURL - else if(strcasecmp(scheme,"http")==0) + else if(strcasecmp(opt->scheme,"http")==0) ; #endif /* HTTP_VIA_LIBCURL */ #ifdef HTTPS_VIA_LIBCURL - else if(strcasecmp(scheme,"https")==0) + else if(strcasecmp(opt->scheme,"https")==0) ; #endif /* HTTP_VIA_LIBCURL */ #ifdef FTP_VIA_LIBCURL - else if(strcasecmp(scheme,"ftp")==0) + else if(strcasecmp(opt->scheme,"ftp")==0) ; #endif /* FTP_VIA_LIBCURL */ #ifdef FTPS_VIA_LIBCURL - else if(strcasecmp(scheme,"ftps")==0) + else if(strcasecmp(opt->scheme,"ftps")==0) ; #endif /* FTPS_VIA_LIBCURL */ else { - fprintf(console,"gpgkeys: scheme `%s' not supported\n",scheme); + fprintf(console,"gpgkeys: scheme `%s' not supported\n",opt->scheme); return KEYSERVER_SCHEME_NOT_FOUND; } - if(timeout && register_timeout()==-1) + if(!opt->host) + { + fprintf(console,"gpgkeys: no keyserver host provided\n"); + goto fail; + } + + if(opt->timeout && register_timeout()==-1) { fprintf(console,"gpgkeys: unable to register timeout handler\n"); return KEYSERVER_INTERNAL_ERROR; @@ -419,16 +327,14 @@ curl_easy_setopt(curl,CURLOPT_MAXREDIRS,follow_redirects); } - if(debug) + if(opt->debug) { curl_easy_setopt(curl,CURLOPT_STDERR,console); curl_easy_setopt(curl,CURLOPT_VERBOSE,1); } - curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,check_cert); - - if(ca_cert_file) - curl_easy_setopt(curl,CURLOPT_CAINFO,ca_cert_file); + curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,opt->flags.check_cert); + curl_easy_setopt(curl,CURLOPT_CAINFO,opt->ca_cert_file); if(proxy[0]) curl_easy_setopt(curl,CURLOPT_PROXY,proxy); @@ -436,7 +342,7 @@ /* If it's a GET or a SEARCH, the next thing to come in is the keyids. If it's a SEND, then there are no keyids. */ - if(action==GET) + if(opt->action==KS_GET) { /* Eat the rest of the file */ for(;;) @@ -472,7 +378,7 @@ goto fail; } - if(!thekey || !host[0]) + if(!thekey) { fprintf(console,"gpgkeys: invalid keyserver instructions\n"); goto fail; @@ -483,18 +389,18 @@ fprintf(output,"VERSION %d\n",KEYSERVER_PROTO_VERSION); fprintf(output,"PROGRAM %s\n\n",VERSION); - if(verbose) + if(opt->verbose) { - fprintf(console,"Scheme:\t\t%s\n",scheme); - fprintf(console,"Host:\t\t%s\n",host); - if(port[0]) - fprintf(console,"Port:\t\t%s\n",port); - if(path[0]) - fprintf(console,"Path:\t\t%s\n",path); + fprintf(console,"Scheme:\t\t%s\n",opt->scheme); + fprintf(console,"Host:\t\t%s\n",opt->host); + if(opt->port) + fprintf(console,"Port:\t\t%s\n",opt->port); + if(opt->path) + fprintf(console,"Path:\t\t%s\n",opt->path); fprintf(console,"Command:\tGET\n"); } - set_timeout(timeout); + set_timeout(opt->timeout); ret=get_key(thekey); @@ -508,6 +414,8 @@ if(output!=stdout) fclose(output); + free_ks_options(opt); + if(curl) curl_easy_cleanup(curl); Index: gnupg/keyserver/gpgkeys_finger.c diff -u gnupg/keyserver/gpgkeys_finger.c:1.13 gnupg/keyserver/gpgkeys_finger.c:1.14 --- gnupg/keyserver/gpgkeys_finger.c:1.13 Sat Feb 5 16:04:59 2005 +++ gnupg/keyserver/gpgkeys_finger.c Thu Mar 17 17:42:41 2005 @@ -55,9 +55,8 @@ extern char *optarg; extern int optind; -static int verbose=0; -static char path[MAX_OPAQUE+1]; -static FILE *input, *output, *console; +static FILE *input,*output,*console; +static struct ks_options *opt; #ifdef _WIN32 static void @@ -300,7 +299,7 @@ indicated the requested key anyway. */ fprintf(output,"KEY 0x%s BEGIN\n",getkey); - rc = send_request (path, &sock); + rc=send_request(opt->opaque,&sock); if(rc) { fprintf(output,"KEY 0x%s FAILED %d\n",getkey, rc); @@ -362,10 +361,9 @@ int main(int argc,char *argv[]) { - int arg,action=-1,ret=KEYSERVER_INTERNAL_ERROR; + int arg,ret=KEYSERVER_INTERNAL_ERROR; char line[MAX_LINE]; char *thekey=NULL; - unsigned int timeout=DEFAULT_KEYSERVER_TIMEOUT; console=stderr; @@ -422,91 +420,38 @@ if(output==NULL) output=stdout; + opt=init_ks_options(); + if(!opt) + return KEYSERVER_NO_MEMORY; + /* Get the command and info block */ while(fgets(line,MAX_LINE,input)!=NULL) { - int version; - char command[MAX_COMMAND+1]; - char option[MAX_OPTION+1]; - char hash; + int err; if(line[0]=='\n') break; - if(sscanf(line,"%c",&hash)==1 && hash=='#') - continue; - - if(sscanf(line,"COMMAND %" MKSTRING(MAX_COMMAND) "s\n",command)==1) + err=parse_ks_options(line,opt); + if(err>0) { - command[MAX_COMMAND]='\0'; - - if(strcasecmp(command,"get")==0) - action=GET; - - continue; - } - - if(strncmp(line,"HOST ",5)==0) - { - fprintf(console,"gpgkeys: finger://relay/user syntax is not" - " supported. Use finger:user instead.\n"); - ret=KEYSERVER_NOT_SUPPORTED; + ret=err; goto fail; } + else if(err==0) + continue; + } - if(sscanf(line,"OPAQUE %" MKSTRING(MAX_OPAQUE) "s\n",path)==1) - { - path[MAX_OPAQUE]='\0'; - continue; - } - - if(sscanf(line,"VERSION %d\n",&version)==1) - { - if(version!=KEYSERVER_PROTO_VERSION) - { - ret=KEYSERVER_VERSION_ERROR; - goto fail; - } - - continue; - } - - if(sscanf(line,"OPTION %" MKSTRING(MAX_OPTION) "s\n",option)==1) - { - int no=0; - char *start=&option[0]; - - option[MAX_OPTION]='\0'; - - if(strncasecmp(option,"no-",3)==0) - { - no=1; - start=&option[3]; - } - - if(strcasecmp(start,"verbose")==0) - { - if(no) - verbose--; - else - verbose++; - } - else if(strncasecmp(start,"timeout",7)==0) - { - if(no) - timeout=0; - else if(start[7]=='=') - timeout=atoi(&start[8]); - else if(start[7]=='\0') - timeout=DEFAULT_KEYSERVER_TIMEOUT; - } - - continue; - } + if(opt->host) + { + fprintf(console,"gpgkeys: finger://relay/user syntax is not" + " supported. Use finger:user instead.\n"); + ret=KEYSERVER_NOT_SUPPORTED; + goto fail; } - if(timeout && register_timeout()==-1) + if(opt->timeout && register_timeout()==-1) { fprintf(console,"gpgkeys: unable to register timeout handler\n"); return KEYSERVER_INTERNAL_ERROR; @@ -515,7 +460,7 @@ /* If it's a GET or a SEARCH, the next thing to come in is the keyids. If it's a SEND, then there are no keyids. */ - if(action==GET) + if(opt->action==KS_GET) { /* Eat the rest of the file */ for(;;) @@ -551,7 +496,7 @@ goto fail; } - if(!thekey || !*path) + if(!thekey || !opt->opaque) { fprintf(console,"gpgkeys: invalid keyserver instructions\n"); goto fail; @@ -562,16 +507,15 @@ fprintf(output,"VERSION %d\n",KEYSERVER_PROTO_VERSION); fprintf(output,"PROGRAM %s\n\n",VERSION); - if (verbose>1) + if(opt->verbose>1) { - if(path[0]) - fprintf(console,"Path:\t\t%s\n",path); + fprintf(console,"User:\t\t%s\n",opt->opaque); fprintf(console,"Command:\tGET\n"); } - set_timeout(timeout); + set_timeout(opt->timeout); - ret = get_key(thekey); + ret=get_key(thekey); fail: @@ -583,5 +527,7 @@ if(output!=stdout) fclose(output); + free_ks_options(opt); + return ret; } Index: gnupg/keyserver/gpgkeys_ldap.c diff -u gnupg/keyserver/gpgkeys_ldap.c:1.51 gnupg/keyserver/gpgkeys_ldap.c:1.52 --- gnupg/keyserver/gpgkeys_ldap.c:1.51 Thu Mar 17 05:02:17 2005 +++ gnupg/keyserver/gpgkeys_ldap.c Thu Mar 17 17:42:41 2005 @@ -50,14 +50,12 @@ extern char *optarg; extern int optind; -static int verbose=0,include_disabled=0,include_revoked=0,include_subkeys=0; static int real_ldap=0; static char *basekeyspacedn=NULL; -static char host[MAX_HOST+1]={'\0'}; -static char portstr[MAX_PORT+1]={'\0'}; static char *pgpkeystr="pgpKey"; static FILE *input=NULL,*output=NULL,*console=NULL; static LDAP *ldap=NULL; +static struct ks_options *opt; #ifndef HAVE_TIMEGM time_t timegm(struct tm *tm); @@ -1007,7 +1005,7 @@ /* fingerprint. Take the last 16 characters and treat it like a long key id */ - if(include_subkeys) + if(opt->flags.include_subkeys) sprintf(search,"(|(pgpcertid=%.16s)(pgpsubkeyid=%.16s))", offset,offset); else @@ -1017,7 +1015,7 @@ { /* long key id */ - if(include_subkeys) + if(opt->flags.include_subkeys) sprintf(search,"(|(pgpcertid=%.16s)(pgpsubkeyid=%.16s))", getkey,getkey); else @@ -1030,10 +1028,10 @@ sprintf(search,"(pgpkeyid=%.8s)",getkey); } - if(verbose>2) + if(opt->verbose>2) fprintf(console,"gpgkeys: LDAP fetch for: %s\n",search); - if(!verbose) + if(!opt->verbose) attrs[2]=NULL; /* keep only pgpkey(v2) and pgpcertid */ err=ldap_search_s(ldap,basekeyspacedn, @@ -1163,13 +1161,13 @@ /* Build the search string */ sprintf(search,"%s(pgpuserid=*%s*)%s%s%s", - (!(include_disabled&&include_revoked))?"(&":"", + (!(opt->flags.include_disabled&&opt->flags.include_revoked))?"(&":"", searchkey, - include_disabled?"":"(pgpdisabled=0)", - include_revoked?"":"(pgprevoked=0)", - !(include_disabled&&include_revoked)?")":""); + opt->flags.include_disabled?"":"(pgpdisabled=0)", + opt->flags.include_revoked?"":"(pgprevoked=0)", + !(opt->flags.include_disabled&&opt->flags.include_revoked)?")":""); - if(verbose>2) + if(opt->verbose>2) fprintf(console,"gpgkeys: LDAP search for: %s\n",search); err=ldap_search_s(ldap,basekeyspacedn, @@ -1374,12 +1372,12 @@ } static void -fail_all(struct keylist *keylist,int action,int err) +fail_all(struct keylist *keylist,int err) { if(!keylist) return; - if(action==SEARCH) + if(opt->action==KS_SEARCH) { fprintf(output,"SEARCH "); while(keylist) @@ -1452,7 +1450,7 @@ ldap_value_free(vals); } - if(verbose>1) + if(opt->verbose>1) { vals=ldap_get_values(ldap,si_res,"pgpSoftware"); if(vals) @@ -1503,7 +1501,7 @@ ldap_value_free(vals); } - if(verbose>1) + if(opt->verbose>1) { vals=ldap_get_values(ldap,si_res,"software"); if(vals) @@ -1516,7 +1514,7 @@ vals=ldap_get_values(ldap,si_res,"version"); if(vals) { - if(verbose>1) + if(opt->verbose>1) fprintf(console,"Version:\t%s\n",vals[0]); /* If the version is high enough, use the new pgpKeyV2 @@ -1547,12 +1545,10 @@ int main(int argc,char *argv[]) { - int debug=0,port=0,arg,err,action=-1,ret=KEYSERVER_INTERNAL_ERROR; + int port=0,arg,err,ret=KEYSERVER_INTERNAL_ERROR; char line[MAX_LINE]; - int version,failed=0,use_ssl=0,use_tls=0,bound=0,check_cert=1; + int failed=0,use_ssl=0,use_tls=0,bound=0; struct keylist *keylist=NULL,*keyptr=NULL; - unsigned int timeout=DEFAULT_KEYSERVER_TIMEOUT; - char *ca_cert_file=NULL; console=stderr; @@ -1592,7 +1588,6 @@ break; } - if(argc>optind) { input=fopen(argv[optind],"r"); @@ -1610,69 +1605,27 @@ if(output==NULL) output=stdout; + opt=init_ks_options(); + if(!opt) + return KEYSERVER_NO_MEMORY; + /* Get the command and info block */ while(fgets(line,MAX_LINE,input)!=NULL) { - char command[MAX_COMMAND+1]; char optionstr[MAX_OPTION+1]; - char scheme[MAX_SCHEME+1]; - char hash; if(line[0]=='\n') break; - if(sscanf(line,"%c",&hash)==1 && hash=='#') - continue; - - if(sscanf(line,"COMMAND %" MKSTRING(MAX_COMMAND) "s\n",command)==1) - { - command[MAX_COMMAND]='\0'; - - if(strcasecmp(command,"get")==0) - action=GET; - else if(strcasecmp(command,"send")==0) - action=SEND; - else if(strcasecmp(command,"search")==0) - action=SEARCH; - - continue; - } - - if(sscanf(line,"HOST %" MKSTRING(MAX_HOST) "s\n",host)==1) - { - host[MAX_HOST]='\0'; - continue; - } - - if(sscanf(line,"PORT %" MKSTRING(MAX_PORT) "s\n",portstr)==1) - { - portstr[MAX_PORT]='\0'; - port=atoi(portstr); - continue; - } - - if(sscanf(line,"SCHEME %" MKSTRING(MAX_SCHEME) "s\n",scheme)==1) + err=parse_ks_options(line,opt); + if(err>0) { - scheme[MAX_SCHEME]='\0'; - if(strcasecmp(scheme,"ldaps")==0) - { - port=636; - use_ssl=1; - } - continue; - } - - if(sscanf(line,"VERSION %d\n",&version)==1) - { - if(version!=KEYSERVER_PROTO_VERSION) - { - ret=KEYSERVER_VERSION_ERROR; - goto fail; - } - - continue; + ret=err; + goto fail; } + else if(err==0) + continue; if(sscanf(line,"OPTION %" MKSTRING(MAX_OPTION) "[^\n]\n",optionstr)==1) { @@ -1687,35 +1640,7 @@ start=&optionstr[3]; } - if(strcasecmp(start,"verbose")==0) - { - if(no) - verbose--; - else - verbose++; - } - else if(strcasecmp(start,"include-disabled")==0) - { - if(no) - include_disabled=0; - else - include_disabled=1; - } - else if(strcasecmp(start,"include-revoked")==0) - { - if(no) - include_revoked=0; - else - include_revoked=1; - } - else if(strcasecmp(start,"include-subkeys")==0) - { - if(no) - include_subkeys=0; - else - include_subkeys=1; - } - else if(strncasecmp(start,"tls",3)==0) + if(strncasecmp(start,"tls",3)==0) { if(no) use_tls=0; @@ -1735,20 +1660,6 @@ else if(start[3]=='\0') use_tls=1; } - else if(strcasecmp(start,"check-cert")==0) - { - if(no) - check_cert=0; - else - check_cert=1; - } - else if(strncasecmp(start,"debug",5)==0) - { - if(no) - debug=0; - else if(start[5]=='=') - debug=atoi(&start[6]); - } else if(strncasecmp(start,"basedn",6)==0) { if(no) @@ -1771,50 +1682,43 @@ real_ldap=1; } } - else if(strncasecmp(start,"timeout",7)==0) - { - if(no) - timeout=0; - else if(start[7]=='=') - timeout=atoi(&start[8]); - else if(start[7]=='\0') - timeout=DEFAULT_KEYSERVER_TIMEOUT; - } - else if(strncasecmp(start,"ca-cert-file",12)==0) - { - if(no) - { - free(ca_cert_file); - ca_cert_file=NULL; - } - else if(start[12]=='=') - { - free(ca_cert_file); - ca_cert_file=strdup(&start[13]); - if(!ca_cert_file) - { - fprintf(console,"gpgkeys: out of memory while creating " - "ca_cert_file\n"); - ret=KEYSERVER_NO_MEMORY; - goto fail; - } - } - } continue; } } - if(timeout && register_timeout()==-1) + if(!opt->scheme) + { + fprintf(console,"gpgkeys: no scheme supplied!\n"); + ret=KEYSERVER_SCHEME_NOT_FOUND; + goto fail; + } + + if(strcasecmp(opt->scheme,"ldaps")==0) + { + port=636; + use_ssl=1; + } + + if(opt->port) + port=atoi(opt->port); + + if(!opt->host) + { + fprintf(console,"gpgkeys: no keyserver host provided\n"); + goto fail; + } + + if(opt->timeout && register_timeout()==-1) { fprintf(console,"gpgkeys: unable to register timeout handler\n"); return KEYSERVER_INTERNAL_ERROR; } #if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_X_TLS_CACERTFILE) - if(ca_cert_file) + if(opt->ca_cert_file) { - err=ldap_set_option(NULL,LDAP_OPT_X_TLS_CACERTFILE,ca_cert_file); + err=ldap_set_option(NULL,LDAP_OPT_X_TLS_CACERTFILE,opt->ca_cert_file); if(err!=LDAP_SUCCESS) { fprintf(console,"gpgkeys: unable to set ca-cert-file: %s\n", @@ -1832,9 +1736,9 @@ /* If it's a GET or a SEARCH, the next thing to come in is the keyids. If it's a SEND, then there are no keyids. */ - if(action==SEND) + if(opt->action==KS_SEND) while(fgets(line,MAX_LINE,input)!=NULL && line[0]!='\n'); - else if(action==GET || action==SEARCH) + else if(opt->action==KS_GET || opt->action==KS_SEARCH) { for(;;) { @@ -1885,24 +1789,23 @@ fprintf(output,"VERSION %d\n",KEYSERVER_PROTO_VERSION); fprintf(output,"PROGRAM %s\n\n",VERSION); - if(verbose>1) + if(opt->verbose>1) { - fprintf(console,"Host:\t\t%s\n",host); + fprintf(console,"Host:\t\t%s\n",opt->host); if(port) fprintf(console,"Port:\t\t%d\n",port); - fprintf(console,"Command:\t%s\n",action==GET?"GET": - action==SEND?"SEND":"SEARCH"); + fprintf(console,"Command:\t%s\n",ks_action_to_string(opt->action)); } - if(debug) + if(opt->debug) { #if defined(LDAP_OPT_DEBUG_LEVEL) && defined(HAVE_LDAP_SET_OPTION) - err=ldap_set_option(NULL,LDAP_OPT_DEBUG_LEVEL,&debug); + err=ldap_set_option(NULL,LDAP_OPT_DEBUG_LEVEL,&opt->debug); if(err!=LDAP_SUCCESS) fprintf(console,"gpgkeys: unable to set debug mode: %s\n", ldap_err2string(err)); else - fprintf(console,"gpgkeys: debug level %d\n",debug); + fprintf(console,"gpgkeys: debug level %d\n",opt->debug); #else fprintf(console,"gpgkeys: not built with debugging support\n"); #endif @@ -1910,16 +1813,16 @@ /* We have a timeout set for the setup stuff since it could time out as well. */ - set_timeout(timeout); + set_timeout(opt->timeout); /* Note that this tries all A records on a given host (or at least, OpenLDAP does). */ - ldap=ldap_init(host,port); + ldap=ldap_init(opt->host,port); if(ldap==NULL) { fprintf(console,"gpgkeys: internal LDAP init error: %s\n", strerror(errno)); - fail_all(keylist,action,KEYSERVER_INTERNAL_ERROR); + fail_all(keylist,KEYSERVER_INTERNAL_ERROR); goto fail; } @@ -1933,11 +1836,11 @@ { fprintf(console,"gpgkeys: unable to make SSL connection: %s\n", ldap_err2string(err)); - fail_all(keylist,action,ldap_err_to_gpg_err(err)); + fail_all(keylist,ldap_err_to_gpg_err(err)); goto fail; } - if(!check_cert) + if(!opt->flags.check_cert) ssl=LDAP_OPT_X_TLS_NEVER; err=ldap_set_option(NULL,LDAP_OPT_X_TLS_REQUIRE_CERT,&ssl); @@ -1946,7 +1849,7 @@ fprintf(console, "gpgkeys: unable to set certificate validation: %s\n", ldap_err2string(err)); - fail_all(keylist,action,ldap_err_to_gpg_err(err)); + fail_all(keylist,ldap_err_to_gpg_err(err)); goto fail; } #else @@ -1962,7 +1865,7 @@ { fprintf(console,"gpgkeys: unable to retrieve LDAP base: %s\n", err?ldap_err2string(err):"not found"); - fail_all(keylist,action,ldap_err_to_gpg_err(err)); + fail_all(keylist,ldap_err_to_gpg_err(err)); goto fail; } @@ -1977,7 +1880,7 @@ "not supported by the NAI LDAP keyserver"); if(use_tls==3) { - fail_all(keylist,action,KEYSERVER_INTERNAL_ERROR); + fail_all(keylist,KEYSERVER_INTERNAL_ERROR); goto fail; } } @@ -1989,7 +1892,7 @@ err=ldap_set_option(ldap,LDAP_OPT_PROTOCOL_VERSION,&ver); if(err==LDAP_SUCCESS) { - if(check_cert) + if(opt->flags.check_cert) ver=LDAP_OPT_X_TLS_HARD; else ver=LDAP_OPT_X_TLS_NEVER; @@ -2001,17 +1904,17 @@ if(err!=LDAP_SUCCESS) { - if(use_tls>=2 || verbose>2) + if(use_tls>=2 || opt->verbose>2) fprintf(console,"gpgkeys: unable to start TLS: %s\n", ldap_err2string(err)); /* Are we forcing it? */ if(use_tls==3) { - fail_all(keylist,action,ldap_err_to_gpg_err(err)); + fail_all(keylist,ldap_err_to_gpg_err(err)); goto fail; } } - else if(err==LDAP_SUCCESS && verbose>1) + else if(err==LDAP_SUCCESS && opt->verbose>1) fprintf(console,"gpgkeys: TLS started successfully.\n"); #else if(use_tls>=2) @@ -2045,94 +1948,89 @@ bound=1; #endif - switch(action) + if(opt->action==KS_GET) { - case GET: keyptr=keylist; while(keyptr!=NULL) { - set_timeout(timeout); + set_timeout(opt->timeout); if(get_key(keyptr->str)!=KEYSERVER_OK) failed++; keyptr=keyptr->next; } - break; - - case SEND: - { - int eof=0; - - do - { - set_timeout(timeout); - - if(real_ldap) - { - if(send_key(&eof)!=KEYSERVER_OK) - failed++; - } - else - { - if(send_key_keyserver(&eof)!=KEYSERVER_OK) - failed++; - } - } - while(!eof); - } - break; + } + else if(opt->action==KS_SEND) + { + int eof=0; - case SEARCH: - { - char *searchkey=NULL; - int len=0; + do + { + set_timeout(opt->timeout); - set_timeout(timeout); + if(real_ldap) + { + if(send_key(&eof)!=KEYSERVER_OK) + failed++; + } + else + { + if(send_key_keyserver(&eof)!=KEYSERVER_OK) + failed++; + } + } + while(!eof); + } + else if(opt->action==KS_SEARCH) + { + char *searchkey=NULL; + int len=0; - /* To search, we stick a * in between each key to search for. - This means that if the user enters words, they'll get - "enters*words". If the user "enters words", they'll get - "enters words" */ + set_timeout(opt->timeout); - keyptr=keylist; - while(keyptr!=NULL) - { - len+=strlen(keyptr->str)+1; - keyptr=keyptr->next; - } + /* To search, we stick a * in between each key to search for. + This means that if the user enters words, they'll get + "enters*words". If the user "enters words", they'll get + "enters words" */ - searchkey=malloc(len+1); - if(searchkey==NULL) - { - ret=KEYSERVER_NO_MEMORY; - fail_all(keylist,action,KEYSERVER_NO_MEMORY); - goto fail; - } + keyptr=keylist; + while(keyptr!=NULL) + { + len+=strlen(keyptr->str)+1; + keyptr=keyptr->next; + } - searchkey[0]='\0'; + searchkey=malloc(len+1); + if(searchkey==NULL) + { + ret=KEYSERVER_NO_MEMORY; + fail_all(keylist,KEYSERVER_NO_MEMORY); + goto fail; + } - keyptr=keylist; - while(keyptr!=NULL) - { - strcat(searchkey,keyptr->str); - strcat(searchkey,"*"); - keyptr=keyptr->next; - } + searchkey[0]='\0'; - /* Nail that last "*" */ - if(*searchkey) - searchkey[strlen(searchkey)-1]='\0'; + keyptr=keylist; + while(keyptr!=NULL) + { + strcat(searchkey,keyptr->str); + strcat(searchkey,"*"); + keyptr=keyptr->next; + } - if(search_key(searchkey)!=KEYSERVER_OK) - failed++; + /* Nail that last "*" */ + if(*searchkey) + searchkey[strlen(searchkey)-1]='\0'; - free(searchkey); - } + if(search_key(searchkey)!=KEYSERVER_OK) + failed++; - break; + free(searchkey); } + else + BUG(); if(!failed) ret=KEYSERVER_OK; @@ -2152,6 +2050,8 @@ if(output!=stdout) fclose(output); + free_ks_options(opt); + if(ldap!=NULL && bound) ldap_unbind_s(ldap); Index: gnupg/keyserver/ksutil.c diff -u gnupg/keyserver/ksutil.c:1.3 gnupg/keyserver/ksutil.c:1.4 --- gnupg/keyserver/ksutil.c:1.3 Thu Mar 17 00:46:07 2005 +++ gnupg/keyserver/ksutil.c Thu Mar 17 17:42:41 2005 @@ -110,6 +110,7 @@ char scheme[MAX_SCHEME+1]; char auth[MAX_AUTH+1]; char path[URLMAX_PATH+1]; + char opaque[MAX_OPAQUE+1]; char option[MAX_OPTION+1]; if(line[0]=='#') @@ -174,6 +175,15 @@ return 0; } + if(sscanf(line,"OPAQUE %" MKSTRING(MAX_OPAQUE) "s\n",opaque)==1) + { + opaque[MAX_OPAQUE]='\0'; + opt->opaque=strdup(opaque); + if(!opt->opaque) + return KEYSERVER_NO_MEMORY; + return 0; + } + if(sscanf(line,"VERSION %d\n",&version)==1) { if(version!=KEYSERVER_PROTO_VERSION) @@ -236,6 +246,8 @@ opt->debug=0; else if(start[5]=='=') opt->debug=atoi(&start[6]); + else if(start[5]=='\0') + opt->debug=1; } else if(strncasecmp(start,"timeout",7)==0) { Index: gnupg/keyserver/ksutil.h diff -u gnupg/keyserver/ksutil.h:1.6 gnupg/keyserver/ksutil.h:1.7 --- gnupg/keyserver/ksutil.h:1.6 Thu Mar 17 00:46:07 2005 +++ gnupg/keyserver/ksutil.h Thu Mar 17 17:42:41 2005 @@ -69,6 +69,7 @@ char *scheme; char *auth; char *path; + char *opaque; struct { unsigned int include_disabled:1; From cvs at cvs.gnupg.org Thu Mar 17 19:57:04 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Thu Mar 17 19:57:06 2005 Subject: GNUPG-1-9-BRANCH gnupg/sm (ChangeLog certchain.c certcheck.c) Message-ID: Date: Thursday, March 17, 2005 @ 20:10:37 Author: wk Path: /cvs/gnupg/gnupg/sm Tag: GNUPG-1-9-BRANCH Modified: ChangeLog certchain.c certcheck.c * certcheck.c: Fixed use of DBG_CRYPTO and DBG_X509. * certchain.c (gpgsm_basic_cert_check): Dump certificates after a failed gcry_pk_verify. (find_up): Do an external lookup also for an authorityKeyIdentifier lookup. Factored external lookup code out to .. (find_up_external): .. new. -------------+ ChangeLog | 12 ++++- certchain.c | 133 ++++++++++++++++++++++++++++++++++++---------------------- certcheck.c | 10 ++-- 3 files changed, 99 insertions(+), 56 deletions(-) Index: gnupg/sm/ChangeLog diff -u gnupg/sm/ChangeLog:1.101.2.89 gnupg/sm/ChangeLog:1.101.2.90 --- gnupg/sm/ChangeLog:1.101.2.89 Thu Mar 3 11:15:07 2005 +++ gnupg/sm/ChangeLog Thu Mar 17 20:10:37 2005 @@ -1,3 +1,13 @@ +2005-03-17 Werner Koch + + * certcheck.c: Fixed use of DBG_CRYPTO and DBG_X509. + + * certchain.c (gpgsm_basic_cert_check): Dump certificates after a + failed gcry_pk_verify. + (find_up): Do an external lookup also for an authorityKeyIdentifier + lookup. Factored external lookup code out to .. + (find_up_external): .. new. + 2005-03-03 Werner Koch * Makefile.am (gpgsm_LDADD): Added PTH_LIBS. Noted by Kazu Yamamoto. @@ -1407,7 +1417,7 @@ * server.c (rc_to_assuan_status): New. Use it for all commands. - Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2004, 2005 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 Index: gnupg/sm/certchain.c diff -u gnupg/sm/certchain.c:1.32.2.20 gnupg/sm/certchain.c:1.32.2.21 --- gnupg/sm/certchain.c:1.32.2.20 Fri Dec 3 18:44:54 2004 +++ gnupg/sm/certchain.c Thu Mar 17 20:10:37 2005 @@ -1,5 +1,5 @@ /* certchain.c - certificate chain validation - * Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -275,6 +275,69 @@ } + +/* Helper for find_up(). Locate the certificate for ISSUER using an + external lookup. KH is the keydb context we are currently using. + On success 0 is returned and the certificate may be retrieved from + the keydb using keydb_get_cert().*/ +static int +find_up_external (KEYDB_HANDLE kh, const char *issuer) +{ + int rc; + strlist_t names = NULL; + int count = 0; + char *pattern; + const char *s; + + if (opt.verbose) + log_info (_("looking up issuer at external location\n")); + /* The DIRMNGR process is confused about unknown attributes. As a + quick and ugly hack we locate the CN and use the issuer string + starting at this attribite. Fixme: we should have far better + parsing in the dirmngr. */ + s = strstr (issuer, "CN="); + if (!s || s == issuer || s[-1] != ',') + s = issuer; + + pattern = xtrymalloc (strlen (s)+2); + if (!pattern) + return gpg_error_from_errno (errno); + strcpy (stpcpy (pattern, "/"), s); + add_to_strlist (&names, pattern); + xfree (pattern); + + rc = gpgsm_dirmngr_lookup (NULL, names, find_up_store_certs_cb, &count); + free_strlist (names); + + if (opt.verbose) + log_info (_("number of issuers matching: %d\n"), count); + if (rc) + { + log_error ("external key lookup failed: %s\n", gpg_strerror (rc)); + rc = -1; + } + else if (!count) + rc = -1; + else + { + int old; + /* The issuers are currently stored in the ephemeral key DB, so + we temporary switch to ephemeral mode. */ + old = keydb_set_ephemeral (kh, 1); + keydb_search_reset (kh); + rc = keydb_search_subject (kh, issuer); + keydb_set_ephemeral (kh, old); + } + return rc; +} + + +/* Locate issuing certificate for CERT. ISSUER is the name of the + issuer used as a fallback if the other methods don't work. If + FIND_NEXT is true, the function shall return the next possible + issuer. The certificate itself is not directly returned but a + keydb_get_cert on the keyDb context KH will return it. Returns 0 + on success, -1 if not found or an error code. */ static int find_up (KEYDB_HANDLE kh, ksba_cert_t cert, const char *issuer, int find_next) { @@ -292,7 +355,7 @@ keydb_search_reset (kh); /* In case of an error try the ephemeral DB. We can't do - that in find-next mode because we can't keep the search + that in find_next mode because we can't keep the search state then. */ if (rc == -1 && !find_next) { @@ -305,7 +368,12 @@ } keydb_set_ephemeral (kh, old); } + + /* If we didn't found it, try an external lookup. */ + if (rc == -1 && opt.auto_issuer_key_retrieve && !find_next) + rc = find_up_external (kh, issuer); } + /* Print a note so that the user does not feel too helpless when an issuer certificate was found and gpgsm prints BAD signature because it is not the correct one. */ @@ -315,16 +383,17 @@ gpgsm_dump_serial (authidno); log_printf ("/"); gpgsm_dump_string (s); - log_printf (") not found\n"); + log_printf (") not found using authorityKeyIdentifier\n"); } else if (rc) log_error ("failed to find authorityKeyIdentifier: rc=%d\n", rc); ksba_name_release (authid); xfree (authidno); - /* Fixme: don't know how to do dirmngr lookup with serial+issuer. */ + /* Fixme: There is no way to do an external lookup with + serial+issuer. */ } - if (rc) /* not found via authorithyKeyIdentifier, try regular issuer name */ + if (rc) /* Not found via authorithyKeyIdentifier, try regular issuer name. */ rc = keydb_search_subject (kh, issuer); if (rc == -1 && !find_next) { @@ -338,51 +407,10 @@ keydb_set_ephemeral (kh, old); } + /* Still not found. If enabled, try an external lookup. */ if (rc == -1 && opt.auto_issuer_key_retrieve && !find_next) - { - STRLIST names = NULL; - int count = 0; - char *pattern; - const char *s; - - if (opt.verbose) - log_info (_("looking up issuer at external location\n")); - /* dirmngr is confused about unknown attributes so as a quick - and ugly hack we locate the CN and use this and the - following. Fixme: we should have far better parsing in the - dirmngr. */ - s = strstr (issuer, "CN="); - if (!s || s == issuer || s[-1] != ',') - s = issuer; - - pattern = xtrymalloc (strlen (s)+2); - if (!pattern) - return OUT_OF_CORE (errno); - strcpy (stpcpy (pattern, "/"), s); - add_to_strlist (&names, pattern); - xfree (pattern); - rc = gpgsm_dirmngr_lookup (NULL, names, find_up_store_certs_cb, &count); - free_strlist (names); - if (opt.verbose) - log_info (_("number of issuers matching: %d\n"), count); - if (rc) - { - log_error ("external key lookup failed: %s\n", gpg_strerror (rc)); - rc = -1; - } - else if (!count) - rc = -1; - else - { - int old; - /* The issuers are currently stored in the ephemeral key - DB, so we temporary switch to ephemeral mode. */ - old = keydb_set_ephemeral (kh, 1); - keydb_search_reset (kh); - rc = keydb_search_subject (kh, issuer); - keydb_set_ephemeral (kh, old); - } - } + rc = find_up_external (kh, issuer); + return rc; } @@ -959,7 +987,7 @@ } else { - /* find the next cert up the tree */ + /* Find the next cert up the tree. */ keydb_search_reset (kh); rc = find_up (kh, cert, issuer, 0); if (rc) @@ -990,6 +1018,11 @@ { log_error ("certificate has a BAD signature: %s\n", gpg_strerror (rc)); + if (DBG_X509) + { + gpgsm_dump_cert ("signing issuer", issuer_cert); + gpgsm_dump_cert ("signed subject", cert); + } rc = gpg_error (GPG_ERR_BAD_CERT); goto leave; } Index: gnupg/sm/certcheck.c diff -u gnupg/sm/certcheck.c:1.17.2.6 gnupg/sm/certcheck.c:1.17.2.7 --- gnupg/sm/certcheck.c:1.17.2.6 Tue Aug 17 17:26:16 2004 +++ gnupg/sm/certcheck.c Thu Mar 17 20:10:37 2005 @@ -101,7 +101,7 @@ memcpy ( frame+n, gcry_md_read(md, algo), len ); n += len; assert ( n == nframe ); } - if (DBG_X509) + if (DBG_CRYPTO) { int j; log_debug ("encoded hash:"); @@ -196,7 +196,7 @@ ksba_free (p); return gpg_error (GPG_ERR_BUG); } - if (DBG_X509) + if (DBG_CRYPTO) { int j; log_debug ("signature value:"); @@ -251,7 +251,7 @@ rc = gcry_pk_verify (s_sig, s_hash, s_pkey); - if (DBG_CRYPTO) + if (DBG_X509) log_debug ("gcry_pk_verify: %s\n", gpg_strerror (rc)); gcry_md_close (md); gcry_sexp_release (s_sig); @@ -294,7 +294,7 @@ gcry_sexp_release (s_sig); return gpg_error (GPG_ERR_BUG); } - if (DBG_X509) + if (DBG_CRYPTO) log_printhex ("public key: ", p, n); rc = gcry_sexp_sscan ( &s_pkey, NULL, p, n); @@ -321,7 +321,7 @@ gcry_mpi_release (frame); rc = gcry_pk_verify (s_sig, s_hash, s_pkey); - if (DBG_CRYPTO) + if (DBG_X509) log_debug ("gcry_pk_verify: %s\n", gpg_strerror (rc)); gcry_sexp_release (s_sig); gcry_sexp_release (s_hash); From cvs at cvs.gnupg.org Thu Mar 17 23:41:44 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 17 23:41:47 2005 Subject: gnupg/g10 (ChangeLog keyserver.c options.h) Message-ID: Date: Thursday, March 17, 2005 @ 23:55:17 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog keyserver.c options.h * options.h, keyserver.c (parse_keyserver_options, keyserver_spawn): Don't treat 'verbose' and 'include-disabled' as special. Just pass them through silently to the keyserver helper. -------------+ ChangeLog | 6 ++++++ keyserver.c | 14 +++----------- options.h | 20 +++++++++----------- 3 files changed, 18 insertions(+), 22 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.706 gnupg/g10/ChangeLog:1.707 --- gnupg/g10/ChangeLog:1.706 Wed Mar 16 20:10:54 2005 +++ gnupg/g10/ChangeLog Thu Mar 17 23:55:17 2005 @@ -1,3 +1,9 @@ +2005-03-17 David Shaw + + * options.h, keyserver.c (parse_keyserver_options, + keyserver_spawn): Don't treat 'verbose' and 'include-disabled' as + special. Just pass them through silently to the keyserver helper. + 2005-03-16 Werner Koch * ccid-driver.c (parse_ccid_descriptor): Make SCM workaround Index: gnupg/g10/keyserver.c diff -u gnupg/g10/keyserver.c:1.81 gnupg/g10/keyserver.c:1.82 --- gnupg/g10/keyserver.c:1.81 Thu Mar 10 20:34:40 2005 +++ gnupg/g10/keyserver.c Thu Mar 17 23:55:17 2005 @@ -54,12 +54,11 @@ }; /* Tell remote processes about these options */ -#define REMOTE_TELL (KEYSERVER_INCLUDE_REVOKED|KEYSERVER_INCLUDE_DISABLED|KEYSERVER_INCLUDE_SUBKEYS|KEYSERVER_TRY_DNS_SRV) +#define REMOTE_TELL (KEYSERVER_INCLUDE_REVOKED|KEYSERVER_INCLUDE_SUBKEYS|KEYSERVER_TRY_DNS_SRV) static struct parse_options keyserver_opts[]= { {"include-revoked",KEYSERVER_INCLUDE_REVOKED,NULL}, - {"include-disabled",KEYSERVER_INCLUDE_DISABLED,NULL}, {"include-subkeys",KEYSERVER_INCLUDE_SUBKEYS,NULL}, {"keep-temp-files",KEYSERVER_KEEP_TEMP_FILES,NULL}, {"refresh-add-fake-v3-keyids",KEYSERVER_ADD_FAKE_V3,NULL}, @@ -97,17 +96,13 @@ that you must use strncasecmp here as there might be an =argument attached which will foil the use of strcasecmp. */ - if(ascii_strncasecmp(tok,"verbose",7)==0) - opt.keyserver_options.verbose++; - else if(ascii_strncasecmp(tok,"no-verbose",10)==0) - opt.keyserver_options.verbose--; #ifdef EXEC_TEMPFILE_ONLY - else if(ascii_strncasecmp(tok,"use-temp-files",14)==0 || + if(ascii_strncasecmp(tok,"use-temp-files",14)==0 || ascii_strncasecmp(tok,"no-use-temp-files",17)==0) log_info(_("WARNING: keyserver option `%s' is not used" " on this platform\n"),tok); #else - else if(ascii_strncasecmp(tok,"use-temp-files",14)==0) + if(ascii_strncasecmp(tok,"use-temp-files",14)==0) opt.keyserver_options.options|=KEYSERVER_USE_TEMP_FILES; else if(ascii_strncasecmp(tok,"no-use-temp-files",17)==0) opt.keyserver_options.options&=~KEYSERVER_USE_TEMP_FILES; @@ -931,9 +926,6 @@ if(opt.keyserver_options.options & kopts[i].bit & REMOTE_TELL) fprintf(spawn->tochild,"OPTION %s\n",kopts[i].name); - for(i=0;itochild,"OPTION verbose\n"); - for(temp=opt.keyserver_options.other;temp;temp=temp->next) fprintf(spawn->tochild,"OPTION %s\n",temp->d); Index: gnupg/g10/options.h diff -u gnupg/g10/options.h:1.133 gnupg/g10/options.h:1.134 --- gnupg/g10/options.h:1.133 Sat Jan 1 22:21:11 2005 +++ gnupg/g10/options.h Thu Mar 17 23:55:17 2005 @@ -1,6 +1,6 @@ /* options.h - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, - * 2004 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, + * 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -137,7 +137,6 @@ } *keyserver; struct { - int verbose; unsigned int options; unsigned int import_options; unsigned int export_options; @@ -283,13 +282,12 @@ #define VERIFY_SHOW_UNUSABLE_UIDS (1<<6) #define KEYSERVER_INCLUDE_REVOKED (1<<0) -#define KEYSERVER_INCLUDE_DISABLED (1<<1) -#define KEYSERVER_INCLUDE_SUBKEYS (1<<2) -#define KEYSERVER_USE_TEMP_FILES (1<<3) -#define KEYSERVER_KEEP_TEMP_FILES (1<<4) -#define KEYSERVER_ADD_FAKE_V3 (1<<5) -#define KEYSERVER_AUTO_KEY_RETRIEVE (1<<6) -#define KEYSERVER_TRY_DNS_SRV (1<<7) -#define KEYSERVER_HONOR_KEYSERVER_URL (1<<8) +#define KEYSERVER_INCLUDE_SUBKEYS (1<<1) +#define KEYSERVER_USE_TEMP_FILES (1<<2) +#define KEYSERVER_KEEP_TEMP_FILES (1<<3) +#define KEYSERVER_ADD_FAKE_V3 (1<<4) +#define KEYSERVER_AUTO_KEY_RETRIEVE (1<<5) +#define KEYSERVER_TRY_DNS_SRV (1<<6) +#define KEYSERVER_HONOR_KEYSERVER_URL (1<<7) #endif /*G10_OPTIONS_H*/ From cvs at cvs.gnupg.org Fri Mar 18 00:01:13 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Fri Mar 18 00:01:17 2005 Subject: gnupg/g10 (ChangeLog Makefile.am) Message-ID: Date: Friday, March 18, 2005 @ 00:14:47 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog Makefile.am * Makefile.am: Calculate GNUPG_LIBEXECDIR directly. Do not redefine $libexecdir. -------------+ ChangeLog | 3 +++ Makefile.am | 16 ++++------------ 2 files changed, 7 insertions(+), 12 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.707 gnupg/g10/ChangeLog:1.708 --- gnupg/g10/ChangeLog:1.707 Thu Mar 17 23:55:17 2005 +++ gnupg/g10/ChangeLog Fri Mar 18 00:14:47 2005 @@ -1,5 +1,8 @@ 2005-03-17 David Shaw + * Makefile.am: Calculate GNUPG_LIBEXECDIR directly. Do not + redefine $libexecdir. + * options.h, keyserver.c (parse_keyserver_options, keyserver_spawn): Don't treat 'verbose' and 'include-disabled' as special. Just pass them through silently to the keyserver helper. Index: gnupg/g10/Makefile.am diff -u gnupg/g10/Makefile.am:1.89 gnupg/g10/Makefile.am:1.90 --- gnupg/g10/Makefile.am:1.89 Mon Jan 3 16:15:34 2005 +++ gnupg/g10/Makefile.am Fri Mar 18 00:14:47 2005 @@ -1,5 +1,5 @@ -# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, -# 2004 Free Software Foundation, Inc. +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. # # This file is part of GnuPG. # @@ -23,14 +23,13 @@ EXTRA_DIST = options.skel # it seems that we can't use this with automake 1.5 #OMIT_DEPENDENCIES = zlib.h zconf.h -libexecdir = @libexecdir@/@PACKAGE@ + if ! HAVE_DOSISH_SYSTEM -AM_CFLAGS = -DGNUPG_LIBEXECDIR="\"$(libexecdir)\"" +AM_CFLAGS = -DGNUPG_LIBEXECDIR="\"$(libexecdir)/@PACKAGE@\"" endif needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a other_libs = $(LIBICONV) $(LIBINTL) $(CAPLIBS) -#noinst_PROGRAMS = gpgd bin_PROGRAMS = gpg gpgv if ENABLE_BZIP2_SUPPORT @@ -125,13 +124,6 @@ $(common_source) \ verify.c -#gpgd_SOURCES = gpgd.c \ -# ks-proto.h \ -# ks-proto.c \ -# ks-db.c \ -# ks-db.h \ -# $(common_source) - LDADD = $(needed_libs) $(other_libs) @ZLIBS@ @W32LIBS@ @LIBREADLINE@ gpg_LDADD = $(LDADD) @DLLIBS@ @NETLIBS@ @LIBUSB@ From cvs at cvs.gnupg.org Fri Mar 18 00:03:06 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Fri Mar 18 00:03:08 2005 Subject: gnupg/keyserver (ChangeLog Makefile.am ksutil.c) Message-ID: Date: Friday, March 18, 2005 @ 00:16:41 Author: dshaw Path: /cvs/gnupg/gnupg/keyserver Modified: ChangeLog Makefile.am ksutil.c * ksutil.c (parse_ks_options): Handle verbose=nnn. * Makefile.am: Calculate GNUPG_LIBEXECDIR directly. Do not redefine $libexecdir. -------------+ ChangeLog | 5 +++++ Makefile.am | 9 +++++---- ksutil.c | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) Index: gnupg/keyserver/ChangeLog diff -u gnupg/keyserver/ChangeLog:1.117 gnupg/keyserver/ChangeLog:1.118 --- gnupg/keyserver/ChangeLog:1.117 Thu Mar 17 17:42:41 2005 +++ gnupg/keyserver/ChangeLog Fri Mar 18 00:16:41 2005 @@ -1,5 +1,10 @@ 2005-03-17 David Shaw + * ksutil.c (parse_ks_options): Handle verbose=nnn. + + * Makefile.am: Calculate GNUPG_LIBEXECDIR directly. Do not + redefine $libexecdir. + * gpgkeys_curl.c, gpgkeys_finger.c, gpgkeys_ldap.c: Start using parse_ks_options and remove a lot of common code. Index: gnupg/keyserver/Makefile.am diff -u gnupg/keyserver/Makefile.am:1.26 gnupg/keyserver/Makefile.am:1.27 --- gnupg/keyserver/Makefile.am:1.26 Fri Feb 11 19:05:13 2005 +++ gnupg/keyserver/Makefile.am Fri Mar 18 00:16:41 2005 @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. # # This file is part of GnuPG. # @@ -21,10 +21,11 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl EXTRA_PROGRAMS = gpgkeys_ldap gpgkeys_hkp gpgkeys_http gpgkeys_finger gpgkeys_curl EXTRA_SCRIPTS = gpgkeys_mailto -libexecdir = @libexecdir@/@PACKAGE@ -libexec_PROGRAMS = @GPGKEYS_LDAP@ @GPGKEYS_HKP@ @GPGKEYS_FINGER@ @GPGKEYS_HTTP@ @GPGKEYS_CURL@ -libexec_SCRIPTS = @GPGKEYS_MAILTO@ +gpglibexecdir = $(libexecdir)/@PACKAGE@ + +gpglibexec_PROGRAMS = @GPGKEYS_LDAP@ @GPGKEYS_HKP@ @GPGKEYS_FINGER@ @GPGKEYS_HTTP@ @GPGKEYS_CURL@ +gpglibexec_SCRIPTS = @GPGKEYS_MAILTO@ noinst_SCRIPTS = gpgkeys_test gpgkeys_ldap_SOURCES = gpgkeys_ldap.c ksutil.c ksutil.h Index: gnupg/keyserver/ksutil.c diff -u gnupg/keyserver/ksutil.c:1.4 gnupg/keyserver/ksutil.c:1.5 --- gnupg/keyserver/ksutil.c:1.4 Thu Mar 17 17:42:41 2005 +++ gnupg/keyserver/ksutil.c Fri Mar 18 00:16:41 2005 @@ -92,6 +92,7 @@ free(opt->scheme); free(opt->auth); free(opt->path); + free(opt->opaque); free(opt->ca_cert_file); free(opt); } @@ -205,10 +206,12 @@ start=&option[3]; } - if(strcasecmp(start,"verbose")==0) + if(strncasecmp(start,"verbose",7)==0) { if(no) - opt->verbose--; + opt->verbose=0; + else if(start[7]=='=') + opt->verbose=atoi(&start[8]); else opt->verbose++; } From cvs at cvs.gnupg.org Fri Mar 18 00:39:04 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Fri Mar 18 00:39:08 2005 Subject: gnupg/g10 (ChangeLog getkey.c) Message-ID: Date: Friday, March 18, 2005 @ 00:52:38 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog getkey.c * getkey.c (get_seckey_byname2): If no explicit default key is set, don't pick a disabled default. Noted by David Crick. -----------+ ChangeLog | 3 +++ getkey.c | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.708 gnupg/g10/ChangeLog:1.709 --- gnupg/g10/ChangeLog:1.708 Fri Mar 18 00:14:47 2005 +++ gnupg/g10/ChangeLog Fri Mar 18 00:52:37 2005 @@ -1,5 +1,8 @@ 2005-03-17 David Shaw + * getkey.c (get_seckey_byname2): If no explicit default key is + set, don't pick a disabled default. Noted by David Crick. + * Makefile.am: Calculate GNUPG_LIBEXECDIR directly. Do not redefine $libexecdir. Index: gnupg/g10/getkey.c diff -u gnupg/g10/getkey.c:1.125 gnupg/g10/getkey.c:1.126 --- gnupg/g10/getkey.c:1.125 Sat Feb 5 01:00:35 2005 +++ gnupg/g10/getkey.c Fri Mar 18 00:52:38 2005 @@ -1,6 +1,6 @@ /* getkey.c - Get a key from the database - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, - * 2004, 2005 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, + * 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -1059,14 +1059,20 @@ KBNODE *retblock ) { STRLIST namelist = NULL; - int rc; + int rc,include_unusable=1; + + /* If we have no name, try to use the default secret key. If we + have no default, we'll use the first usable one. */ if( !name && opt.def_secret_key && *opt.def_secret_key ) add_to_strlist( &namelist, opt.def_secret_key ); else if(name) add_to_strlist( &namelist, name ); + else + include_unusable=0; - rc = key_byname( retctx, namelist, NULL, sk, 1, 1, retblock, NULL ); + rc = key_byname( retctx, namelist, NULL, sk, 1, include_unusable, + retblock, NULL ); free_strlist( namelist ); From cvs at cvs.gnupg.org Fri Mar 18 21:04:01 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Fri Mar 18 21:04:05 2005 Subject: gnupg (include/ChangeLog include/ttyio.h util/ChangeLog util/ttyio.c) Message-ID: Date: Friday, March 18, 2005 @ 21:17:38 Author: dshaw Path: /cvs/gnupg/gnupg Modified: include/ChangeLog include/ttyio.h util/ChangeLog util/ttyio.c * ttyio.c (tty_enable_completion, tty_disable_completion): Enable and disable readline completion. (init_ttyfp): Completion is disabled by default. -------------------+ include/ChangeLog | 5 +++++ include/ttyio.h | 17 ++++++++++++++++- util/ChangeLog | 6 ++++++ util/ttyio.c | 20 ++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) Index: gnupg/include/ChangeLog diff -u gnupg/include/ChangeLog:1.82 gnupg/include/ChangeLog:1.83 --- gnupg/include/ChangeLog:1.82 Thu Feb 10 05:06:30 2005 +++ gnupg/include/ChangeLog Fri Mar 18 21:17:38 2005 @@ -1,3 +1,8 @@ +2005-03-18 David Shaw + + * ttyio.h: Prototype tty_enable_completion(), and + tty_disable_completion(). + 2005-02-09 David Shaw * cipher.h: Add a flag for a symmetric DEK. Index: gnupg/include/ttyio.h diff -u gnupg/include/ttyio.h:1.13 gnupg/include/ttyio.h:1.14 --- gnupg/include/ttyio.h:1.13 Wed Oct 8 17:20:58 2003 +++ gnupg/include/ttyio.h Fri Mar 18 21:17:38 2005 @@ -1,5 +1,5 @@ /* ttyio.h - * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc. * * This file is part of GNUPG. * @@ -20,6 +20,11 @@ #ifndef G10_TTYIO_H #define G10_TTYIO_H +#ifdef HAVE_LIBREADLINE +#include +#include +#endif + const char *tty_get_ttyname (void); int tty_batchmode( int onoff ); #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) @@ -39,5 +44,15 @@ int tty_get_answer_is_yes( const char *prompt ); int tty_no_terminal(int onoff); +#ifdef HAVE_LIBREADLINE +void tty_enable_completion(rl_completion_func_t *completer); +void tty_disable_completion(void); +#else +/* Use a macro to stub out these functions since a macro has no need + to typedef a "rl_completion_func_t" which would be undefined + without readline. */ +#define tty_enable_completion(x) +#define tty_disable_completion() +#endif #endif /*G10_TTYIO_H*/ Index: gnupg/util/ChangeLog diff -u gnupg/util/ChangeLog:1.183 gnupg/util/ChangeLog:1.184 --- gnupg/util/ChangeLog:1.183 Mon Mar 14 21:41:20 2005 +++ gnupg/util/ChangeLog Fri Mar 18 21:17:38 2005 @@ -1,3 +1,9 @@ +2005-03-18 David Shaw + + * ttyio.c (tty_enable_completion, tty_disable_completion): Enable + and disable readline completion. + (init_ttyfp): Completion is disabled by default. + 2005-03-14 Werner Koch * miscutil.c (isotimestamp): New. Index: gnupg/util/ttyio.c diff -u gnupg/util/ttyio.c:1.34 gnupg/util/ttyio.c:1.35 --- gnupg/util/ttyio.c:1.34 Sat Dec 18 23:23:49 2004 +++ gnupg/util/ttyio.c Fri Mar 18 21:17:38 2005 @@ -165,6 +165,7 @@ #ifdef HAVE_LIBREADLINE rl_catch_signals = 0; rl_instream = rl_outstream = ttyfp; + rl_inhibit_completion = 1; #endif #endif #ifdef HAVE_TCGETATTR @@ -173,6 +174,25 @@ initialized = 1; } +#ifdef HAVE_LIBREADLINE +void +tty_enable_completion(rl_completion_func_t *completer) +{ + if( !initialized ) + init_ttyfp(); + rl_attempted_completion_function=completer; + rl_inhibit_completion=0; +} + +void +tty_disable_completion(void) +{ + if( !initialized ) + init_ttyfp(); + rl_inhibit_completion=1; +} +#endif + int tty_batchmode( int onoff ) { From cvs at cvs.gnupg.org Fri Mar 18 22:53:32 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Fri Mar 18 22:53:36 2005 Subject: gnupg/g10 (ChangeLog keyedit.c) Message-ID: Date: Friday, March 18, 2005 @ 23:07:12 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog keyedit.c * keyedit.c (command_generator, keyedit_completion) [HAVE_LIBREADLINE]: New functions to enable command completion in the --edit-key menu. (keyedit_menu): Call them here. -----------+ ChangeLog | 7 +++++++ keyedit.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 3 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.709 gnupg/g10/ChangeLog:1.710 --- gnupg/g10/ChangeLog:1.709 Fri Mar 18 00:52:37 2005 +++ gnupg/g10/ChangeLog Fri Mar 18 23:07:12 2005 @@ -1,3 +1,10 @@ +2005-03-18 David Shaw + + * keyedit.c (command_generator, keyedit_completion) + [HAVE_LIBREADLINE]: New functions to enable command completion in + the --edit-key menu. + (keyedit_menu): Call them here. + 2005-03-17 David Shaw * getkey.c (get_seckey_byname2): If no explicit default key is Index: gnupg/g10/keyedit.c diff -u gnupg/g10/keyedit.c:1.173 gnupg/g10/keyedit.c:1.174 --- gnupg/g10/keyedit.c:1.173 Thu Mar 10 19:40:57 2005 +++ gnupg/g10/keyedit.c Fri Mar 18 23:07:12 2005 @@ -26,7 +26,10 @@ #include #include #include - +#ifdef HAVE_LIBREADLINE +#include +#include +#endif #include "options.h" #include "packet.h" #include "errors.h" @@ -1405,6 +1408,49 @@ { NULL, cmdNONE, 0, NULL } }; +#ifdef HAVE_LIBREADLINE + +/* These two functions are used by readline for command completion. */ + +static char *command_generator(const char *text,int state) +{ + static int list_index,len; + const char *name; + + /* If this is a new word to complete, initialize now. This includes + saving the length of TEXT for efficiency, and initializing the + index variable to 0. */ + if(!state) + { + list_index=0; + len=strlen(text); + } + + /* Return the next partial match */ + while((name=cmds[list_index].name)) + { + /* Only complete commands that have help text */ + if(cmds[list_index++].desc && strncmp(name,text,len)==0) + return strdup(name); + } + + return NULL; +} + +static char **keyedit_completion(const char *text, int start, int end) +{ + /* If we are at the start of a line, we try and command-complete. + If not, just do nothing for now. */ + + if(start==0) + return rl_completion_matches(text,command_generator); + + rl_attempted_completion_over=1; + + return NULL; +} +#endif + void keyedit_menu( const char *username, STRLIST locusr, STRLIST commands, int quiet, int seckey_check ) @@ -1522,10 +1568,13 @@ else have_commands = 0; } - if( !have_commands ) { + if( !have_commands ) + { + tty_enable_completion(keyedit_completion); answer = cpr_get_no_help("keyedit.prompt", _("Command> ")); cpr_kill_prompt(); - } + tty_disable_completion(); + } trim_spaces(answer); } while( *answer == '#' ); From cvs at cvs.gnupg.org Sat Mar 19 15:11:01 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Sat Mar 19 15:11:07 2005 Subject: gnupg/keyserver (ChangeLog gpgkeys_ldap.c) Message-ID: Date: Saturday, March 19, 2005 @ 15:24:36 Author: dshaw Path: /cvs/gnupg/gnupg/keyserver Modified: ChangeLog gpgkeys_ldap.c * gpgkeys_ldap.c (main): Fix three wrong calls to fail_all(). Noted by Stefan Bellon. ----------------+ ChangeLog | 5 +++++ gpgkeys_ldap.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) Index: gnupg/keyserver/ChangeLog diff -u gnupg/keyserver/ChangeLog:1.118 gnupg/keyserver/ChangeLog:1.119 --- gnupg/keyserver/ChangeLog:1.118 Fri Mar 18 00:16:41 2005 +++ gnupg/keyserver/ChangeLog Sat Mar 19 15:24:36 2005 @@ -1,3 +1,8 @@ +2005-03-19 David Shaw + + * gpgkeys_ldap.c (main): Fix three wrong calls to fail_all(). + Noted by Stefan Bellon. + 2005-03-17 David Shaw * ksutil.c (parse_ks_options): Handle verbose=nnn. Index: gnupg/keyserver/gpgkeys_ldap.c diff -u gnupg/keyserver/gpgkeys_ldap.c:1.52 gnupg/keyserver/gpgkeys_ldap.c:1.53 --- gnupg/keyserver/gpgkeys_ldap.c:1.52 Thu Mar 17 17:42:41 2005 +++ gnupg/keyserver/gpgkeys_ldap.c Sat Mar 19 15:24:36 2005 @@ -1855,7 +1855,7 @@ #else fprintf(console,"gpgkeys: unable to make SSL connection: %s\n", "not built with LDAPS support"); - fail_all(keylist,action,KEYSERVER_INTERNAL_ERROR); + fail_all(keylist,KEYSERVER_INTERNAL_ERROR); goto fail; #endif } @@ -1922,7 +1922,7 @@ "not built with TLS support"); if(use_tls==3) { - fail_all(keylist,action,KEYSERVER_INTERNAL_ERROR); + fail_all(keylist,KEYSERVER_INTERNAL_ERROR); goto fail; } #endif @@ -1941,7 +1941,7 @@ { fprintf(console,"gpgkeys: internal LDAP bind error: %s\n", ldap_err2string(err)); - fail_all(keylist,action,ldap_err_to_gpg_err(err)); + fail_all(keylist,ldap_err_to_gpg_err(err)); goto fail; } else From cvs at cvs.gnupg.org Sat Mar 19 18:21:43 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Sat Mar 19 18:21:52 2005 Subject: libgcrypt/cipher (ChangeLog cipher.c) Message-ID: Date: Saturday, March 19, 2005 @ 18:35:27 Author: mo Path: /cvs/libgcrypt/libgcrypt/cipher Modified: ChangeLog cipher.c 2005-03-19 Moritz Schulte * cipher.c (do_cbc_encrypt): Be careful to not overwrite data, which is to be used later on. This happend, in case CTS is enabled and OUTBUF is equal to INBUF. -----------+ ChangeLog | 6 ++++++ cipher.c | 28 +++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) Index: libgcrypt/cipher/ChangeLog diff -u libgcrypt/cipher/ChangeLog:1.225 libgcrypt/cipher/ChangeLog:1.226 --- libgcrypt/cipher/ChangeLog:1.225 Fri Feb 25 11:48:10 2005 +++ libgcrypt/cipher/ChangeLog Sat Mar 19 18:35:27 2005 @@ -1,3 +1,9 @@ +2005-03-19 Moritz Schulte + + * cipher.c (do_cbc_encrypt): Be careful to not overwrite data, + which is to be used later on. This happend, in case CTS is + enabled and OUTBUF is equal to INBUF. + 2005-02-25 Werner Koch * pubkey.c (gcry_pk_get_keygrip): Allow for shadowed-private-key. Index: libgcrypt/cipher/cipher.c diff -u libgcrypt/cipher/cipher.c:1.70 libgcrypt/cipher/cipher.c:1.71 --- libgcrypt/cipher/cipher.c:1.70 Mon Aug 23 15:33:15 2004 +++ libgcrypt/cipher/cipher.c Sat Mar 19 18:35:27 2005 @@ -784,30 +784,36 @@ outbuf[i] = inbuf[i] ^ *ivp++; c->cipher->encrypt ( &c->context.c, outbuf, outbuf ); memcpy(c->iv, outbuf, blocksize ); - inbuf += c->cipher->blocksize; + inbuf += blocksize; if (!(c->flags & GCRY_CIPHER_CBC_MAC)) - outbuf += c->cipher->blocksize; + outbuf += blocksize; } if ((c->flags & GCRY_CIPHER_CBC_CTS) && nbytes > blocksize) { + /* We have to be careful here, since outbuf might be equal to + inbuf. */ + int restbytes; + byte b; if ((nbytes % blocksize) == 0) restbytes = blocksize; else restbytes = nbytes % blocksize; - memcpy(outbuf, outbuf - c->cipher->blocksize, restbytes); - outbuf -= c->cipher->blocksize; - - for(ivp=c->iv,i=0; i < restbytes; i++ ) - outbuf[i] = inbuf[i] ^ *ivp++; - for(; i < blocksize; i++ ) - outbuf[i] = 0 ^ *ivp++; + outbuf -= blocksize; + for (ivp = c->iv, i = 0; i < restbytes; i++) + { + b = inbuf[i]; + outbuf[blocksize + i] = outbuf[i]; + outbuf[i] = b ^ *ivp++; + } + for (; i < blocksize; i++) + outbuf[i] = 0 ^ *ivp++; - c->cipher->encrypt ( &c->context.c, outbuf, outbuf ); - memcpy(c->iv, outbuf, blocksize ); + c->cipher->encrypt (&c->context.c, outbuf, outbuf); + memcpy (c->iv, outbuf, blocksize); } } From cvs at cvs.gnupg.org Sat Mar 19 18:44:28 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Sat Mar 19 18:44:31 2005 Subject: LIBGCRYPT-1-2-BRANCH libgcrypt/cipher (ChangeLog cipher.c) Message-ID: Date: Saturday, March 19, 2005 @ 18:58:13 Author: mo Path: /cvs/libgcrypt/libgcrypt/cipher Tag: LIBGCRYPT-1-2-BRANCH Modified: ChangeLog cipher.c 2005-03-19 Moritz Schulte * cipher.c (do_cbc_encrypt): Be careful to not overwrite data, which is to be used later on. This happend, in case CTS is enabled and OUTBUF is equal to INBUF. -----------+ ChangeLog | 13 +++++++++++++ cipher.c | 24 +++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) Index: libgcrypt/cipher/ChangeLog diff -u libgcrypt/cipher/ChangeLog:1.211.2.9 libgcrypt/cipher/ChangeLog:1.211.2.10 --- libgcrypt/cipher/ChangeLog:1.211.2.9 Fri Feb 25 11:48:44 2005 +++ libgcrypt/cipher/ChangeLog Sat Mar 19 18:58:13 2005 @@ -1,3 +1,16 @@ +2005-03-19 Moritz Schulte + + * cipher.c (do_cbc_encrypt): Be careful to not overwrite data, + which is to be used later on. This happend, in case CTS is + enabled and OUTBUF is equal to INBUF. + +2005-03-19 Moritz Schulte + + * ac.c (gcry_ac_data_copy_internal): Use gcry_strdup instead of + strdup. + (gcry_ac_data_set): Likewise. + (gcry_ac_data_get_index): Likewise. + 2005-02-25 Werner Koch * pubkey.c (gcry_pk_get_keygrip): Allow for shadowed-private-key. Index: libgcrypt/cipher/cipher.c diff -u libgcrypt/cipher/cipher.c:1.69 libgcrypt/cipher/cipher.c:1.69.2.1 --- libgcrypt/cipher/cipher.c:1.69 Wed Feb 25 19:27:35 2004 +++ libgcrypt/cipher/cipher.c Sat Mar 19 18:58:13 2005 @@ -792,23 +792,29 @@ if ((c->flags & GCRY_CIPHER_CBC_CTS) && nbytes > blocksize) { + /* We have to be careful here, since outbuf might be equal to + inbuf. */ + int restbytes; + byte b; if ((nbytes % blocksize) == 0) restbytes = blocksize; else restbytes = nbytes % blocksize; - memcpy(outbuf, outbuf - c->cipher->blocksize, restbytes); - outbuf -= c->cipher->blocksize; - - for(ivp=c->iv,i=0; i < restbytes; i++ ) - outbuf[i] = inbuf[i] ^ *ivp++; - for(; i < blocksize; i++ ) - outbuf[i] = 0 ^ *ivp++; + outbuf -= blocksize; + for (ivp = c->iv, i = 0; i < restbytes; i++) + { + b = inbuf[i]; + outbuf[blocksize + i] = outbuf[i]; + outbuf[i] = b ^ *ivp++; + } + for (; i < blocksize; i++) + outbuf[i] = 0 ^ *ivp++; - c->cipher->encrypt ( &c->context.c, outbuf, outbuf ); - memcpy(c->iv, outbuf, blocksize ); + c->cipher->encrypt (&c->context.c, outbuf, outbuf); + memcpy (c->iv, outbuf, blocksize); } } From cvs at cvs.gnupg.org Sat Mar 19 19:42:47 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Sat Mar 19 19:42:52 2005 Subject: libgcrypt/doc (ChangeLog gcrypt.texi) Message-ID: Date: Saturday, March 19, 2005 @ 19:56:32 Author: mo Path: /cvs/libgcrypt/libgcrypt/doc Modified: ChangeLog gcrypt.texi 2005-03-19 Moritz Schulte * gcrypt.texi (Working with cipher handles): Clarify CTS mode. -------------+ ChangeLog | 4 ++++ gcrypt.texi | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) Index: libgcrypt/doc/ChangeLog diff -u libgcrypt/doc/ChangeLog:1.45 libgcrypt/doc/ChangeLog:1.46 --- libgcrypt/doc/ChangeLog:1.45 Tue Feb 22 18:54:27 2005 +++ libgcrypt/doc/ChangeLog Sat Mar 19 19:56:32 2005 @@ -1,3 +1,7 @@ +2005-03-19 Moritz Schulte + + * gcrypt.texi (Working with cipher handles): Clarify CTS mode. + 2005-02-08 Werner Koch * gcrypt.texi: Fixed direntry. Index: libgcrypt/doc/gcrypt.texi diff -u libgcrypt/doc/gcrypt.texi:1.47 libgcrypt/doc/gcrypt.texi:1.48 --- libgcrypt/doc/gcrypt.texi:1.47 Tue Feb 22 18:54:27 2005 +++ libgcrypt/doc/gcrypt.texi Sat Mar 19 19:56:32 2005 @@ -1285,7 +1285,9 @@ See @code{gcry_cipher_sync}. @item GCRY_CIPHER_CBC_CTS Enable cipher text stealing (CTS) for the CBC mode. Cannot be used -simultaneous as GCRY_CIPHER_CBC_MAC +simultaneous as GCRY_CIPHER_CBC_MAC. CTS mode makes it possible to +transform data of almost arbitrary size (only limitation is that it +must be greater than the algorithm's block size). @item GCRY_CIPHER_CBC_MAC Compute CBC-MAC keyed checksums. This is the same as CBC mode, but only output the last block. Cannot be used simultaneous as From cvs at cvs.gnupg.org Mon Mar 21 15:18:51 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Mon Mar 21 15:18:59 2005 Subject: gnupg/m4 (ChangeLog ldap.m4 readline.m4) Message-ID: Date: Monday, March 21, 2005 @ 15:32:44 Author: dshaw Path: /cvs/gnupg/gnupg/m4 Modified: ChangeLog ldap.m4 readline.m4 * readline.m4: Check for completion functionality. * ldap.m4: Comments. -------------+ ChangeLog | 6 ++++++ ldap.m4 | 11 ++++------- readline.m4 | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) Index: gnupg/m4/ChangeLog diff -u gnupg/m4/ChangeLog:1.16 gnupg/m4/ChangeLog:1.17 --- gnupg/m4/ChangeLog:1.16 Thu Mar 17 05:05:14 2005 +++ gnupg/m4/ChangeLog Mon Mar 21 15:32:44 2005 @@ -1,3 +1,9 @@ +2005-03-21 David Shaw + + * readline.m4: Check for completion functionality. + + * ldap.m4: Comments. + 2005-03-16 David Shaw * ldap.m4: New. Moved from configure.ac. Index: gnupg/m4/ldap.m4 diff -u gnupg/m4/ldap.m4:1.1 gnupg/m4/ldap.m4:1.2 --- gnupg/m4/ldap.m4:1.1 Thu Mar 17 05:05:14 2005 +++ gnupg/m4/ldap.m4 Mon Mar 21 15:32:44 2005 @@ -7,19 +7,16 @@ dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl -dnl Defines HAVE_LIBUSB to 1 if a working libusb setup is found, and sets -dnl @LIBUSB@ to the necessary libraries. HAVE_USB_GET_BUSSES is set if -dnl usb_get_busses() exists. +dnl Defines @GPGKEYS_LDAP@ to a executable name if a working ldap +dnl setup is found, and sets @LDAPLIBS@ to the necessary libraries. AC_DEFUN([GNUPG_CHECK_LDAP], [ # Try and link a LDAP test program to weed out unusable LDAP # libraries. -lldap [-llber [-lresolv]] is for older OpenLDAPs. # OpenLDAP, circa 1999, was terrible with creating weird dependencies. -# This seems to have all been resolved, so I'm simplifying this code -# significantly. If all else fails, the user can play -# guess-the-dependency by using something like ./configure -# LDAPLIBS="-Lfoo -lbar" +# If all else fails, the user can play guess-the-dependency by using +# something like ./configure LDAPLIBS="-Lfoo -lbar" AC_ARG_WITH(ldap, AC_HELP_STRING([--with-ldap=DIR],[look for the LDAP library in DIR]), Index: gnupg/m4/readline.m4 diff -u gnupg/m4/readline.m4:1.2 gnupg/m4/readline.m4:1.3 --- gnupg/m4/readline.m4:1.2 Thu Dec 23 17:12:13 2004 +++ gnupg/m4/readline.m4 Mon Mar 21 15:32:44 2005 @@ -37,6 +37,8 @@ ],[ add_history("foobar"); rl_catch_signals=0; +rl_inhibit_completion=0; +rl_attempted_completion_function=NULL; ]),_found_readline=yes,_found_readline=no) AC_MSG_RESULT([$_found_readline]) From cvs at cvs.gnupg.org Mon Mar 21 16:10:52 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Mon Mar 21 16:10:57 2005 Subject: gnupg (g10/ChangeLog g10/card-util.c g10/keyedit.c util/ttyio.c) Message-ID: Date: Monday, March 21, 2005 @ 16:24:48 Author: wk Path: /cvs/gnupg/gnupg Modified: g10/ChangeLog g10/card-util.c g10/keyedit.c util/ttyio.c * keyedit.c (command_generator, keyedit_completion): Changed indentation. * card-util.c (command_generator, card_edit_completion): Ditto. -----------------+ g10/ChangeLog | 10 ++++++++-- g10/card-util.c | 25 ++++++++++++++++--------- g10/keyedit.c | 12 +++++++++--- util/ttyio.c | 2 +- 4 files changed, 34 insertions(+), 15 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.711 gnupg/g10/ChangeLog:1.712 --- gnupg/g10/ChangeLog:1.711 Sun Mar 20 04:59:06 2005 +++ gnupg/g10/ChangeLog Mon Mar 21 16:24:48 2005 @@ -1,3 +1,9 @@ +2005-03-21 Werner Koch + + * keyedit.c (command_generator, keyedit_completion): Changed + indentation. + * card-util.c (command_generator, card_edit_completion): Ditto. + 2005-03-19 David Shaw * card-util.c (command_generator, card_edit_completion) @@ -20,8 +26,8 @@ * Makefile.am: Calculate GNUPG_LIBEXECDIR directly. Do not redefine $libexecdir. - * options.h, keyserver.c (parse_keyserver_options, - keyserver_spawn): Don't treat 'verbose' and 'include-disabled' as + * options.h, keyserver.c (parse_keyserver_options) + (keyserver_spawn): Don't treat 'verbose' and 'include-disabled' as special. Just pass them through silently to the keyserver helper. 2005-03-16 Werner Koch Index: gnupg/g10/card-util.c diff -u gnupg/g10/card-util.c:1.31 gnupg/g10/card-util.c:1.32 --- gnupg/g10/card-util.c:1.31 Sun Mar 20 04:59:07 2005 +++ gnupg/g10/card-util.c Mon Mar 21 16:24:48 2005 @@ -27,7 +27,7 @@ #if GNUPG_MAJOR_VERSION != 1 #include "gpg.h" -#endif +#endif /*GNUPG_MAJOR_VERSION != 1*/ #include "util.h" #include "i18n.h" #include "ttyio.h" @@ -39,11 +39,11 @@ #ifdef HAVE_LIBREADLINE #include #include -#endif +#endif /*HAVE_LIBREADLINE*/ #include "cardglue.h" -#else +#else /*GNUPG_MAJOR_VERSION!=1*/ #include "call-agent.h" -#endif +#endif /*GNUPG_MAJOR_VERSION!=1*/ #define CONTROL_D ('D' - 'A' + 1) @@ -1275,6 +1275,10 @@ #endif } + + +/* Data used by the command parser. This needs to be outside of the + function scope to allow readline based command completion. */ enum cmdids { cmdNOP = 0, @@ -1315,11 +1319,13 @@ { NULL, cmdINVCMD, 0, NULL } }; + #if GNUPG_MAJOR_VERSION == 1 && defined (HAVE_LIBREADLINE) /* These two functions are used by readline for command completion. */ -static char *command_generator(const char *text,int state) +static char * +command_generator(const char *text,int state) { static int list_index,len; const char *name; @@ -1344,7 +1350,8 @@ return NULL; } -static char **card_edit_completion(const char *text, int start, int end) +static char ** +card_edit_completion(const char *text, int start, int end) { /* If we are at the start of a line, we try and command-complete. If not, just do nothing for now. */ @@ -1356,7 +1363,7 @@ return NULL; } -#endif +#endif /* GNUPG_MAJOR_VERSION == 1 && HAVE_LIBREADLINE */ /* Menu to edit all user changeable values on an OpenPGP card. Only Key creation is not handled here. */ @@ -1424,12 +1431,12 @@ if (!have_commands) { #if GNUPG_MAJOR_VERSION == 1 - tty_enable_completion(card_edit_completion); + tty_enable_completion (card_edit_completion); #endif answer = cpr_get_no_help("cardedit.prompt", _("Command> ")); cpr_kill_prompt(); #if GNUPG_MAJOR_VERSION == 1 - tty_disable_completion(); + tty_disable_completion (); #endif } trim_spaces(answer); Index: gnupg/g10/keyedit.c diff -u gnupg/g10/keyedit.c:1.174 gnupg/g10/keyedit.c:1.175 --- gnupg/g10/keyedit.c:1.174 Fri Mar 18 23:07:12 2005 +++ gnupg/g10/keyedit.c Mon Mar 21 16:24:47 2005 @@ -1280,6 +1280,7 @@ return 1; } + /**************** * Menu driven key editor. If seckey_check is true, then a secret key * that matches username will be looked for. If it is false, not all @@ -1408,11 +1409,13 @@ { NULL, cmdNONE, 0, NULL } }; + #ifdef HAVE_LIBREADLINE /* These two functions are used by readline for command completion. */ -static char *command_generator(const char *text,int state) +static char * +command_generator(const char *text,int state) { static int list_index,len; const char *name; @@ -1437,7 +1440,8 @@ return NULL; } -static char **keyedit_completion(const char *text, int start, int end) +static char ** +keyedit_completion(const char *text, int start, int end) { /* If we are at the start of a line, we try and command-complete. If not, just do nothing for now. */ @@ -1449,7 +1453,8 @@ return NULL; } -#endif +#endif /* HAVE_LIBREADLINE */ + void keyedit_menu( const char *username, STRLIST locusr, @@ -2163,6 +2168,7 @@ } + /**************** * show preferences of a public keyblock. */ Index: gnupg/util/ttyio.c diff -u gnupg/util/ttyio.c:1.35 gnupg/util/ttyio.c:1.36 --- gnupg/util/ttyio.c:1.35 Fri Mar 18 21:17:38 2005 +++ gnupg/util/ttyio.c Mon Mar 21 16:24:47 2005 @@ -191,7 +191,7 @@ init_ttyfp(); rl_inhibit_completion=1; } -#endif +#endif /*HAVE_LIBREADLINE*/ int tty_batchmode( int onoff ) From cvs at cvs.gnupg.org Mon Mar 21 21:33:31 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Mon Mar 21 21:33:35 2005 Subject: gnupg/g10 (ChangeLog gpgv.c openfile.c plaintext.c) Message-ID: Date: Monday, March 21, 2005 @ 21:47:28 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog gpgv.c openfile.c plaintext.c * gpgv.c: Stubs for tty_enable_completion() & tty_disable_completion(). * openfile.c (ask_outfile_name): Enable readline completion when prompting for an output filename. * plaintext.c (ask_for_detached_datafile): Enable readline completion when prompting for a detached sig datafile. -------------+ ChangeLog | 11 +++++++++++ gpgv.c | 8 ++++++++ openfile.c | 5 ++++- plaintext.c | 6 ++++-- 4 files changed, 27 insertions(+), 3 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.712 gnupg/g10/ChangeLog:1.713 --- gnupg/g10/ChangeLog:1.712 Mon Mar 21 16:24:48 2005 +++ gnupg/g10/ChangeLog Mon Mar 21 21:47:28 2005 @@ -1,3 +1,14 @@ +2005-03-21 David Shaw + + * gpgv.c: Stubs for tty_enable_completion() & + tty_disable_completion(). + + * openfile.c (ask_outfile_name): Enable readline completion when + prompting for an output filename. + + * plaintext.c (ask_for_detached_datafile): Enable readline + completion when prompting for a detached sig datafile. + 2005-03-21 Werner Koch * keyedit.c (command_generator, keyedit_completion): Changed Index: gnupg/g10/gpgv.c diff -u gnupg/g10/gpgv.c:1.27 gnupg/g10/gpgv.c:1.28 --- gnupg/g10/gpgv.c:1.27 Thu Jan 20 18:21:40 2005 +++ gnupg/g10/gpgv.c Mon Mar 21 21:47:28 2005 @@ -29,6 +29,10 @@ #ifdef HAVE_DOSISH_SYSTEM #include /* for setmode() */ #endif +#ifdef HAVE_LIBREADLINE +#include +#include +#endif #define INCLUDED_BY_MAIN_MODULE 1 #include "packet.h" @@ -389,6 +393,10 @@ void tty_kill_prompt(void) {} int tty_get_answer_is_yes( const char *prompt ) {return 0;} int tty_no_terminal(int onoff) {return 0;} +#ifdef HAVE_LIBREADLINE +void tty_enable_completion(rl_completion_func_t *completer) {} +void tty_disable_completion(void) {} +#endif /* We do not do any locking, so use these stubs here */ void disable_dotlock(void) {} Index: gnupg/g10/openfile.c diff -u gnupg/g10/openfile.c:1.41 gnupg/g10/openfile.c:1.42 --- gnupg/g10/openfile.c:1.41 Thu Oct 14 09:11:56 2004 +++ gnupg/g10/openfile.c Mon Mar 21 21:47:28 2005 @@ -1,5 +1,6 @@ /* openfile.c - * Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, + * 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -147,8 +148,10 @@ sprintf(prompt, "%s [%s]: ", s, defname ); else sprintf(prompt, "%s: ", s ); + tty_enable_completion(NULL); fname = cpr_get("openfile.askoutname", prompt ); cpr_kill_prompt(); + tty_disable_completion(); m_free(prompt); if( !*fname ) { m_free( fname ); fname = NULL; Index: gnupg/g10/plaintext.c diff -u gnupg/g10/plaintext.c:1.59 gnupg/g10/plaintext.c:1.60 --- gnupg/g10/plaintext.c:1.59 Thu Nov 4 23:28:39 2004 +++ gnupg/g10/plaintext.c Mon Mar 21 21:47:28 2005 @@ -1,6 +1,6 @@ /* plaintext.c - process plaintext packets - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, - * 2004 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, + * 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -446,8 +446,10 @@ tty_printf(_("Detached signature.\n")); do { m_free(answer); + tty_enable_completion(NULL); answer = cpr_get("detached_signature.filename", _("Please enter name of data file: ")); + tty_disable_completion(); cpr_kill_prompt(); if( any && !*answer ) { rc = G10ERR_READ_FILE; From cvs at cvs.gnupg.org Tue Mar 22 09:53:18 2005 From: cvs at cvs.gnupg.org (cvs user werner) Date: Tue Mar 22 09:53:27 2005 Subject: libassuan/src (5 files) Message-ID: Date: Tuesday, March 22, 2005 @ 09:53:18 Author: werner Path: /cvs/gnupg/libassuan/src Modified: ChangeLog assuan-buffer.c assuan-client.c assuan-defs.h assuan-handler.c (struct assuan_io): Renamed elements READ and WRITE to READFNC and WRITEFNC to avoid problems with read defined as macros. Changed callers. Noted by Ville Skyttä. ------------------+ ChangeLog | 11 +++++++++++ assuan-buffer.c | 4 ++-- assuan-client.c | 3 +++ assuan-defs.h | 4 ++-- assuan-handler.c | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) From cvs at cvs.gnupg.org Tue Mar 22 09:56:43 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Tue Mar 22 09:56:56 2005 Subject: gpgme/assuan (ChangeLog assuan-buffer.c assuan-defs.h) Message-ID: Date: Tuesday, March 22, 2005 @ 10:10:36 Author: wk Path: /cvs/gpgme/gpgme/assuan Modified: ChangeLog assuan-buffer.c assuan-defs.h (struct assuan_io): Renamed elements READ and WRITE to READFNC and WRITEFNC to avoid problems with read defined as macro. Changed callers. Noted by Ville Skyttä. -----------------+ ChangeLog | 6 ++++++ assuan-buffer.c | 4 ++-- assuan-defs.h | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) Index: gpgme/assuan/ChangeLog diff -u gpgme/assuan/ChangeLog:1.24 gpgme/assuan/ChangeLog:1.25 --- gpgme/assuan/ChangeLog:1.24 Tue Dec 21 09:42:31 2004 +++ gpgme/assuan/ChangeLog Tue Mar 22 10:10:36 2005 @@ -1,3 +1,9 @@ +2005-03-22 Werner Koch + + * assuan-defs.h (struct assuan_io): Renamed elements READ and + WRITE to READFNC and WRITEFNC to avoid problems with read defined + as macro. Changed callers. Noted by Ville Skyttä. + 2004-12-16 Marcus Brinkmann * assuan-pipe-connect.c (do_finish): Do not wait for child to finish. Index: gpgme/assuan/assuan-buffer.c diff -u gpgme/assuan/assuan-buffer.c:1.10 gpgme/assuan/assuan-buffer.c:1.11 --- gpgme/assuan/assuan-buffer.c:1.10 Tue Jun 8 19:48:37 2004 +++ gpgme/assuan/assuan-buffer.c Tue Mar 22 10:10:36 2005 @@ -32,7 +32,7 @@ { while (length) { - ssize_t nwritten = ctx->io->write (ctx, buffer, length); + ssize_t nwritten = ctx->io->writefnc (ctx, buffer, length); if (nwritten < 0) { @@ -58,7 +58,7 @@ *r_nread = 0; while (nleft > 0) { - ssize_t n = ctx->io->read (ctx, buf, nleft); + ssize_t n = ctx->io->readfnc (ctx, buf, nleft); if (n < 0) { Index: gpgme/assuan/assuan-defs.h diff -u gpgme/assuan/assuan-defs.h:1.8 gpgme/assuan/assuan-defs.h:1.9 --- gpgme/assuan/assuan-defs.h:1.8 Mon Aug 18 21:17:07 2003 +++ gpgme/assuan/assuan-defs.h Tue Mar 22 10:10:36 2005 @@ -39,9 +39,9 @@ struct assuan_io { /* Routine to read from input_fd. */ - ssize_t (*read) (ASSUAN_CONTEXT, void *, size_t); + ssize_t (*readfnc) (ASSUAN_CONTEXT, void *, size_t); /* Routine to write to output_fd. */ - ssize_t (*write) (ASSUAN_CONTEXT, const void *, size_t); + ssize_t (*writefnc) (ASSUAN_CONTEXT, const void *, size_t); /* Send a file descriptor. */ AssuanError (*sendfd) (ASSUAN_CONTEXT, int); /* Receive a file descriptor. */ From cvs at cvs.gnupg.org Tue Mar 22 09:57:28 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Tue Mar 22 09:57:43 2005 Subject: gpgme-1-0-branch gpgme/assuan (ChangeLog assuan-buffer.c assuan-defs.h) Message-ID: Date: Tuesday, March 22, 2005 @ 10:11:28 Author: wk Path: /cvs/gpgme/gpgme/assuan Tag: gpgme-1-0-branch Modified: ChangeLog assuan-buffer.c assuan-defs.h (struct assuan_io): Renamed elements READ and WRITE to READFNC and WRITEFNC to avoid problems with read defined as macro. Changed callers. Noted by Ville Skyttä. -----------------+ ChangeLog | 6 ++++++ assuan-buffer.c | 4 ++-- assuan-defs.h | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) Index: gpgme/assuan/ChangeLog diff -u gpgme/assuan/ChangeLog:1.22.2.2 gpgme/assuan/ChangeLog:1.22.2.3 --- gpgme/assuan/ChangeLog:1.22.2.2 Tue Dec 21 09:44:27 2004 +++ gpgme/assuan/ChangeLog Tue Mar 22 10:11:28 2005 @@ -1,3 +1,9 @@ +2005-03-22 Werner Koch + + * assuan-defs.h (struct assuan_io): Renamed elements READ and + WRITE to READFNC and WRITEFNC to avoid problems with read defined + as macro. Changed callers. Noted by Ville Skyttä. + 2004-12-16 Marcus Brinkmann * assuan-pipe-connect.c (do_finish): Do not wait for child to finish. Index: gpgme/assuan/assuan-buffer.c diff -u gpgme/assuan/assuan-buffer.c:1.10 gpgme/assuan/assuan-buffer.c:1.10.2.1 --- gpgme/assuan/assuan-buffer.c:1.10 Tue Jun 8 19:48:37 2004 +++ gpgme/assuan/assuan-buffer.c Tue Mar 22 10:11:28 2005 @@ -32,7 +32,7 @@ { while (length) { - ssize_t nwritten = ctx->io->write (ctx, buffer, length); + ssize_t nwritten = ctx->io->writefnc (ctx, buffer, length); if (nwritten < 0) { @@ -58,7 +58,7 @@ *r_nread = 0; while (nleft > 0) { - ssize_t n = ctx->io->read (ctx, buf, nleft); + ssize_t n = ctx->io->readfnc (ctx, buf, nleft); if (n < 0) { Index: gpgme/assuan/assuan-defs.h diff -u gpgme/assuan/assuan-defs.h:1.8 gpgme/assuan/assuan-defs.h:1.8.2.1 --- gpgme/assuan/assuan-defs.h:1.8 Mon Aug 18 21:17:07 2003 +++ gpgme/assuan/assuan-defs.h Tue Mar 22 10:11:28 2005 @@ -39,9 +39,9 @@ struct assuan_io { /* Routine to read from input_fd. */ - ssize_t (*read) (ASSUAN_CONTEXT, void *, size_t); + ssize_t (*readfnc) (ASSUAN_CONTEXT, void *, size_t); /* Routine to write to output_fd. */ - ssize_t (*write) (ASSUAN_CONTEXT, const void *, size_t); + ssize_t (*writefnc) (ASSUAN_CONTEXT, const void *, size_t); /* Send a file descriptor. */ AssuanError (*sendfd) (ASSUAN_CONTEXT, int); /* Receive a file descriptor. */ From cvs at cvs.gnupg.org Tue Mar 22 22:10:08 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Tue Mar 22 22:10:11 2005 Subject: libgcrypt/src (ChangeLog libgcrypt.vers) Message-ID: Date: Tuesday, March 22, 2005 @ 22:24:09 Author: mo Path: /cvs/libgcrypt/libgcrypt/src Modified: ChangeLog libgcrypt.vers 2005-03-03 Moritz Schulte * libgcrypt.vers: Added: gcry_ac_data_to_sexp() and gcry_ac_data_from_sexp(). ----------------+ ChangeLog | 5 +++++ libgcrypt.vers | 1 + 2 files changed, 6 insertions(+) Index: libgcrypt/src/ChangeLog diff -u libgcrypt/src/ChangeLog:1.160 libgcrypt/src/ChangeLog:1.161 --- libgcrypt/src/ChangeLog:1.160 Tue Feb 22 18:49:27 2005 +++ libgcrypt/src/ChangeLog Tue Mar 22 22:24:09 2005 @@ -1,3 +1,8 @@ +2005-03-03 Moritz Schulte + + * libgcrypt.vers: Added: gcry_ac_data_to_sexp() and + gcry_ac_data_from_sexp(). + 2005-02-22 Werner Koch * global.c (_gcry_malloc): Make sure ERRNO is set if we return Index: libgcrypt/src/libgcrypt.vers diff -u libgcrypt/src/libgcrypt.vers:1.5 libgcrypt/src/libgcrypt.vers:1.6 --- libgcrypt/src/libgcrypt.vers:1.5 Sun Feb 13 19:13:22 2005 +++ libgcrypt/src/libgcrypt.vers Tue Mar 22 22:24:09 2005 @@ -66,6 +66,7 @@ gcry_ac_data_decode; gcry_ac_mpi_to_os; gcry_ac_mpi_to_os_alloc; gcry_ac_os_to_mpi; gcry_ac_data_encrypt_scheme; gcry_ac_data_decrypt_scheme; gcry_ac_data_sign_scheme; gcry_ac_data_verify_scheme; + gcry_ac_data_to_sexp; gcry_ac_data_from_sexp; gcry_prime_check; gcry_prime_generate; gcry_prime_group_generator; gcry_prime_release_factors; From cvs at cvs.gnupg.org Tue Mar 22 22:16:13 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Tue Mar 22 22:16:17 2005 Subject: libgcrypt (THANKS) Message-ID: Date: Tuesday, March 22, 2005 @ 22:30:17 Author: mo Path: /cvs/libgcrypt/libgcrypt Modified: THANKS Forgot to commit this (updated). --------+ THANKS | 1 + 1 files changed, 1 insertion(+) Index: libgcrypt/THANKS diff -u libgcrypt/THANKS:1.84 libgcrypt/THANKS:1.85 --- libgcrypt/THANKS:1.84 Tue Feb 22 18:54:27 2005 +++ libgcrypt/THANKS Tue Mar 22 22:30:17 2005 @@ -72,6 +72,7 @@ Michael Fischer v. Mollard mfvm@gmx.de Michael Roth mroth@nessie.de Michael Sobolev mss@despair.transas.com +Michele Baldessari michele@pupazzo.org Modestas Vainius geromanas@mailas.com Neil Spring nspring@cs.washington.edu Newton Hammet newton@hammet.net From cvs at cvs.gnupg.org Wed Mar 23 00:27:04 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Wed Mar 23 00:27:08 2005 Subject: gnupg/keyserver (7 files) Message-ID: Date: Wednesday, March 23, 2005 @ 00:41:08 Author: dshaw Path: /cvs/gnupg/gnupg/keyserver Modified: ChangeLog gpgkeys_finger.c gpgkeys_hkp.c gpgkeys_http.c gpgkeys_ldap.c ksutil.c ksutil.h * gpgkeys_ldap.c, ksutil.h, ksutil.c (print_nocr): Moved from gpgkeys_ldap.c. Print a string, but strip out any CRs. * gpgkeys_finger.c (get_key), gpgkeys_hkp.c (get_key), gpgkeys_http.c (get_key): Use it here when outputting key material to canonicalize line endings. ------------------+ ChangeLog | 9 +++++++++ gpgkeys_finger.c | 4 ++-- gpgkeys_hkp.c | 4 ++-- gpgkeys_http.c | 4 ++-- gpgkeys_ldap.c | 11 ----------- ksutil.c | 18 ++++++++++++++++++ ksutil.h | 1 + 7 files changed, 34 insertions(+), 17 deletions(-) Index: gnupg/keyserver/ChangeLog diff -u gnupg/keyserver/ChangeLog:1.119 gnupg/keyserver/ChangeLog:1.120 --- gnupg/keyserver/ChangeLog:1.119 Sat Mar 19 15:24:36 2005 +++ gnupg/keyserver/ChangeLog Wed Mar 23 00:41:08 2005 @@ -1,3 +1,12 @@ +2005-03-22 David Shaw + + * gpgkeys_ldap.c, ksutil.h, ksutil.c (print_nocr): Moved from + gpgkeys_ldap.c. Print a string, but strip out any CRs. + + * gpgkeys_finger.c (get_key), gpgkeys_hkp.c (get_key), + gpgkeys_http.c (get_key): Use it here when outputting key material + to canonicalize line endings. + 2005-03-19 David Shaw * gpgkeys_ldap.c (main): Fix three wrong calls to fail_all(). Index: gnupg/keyserver/gpgkeys_finger.c diff -u gnupg/keyserver/gpgkeys_finger.c:1.14 gnupg/keyserver/gpgkeys_finger.c:1.15 --- gnupg/keyserver/gpgkeys_finger.c:1.14 Thu Mar 17 17:42:41 2005 +++ gnupg/keyserver/gpgkeys_finger.c Wed Mar 23 00:41:08 2005 @@ -323,13 +323,13 @@ if(gotit) { - fputs (line, output); + print_nocr(output,line); if (!strncmp(line,END,strlen(END))) break; } else if(!strncmp(line,BEGIN,strlen(BEGIN))) { - fputs (line,output); + print_nocr(output,line); gotit=1; } } Index: gnupg/keyserver/gpgkeys_hkp.c diff -u gnupg/keyserver/gpgkeys_hkp.c:1.49 gnupg/keyserver/gpgkeys_hkp.c:1.50 --- gnupg/keyserver/gpgkeys_hkp.c:1.49 Sat Feb 5 16:04:59 2005 +++ gnupg/keyserver/gpgkeys_hkp.c Wed Mar 23 00:41:08 2005 @@ -267,14 +267,14 @@ if(gotit) { - fputs (line, output); + print_nocr(output,line); if(strncmp(line,END,strlen(END))==0) break; } else if(strncmp(line,BEGIN,strlen(BEGIN))==0) { - fputs (line,output); + print_nocr(output,line); gotit=1; } } Index: gnupg/keyserver/gpgkeys_http.c diff -u gnupg/keyserver/gpgkeys_http.c:1.13 gnupg/keyserver/gpgkeys_http.c:1.14 --- gnupg/keyserver/gpgkeys_http.c:1.13 Tue Feb 1 21:57:08 2005 +++ gnupg/keyserver/gpgkeys_http.c Wed Mar 23 00:41:08 2005 @@ -92,14 +92,14 @@ if(gotit) { - fputs(line,output); + print_nocr(output,line); if(strncmp(line,END,strlen(END))==0) break; } else if(strncmp(line,BEGIN,strlen(BEGIN))==0) { - fputs(line,output); + print_nocr(output,line); gotit=1; } } Index: gnupg/keyserver/gpgkeys_ldap.c diff -u gnupg/keyserver/gpgkeys_ldap.c:1.53 gnupg/keyserver/gpgkeys_ldap.c:1.54 --- gnupg/keyserver/gpgkeys_ldap.c:1.53 Sat Mar 19 15:24:36 2005 +++ gnupg/keyserver/gpgkeys_ldap.c Wed Mar 23 00:41:08 2005 @@ -953,17 +953,6 @@ fprintf(output,"INFO %s END\n",certid); } -static void -print_nocr(FILE *stream,const char *str) -{ - while(*str) - { - if(*str!='\r') - fputc(*str,stream); - str++; - } -} - /* Note that key-not-found is not a fatal error */ static int get_key(char *getkey) Index: gnupg/keyserver/ksutil.c diff -u gnupg/keyserver/ksutil.c:1.5 gnupg/keyserver/ksutil.c:1.6 --- gnupg/keyserver/ksutil.c:1.5 Fri Mar 18 00:16:41 2005 +++ gnupg/keyserver/ksutil.c Wed Mar 23 00:41:08 2005 @@ -294,3 +294,21 @@ return "?"; } + +/* Canonicalize CRLF to just LF by stripping CRs. This actually makes + sense, since on Unix-like machines LF is correct, and on win32-like + machines, our output buffer is opened in textmode and will + re-canonicalize line endings back to CRLF. Since we only need to + handle armored keys, we don't have to worry about odd cases like + CRCRCR and the like. */ + +void +print_nocr(FILE *stream,const char *str) +{ + while(*str) + { + if(*str!='\r') + fputc(*str,stream); + str++; + } +} Index: gnupg/keyserver/ksutil.h diff -u gnupg/keyserver/ksutil.h:1.7 gnupg/keyserver/ksutil.h:1.8 --- gnupg/keyserver/ksutil.h:1.7 Thu Mar 17 17:42:41 2005 +++ gnupg/keyserver/ksutil.h Wed Mar 23 00:41:08 2005 @@ -87,5 +87,6 @@ void free_ks_options(struct ks_options *opt); int parse_ks_options(char *line,struct ks_options *opt); const char *ks_action_to_string(enum ks_action action); +void print_nocr(FILE *stream,const char *str); #endif /* !_KSUTIL_H_ */ From cvs at cvs.gnupg.org Wed Mar 23 09:36:20 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 23 09:36:26 2005 Subject: gnupg/cipher (ChangeLog rndw32.c) Message-ID: Date: Wednesday, March 23, 2005 @ 09:50:27 Author: wk Path: /cvs/gnupg/gnupg/cipher Modified: ChangeLog rndw32.c (rndw32_gather_random_fast): While adding data use the size of the object and not the one of its address. Bug reported by Sascha Kiefer. -----------+ ChangeLog | 8 +++++++- rndw32.c | 9 +++++---- 2 files changed, 12 insertions(+), 5 deletions(-) Index: gnupg/cipher/ChangeLog diff -u gnupg/cipher/ChangeLog:1.147 gnupg/cipher/ChangeLog:1.148 --- gnupg/cipher/ChangeLog:1.147 Mon Mar 7 14:59:59 2005 +++ gnupg/cipher/ChangeLog Wed Mar 23 09:50:27 2005 @@ -1,3 +1,9 @@ +2005-03-23 Werner Koch + + * rndw32.c (rndw32_gather_random_fast): While adding data use the + size of the object and not the one of its address. Bug reported by + Sascha Kiefer. + 2005-03-07 Werner Koch * primegen.c (is_prime): Free A2. Noted by pmike2001@mail.ru. @@ -1212,7 +1218,7 @@ Copyright 1998, 1999, 2000, 2001, 2002, 2003, - 2004 Free Software Foundation, Inc. + 2004, 2005 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 Index: gnupg/cipher/rndw32.c diff -u gnupg/cipher/rndw32.c:1.11 gnupg/cipher/rndw32.c:1.12 --- gnupg/cipher/rndw32.c:1.11 Sat May 24 20:31:33 2003 +++ gnupg/cipher/rndw32.c Wed Mar 23 09:50:27 2005 @@ -654,13 +654,14 @@ (*add) ( &kernelTime, sizeof (kernelTime), requester ); (*add) ( &userTime, sizeof (userTime), requester ); - /* Get the minimum and maximum working set size for the current process */ + /* Get the minimum and maximum working set size for the + current process */ GetProcessWorkingSetSize (handle, &minimumWorkingSetSize, &maximumWorkingSetSize); (*add) ( &minimumWorkingSetSize, - sizeof (&minimumWorkingSetSize), requester ); + sizeof (minimumWorkingSetSize), requester ); (*add) ( &maximumWorkingSetSize, - sizeof (&maximumWorkingSetSize), requester ); + sizeof (maximumWorkingSetSize), requester ); } @@ -688,7 +689,7 @@ if (QueryPerformanceCounter (&performanceCount)) { if ( debug_me ) log_debug ("rndw32#gather_random_fast: perf data\n"); - (*add) (&performanceCount, sizeof (&performanceCount), requester); + (*add) (&performanceCount, sizeof (performanceCount), requester); } else { /* Millisecond accuracy at best... */ DWORD aword = GetTickCount (); From cvs at cvs.gnupg.org Wed Mar 23 09:38:14 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 23 09:38:18 2005 Subject: LIBGCRYPT-1-2-BRANCH libgcrypt/cipher (ChangeLog rndw32.c) Message-ID: Date: Wednesday, March 23, 2005 @ 09:52:21 Author: wk Path: /cvs/libgcrypt/libgcrypt/cipher Tag: LIBGCRYPT-1-2-BRANCH Modified: ChangeLog rndw32.c (_gcry_rndw32_gather_random_fast): While adding data use the size of the object and not the one of its address. Bug reported by Sascha Kiefer. -----------+ ChangeLog | 8 +++++++- rndw32.c | 9 +++++---- 2 files changed, 12 insertions(+), 5 deletions(-) Index: libgcrypt/cipher/ChangeLog diff -u libgcrypt/cipher/ChangeLog:1.211.2.10 libgcrypt/cipher/ChangeLog:1.211.2.11 --- libgcrypt/cipher/ChangeLog:1.211.2.10 Sat Mar 19 18:58:13 2005 +++ libgcrypt/cipher/ChangeLog Wed Mar 23 09:52:21 2005 @@ -1,3 +1,9 @@ +2005-03-23 Werner Koch + + * rndw32.c (_gcry_rndw32_gather_random_fast): While adding data + use the size of the object and not the one of its address. Bug + reported by Sascha Kiefer. + 2005-03-19 Moritz Schulte * cipher.c (do_cbc_encrypt): Be careful to not overwrite data, @@ -2837,7 +2843,7 @@ (digest_algo_to_string): New. - Copyright 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. + Copyright 1998,1999,2000,2001,2002,2003,2005 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 Index: libgcrypt/cipher/rndw32.c diff -u libgcrypt/cipher/rndw32.c:1.17 libgcrypt/cipher/rndw32.c:1.17.2.1 --- libgcrypt/cipher/rndw32.c:1.17 Thu Dec 11 16:46:12 2003 +++ libgcrypt/cipher/rndw32.c Wed Mar 23 09:52:21 2005 @@ -635,13 +635,14 @@ (*add) ( &kernelTime, sizeof (kernelTime), requester ); (*add) ( &userTime, sizeof (userTime), requester ); - /* Get the minimum and maximum working set size for the current process */ + /* Get the minimum and maximum working set size for the + current process */ GetProcessWorkingSetSize (handle, &minimumWorkingSetSize, &maximumWorkingSetSize); (*add) ( &minimumWorkingSetSize, - sizeof (&minimumWorkingSetSize), requester ); + sizeof (minimumWorkingSetSize), requester ); (*add) ( &maximumWorkingSetSize, - sizeof (&maximumWorkingSetSize), requester ); + sizeof (maximumWorkingSetSize), requester ); } @@ -669,7 +670,7 @@ if (QueryPerformanceCounter (&performanceCount)) { if ( debug_me ) log_debug ("rndw32#gather_random_fast: perf data\n"); - (*add) (&performanceCount, sizeof (&performanceCount), requester); + (*add) (&performanceCount, sizeof (performanceCount), requester); } else { /* Millisecond accuracy at best... */ DWORD aword = GetTickCount (); From cvs at cvs.gnupg.org Wed Mar 23 09:39:48 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 23 09:39:50 2005 Subject: libgcrypt/cipher (ChangeLog rndw32.c) Message-ID: Date: Wednesday, March 23, 2005 @ 09:53:55 Author: wk Path: /cvs/libgcrypt/libgcrypt/cipher Modified: ChangeLog rndw32.c (_gcry_rndw32_gather_random_fast): While adding data use the size of the object and not the one of its address. Bug reported by Sascha Kiefer. -----------+ ChangeLog | 6 ++++++ rndw32.c | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) Index: libgcrypt/cipher/ChangeLog diff -u libgcrypt/cipher/ChangeLog:1.226 libgcrypt/cipher/ChangeLog:1.227 --- libgcrypt/cipher/ChangeLog:1.226 Sat Mar 19 18:35:27 2005 +++ libgcrypt/cipher/ChangeLog Wed Mar 23 09:53:54 2005 @@ -1,3 +1,9 @@ +2005-03-23 Werner Koch + + * rndw32.c (_gcry_rndw32_gather_random_fast): While adding data + use the size of the object and not the one of its address. Bug + reported by Sascha Kiefer. + 2005-03-19 Moritz Schulte * cipher.c (do_cbc_encrypt): Be careful to not overwrite data, Index: libgcrypt/cipher/rndw32.c diff -u libgcrypt/cipher/rndw32.c:1.17 libgcrypt/cipher/rndw32.c:1.18 --- libgcrypt/cipher/rndw32.c:1.17 Thu Dec 11 16:46:12 2003 +++ libgcrypt/cipher/rndw32.c Wed Mar 23 09:53:54 2005 @@ -635,13 +635,14 @@ (*add) ( &kernelTime, sizeof (kernelTime), requester ); (*add) ( &userTime, sizeof (userTime), requester ); - /* Get the minimum and maximum working set size for the current process */ + /* Get the minimum and maximum working set size for the + current process */ GetProcessWorkingSetSize (handle, &minimumWorkingSetSize, &maximumWorkingSetSize); (*add) ( &minimumWorkingSetSize, - sizeof (&minimumWorkingSetSize), requester ); + sizeof (minimumWorkingSetSize), requester ); (*add) ( &maximumWorkingSetSize, - sizeof (&maximumWorkingSetSize), requester ); + sizeof (maximumWorkingSetSize), requester ); } @@ -669,7 +670,7 @@ if (QueryPerformanceCounter (&performanceCount)) { if ( debug_me ) log_debug ("rndw32#gather_random_fast: perf data\n"); - (*add) (&performanceCount, sizeof (&performanceCount), requester); + (*add) (&performanceCount, sizeof (performanceCount), requester); } else { /* Millisecond accuracy at best... */ DWORD aword = GetTickCount (); From cvs at cvs.gnupg.org Thu Mar 24 13:51:11 2005 From: cvs at cvs.gnupg.org (cvs user marcus) Date: Thu Mar 24 13:51:38 2005 Subject: gpgme/gpgme (14 files) Message-ID: Date: Thursday, March 24, 2005 @ 14:05:13 Author: marcus Path: /cvs/gpgme/gpgme/gpgme Added: priv-io.h Modified: ChangeLog Makefile.am data.c engine-gpgsm.c posix-io.c rungpg.c version.c w32-io.c wait-global.c wait-private.c wait-user.c wait.c Removed: io.h 2005-03-24 Marcus Brinkmann * io.h: Rename to ... * priv-io.h: ... this. * Makefile.am (libgpgme_real_la_SOURCES): Change io.h to priv-io.h. * data.c, engine-gpgsm.c, posix-io.c, rungpg.c, version.c, w32-io.c, wait-private.c, wait-global.c, wait-user.c, wait.c: Change all includes of "io.h" to "priv-io.h" ----------------+ ChangeLog | 9 +++++++ Makefile.am | 4 +-- data.c | 4 +-- engine-gpgsm.c | 4 +-- io.h | 67 ------------------------------------------------------- posix-io.c | 4 +-- priv-io.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ rungpg.c | 4 +-- version.c | 4 +-- w32-io.c | 2 - wait-global.c | 4 +-- wait-private.c | 4 +-- wait-user.c | 4 +-- wait.c | 4 +-- 14 files changed, 97 insertions(+), 88 deletions(-) Index: gpgme/gpgme/ChangeLog diff -u gpgme/gpgme/ChangeLog:1.392 gpgme/gpgme/ChangeLog:1.393 --- gpgme/gpgme/ChangeLog:1.392 Wed Mar 9 17:03:04 2005 +++ gpgme/gpgme/ChangeLog Thu Mar 24 14:05:12 2005 @@ -1,3 +1,12 @@ +2005-03-24 Marcus Brinkmann + + * io.h: Rename to ... + * priv-io.h: ... this. + * Makefile.am (libgpgme_real_la_SOURCES): Change io.h to priv-io.h. + * data.c, engine-gpgsm.c, posix-io.c, rungpg.c, version.c, + w32-io.c, wait-private.c, wait-global.c, wait-user.c, wait.c: + Change all includes of "io.h" to "priv-io.h" + 2005-03-09 Werner Koch * w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Do not Index: gpgme/gpgme/Makefile.am diff -u gpgme/gpgme/Makefile.am:1.55 gpgme/gpgme/Makefile.am:1.56 --- gpgme/gpgme/Makefile.am:1.55 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/Makefile.am Thu Mar 24 14:05:12 2005 @@ -1,5 +1,5 @@ # Copyright (C) 2000 Werner Koch (dd9jn) -# Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH +# Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH # # This file is part of GPGME. # @@ -79,7 +79,7 @@ key.c keylist.c trust-item.c trustlist.c \ import.c export.c genkey.c delete.c edit.c \ engine.h engine-backend.h engine.c rungpg.c status-table.h \ - $(gpgsm_components) sema.h io.h $(system_components) \ + $(gpgsm_components) sema.h priv-io.h $(system_components) \ debug.c debug.h gpgme.c version.c error.c # libgpgme_la_SOURCES = ath.h ath.c Index: gpgme/gpgme/data.c diff -u gpgme/gpgme/data.c:1.43 gpgme/gpgme/data.c:1.44 --- gpgme/gpgme/data.c:1.43 Wed Mar 9 17:03:04 2005 +++ gpgme/gpgme/data.c Thu Mar 24 14:05:12 2005 @@ -1,5 +1,5 @@ /* data.c - An abstraction for data objects. - Copyright (C) 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -31,7 +31,7 @@ #include "data.h" #include "util.h" #include "ops.h" -#include "io.h" +#include "priv-io.h" #if defined(HAVE_W32_SYSTEM) && !defined(EOPNOTSUPP) #define EOPNOTSUPP VALUE_FOR_EOPNOTSUPP Index: gpgme/gpgme/engine-gpgsm.c diff -u gpgme/gpgme/engine-gpgsm.c:1.104 gpgme/gpgme/engine-gpgsm.c:1.105 --- gpgme/gpgme/engine-gpgsm.c:1.104 Wed Mar 9 17:03:04 2005 +++ gpgme/gpgme/engine-gpgsm.c Thu Mar 24 14:05:12 2005 @@ -1,6 +1,6 @@ /* engine-gpgsm.c - GpgSM engine. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -38,7 +38,7 @@ #include "util.h" #include "ops.h" #include "wait.h" -#include "io.h" +#include "priv-io.h" #include "sema.h" #include "assuan.h" Index: gpgme/gpgme/io.h diff -u gpgme/gpgme/io.h:1.14 gpgme/gpgme/io.h:removed --- gpgme/gpgme/io.h:1.14 Wed Mar 9 17:03:04 2005 +++ gpgme/gpgme/io.h Thu Mar 24 14:05:13 2005 @@ -1,67 +0,0 @@ -/* io.h - Interface to the I/O functions. - Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH - - This file is part of GPGME. - - GPGME 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. - - GPGME 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifndef IO_H -#define IO_H - - -/* A single file descriptor passed to spawn. For child fds, dup_to - specifies the fd it should become in the child. */ -struct spawn_fd_item_s -{ - int fd; - int dup_to; -}; - -struct io_select_fd_s -{ - int fd; - int for_read; - int for_write; - int signaled; - int frozen; - void *opaque; -}; - -/* These function are either defined in posix-io.c or w32-io.c. */ -void _gpgme_io_subsystem_init (void); -int _gpgme_io_read (int fd, void *buffer, size_t count); -int _gpgme_io_write (int fd, const void *buffer, size_t count); -int _gpgme_io_pipe (int filedes[2], int inherit_idx); -int _gpgme_io_close (int fd); -int _gpgme_io_set_close_notify (int fd, void (*handler) (int, void *), - void *value); -int _gpgme_io_set_nonblocking (int fd); - -/* Spawn the executable PATH with ARGV as arguments, after forking - close all fds in FD_PARENT_LIST in the parent and close or dup all - fds in FD_CHILD_LIST in the child. */ -int _gpgme_io_spawn (const char *path, char **argv, - struct spawn_fd_item_s *fd_child_list, - struct spawn_fd_item_s *fd_parent_list); -int _gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal); -int _gpgme_io_kill (int pid, int hard); -int _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock); - -#endif /* IO_H */ - - - Index: gpgme/gpgme/posix-io.c diff -u gpgme/gpgme/posix-io.c:1.27 gpgme/gpgme/posix-io.c:1.28 --- gpgme/gpgme/posix-io.c:1.27 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/posix-io.c Thu Mar 24 14:05:12 2005 @@ -1,6 +1,6 @@ /* posix-io.c - Posix I/O functions Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -35,7 +35,7 @@ #include #include "util.h" -#include "io.h" +#include "priv-io.h" #include "sema.h" #include "ath.h" #include "debug.h" Index: gpgme/gpgme/priv-io.h diff -u /dev/null gpgme/gpgme/priv-io.h:1.1 --- /dev/null Thu Mar 24 14:05:13 2005 +++ gpgme/gpgme/priv-io.h Thu Mar 24 14:05:12 2005 @@ -0,0 +1,67 @@ +/* priv-io.h - Interface to the private I/O functions. + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH + + This file is part of GPGME. + + GPGME 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. + + GPGME 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef IO_H +#define IO_H + + +/* A single file descriptor passed to spawn. For child fds, dup_to + specifies the fd it should become in the child. */ +struct spawn_fd_item_s +{ + int fd; + int dup_to; +}; + +struct io_select_fd_s +{ + int fd; + int for_read; + int for_write; + int signaled; + int frozen; + void *opaque; +}; + +/* These function are either defined in posix-io.c or w32-io.c. */ +void _gpgme_io_subsystem_init (void); +int _gpgme_io_read (int fd, void *buffer, size_t count); +int _gpgme_io_write (int fd, const void *buffer, size_t count); +int _gpgme_io_pipe (int filedes[2], int inherit_idx); +int _gpgme_io_close (int fd); +int _gpgme_io_set_close_notify (int fd, void (*handler) (int, void *), + void *value); +int _gpgme_io_set_nonblocking (int fd); + +/* Spawn the executable PATH with ARGV as arguments, after forking + close all fds in FD_PARENT_LIST in the parent and close or dup all + fds in FD_CHILD_LIST in the child. */ +int _gpgme_io_spawn (const char *path, char **argv, + struct spawn_fd_item_s *fd_child_list, + struct spawn_fd_item_s *fd_parent_list); +int _gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal); +int _gpgme_io_kill (int pid, int hard); +int _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock); + +#endif /* IO_H */ + + + Index: gpgme/gpgme/rungpg.c diff -u gpgme/gpgme/rungpg.c:1.103 gpgme/gpgme/rungpg.c:1.104 --- gpgme/gpgme/rungpg.c:1.103 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/rungpg.c Thu Mar 24 14:05:12 2005 @@ -1,6 +1,6 @@ /* rungpg.c - Gpg Engine. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -33,7 +33,7 @@ #include "ops.h" #include "wait.h" #include "context.h" /*temp hack until we have GpmeData methods to do I/O */ -#include "io.h" +#include "priv-io.h" #include "sema.h" #include "debug.h" Index: gpgme/gpgme/version.c diff -u gpgme/gpgme/version.c:1.27 gpgme/gpgme/version.c:1.28 --- gpgme/gpgme/version.c:1.27 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/version.c Thu Mar 24 14:05:12 2005 @@ -1,6 +1,6 @@ /* version.c - Version check routines. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -27,7 +27,7 @@ #include #include "gpgme.h" -#include "io.h" +#include "priv-io.h" /* For _gpgme_sema_subsystem_init (). */ #include "sema.h" Index: gpgme/gpgme/w32-io.c diff -u gpgme/gpgme/w32-io.c:1.31 gpgme/gpgme/w32-io.c:1.32 --- gpgme/gpgme/w32-io.c:1.31 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/w32-io.c Thu Mar 24 14:05:12 2005 @@ -36,7 +36,7 @@ #include "util.h" #include "sema.h" -#include "io.h" +#include "priv-io.h" #include "debug.h" /* We assume that a HANDLE can be represented by an int which should Index: gpgme/gpgme/wait-global.c diff -u gpgme/gpgme/wait-global.c:1.11 gpgme/gpgme/wait-global.c:1.12 --- gpgme/gpgme/wait-global.c:1.11 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/wait-global.c Thu Mar 24 14:05:12 2005 @@ -1,6 +1,6 @@ /* wait-global.c Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -32,7 +32,7 @@ #include "util.h" #include "context.h" #include "wait.h" -#include "io.h" +#include "priv-io.h" /* The global event loop is used for all asynchronous operations (except key listing) for which no user I/O callbacks are specified. Index: gpgme/gpgme/wait-private.c diff -u gpgme/gpgme/wait-private.c:1.10 gpgme/gpgme/wait-private.c:1.11 --- gpgme/gpgme/wait-private.c:1.10 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/wait-private.c Thu Mar 24 14:05:12 2005 @@ -1,6 +1,6 @@ /* wait-private.c Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -29,7 +29,7 @@ #include "context.h" #include "wait.h" #include "ops.h" -#include "io.h" +#include "priv-io.h" #include "util.h" Index: gpgme/gpgme/wait-user.c diff -u gpgme/gpgme/wait-user.c:1.6 gpgme/gpgme/wait-user.c:1.7 --- gpgme/gpgme/wait-user.c:1.6 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/wait-user.c Thu Mar 24 14:05:12 2005 @@ -1,6 +1,6 @@ /* wait-user.c Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -26,7 +26,7 @@ #include "gpgme.h" #include "context.h" -#include "io.h" +#include "priv-io.h" #include "wait.h" Index: gpgme/gpgme/wait.c diff -u gpgme/gpgme/wait.c:1.43 gpgme/gpgme/wait.c:1.44 --- gpgme/gpgme/wait.c:1.43 Tue Dec 7 22:13:36 2004 +++ gpgme/gpgme/wait.c Thu Mar 24 14:05:12 2005 @@ -1,6 +1,6 @@ /* wait.c Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -33,7 +33,7 @@ #include "ops.h" #include "wait.h" #include "sema.h" -#include "io.h" +#include "priv-io.h" #include "engine.h" #include "debug.h" From cvs at cvs.gnupg.org Thu Mar 24 13:55:41 2005 From: cvs at cvs.gnupg.org (cvs user marcus) Date: Thu Mar 24 13:55:46 2005 Subject: gpgme (6 files) Message-ID: Date: Thursday, March 24, 2005 @ 14:09:54 Author: marcus Path: /cvs/gpgme/gpgme Modified: ChangeLog configure.ac gpgme/ChangeLog gpgme/data-compat.c gpgme/data.c gpgme/data.h 2005-03-24 Marcus Brinkmann * configure.ac (AH_BOTTOM): Removed. gpgme/ 2005-03-24 Marcus Brinkmann * data.h (EOPNOTSUPP) [_WIN32]: Remove definition. * data.c (EOPNOTSUPP) [HAVE_W32_SYSTEM]: Remove definition. (gpgme_data_read, gpgme_data_write, gpgme_data_seek): Return ENOSYS instead EOPNOTSUPP. * data-compat.c (EOPNOTSUPP) [HAVE_W32_SYSTEM]: Remove definition. (gpgme_error_to_errno): Map GPG_ERR_NOT_SUPPORTED to ENOSYS. ---------------------+ ChangeLog | 4 ++++ configure.ac | 11 ----------- gpgme/ChangeLog | 10 ++++++++++ gpgme/data-compat.c | 7 +------ gpgme/data.c | 11 +++-------- gpgme/data.h | 4 ---- 6 files changed, 18 insertions(+), 29 deletions(-) Index: gpgme/ChangeLog diff -u gpgme/ChangeLog:1.112 gpgme/ChangeLog:1.113 --- gpgme/ChangeLog:1.112 Wed Mar 9 17:03:05 2005 +++ gpgme/ChangeLog Thu Mar 24 14:09:54 2005 @@ -1,3 +1,7 @@ +2005-03-24 Marcus Brinkmann + + * configure.ac (AH_BOTTOM): Removed. + 2005-03-09 Werner Koch * acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling. Index: gpgme/configure.ac diff -u gpgme/configure.ac:1.97 gpgme/configure.ac:1.98 --- gpgme/configure.ac:1.97 Wed Mar 9 17:03:05 2005 +++ gpgme/configure.ac Thu Mar 24 14:09:54 2005 @@ -68,17 +68,6 @@ # define _REENTRANT 1 #endif]) -AH_BOTTOM([ -/* Some environments miss the definition for EOPNOTSUPP. We provide - the error code here and test where neded whether it should be - defined. Can't do the test here due to the order of includes. */ -#ifdef HAVE_W32_SYSTEM -#define VALUE_FOR_EOPNOTSUPP 95 -#endif /*!HAVE_W32_SYSTEM*/ - -]) - - AC_PROG_CC Index: gpgme/gpgme/ChangeLog diff -u gpgme/gpgme/ChangeLog:1.393 gpgme/gpgme/ChangeLog:1.394 --- gpgme/gpgme/ChangeLog:1.393 Thu Mar 24 14:05:12 2005 +++ gpgme/gpgme/ChangeLog Thu Mar 24 14:09:54 2005 @@ -1,5 +1,15 @@ 2005-03-24 Marcus Brinkmann + * data.h (EOPNOTSUPP) [_WIN32]: Remove definition. + * data.c (EOPNOTSUPP) [HAVE_W32_SYSTEM]: Remove definition. + (gpgme_data_read, gpgme_data_write, gpgme_data_seek): Return + ENOSYS instead EOPNOTSUPP. + * data-compat.c (EOPNOTSUPP) [HAVE_W32_SYSTEM]: Remove definition. + (gpgme_error_to_errno): Map GPG_ERR_NOT_SUPPORTED + to ENOSYS. + +2005-03-24 Marcus Brinkmann + * io.h: Rename to ... * priv-io.h: ... this. * Makefile.am (libgpgme_real_la_SOURCES): Change io.h to priv-io.h. Index: gpgme/gpgme/data-compat.c diff -u gpgme/gpgme/data-compat.c:1.10 gpgme/gpgme/data-compat.c:1.11 --- gpgme/gpgme/data-compat.c:1.10 Wed Mar 9 17:03:04 2005 +++ gpgme/gpgme/data-compat.c Thu Mar 24 14:09:54 2005 @@ -30,11 +30,6 @@ #include "data.h" #include "util.h" -#if defined(HAVE_W32_SYSTEM) && !defined(EOPNOTSUPP) -#define EOPNOTSUPP VALUE_FOR_EOPNOTSUPP -#endif - - /* Create a new data buffer filled with LENGTH bytes starting from OFFSET within the file FNAME or stream STREAM (exactly one must be @@ -145,7 +140,7 @@ errno = EINVAL; return -1; case GPG_ERR_NOT_SUPPORTED: - errno = EOPNOTSUPP; + errno = ENOSYS; return -1; default: /* FIXME: Yeah, well. */ Index: gpgme/gpgme/data.c diff -u gpgme/gpgme/data.c:1.44 gpgme/gpgme/data.c:1.45 --- gpgme/gpgme/data.c:1.44 Thu Mar 24 14:05:12 2005 +++ gpgme/gpgme/data.c Thu Mar 24 14:09:54 2005 @@ -33,11 +33,6 @@ #include "ops.h" #include "priv-io.h" -#if defined(HAVE_W32_SYSTEM) && !defined(EOPNOTSUPP) -#define EOPNOTSUPP VALUE_FOR_EOPNOTSUPP -#endif - - gpgme_error_t _gpgme_data_new (gpgme_data_t *r_dh, struct _gpgme_data_cbs *cbs) @@ -80,7 +75,7 @@ } if (!dh->cbs->read) { - errno = EOPNOTSUPP; + errno = ENOSYS; return -1; } return (*dh->cbs->read) (dh, buffer, size); @@ -100,7 +95,7 @@ } if (!dh->cbs->write) { - errno = EOPNOTSUPP; + errno = ENOSYS; return -1; } return (*dh->cbs->write) (dh, buffer, size); @@ -120,7 +115,7 @@ } if (!dh->cbs->seek) { - errno = EOPNOTSUPP; + errno = ENOSYS; return -1; } Index: gpgme/gpgme/data.h diff -u gpgme/gpgme/data.h:1.7 gpgme/gpgme/data.h:1.8 --- gpgme/gpgme/data.h:1.7 Wed Mar 9 12:47:21 2005 +++ gpgme/gpgme/data.h Thu Mar 24 14:09:54 2005 @@ -30,10 +30,6 @@ #include "gpgme.h" -#ifdef _WIN32 -# define EOPNOTSUPP 95 -#endif - /* Read up to SIZE bytes into buffer BUFFER from the data object with the handle DH. Return the number of characters read, 0 on EOF and From cvs at cvs.gnupg.org Tue Mar 29 22:31:35 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Tue Mar 29 22:31:38 2005 Subject: GNUPG-1-9-BRANCH gnupg/scd (ChangeLog app-openpgp.c) Message-ID: Date: Tuesday, March 29, 2005 @ 22:46:18 Author: mo Path: /cvs/gnupg/gnupg/scd Tag: GNUPG-1-9-BRANCH Modified: ChangeLog app-openpgp.c 2005-03-29 Moritz Schulte * app-openpgp.c (retrieve_fpr_from_card): New function. (retrieve_next_token): New function. (retrieve_key_material): New function. (get_public_key): Implement retrival of key through expernal helper (gpg) in case the openpgp card is not cooperative enough. ---------------+ ChangeLog | 8 + app-openpgp.c | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 325 insertions(+), 15 deletions(-) Index: gnupg/scd/ChangeLog diff -u gnupg/scd/ChangeLog:1.25.2.70 gnupg/scd/ChangeLog:1.25.2.71 --- gnupg/scd/ChangeLog:1.25.2.70 Fri Feb 25 17:14:54 2005 +++ gnupg/scd/ChangeLog Tue Mar 29 22:46:18 2005 @@ -1,3 +1,11 @@ +2005-03-29 Moritz Schulte + + * app-openpgp.c (retrieve_fpr_from_card): New function. + (retrieve_next_token): New function. + (retrieve_key_material): New function. + (get_public_key): Implement retrival of key through expernal + helper (gpg) in case the openpgp card is not cooperative enough. + 2005-02-25 Werner Koch * app-openpgp.c (get_public_key): Make sure not to return negative Index: gnupg/scd/app-openpgp.c diff -u gnupg/scd/app-openpgp.c:1.9.2.27 gnupg/scd/app-openpgp.c:1.9.2.28 --- gnupg/scd/app-openpgp.c:1.9.2.27 Fri Feb 25 17:14:54 2005 +++ gnupg/scd/app-openpgp.c Tue Mar 29 22:46:18 2005 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: app-openpgp.c,v 1.9.2.27 2005/02/25 16:14:54 wk Exp $ + * $Id: app-openpgp.c,v 1.9.2.28 2005/03/29 20:46:18 mo Exp $ */ #include @@ -776,6 +776,263 @@ return rc; } +/* Retrieve the fingerprint from the card inserted in SLOT and write + the according hex representation (40 hex digits plus NUL character) + to FPR. */ +static gpg_error_t +retrieve_fpr_from_card (int slot, char *fpr) +{ + const unsigned char *value; + unsigned char *data; + size_t data_n; + gpg_error_t err; + size_t value_n; + unsigned int i; + + data = NULL; + + err = iso7816_get_data (slot, 0x6E, &data, &data_n); + if (err) + /* FIXME */ + goto out; + + value = find_tlv (data, data_n, 0x00C5, &value_n); + if (! (value + && (! (value_n > (data_n - (value - data)))) + && (value_n >= 60))) /* FIXME: Shouldn't this be "== 60"? */ + { + /* FIXME? */ + err = gpg_error (GPG_ERR_CARD); /* */ + goto out; + } + + /* Copy out third key FPR. */ + for (i = 0; i < 20; i++) + sprintf (fpr + (i * 2), "%02X", (value + (2 * 20))[i]); + + out: + + xfree (data); + + return err; +} + +/* Retrieve the next token from S, using ":" as delimiter. */ +static char * +retrieve_next_token (char *s) +{ + char *p; + + p = strtok (s, ":"); + if (! p) + log_error ("error while extracting token\n"); + + return p; +} + +/* Retrieve the secret key material for the key, whose fingerprint is + FPR, from gpg output, which can be read through the stream FP. The + RSA modulus will be stored in m/mlen, the secret exponent in + e/elen. Return zero on success, one on failure. */ +static int +retrieve_key_material (FILE *fp, const char *fpr, + const unsigned char **m, size_t *mlen, + const unsigned char **e, size_t *elen) +{ + size_t line_size; + ssize_t line_ret; + char *line; + int ret; + int found_key; + char *token; + int pkd_n; + unsigned char *m_new; + unsigned char *e_new; + size_t m_new_n; + size_t e_new_n; + int is_rsa; + gcry_mpi_t mpi; + gcry_error_t err; + size_t max_length; + + line_size = 0; + line = NULL; + found_key = 0; + pkd_n = 0; + m_new = NULL; + e_new = NULL; + mpi = NULL; + ret = 0; + + while (1) + { + /* FIXME? */ + max_length = 1024; + line_ret = read_line (fp, &line, &line_size, &max_length); + if (line_ret < 0) + { + ret = 1; + break; + } + if (! line_ret) + /* EOF. */ + /* FIXME? */ + break; + + token = retrieve_next_token (line); + if (! found_key) + { + /* Key not found yet, search for key entry. */ + if ((! strcmp (token, "pub")) || (! strcmp (token, "sub"))) + { + /* Reached next key entry, parse it. */ + + /* This is the trust level (right, FIXME?). */ + token = retrieve_next_token (NULL); + if (! token) + { + ret = 1; + break; + } + + /* This is the size. */ + token = retrieve_next_token (NULL); + if (! token) + { + ret = 1; + break; + } + + /* This is the algorithm (right, FIXME?). */ + token = retrieve_next_token (NULL); + if (! token) + { + ret = 1; + break; + } + is_rsa = ! strcmp (token, "1"); + + /* This is the fingerprint. */ + token = retrieve_next_token (NULL); + if (! token) + { + ret = 1; + break; + } + + if (! strcmp (token, fpr)) + { + /* Found our key. */ + if (! is_rsa) + { + /* FIXME. */ + ret = 1; + break; + } + found_key = 1; + } + } + } + else + { + if (! strcmp (token, "sub")) + /* Next key entry, break. */ + break; + + if (! strcmp (token, "pkd")) + { + if ((pkd_n == 0) || (pkd_n == 1)) + { + /* This is the pkd index. */ + token = retrieve_next_token (NULL); + if (! token) + { + /* FIXME. */ + ret = 1; + break; + } + + /* This is the pkd size. */ + token = retrieve_next_token (NULL); + if (! token) + { + /* FIXME. */ + ret = 1; + break; + } + + /* This is the pkd mpi. */ + token = retrieve_next_token (NULL); + if (! token) + { + /* FIXME. */ + ret = 1; + break; + } + + err = gcry_mpi_scan (&mpi, GCRYMPI_FMT_HEX, token, 0, NULL); + if (err) + { + log_error ("error while converting pkd %i from hex: %s\n", + pkd_n, gcry_strerror (err)); + ret = 1; + break; + } + + if (pkd_n == 0) + err = gcry_mpi_aprint (GCRYMPI_FMT_STD, + &m_new, &m_new_n, mpi); + else + err = gcry_mpi_aprint (GCRYMPI_FMT_STD, + &e_new, &e_new_n, mpi); + if (err) + { + log_error ("error while converting pkd %i to std: %s\n", + pkd_n, gcry_strerror (err)); + ret = 1; + break; + } + gcry_mpi_release (mpi); + mpi = NULL; + pkd_n++; + } + else + { + /* Too many pkd entries. */ + /* FIXME */ + ret = 1; + break; + } + } + } + } + if (ret) + goto out; + + if (pkd_n < 2) + { + /* Not enough pkds retrieved. */ + ret = 1; + goto out; + } + + *m = m_new; + *mlen = m_new_n; + *e = e_new; + *elen = e_new_n; + + out: + + if (ret) + { + gcry_free (m_new); + gcry_free (e_new); + } + gcry_mpi_release (mpi); + gcry_free (line); + + return ret; +} /* Get the public key for KEYNO and store it as an S-expresion with the APP handle. On error that field gets cleared. If we already @@ -875,30 +1132,75 @@ e = ebuf; } - - err = gcry_sexp_build (&sexp, NULL, - "(public-key (rsa (n %b) (e %b)))", - (int)mlen, m,(int)elen, e); - if (err) - { - log_error ("error formatting the key into an S-expression: %s\n", - gpg_strerror (err)); - goto leave; - } - app->app_local->pk[keyno].key = sexp; - } else { /* Due to a design problem in v1.0 cards we can't get the public key out of these cards without doing a verify on CHV3. Clearly that is not an option and thus we try to locate the - key using an external helper. */ + key using an external helper. + + The helper we use here is gpg itself, which should know about + the key in any case. */ + + char fpr_long[41]; + char *fpr = fpr_long + 24; + char *command; + FILE *fp; + int ret; + + command = NULL; + + err = retrieve_fpr_from_card (app->slot, fpr_long); + if (err) + { + log_error ("error while retrieving fpr from card: %s\n", + gpg_strerror (err)); + goto leave; + } + + ret = asprintf (&command, + "gpg --list-keys --with-colons --with-key-data '%s'", + fpr_long); + if (ret < 0) + { + err = gpg_error_from_errno (errno); + log_error ("error while creating pipe command " + "for retrieving key: %s\n", gpg_strerror (err)); + goto leave; + } + + fp = popen (command, "r"); + if (! fp) + { + err = gpg_error_from_errno (errno); + log_error ("error while creating pipe: %s\n", gpg_strerror (err)); + goto leave; + } + + ret = retrieve_key_material (fp, fpr, &m, &mlen, &e, &elen); + fclose (fp); + if (ret) + { + /* FIXME? */ + err = gpg_error (GPG_ERR_INTERNAL); + log_error ("error while retrieving key material through pipe\n"); + goto leave; + } buffer = NULL; - /* FIXME */ + } + err = gcry_sexp_build (&sexp, NULL, + "(public-key (rsa (n %b) (e %b)))", + (int)mlen, m,(int)elen, e); + if (err) + { + log_error ("error formatting the key into an S-expression: %s\n", + gpg_strerror (err)); + goto leave; } + app->app_local->pk[keyno].key = sexp; leave: /* Set a flag to indicate that we tried to read the key. */ From cvs at cvs.gnupg.org Wed Mar 30 12:24:27 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Wed Mar 30 12:24:31 2005 Subject: gnupg/g10 (ChangeLog apdu.c app-openpgp.c cardglue.c misc.c options.h) Message-ID: Date: Wednesday, March 30, 2005 @ 12:39:13 Author: wk Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog apdu.c app-openpgp.c cardglue.c misc.c options.h (pin_cb): Print a warning if the info string hack is not there. This may happen due to typos in the translation. ---------------+ ChangeLog | 11 +++++++++++ apdu.c | 32 ++++++++++++++++---------------- app-openpgp.c | 4 ++-- cardglue.c | 2 ++ misc.c | 2 +- options.h | 2 +- 6 files changed, 33 insertions(+), 20 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.713 gnupg/g10/ChangeLog:1.714 --- gnupg/g10/ChangeLog:1.713 Mon Mar 21 21:47:28 2005 +++ gnupg/g10/ChangeLog Wed Mar 30 12:39:13 2005 @@ -1,3 +1,14 @@ +2005-03-30 Werner Koch + + * cardglue.c (pin_cb): Print a warning if the info string hack is + not there. This may happen due to typos in the translation. + +2005-03-22 Werner Koch + + * misc.c (w32_shgetfolderpath) [W32]: Changed declaration of + function ptr. Noted by Tim Costello. + * apdu.c [W32]: Changed declaration of dlopened function pointers. + 2005-03-21 David Shaw * gpgv.c: Stubs for tty_enable_completion() & Index: gnupg/g10/apdu.c diff -u gnupg/g10/apdu.c:1.19 gnupg/g10/apdu.c:1.20 --- gnupg/g10/apdu.c:1.19 Tue Jan 25 15:18:56 2005 +++ gnupg/g10/apdu.c Wed Mar 30 12:39:13 2005 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: apdu.c,v 1.19 2005/01/25 14:18:56 wk Exp $ + * $Id: apdu.c,v 1.20 2005/03/30 10:39:13 wk Exp $ */ #include @@ -150,12 +150,12 @@ /* ct API function pointer. */ -static char (* DLSTDCALL CT_init) (unsigned short ctn, unsigned short Pn); -static char (* DLSTDCALL CT_data) (unsigned short ctn, unsigned char *dad, +static char (DLSTDCALL * CT_init) (unsigned short ctn, unsigned short Pn); +static char (DLSTDCALL * CT_data) (unsigned short ctn, unsigned char *dad, unsigned char *sad, unsigned short lc, unsigned char *cmd, unsigned short *lr, unsigned char *rsp); -static char (* DLSTDCALL CT_close) (unsigned short ctn); +static char (DLSTDCALL * CT_close) (unsigned short ctn); /* PC/SC constants and function pointer. */ #define PCSC_SCOPE_USER 0 @@ -217,46 +217,46 @@ typedef struct pcsc_readerstate_s *pcsc_readerstate_t; -long (* DLSTDCALL pcsc_establish_context) (unsigned long scope, +long (DLSTDCALL * pcsc_establish_context) (unsigned long scope, const void *reserved1, const void *reserved2, unsigned long *r_context); -long (* DLSTDCALL pcsc_release_context) (unsigned long context); -long (* DLSTDCALL pcsc_list_readers) (unsigned long context, +long (DLSTDCALL * pcsc_release_context) (unsigned long context); +long (DLSTDCALL * pcsc_list_readers) (unsigned long context, const char *groups, char *readers, unsigned long*readerslen); -long (* DLSTDCALL pcsc_get_status_change) (unsigned long context, +long (DLSTDCALL * pcsc_get_status_change) (unsigned long context, unsigned long timeout, pcsc_readerstate_t readerstates, unsigned long nreaderstates); -long (* DLSTDCALL pcsc_connect) (unsigned long context, +long (DLSTDCALL * pcsc_connect) (unsigned long context, const char *reader, unsigned long share_mode, unsigned long preferred_protocols, unsigned long *r_card, unsigned long *r_active_protocol); -long (* DLSTDCALL pcsc_reconnect) (unsigned long card, +long (DLSTDCALL * pcsc_reconnect) (unsigned long card, unsigned long share_mode, unsigned long preferred_protocols, unsigned long initialization, unsigned long *r_active_protocol); -long (* DLSTDCALL pcsc_disconnect) (unsigned long card, +long (DLSTDCALL * pcsc_disconnect) (unsigned long card, unsigned long disposition); -long (* DLSTDCALL pcsc_status) (unsigned long card, +long (DLSTDCALL * pcsc_status) (unsigned long card, char *reader, unsigned long *readerlen, unsigned long *r_state, unsigned long *r_protocol, unsigned char *atr, unsigned long *atrlen); -long (* DLSTDCALL pcsc_begin_transaction) (unsigned long card); -long (* DLSTDCALL pcsc_end_transaction) (unsigned long card); -long (* DLSTDCALL pcsc_transmit) (unsigned long card, +long (DLSTDCALL * pcsc_begin_transaction) (unsigned long card); +long (DLSTDCALL * pcsc_end_transaction) (unsigned long card); +long (DLSTDCALL * pcsc_transmit) (unsigned long card, const pcsc_io_request_t send_pci, const unsigned char *send_buffer, unsigned long send_len, pcsc_io_request_t recv_pci, unsigned char *recv_buffer, unsigned long *recv_len); -long (* DLSTDCALL pcsc_set_timeout) (unsigned long context, +long (DLSTDCALL * pcsc_set_timeout) (unsigned long context, unsigned long timeout); Index: gnupg/g10/app-openpgp.c diff -u gnupg/g10/app-openpgp.c:1.23 gnupg/g10/app-openpgp.c:1.24 --- gnupg/g10/app-openpgp.c:1.23 Tue Jan 25 15:18:55 2005 +++ gnupg/g10/app-openpgp.c Wed Mar 30 12:39:13 2005 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: app-openpgp.c,v 1.23 2005/01/25 14:18:55 wk Exp $ + * $Id: app-openpgp.c,v 1.24 2005/03/30 10:39:13 wk Exp $ */ #include @@ -1012,7 +1012,7 @@ else app->did_chv1 = app->did_chv2 = 0; - /* Note to translators: Do not translate the "|*|" prefixes but + /* TRANSLATORS: Do not translate the "|*|" prefixes but keep it at the start of the string. We need this elsewhere to get some infos on the string. */ rc = pincb (pincb_arg, chvno == 3? _("|AN|New Admin PIN") : _("|N|New PIN"), Index: gnupg/g10/cardglue.c diff -u gnupg/g10/cardglue.c:1.24 gnupg/g10/cardglue.c:1.25 --- gnupg/g10/cardglue.c:1.24 Mon Mar 14 20:19:20 2005 +++ gnupg/g10/cardglue.c Wed Mar 30 12:39:13 2005 @@ -674,6 +674,8 @@ } info = ends+1; } + else + log_debug ("pin_cb called without proper PIN info hack\n"); again: if (is_status_enabled()) Index: gnupg/g10/misc.c diff -u gnupg/g10/misc.c:1.65 gnupg/g10/misc.c:1.66 --- gnupg/g10/misc.c:1.65 Tue Feb 15 12:02:31 2005 +++ gnupg/g10/misc.c Wed Mar 30 12:39:13 2005 @@ -1027,7 +1027,7 @@ w32_shgetfolderpath (HWND a, int b, HANDLE c, DWORD d, LPSTR e) { static int initialized; - static HRESULT (* WINAPI func)(HWND,int,HANDLE,DWORD,LPSTR); + static HRESULT (WINAPI * func)(HWND,int,HANDLE,DWORD,LPSTR); if (!initialized) { Index: gnupg/g10/options.h diff -u gnupg/g10/options.h:1.134 gnupg/g10/options.h:1.135 --- gnupg/g10/options.h:1.134 Thu Mar 17 23:55:17 2005 +++ gnupg/g10/options.h Wed Mar 30 12:39:13 2005 @@ -223,7 +223,7 @@ #define DBG_TRUST_VALUE 256 /* debug the trustdb */ #define DBG_HASHING_VALUE 512 /* debug hashing operations */ #define DBG_EXTPROG_VALUE 1024 /* debug external program calls */ -#define DBG_CARD_IO_VALUE 2048 +#define DBG_CARD_IO_VALUE 2048 /* debug smart card I/O. */ #define DBG_PACKET (opt.debug & DBG_PACKET_VALUE) #define DBG_FILTER (opt.debug & DBG_FILTER_VALUE) From cvs at cvs.gnupg.org Wed Mar 30 16:08:11 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Thu Mar 31 06:40:25 2005 Subject: gnupg/scripts (4 files) Message-ID: Date: Wednesday, March 30, 2005 @ 16:23:01 Author: wk Path: /cvs/gnupg/gnupg/scripts Modified: ChangeLog conf-w32/bzip2-1.diff mk-w32-dist w32installer.nsi * w32installer.nsi: Allow including of WINPT source. Include libiconv source. * mk-w32-dist: Add code to detect presence of source. Calculate a build number; add option --build-number to overide. -----------------------+ ChangeLog | 7 +++ conf-w32/bzip2-1.diff | 2 - mk-w32-dist | 86 +++++++++++++++++++++++++++++++++++++++++++----- w32installer.nsi | 32 ++++++++++++++--- 4 files changed, 112 insertions(+), 15 deletions(-) Index: gnupg/scripts/ChangeLog diff -u gnupg/scripts/ChangeLog:1.66 gnupg/scripts/ChangeLog:1.67 --- gnupg/scripts/ChangeLog:1.66 Mon Mar 14 20:19:20 2005 +++ gnupg/scripts/ChangeLog Wed Mar 30 16:23:01 2005 @@ -1,3 +1,10 @@ +2005-03-30 Werner Koch + + * w32installer.nsi: Allow including of WINPT source. Include + libiconv source. + * mk-w32-dist: Add code to detect presence of source. Calculate a + build number; add option --build-number to overide. + 2005-03-14 Werner Koch * mk-w32-dist: Check for patch files. Index: gnupg/scripts/conf-w32/bzip2-1.diff diff -u gnupg/scripts/conf-w32/bzip2-1.diff:1.1 gnupg/scripts/conf-w32/bzip2-1.diff:1.2 --- gnupg/scripts/conf-w32/bzip2-1.diff:1.1 Mon Mar 14 21:41:20 2005 +++ gnupg/scripts/conf-w32/bzip2-1.diff Wed Mar 30 16:23:00 2005 @@ -3,7 +3,7 @@ usual using the mingw32 cross compiler package from Debian and install the library and header file on top of the cross compiler installation (/usr/i586-mingw32msvc/lib/). Note that for ease of maintenance we -don't used a DLL. [wk 2005-03-14] +don't use a DLL. [wk 2005-03-14] diff -u orig/bzip2-1.0.2/Makefile bzip2-1.0.2/Makefile Index: gnupg/scripts/mk-w32-dist diff -u gnupg/scripts/mk-w32-dist:1.19 gnupg/scripts/mk-w32-dist:1.20 --- gnupg/scripts/mk-w32-dist:1.19 Mon Mar 14 20:19:20 2005 +++ gnupg/scripts/mk-w32-dist Wed Mar 30 16:23:01 2005 @@ -36,6 +36,20 @@ exit 1 fi +# Windows uses an internal build number. We use the last day of the +# year concatenated with the hour. for it. If it happens that a new +# release of the same version is to be made in the next year, the +# build number must be given manually by adding the appropriate number +# of days. +if [ "$1" = "--build-number" -a -n "$2" ]; then + build_number="$2" + shift + shift +else + build_number=$(date -u '+%j%k' | sed 's/^0*\(.*\)/\1/') +fi + + if i586-mingw32msvc-strip --version >/dev/null 2>&1 ; then STRIP=i586-mingw32msvc-strip else @@ -92,7 +106,8 @@ # Figure out the version version=$(sed -n 's/^#[ ]*define[ ][ ]*VERSION[ ][ ]*\"\([0-9.a-z-]*\)\"/\1/p' $bindir/config.h) -prod_version=$(echo "$version"|awk -F'[^0-9]' '{print $1 "." $2 "." $3 ".1"}') +prod_version=$(echo "$version"|awk -F'[^0-9]' '{print $1 "." $2 "." $3 }') +prod_version="${prod_version}.${build_number}" echo "building version $version ($prod_version)" rm * >/dev/null 2>/dev/null || true @@ -189,7 +204,7 @@ # iconv.dll is a hard requirement if [ ! -f "$topdir/iconv/iconv.dll" ]; then - echo "iconv.dll not availavle" >&2 + echo "iconv.dll not available" >&2 exit 1 fi ln "$topdir/iconv/iconv.dll" iconv.dll @@ -208,19 +223,74 @@ winpt_defs="-DWITH_WINPT" fi - # See whether we should include the source. - if [ ! -d "$topdir/tarballs" ]; then - # FIXME - : + # See whether we should include the source and figure out the + # version numbers of the source files. + if [ -d "$topdir/tarballs" ]; then + have_gnupg_src=no + have_libiconv_src=no + have_winpt_src=no + for i in `find "$topdir/tarballs" -type f -name '*.tar.gz'`; do + fname=$(basename "$i" .gz) + zcat "$i" > "$fname" + case "$fname" in + gnupg-*) + tmp=$(echo "$fname" | \ + sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p') + echo "gnupg source version is $tmp" >&2 + if [ "$version" != "$tmp" ]; then + echo "gnupg source version does not match" >&2 + exit 1 + fi + have_gnupg_src=yes + ;; + libiconv-*) + tmp=$(echo "$fname" | \ + sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p') + echo "libiconv source version is $tmp" >&2 + src_defs="$src_defs -DLIBICONV_VERSION=$tmp" + have_libiconv_src=yes + ;; + winpt-*) + tmp=$(echo "$fname" | \ + sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p') + echo "winpt source version is $tmp" >&2 + src_defs="$src_defs -DWINPT_VERSION=$tmp" + have_winpt_src=yes + ;; + + *) + echo "WARNING: unknown source file $fname ignored" >&2 + ;; + esac + done + if [ -n "$src_defs" ]; then + if [ $have_gnupg_src = "no" ]; then + echo "gnupg source missing" >&2 + exit 1 + fi + if [ $have_libiconv_src = "no" ]; then + echo "libiconv source missing" >&2 + exit 1 + fi + if [ -n "$winpt_defs" ]; then + if [ $have_winpt_src = "no" ]; then + echo "winpt source missing" >&2 + exit 1 + fi + fi + + src_defs="$src_defs -DWITH_SOURCE" + fi + fi # Now run the installer echo "invoking installer as:" - echo makensis -v2 -nocd -DVERSION="${version}" \ + echo makensis -nocd -DVERSION="${version}" \ -DPROD_VERSION="${prod_version}" \ -DGNUPG_SRCDIR="${srcdir}" ${winpt_defs} ${src_defs} \ ${patches_defs} ${srcdir}/scripts/w32installer.nsi - BUILDINFO=$buildinfo makensis -v2 -nocd -DVERSION="${version}" \ + BUILDINFO=$buildinfo makensis -nocd -DVERSION="${version}" \ -DPROD_VERSION="${prod_version}" \ -DGNUPG_SRCDIR="${srcdir}" ${winpt_defs} ${src_defs} \ ${patches_defs} ${srcdir}/scripts/w32installer.nsi Index: gnupg/scripts/w32installer.nsi diff -u gnupg/scripts/w32installer.nsi:1.8 gnupg/scripts/w32installer.nsi:1.9 --- gnupg/scripts/w32installer.nsi:1.8 Mon Mar 14 20:19:20 2005 +++ gnupg/scripts/w32installer.nsi Wed Mar 30 16:23:01 2005 @@ -37,7 +37,6 @@ SetCompressor lzma - VIProductVersion "${PROD_VERSION}" VIAddVersionKey "ProductName" "GNU Privacy Guard (${VERSION})" VIAddVersionKey "Comments" \ @@ -132,6 +131,8 @@ !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ReserveFile "opt.ini" ReserveFile "COPYING.txt" +ReserveFile "README-W32.txt" +ReserveFile "${NSISDIR}/Plugins/System.dll" ReserveFile "${NSISDIR}/Plugins/UserInfo.dll" @@ -236,15 +237,22 @@ ;------------------ !ifdef WITH_SOURCE -Section "Source" SecSource +Section /o "Source" SecSource SetOutPath "$INSTDIR\Src" - ; Note that we include the uncompressed tarball because this allows + ; Note that we include the uncompressed tarballs because this allows ; far better compression results for the distribution. We might ; want to compress it again after installation. + File "gnupg-${VERSION}.tar" + File "libiconv-${LIBICONV_VERSION}.tar" + +!ifdef WITH_WINPT + File "winpt-$(WINPT_VERSION}.tar" +!endif ; WITH_WINPT + SectionEnd ; Section Source !endif @@ -389,6 +397,11 @@ Delete "$INSTDIR\Doc\NEWS.txt" Delete "$INSTDIR\Doc\FAQ.txt" + Delete "$INSTDIR\Src\gnupg-${VERSION}.tar" + Delete "$INSTDIR\Src\libiconv-${LIBICONV_VERSION}.tar" + Delete "$INSTDIR\Src\winpt-$(WINPT_VERSION}.tar" + Delete "$INSTDIR\Src\*.diff" + Delete "$INSTDIR\uninst-gnupg.exe" ;;------------------------ @@ -553,13 +566,15 @@ with the proposed OpenPGP Internet standard as described in RFC2440. \ \r\n\r\n$_CLICK \ \r\n\r\n\r\n\r\n\r\nThis is GnuPG version ${VERSION}\r\n\ - built on $%BUILDINFO%" + built on $%BUILDINFO%\r\n\ + file version ${PROD_VERSION}" LangString T_About ${LANG_GERMAN} \ "GnuPG is das Werkzeug aus dem GNU Projekt zur sicheren Kommunikation \ sowie zum sicheren Speichern von Daten. \ \r\n\r\n$_CLICK \ - \r\n\r\n\r\n\r\n\r\nDies ist GnuPG version ${VERSION}\r\n\ - erstellt am $%BUILDINFO%" + \r\n\r\n\r\n\r\n\r\nDies ist GnuPG Version ${VERSION}\r\n\ + erstellt am $%BUILDINFO%\r\n\ + Dateiversion ${PROD_VERSION}" ; Startup page LangString T_GPLHeader ${LANG_ENGLISH} \ @@ -634,6 +649,11 @@ LangString DESC_SecDoc ${LANG_GERMAN} \ "Handbuchseiten und eine FAQ" +LangString DESC_SecSource ${LANG_ENGLISH} \ + "Quelltextdateien" +LangString DESC_SecSource ${LANG_GERMAN} \ + "Source files" + ;------------------------------------- From cvs at cvs.gnupg.org Wed Mar 30 20:25:11 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Thu Mar 31 06:42:02 2005 Subject: libgcrypt/src (ChangeLog gcrypt.h libgcrypt.vers) Message-ID: Date: Wednesday, March 30, 2005 @ 20:40:02 Author: mo Path: /cvs/libgcrypt/libgcrypt/src Modified: ChangeLog gcrypt.h libgcrypt.vers 2005-03-30 Moritz Schulte * libgcrypt.vers: Added: gcry_ac_io_init, gry_ac_io_init_va. * gcrypt.h (gcry_ac_data_read_cb_t, gcry_ac_data_write_cb_t, gcry_ac_io_mode_t, gcry_ac_io_type_t, gcry_ac_io_t): New types. (gcry_ac_io_init_va): Declare function. (gcry_ac_data_encode, gcry_ac_data_decode, gcry_ac_data_encrypt_scheme, gcry_ac_data_decrypt_scheme, gcry_ac_data_sign_scheme, gcry_ac_data_verify_scheme): Use gcry_ac_io_type_t objects instead of memory strings directly. ----------------+ ChangeLog | 12 +++ gcrypt.h | 170 ++++++++++++++++++++++++++++++++++++++----------------- libgcrypt.vers | 1 3 files changed, 133 insertions(+), 50 deletions(-) Index: libgcrypt/src/ChangeLog diff -u libgcrypt/src/ChangeLog:1.161 libgcrypt/src/ChangeLog:1.162 --- libgcrypt/src/ChangeLog:1.161 Tue Mar 22 22:24:09 2005 +++ libgcrypt/src/ChangeLog Wed Mar 30 20:40:02 2005 @@ -1,3 +1,15 @@ +2005-03-30 Moritz Schulte + + * libgcrypt.vers: Added: gcry_ac_io_init, gry_ac_io_init_va. + + * gcrypt.h (gcry_ac_data_read_cb_t, gcry_ac_data_write_cb_t, + gcry_ac_io_mode_t, gcry_ac_io_type_t, gcry_ac_io_t): New types. + (gcry_ac_io_init_va): Declare function. + (gcry_ac_data_encode, gcry_ac_data_decode, + gcry_ac_data_encrypt_scheme, gcry_ac_data_decrypt_scheme, + gcry_ac_data_sign_scheme, gcry_ac_data_verify_scheme): Use + gcry_ac_io_type_t objects instead of memory strings directly. + 2005-03-03 Moritz Schulte * libgcrypt.vers: Added: gcry_ac_data_to_sexp() and Index: libgcrypt/src/gcrypt.h diff -u libgcrypt/src/gcrypt.h:1.129 libgcrypt/src/gcrypt.h:1.130 --- libgcrypt/src/gcrypt.h:1.129 Sun Feb 13 19:13:22 2005 +++ libgcrypt/src/gcrypt.h Wed Mar 30 20:40:02 2005 @@ -379,7 +379,7 @@ /* Like gcry_sexp_build, but uses an array instead of variable function arguments. */ gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff, - const char *format, void **arg_list); + const char *format, void **arg_list); /* Release the S-expression object SEXP */ void gcry_sexp_release (gcry_sexp_t sexp); @@ -1173,6 +1173,67 @@ performing cryptographic operations. */ typedef struct gcry_ac_handle *gcry_ac_handle_t; +typedef gpg_error_t (*gcry_ac_data_read_cb_t) (void *opaque, + unsigned char *buffer, + size_t *buffer_n); + +typedef gpg_error_t (*gcry_ac_data_write_cb_t) (void *opaque, + unsigned char *buffer, + size_t buffer_n); + +typedef enum + { + GCRY_AC_IO_READABLE, + GCRY_AC_IO_WRITABLE + } +gcry_ac_io_mode_t; + +typedef enum + { + GCRY_AC_IO_STRING, + GCRY_AC_IO_CALLBACK + } +gcry_ac_io_type_t; + +typedef struct gcry_ac_io +{ + /* This is an INTERNAL structure, do NOT use manually. */ + gcry_ac_io_mode_t mode; + gcry_ac_io_type_t type; + union + { + union + { + struct + { + gcry_ac_data_read_cb_t cb; + void *opaque; + } callback; + struct + { + unsigned char *data; + size_t data_n; + } string; + void *opaque; + } readable; + union + { + struct + { + gcry_ac_data_write_cb_t cb; + void *opaque; + } callback; + struct + { + unsigned char **data; + size_t *data_n; + } string; + void *opaque; + } writable; + }; +} +gcry_ac_io_t; + /* The caller of gcry_ac_key_pair_generate can provide one of these structures in order to influence the key generation process in an algorithm-specific way. */ @@ -1257,6 +1318,18 @@ gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp, const char **identifiers); +/* Initialize AC_IO according to MODE, TYPE and the variable list of + arguments. The list of variable arguments to specify depends on + the given TYPE. */ +void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode, + gcry_ac_io_type_t type, ...); + +/* Initialize AC_IO according to MODE, TYPE and the variable list of + arguments AP. The list of variable arguments to specify depends on + the given TYPE. */ +void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode, + gcry_ac_io_type_t type, va_list ap); + /* Create a new ac handle. */ gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle, gcry_ac_id_t algorithm, unsigned int flags); @@ -1308,16 +1381,16 @@ (gcry_ac_em*_t). */ gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method, unsigned int flags, void *options, - unsigned char *m, size_t m_n, - unsigned char **em, size_t *em_n); + gcry_ac_io_t *io_read, + gcry_ac_io_t *io_write); /* Decodes a message according to the encoding method METHOD. OPTIONS must be a pointer to a method-specific structure (gcry_ac_em*_t). */ gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method, unsigned int flags, void *options, - unsigned char *em, size_t em_n, - unsigned char **m, size_t *m_n); + gcry_ac_io_t *io_read, + gcry_ac_io_t *io_write); /* Encrypt the plain text MPI value DATA_PLAIN with the key KEY under the control of the flags FLAGS and store the resulting data set @@ -1337,32 +1410,6 @@ gcry_mpi_t *data_plain, gcry_ac_data_t data_encrypted); -/* Encrypts the plain text message contained in M, which is of size - M_N, with the public key KEY_PUBLIC according to the Encryption - Scheme SCHEME_ID. HANDLE is used for accessing the low-level - cryptographic primitives. If OPTS is not NULL, it has to be an - anonymous structure specific to the chosen scheme (gcry_ac_es_*_t). - The encrypted message will be stored in C and C_N. */ -gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle, - gcry_ac_scheme_t scheme, - unsigned int flags, void *opts, - gcry_ac_key_t key_public, - unsigned char *m, size_t m_n, - unsigned char **c, size_t *c_n); - -/* Decrypts the cipher message contained in C, which is of size C_N, - with the secret key KEY_SECRET according to the Encryption Scheme - SCHEME_ID. HANDLE is used for accessing the low-level - cryptographic primitives. If OPTS is not NULL, it has to be an - anonymous structure specific to the chosen scheme (gcry_ac_es_*_t). - The decrypted message will be stored in M and M_N. */ -gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle, - gcry_ac_scheme_t scheme, - unsigned int flags, void *opts, - gcry_ac_key_t key_secret, - unsigned char *c, size_t c_n, - unsigned char **m, size_t *m_n); - /* Sign the data contained in DATA with the key KEY and store the resulting signature in the data set DATA_SIGNATURE. */ gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle, @@ -1378,31 +1425,54 @@ gcry_mpi_t data, gcry_ac_data_t data_signature); -/* Signs the message contained in M, which is of size M_N, with the - secret key KEY_SECRET according to the Signature Scheme SCHEME_ID. - Handle is used for accessing the low-level cryptographic - primitives. If OPTS is not NULL, it has to be an anonymous - structure specific to the chosen scheme (gcry_ac_ssa_*_t). The - signed message will be stored in S and S_N. */ +/* Encrypts the plain text readable from IO_MESSAGE through HANDLE + with the public key KEY according to SCHEME, FLAGS and OPTS. If + OPTS is not NULL, it has to be a pointer to a structure specific to + the chosen scheme (gcry_ac_es_*_t). The encrypted message is + written to IO_CIPHER. */ +gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle, + gcry_ac_scheme_t scheme, + unsigned int flags, void *opts, + gcry_ac_key_t key, + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_cipher); + +/* Decrypts the cipher text readable from IO_CIPHER through HANDLE + with the secret key KEY according to SCHEME, @var{flags} and OPTS. + If OPTS is not NULL, it has to be a pointer to a structure specific + to the chosen scheme (gcry_ac_es_*_t). The decrypted message is + written to IO_MESSAGE. */ +gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle, + gcry_ac_scheme_t scheme, + unsigned int flags, void *opts, + gcry_ac_key_t key, + gcry_ac_io_t *io_cipher, + gcry_ac_io_t *io_message); + +/* Signs the message readable from IO_MESSAGE through HANDLE with the + secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not + NULL, it has to be a pointer to a structure specific to the chosen + scheme (gcry_ac_ssa_*_t). The signature is written to + IO_SIGNATURE. */ gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle, gcry_ac_scheme_t scheme, unsigned int flags, void *opts, - gcry_ac_key_t key_secret, - unsigned char *m, size_t m_n, - unsigned char **s, size_t *s_n); - -/* Verifies that the signature contained in S, which is of length S_N, - is indeed the result of signing the message contained in M, which - is of size M_N, with the secret key belonging to the public key - KEY_PUBLIC. If OPTS is not NULL, it has to be an anonymous - structure (gcry_ac_ssa_*_t) specific to the Signature Scheme, whose - ID is contained in SCHEME_ID. */ + gcry_ac_key_t key, + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_signature); + +/* Verifies through HANDLE that the signature readable from + IO_SIGNATURE is indeed the result of signing the message readable + from IO_MESSAGE with the secret key belonging to the public key KEY + according to SCHEME and OPTS. If OPTS is not NULL, it has to be an + anonymous structure (gcry_ac_ssa_*_t) specific to the chosen + scheme. */ gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle, gcry_ac_scheme_t scheme, unsigned int flags, void *opts, - gcry_ac_key_t key_public, - unsigned char *m, size_t m_n, - unsigned char *s, size_t s_n); + gcry_ac_key_t key, + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_signature); /* Store the textual representation of the algorithm whose id is given in ALGORITHM in NAME. */ Index: libgcrypt/src/libgcrypt.vers diff -u libgcrypt/src/libgcrypt.vers:1.6 libgcrypt/src/libgcrypt.vers:1.7 --- libgcrypt/src/libgcrypt.vers:1.6 Tue Mar 22 22:24:09 2005 +++ libgcrypt/src/libgcrypt.vers Wed Mar 30 20:40:02 2005 @@ -67,6 +67,7 @@ gcry_ac_os_to_mpi; gcry_ac_data_encrypt_scheme; gcry_ac_data_decrypt_scheme; gcry_ac_data_sign_scheme; gcry_ac_data_verify_scheme; gcry_ac_data_to_sexp; gcry_ac_data_from_sexp; + gcry_ac_io_init; gcry_ac_io_init_va; gcry_prime_check; gcry_prime_generate; gcry_prime_group_generator; gcry_prime_release_factors; From cvs at cvs.gnupg.org Wed Mar 30 20:50:34 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Thu Mar 31 06:42:05 2005 Subject: libgcrypt/tests (ChangeLog Makefile.am ac-data.c ac-schemes.c) Message-ID: Date: Wednesday, March 30, 2005 @ 21:05:25 Author: mo Path: /cvs/libgcrypt/libgcrypt/tests Added: ac-data.c Modified: ChangeLog Makefile.am ac-schemes.c 2005-03-30 Moritz Schulte * ac-schemes.c: New file. * ac-data.c: New file. * Makefile.am (TESTS): Added ac-schemes and ac-data. --------------+ ChangeLog | 6 + Makefile.am | 2 ac-data.c | 183 ++++++++++++++++++++++++++++++ ac-schemes.c | 342 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 532 insertions(+), 1 deletion(-) Index: libgcrypt/tests/ChangeLog diff -u libgcrypt/tests/ChangeLog:1.53 libgcrypt/tests/ChangeLog:1.54 --- libgcrypt/tests/ChangeLog:1.53 Wed Sep 15 22:36:10 2004 +++ libgcrypt/tests/ChangeLog Wed Mar 30 21:05:25 2005 @@ -1,3 +1,9 @@ +2005-03-30 Moritz Schulte + + * ac-schemes.c: New file. + * ac-data.c: New file. + * Makefile.am (TESTS): Added ac-schemes and ac-data. + 2004-09-15 Moritz Schulte * pkbench.c: Include . Index: libgcrypt/tests/Makefile.am diff -u libgcrypt/tests/Makefile.am:1.19 libgcrypt/tests/Makefile.am:1.20 --- libgcrypt/tests/Makefile.am:1.19 Thu Sep 16 00:46:30 2004 +++ libgcrypt/tests/Makefile.am Wed Mar 30 21:05:25 2005 @@ -18,7 +18,7 @@ ## Process this file with automake to produce Makefile.in -TESTS = prime register ac basic tsexp keygen pubkey benchmark pkbench +TESTS = prime register ac ac-schemes ac-data basic tsexp keygen pubkey benchmark pkbench INCLUDES = -I$(top_srcdir)/src LDADD = ../src/libgcrypt.la Index: libgcrypt/tests/ac-data.c diff -u /dev/null libgcrypt/tests/ac-data.c:1.1 --- /dev/null Wed Mar 30 21:05:25 2005 +++ libgcrypt/tests/ac-data.c Wed Mar 30 21:05:25 2005 @@ -0,0 +1,183 @@ +/* ac-data.c - Public key encryption/decryption tests + * Copyright (C) 2005 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include + +#define assert_err(err) \ + do \ + if (err) \ + { \ + fprintf (stderr, "Error occured at line %i: %s\n", \ + __LINE__, gcry_strerror (err)); \ + exit (1); \ + } \ + while (0) + +#include "../src/gcrypt.h" + +static int verbose; + +static void +die (const char *format, ...) +{ + va_list arg_ptr ; + + va_start( arg_ptr, format ) ; + vfprintf (stderr, format, arg_ptr ); + va_end(arg_ptr); + exit (1); +} + +static void +check_sexp_conversion (gcry_ac_data_t data) +{ + const char *identifiers[] = { "foo", + "bar", + "baz", + "hello", + "somemoretexthere", + "blahblahblah", + NULL }; + gcry_ac_data_t data2; + gcry_error_t err; + gcry_sexp_t sexp; + unsigned int i; + const char *label1, *label2; + gcry_mpi_t mpi1, mpi2; + size_t length1, length2; + + err = gcry_ac_data_to_sexp (data, &sexp, identifiers); + assert_err (err); + + err = gcry_ac_data_from_sexp (&data2, sexp, identifiers); + assert_err (err); + + length1 = gcry_ac_data_length (data); + assert (length1); + length2 = gcry_ac_data_length (data2); + assert (length2); + assert (length1 == length2); + + for (i = 0; i < length1; i++) + { + err = gcry_ac_data_get_index (data, 0, i, &label1, &mpi1); + assert_err (err); + err = gcry_ac_data_get_index (data2, 0, i, &label2, &mpi2); + assert_err (err); + assert (! strcmp (label1, label2)); + assert (! gcry_mpi_cmp (mpi1, mpi2)); + } + + gcry_ac_data_destroy (data2); + gcry_sexp_release (sexp); +} + +void +check_run (void) +{ + gcry_ac_data_t data; + gcry_error_t err; + const char *label0; + const char *label1; + gcry_mpi_t mpi0; + gcry_mpi_t mpi1; + gcry_mpi_t mpi2; + + label0 = "thisisreallylonglabelbutsincethereisnolimitationonthelengthoflabelsitshouldworkjustfine"; + mpi0 = gcry_mpi_new (0); + assert (mpi0); + gcry_mpi_set_ui (mpi0, 123456); + + err = gcry_ac_data_new (&data); + assert_err (err); + + err = gcry_ac_data_set (data, 0, label0, mpi0); + assert_err (err); + err = gcry_ac_data_get_index (data, 0, 0, &label1, &mpi1); + assert_err (err); + assert (label0 == label1); + assert (mpi0 == mpi1); + check_sexp_conversion (data); + printf ("data-set-test-0 succeeded\n"); + + gcry_ac_data_clear (data); + + err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY, label0, mpi0); + assert_err (err); + err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC, + "foo", mpi0); + assert_err (err); + err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC, + "foo", mpi0); + assert_err (err); + err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC, + "bar", mpi0); + assert_err (err); + err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC, + "blah1", mpi0); + assert_err (err); + check_sexp_conversion (data); + err = gcry_ac_data_get_name (data, 0, label0, &mpi1); + assert_err (err); + assert (mpi0 != mpi1); + err = gcry_ac_data_get_name (data, GCRY_AC_FLAG_COPY, label0, &mpi2); + assert_err (err); + assert (mpi0 != mpi1); + assert (mpi1 != mpi2); + err = gcry_ac_data_get_index (data, 0, 0, &label1, &mpi1); + assert_err (err); + gcry_free ((void *) label1); /* FIXME!! */ + gcry_mpi_release (mpi1); + + printf ("data-set-test-1 succeeded\n"); + + + + + gcry_ac_data_destroy (data); + + +} + +int +main (int argc, char **argv) +{ + int debug = 0; + int i = 1; + + if (argc > 1 && !strcmp (argv[1], "--verbose")) + verbose = 1; + else if (argc > 1 && !strcmp (argv[1], "--debug")) + verbose = debug = 1; + + gcry_control (GCRYCTL_DISABLE_SECMEM, 0); + if (!gcry_check_version (GCRYPT_VERSION)) + die ("version mismatch\n"); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); + if (debug) + gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u , 0); + + for (; i > 0; i--) + check_run (); + + return 0; +} Index: libgcrypt/tests/ac-schemes.c diff -u /dev/null libgcrypt/tests/ac-schemes.c:1.2 --- /dev/null Wed Mar 30 21:05:25 2005 +++ libgcrypt/tests/ac-schemes.c Wed Mar 30 21:05:25 2005 @@ -0,0 +1,342 @@ +/* ac-schemes.c - Tests for ES/SSA + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + + This file is part of Libgcrypt. + + This program 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 2 of the + License, or (at your option) any later version. + + This program 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. */ + +#include +#include +#include +#include +#include +#include + +#include "../src/gcrypt.h" + +static unsigned int verbose; + +static void +die (const char *format, ...) +{ + va_list arg_ptr ; + + va_start( arg_ptr, format ) ; + vfprintf (stderr, format, arg_ptr ); + va_end(arg_ptr); + exit (1); +} + +typedef struct scheme_spec +{ + unsigned int idx; + gcry_ac_scheme_t scheme; + unsigned int flags; + unsigned char *m; + size_t m_n; +} scheme_spec_t; + +#define SCHEME_SPEC_FLAG_GET_OPTS (1 << 0) + +#define FILL(idx, scheme, flags, m) \ + { idx, GCRY_AC_##scheme, flags, m, sizeof (m) } + +scheme_spec_t es_specs[] = + { + FILL (0, ES_PKCS_V1_5, 0, "foobar"), + FILL (1, ES_PKCS_V1_5, 0, "") + }; + +scheme_spec_t ssa_specs[] = + { + FILL (0, SSA_PKCS_V1_5, SCHEME_SPEC_FLAG_GET_OPTS, "foobar") + }; + +#undef FILL + +gcry_err_code_t +scheme_get_opts (scheme_spec_t specs, void **opts) +{ + gcry_err_code_t err = GPG_ERR_NO_ERROR; + void *opts_new = NULL; + + switch (specs.scheme) + { + case GCRY_AC_SSA_PKCS_V1_5: + { + gcry_ac_ssa_pkcs_v1_5_t *opts_pkcs_v1_5 = NULL; + + opts_new = gcry_malloc (sizeof (gcry_ac_ssa_pkcs_v1_5_t)); + if (! opts_new) + err = gpg_err_code_from_errno (ENOMEM); + else + { + opts_pkcs_v1_5 = (gcry_ac_ssa_pkcs_v1_5_t *) opts_new; + + switch (specs.idx) + { + case 0: + opts_pkcs_v1_5->md = GCRY_MD_SHA1; + break; + case 1: + opts_pkcs_v1_5->md = GCRY_MD_MD5; + break; + } + } + } + case GCRY_AC_ES_PKCS_V1_5: + break; + } + + if (! err) + *opts = opts_new; + + return err; +} + +gcry_error_t +es_check (gcry_ac_handle_t handle, scheme_spec_t spec, + gcry_ac_key_t key_public, gcry_ac_key_t key_secret) +{ + gcry_error_t err = GPG_ERR_NO_ERROR; + unsigned char *c = NULL, *m2 = NULL; + size_t c_n = 0, m2_n = 0; + void *opts = NULL; + gcry_ac_io_t io_m; + gcry_ac_io_t io_c; + gcry_ac_io_t io_m2; + + if (spec.flags & SCHEME_SPEC_FLAG_GET_OPTS) + err = scheme_get_opts (spec, &opts); + if (! err) + { + c = NULL; + m2 = NULL; + + gcry_ac_io_init (&io_m, GCRY_AC_IO_READABLE, + GCRY_AC_IO_STRING, spec.m, spec.m_n); + gcry_ac_io_init (&io_c, GCRY_AC_IO_WRITABLE, + GCRY_AC_IO_STRING, &c, &c_n); + + err = gcry_ac_data_encrypt_scheme (handle, GCRY_AC_ES_PKCS_V1_5, 0, opts, key_public, + &io_m, &io_c); + if (! err) + { + gcry_ac_io_init (&io_c, GCRY_AC_IO_READABLE, + GCRY_AC_IO_STRING, c, c_n); + gcry_ac_io_init (&io_m2, GCRY_AC_IO_WRITABLE, + GCRY_AC_IO_STRING, &m2, &m2_n); + + err = gcry_ac_data_decrypt_scheme (handle, GCRY_AC_ES_PKCS_V1_5, 0, + opts, key_secret, &io_c, &io_m2); + } + if (! err) + assert ((spec.m_n == m2_n) && (! strncmp (spec.m, m2, spec.m_n))); + + if (c) + gcry_free (c); + if (m2) + gcry_free (m2); + } + + if (opts) + gcry_free (opts); + + return err; +} + +gcry_error_t +ssa_check (gcry_ac_handle_t handle, scheme_spec_t spec, + gcry_ac_key_t key_public, gcry_ac_key_t key_secret) +{ + gcry_error_t err = GPG_ERR_NO_ERROR; + unsigned char *s = NULL; + size_t s_n = 0; + void *opts = NULL; + gcry_ac_io_t io_m; + gcry_ac_io_t io_s; + + if (spec.flags & SCHEME_SPEC_FLAG_GET_OPTS) + err = scheme_get_opts (spec, &opts); + if (! err) + { + gcry_ac_io_init (&io_m, GCRY_AC_IO_READABLE, + GCRY_AC_IO_STRING, spec.m, spec.m_n); + gcry_ac_io_init (&io_s, GCRY_AC_IO_WRITABLE, + GCRY_AC_IO_STRING, &s, &s_n); + + err = gcry_ac_data_sign_scheme (handle, GCRY_AC_SSA_PKCS_V1_5, 0, opts, key_secret, + &io_m, &io_s); + if (! err) + { + gcry_ac_io_init (&io_m, GCRY_AC_IO_READABLE, + GCRY_AC_IO_STRING, spec.m, spec.m_n); + gcry_ac_io_init (&io_s, GCRY_AC_IO_READABLE, + GCRY_AC_IO_STRING, s, s_n); + err = gcry_ac_data_verify_scheme (handle, GCRY_AC_SSA_PKCS_V1_5, 0, opts, key_public, + &io_m, &io_s); + } + assert (! err); + + if (s) + gcry_free (s); + } + + if (opts) + gcry_free (opts); + + return err; +} + +void +es_checks (gcry_ac_handle_t handle, gcry_ac_key_t key_public, gcry_ac_key_t key_secret) +{ + gcry_error_t err = GPG_ERR_NO_ERROR; + unsigned int i = 0; + + for (i = 0; (i < (sizeof (es_specs) / sizeof (*es_specs))) && (! err); i++) + err = es_check (handle, es_specs[i], key_public, key_secret); + + assert (! err); +} + +void +ssa_checks (gcry_ac_handle_t handle, gcry_ac_key_t key_public, gcry_ac_key_t key_secret) +{ + gcry_error_t err = GPG_ERR_NO_ERROR; + unsigned int i = 0; + + for (i = 0; (i < (sizeof (ssa_specs) / sizeof (*ssa_specs))) && (! err); i++) + err = ssa_check (handle, ssa_specs[i], key_public, key_secret); + + assert (! err); +} + +#define KEY_TYPE_PUBLIC (1 << 0) +#define KEY_TYPE_SECRET (1 << 1) + +typedef struct key_spec +{ + const char *name; + unsigned int flags; + const char *mpi_string; +} key_spec_t; + +key_spec_t key_specs[] = + { + { "n", KEY_TYPE_PUBLIC | KEY_TYPE_SECRET, + "e0ce96f90b6c9e02f3922beada93fe50a875eac6bcc18bb9a9cf2e84965caa" + "2d1ff95a7f542465c6c0c19d276e4526ce048868a7a914fd343cc3a87dd74291" + "ffc565506d5bbb25cbac6a0e2dd1f8bcaab0d4a29c2f37c950f363484bf269f7" + "891440464baf79827e03a36e70b814938eebdc63e964247be75dc58b014b7ea251" }, + { "e", KEY_TYPE_PUBLIC | KEY_TYPE_SECRET, + "010001" }, + { "d", KEY_TYPE_SECRET, + "046129F2489D71579BE0A75FE029BD6CDB574EBF57EA8A5B0FDA942CAB943B11" + "7D7BB95E5D28875E0F9FC5FCC06A72F6D502464DABDED78EF6B716177B83D5BD" + "C543DC5D3FED932E59F5897E92E6F58A0F33424106A3B6FA2CBF877510E4AC21" + "C3EE47851E97D12996222AC3566D4CCB0B83D164074ABF7DE655FC2446DA1781" }, + { "p", KEY_TYPE_SECRET, + "00e861b700e17e8afe6837e7512e35b6ca11d0ae47d8b85161c67baf64377213" + "fe52d772f2035b3ca830af41d8a4120e1c1c70d12cc22f00d28d31dd48a8d424f1" }, + { "q", KEY_TYPE_SECRET, + "00f7a7ca5367c661f8e62df34f0d05c10c88e5492348dd7bddc942c9a8f369f9" + "35a07785d2db805215ed786e4285df1658eed3ce84f469b81b50d358407b4ad361" }, + { "u", KEY_TYPE_SECRET, + "304559a9ead56d2309d203811a641bb1a09626bc8eb36fffa23c968ec5bd891e" + "ebbafc73ae666e01ba7c8990bae06cc2bbe10b75e69fcacb353a6473079d8e9b" }, + { NULL }, + }; + +gcry_error_t +key_init (gcry_ac_key_type_t type, gcry_ac_key_t *key) +{ + gcry_error_t err = GPG_ERR_NO_ERROR; + gcry_ac_data_t key_data = NULL; + gcry_ac_key_t key_new = NULL; + gcry_mpi_t mpi = NULL; + unsigned int i = 0; + + err = gcry_ac_data_new (&key_data); + for (i = 0; key_specs[i].name && (! err); i++) + { + if (((type == GCRY_AC_KEY_PUBLIC) && (key_specs[i].flags & KEY_TYPE_PUBLIC)) + || ((type == GCRY_AC_KEY_SECRET) && (key_specs[i].flags & KEY_TYPE_SECRET))) + { + err = gcry_mpi_scan (&mpi, GCRYMPI_FMT_HEX, key_specs[i].mpi_string, 0, NULL); + if (! err) + { + gcry_ac_data_set (key_data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC, + key_specs[i].name, mpi); + gcry_mpi_release (mpi); + } + } + } + if (! err) + err = gcry_ac_key_init (&key_new, NULL, type, key_data); + + if (key_data) + gcry_ac_data_destroy (key_data); + + if (! err) + *key = key_new; + + return err; +} + +static void +check_run (void) +{ + gcry_ac_handle_t handle = NULL; + gcry_error_t err = GPG_ERR_NO_ERROR; + gcry_ac_key_t key_public = NULL, key_secret = NULL; + + err = key_init (GCRY_AC_KEY_PUBLIC, &key_public); + if (! err) + err = key_init (GCRY_AC_KEY_SECRET, &key_secret); + + if (! err) + err = gcry_ac_open (&handle, GCRY_AC_RSA, 0); + if (! err) + { + es_checks (handle, key_public, key_secret); + ssa_checks (handle, key_public, key_secret); + } + + assert (! err); +} + +int +main (int argc, char **argv) +{ + unsigned int debug = 0; + + if ((argc > 1) && (! strcmp (argv[1], "--verbose"))) + verbose = 1; + else if ((argc > 1) && (! strcmp (argv[1], "--debug"))) + verbose = debug = 1; + + gcry_control (GCRYCTL_DISABLE_SECMEM, 0); + if (! gcry_check_version (GCRYPT_VERSION)) + die ("version mismatch\n"); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); + if (debug) + gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0); + + check_run (); + + return 0; +} From cvs at cvs.gnupg.org Wed Mar 30 20:51:18 2005 From: cvs at cvs.gnupg.org (cvs user mo) Date: Thu Mar 31 06:42:09 2005 Subject: libgcrypt/cipher (ChangeLog ac.c) Message-ID: Date: Wednesday, March 30, 2005 @ 21:06:09 Author: mo Path: /cvs/libgcrypt/libgcrypt/cipher Modified: ChangeLog ac.c 2005-03-30 Moritz Schulte * ac.c (_gcry_ac_data_from_sexp): Use length of SEXP_CUR, not length of SEXP; do not forget to set SEXP_TMP to NULL after it has been released. (struct gcry_ac_mpi): New member: name_provided. (_gcry_ac_data_set): Rename variable `name_final' to `name_cp'; remove const qualifier; change code to not cast away const qualifiers; use name_provided member as well. (_gcry_ac_data_set, _gcry_ac_data_get_name): Use name_provided member of named mpi structure. (gcry_ac_name_to_id): Do not forget to initialize err. (_gcry_ac_data_get_index): Do not forget to initialize mpi_return; use gcry_free() instead of free(); remove unnecessary cast; rename mpi_return and name_return to mpi_cp and name_cp; adjust code. (ac_data_mpi_copy): Do not cast away const qualifier. (ac_data_values_destroy): Likewise. (ac_data_construct): Likewise. (ac_data_mpi_copy): Initialize flags to GCRY_AC_FLAG_DEALLOC. (ac_data_extract): Use GCRY_AC_FLAG_DEALLOC instead of GCRY_AC_FLAG_COPY. (_gcry_ac_io_init_va, _gcry_ac_io_init, gcry_ac_io_init) (gcry_ac_io_init_va, _gcry_ac_io_write, _gcry_ac_io_read) (_gcry_ac_io_read_all, _gcry_ac_io_process): New functions. (gry_ac_em_dencode_t): Use gcry_ac_io_t in prototype instead of memroy strings directly; adjust encode/decode functions to use io objects. (emsa_pkcs_v1_5_encode_data_cb): New function ... (emsa_pkcs_v1_5_encode): ... use it here. (ac_data_dencode): Use io objects. (_gcry_ac_data_encode, _gcry_ac_data_decode, gcry_ac_data_encode) (gcry_ac_data_decode): Likewise. (_gcry_ac_data_encrypt_scheme, gcry_ac_data_encrypt_scheme) (_gcry_ac_data_decrypt_scheme, gcry_ac_data_decrypt_scheme) (_gcry_ac_data_sign_scheme, gcry_ac_data_sign_scheme) (_gcry_ac_data_verify_scheme, gcry_ac_data_verify_scheme): Likewise. -----------+ ChangeLog | 42 +++ ac.c | 784 +++++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 605 insertions(+), 221 deletions(-) Index: libgcrypt/cipher/ChangeLog diff -u libgcrypt/cipher/ChangeLog:1.227 libgcrypt/cipher/ChangeLog:1.228 --- libgcrypt/cipher/ChangeLog:1.227 Wed Mar 23 09:53:54 2005 +++ libgcrypt/cipher/ChangeLog Wed Mar 30 21:06:08 2005 @@ -1,3 +1,45 @@ +2005-03-30 Moritz Schulte + + * ac.c (_gcry_ac_data_from_sexp): Use length of SEXP_CUR, not + length of SEXP; do not forget to set SEXP_TMP to NULL after it has + been released. + + (struct gcry_ac_mpi): New member: name_provided. + (_gcry_ac_data_set): Rename variable `name_final' to `name_cp'; + remove const qualifier; change code to not cast away const + qualifiers; use name_provided member as well. + (_gcry_ac_data_set, _gcry_ac_data_get_name): Use name_provided + member of named mpi structure. + + (gcry_ac_name_to_id): Do not forget to initialize err. + (_gcry_ac_data_get_index): Do not forget to initialize mpi_return; + use gcry_free() instead of free(); remove unnecessary cast; rename + mpi_return and name_return to mpi_cp and name_cp; adjust code. + (ac_data_mpi_copy): Do not cast away const qualifier. + (ac_data_values_destroy): Likewise. + (ac_data_construct): Likewise. + + (ac_data_mpi_copy): Initialize flags to GCRY_AC_FLAG_DEALLOC. + (ac_data_extract): Use GCRY_AC_FLAG_DEALLOC instead of + GCRY_AC_FLAG_COPY. + + (_gcry_ac_io_init_va, _gcry_ac_io_init, gcry_ac_io_init) + (gcry_ac_io_init_va, _gcry_ac_io_write, _gcry_ac_io_read) + (_gcry_ac_io_read_all, _gcry_ac_io_process): New functions. + (gry_ac_em_dencode_t): Use gcry_ac_io_t in prototype instead of + memroy strings directly; adjust encode/decode functions to use io + objects. + (emsa_pkcs_v1_5_encode_data_cb): New function ... + (emsa_pkcs_v1_5_encode): ... use it here. + (ac_data_dencode): Use io objects. + (_gcry_ac_data_encode, _gcry_ac_data_decode, gcry_ac_data_encode) + (gcry_ac_data_decode): Likewise. + (_gcry_ac_data_encrypt_scheme, gcry_ac_data_encrypt_scheme) + (_gcry_ac_data_decrypt_scheme, gcry_ac_data_decrypt_scheme) + (_gcry_ac_data_sign_scheme, gcry_ac_data_sign_scheme) + (_gcry_ac_data_verify_scheme, gcry_ac_data_verify_scheme): + Likewise. + 2005-03-23 Werner Koch * rndw32.c (_gcry_rndw32_gather_random_fast): While adding data Index: libgcrypt/cipher/ac.c diff -u libgcrypt/cipher/ac.c:1.16 libgcrypt/cipher/ac.c:1.17 --- libgcrypt/cipher/ac.c:1.16 Sun Feb 13 19:15:20 2005 +++ libgcrypt/cipher/ac.c Wed Mar 30 21:06:08 2005 @@ -24,6 +24,7 @@ #include #include #include +#include #include "g10lib.h" #include "cipher.h" @@ -51,7 +52,7 @@ static const char *ac_key_identifiers[] = { "private-key", - "public-key", + "public-key" }; /* These specifications are needed for key-pair generation; the caller @@ -87,7 +88,8 @@ /* A named MPI value. */ typedef struct gcry_ac_mpi { - const char *name; /* Name of MPI value. */ + const char *name_provided; /* Provided name of MPI value. */ + char *name; /* Self-maintained copy of name. */ gcry_mpi_t mpi; /* MPI value. */ unsigned int flags; /* Flags. */ } gcry_ac_mpi_t; @@ -119,7 +121,7 @@ * Functions for working with data sets. */ -/* Creates a new, empty data set and stores it in DATA. */ +/* Creates a new, empty data set and store it in DATA. */ gcry_err_code_t _gcry_ac_data_new (gcry_ac_data_t *data) { @@ -132,7 +134,7 @@ err = gpg_err_code_from_errno (errno); goto out; } - + data_new->data = NULL; data_new->data_n = 0; *data = data_new; @@ -153,6 +155,7 @@ return gcry_error (err); } +/* Destroys all the entries in DATA, but not DATA itself. */ static void ac_data_values_destroy (gcry_ac_data_t data) { @@ -162,8 +165,8 @@ { if (data->data[i].flags & GCRY_AC_FLAG_DEALLOC) { - gcry_free ((char *) data->data[i].name); gcry_mpi_release (data->data[i].mpi); + gcry_free (data->data[i].name); } } } @@ -186,6 +189,9 @@ return _gcry_ac_data_destroy (data); } +/* This function creates a copy of the array of named MPIs DATA_MPIS, + which is of length DATA_MPIS_N; the copy is stored in + DATA_MPIS_CP. */ static gcry_err_code_t ac_data_mpi_copy (gcry_ac_mpi_t *data_mpis, unsigned int data_mpis_n, gcry_ac_mpi_t **data_mpis_cp) @@ -194,11 +200,7 @@ gcry_err_code_t err; unsigned int i; gcry_mpi_t mpi; - const char *label; - - data_mpis_new = NULL; - label = NULL; - mpi = NULL; + char *label; data_mpis_new = gcry_malloc (sizeof (*data_mpis_new) * data_mpis_n); if (! data_mpis_new) @@ -208,37 +210,30 @@ } memset (data_mpis_new, 0, sizeof (*data_mpis_new) * data_mpis_n); + err = 0; for (i = 0; i < data_mpis_n; i++) { - if (data_mpis[i].flags & GCRY_AC_FLAG_DEALLOC) - { - /* FIXME: semantics of FLAG_COPY?? */ - /* Copy values. */ + /* Copy values. */ - label = strdup (data_mpis[i].name); - mpi = gcry_mpi_copy (data_mpis[i].mpi); - if (! (label && mpi)) - { - err = gcry_err_code_from_errno (errno); - if (label) - free ((void *) label); - if (mpi) - gcry_mpi_release (mpi); - goto out; - } - } + if (data_mpis[i].name) + label = gcry_strdup (data_mpis[i].name); else + label = gcry_strdup (data_mpis[i].name_provided); + mpi = gcry_mpi_copy (data_mpis[i].mpi); + if (! (label && mpi)) { - /* Reference existing values. */ - - label = data_mpis[i].name; - mpi = data_mpis[i].mpi; + err = gcry_err_code_from_errno (errno); + gcry_mpi_release (mpi); + gcry_free (label); + break; } - data_mpis_new[i].flags = data_mpis[i].flags; + data_mpis_new[i].flags = GCRY_AC_FLAG_DEALLOC; data_mpis_new[i].name = label; data_mpis_new[i].mpi = mpi; } + if (err) + goto out; *data_mpis_cp = data_mpis_new; err = 0; @@ -250,11 +245,10 @@ if (data_mpis_new) { for (i = 0; i < data_mpis_n; i++) - if (data_mpis_new[i].flags & GCRY_AC_FLAG_COPY) - { - gcry_free ((void *) data_mpis_new[i].name); - gcry_mpi_release (data_mpis_new[i].mpi); - } + { + gcry_mpi_release (data_mpis_new[i].mpi); + gcry_free (data_mpis_new[i].name); + } gcry_free (data_mpis_new); } } @@ -323,13 +317,13 @@ _gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags, const char *name, gcry_mpi_t mpi) { - const char *name_final; - gcry_mpi_t mpi_final; + gcry_mpi_t mpi_cp; + char *name_cp; gcry_err_code_t err; unsigned int i; - mpi_final = NULL; - name_final = NULL; + name_cp = NULL; + mpi_cp = NULL; if (flags & ~(GCRY_AC_FLAG_DEALLOC | GCRY_AC_FLAG_COPY)) { @@ -341,35 +335,28 @@ { /* Create copies. */ - name_final = strdup (name); - mpi_final = gcry_mpi_copy (mpi); - if (! (name_final && mpi_final)) - { - err = gpg_err_code_from_errno (ENOMEM); - if (name_final) - free ((void *) name_final); - if (mpi_final) - gcry_mpi_release (mpi_final); + name_cp = gcry_strdup (name); + mpi_cp = gcry_mpi_copy (mpi); + if (! (name_cp && mpi_cp)) + { + err = gpg_err_code_from_errno (errno); goto out; } } - else - { - name_final = name; - mpi_final = mpi; - } /* Search for existing entry. */ for (i = 0; i < data->data_n; i++) - if (! strcmp (name, data->data[i].name)) + if (! strcmp (name, + data->data[i].name + ? data->data[i].name : data->data[i].name_provided)) break; if (i < data->data_n) { - /* An entry for NAME does already exist, deallocate values. */ + /* An entry for NAME does already exist. */ if (data->data[i].flags & GCRY_AC_FLAG_DEALLOC) { - gcry_free ((char *) data->data[i].name); gcry_mpi_release (data->data[i].mpi); + gcry_free (data->data[i].name); } } else @@ -385,14 +372,15 @@ err = gpg_err_code_from_errno (errno); goto out; } - + if (data->data != ac_mpis) data->data = ac_mpis; data->data_n++; } - data->data[i].name = name_final; - data->data[i].mpi = mpi_final; + data->data[i].name_provided = name_cp ? NULL : name; + data->data[i].name = name_cp; + data->data[i].mpi = mpi_cp ? mpi_cp : mpi; data->data[i].flags = flags; err = 0; @@ -400,10 +388,8 @@ if (err) { - if (name_final != name) - gcry_free ((void *) name_final); - if (mpi_final != mpi) - gcry_mpi_release (mpi); + gcry_mpi_release (mpi_cp); + gcry_free (name_cp); } return err; @@ -435,7 +421,9 @@ } for (i = 0; i < data->data_n; i++) - if (! strcmp (data->data[i].name, name)) + if (! strcmp (name, + data->data[i].name ? + data->data[i].name : data->data[i].name_provided)) break; if (i == data->data_n) { @@ -479,10 +467,13 @@ unsigned int idx, const char **name, gcry_mpi_t *mpi) { - const char *name_return; - gcry_mpi_t mpi_return; + gcry_mpi_t mpi_cp; + char *name_cp; gcry_err_code_t err; + name_cp = NULL; + mpi_cp = NULL; + if (flags & ~(GCRY_AC_FLAG_COPY)) { err = GPG_ERR_INV_ARG; @@ -495,15 +486,16 @@ goto out; } - name_return = NULL; - mpi_return = NULL; if (flags & GCRY_AC_FLAG_COPY) { /* Return copies to the user. */ if (name) { - name_return = strdup (data->data[idx].name); - if (! name_return) + if (data->data[idx].name_provided) + name_cp = gcry_strdup (data->data[idx].name_provided); + else + name_cp = gcry_strdup (data->data[idx].name); + if (! name_cp) { err = gpg_err_code_from_errno (errno); goto out; @@ -511,35 +503,29 @@ } if (mpi) { - mpi_return = gcry_mpi_copy (data->data[idx].mpi); - if (! mpi_return) + mpi_cp = gcry_mpi_copy (data->data[idx].mpi); + if (! mpi_cp) { err = gpg_err_code_from_errno (errno); goto out; } - } - } - else - { - name_return = data->data[idx].name; - mpi_return = data->data[idx].mpi; + } } if (name) - *name = name_return; + *name = name_cp ? name_cp : (data->data[idx].name + ? data->data[idx].name + : data->data[idx].name_provided); if (mpi) - *mpi = mpi_return; + *mpi = mpi_cp ? mpi_cp : data->data[idx].mpi; err = 0; out: if (err) { - if (flags & GCRY_AC_FLAG_COPY) - { - free ((void *) name_return); - gcry_mpi_release (mpi_return); - } + gcry_mpi_release (mpi_cp); + gcry_free (name_cp); } return err; @@ -691,7 +677,7 @@ string = NULL; mpi = NULL; err = 0; - + /* Process S-expression/identifiers. */ i = 0; @@ -724,7 +710,7 @@ if (err) goto out; - sexp_n = gcry_sexp_length (sexp); + sexp_n = gcry_sexp_length (sexp_cur); if (sexp_n < 1) { err = GPG_ERR_INV_SEXP; @@ -765,6 +751,7 @@ mpi = NULL; gcry_sexp_release (sexp_tmp); + sexp_tmp = NULL; } if (err) goto out; @@ -812,6 +799,296 @@ +/* + * Implementation of `ac io' objects. + */ + +/* Initialize AC_IO according to MODE, TYPE and the variable list of + arguments AP. The list of variable arguments to specify depends on + the given TYPE. */ +static void +_gcry_ac_io_init_va (gcry_ac_io_t *ac_io, + gcry_ac_io_mode_t mode, gcry_ac_io_type_t type, va_list ap) +{ + memset (ac_io, 0, sizeof (*ac_io)); + + switch (mode) + { + case GCRY_AC_IO_READABLE: + switch (type) + { + case GCRY_AC_IO_STRING: + ac_io->readable.string.data = va_arg (ap, unsigned char *); + ac_io->readable.string.data_n = va_arg (ap, size_t); + break; + + case GCRY_AC_IO_CALLBACK: + ac_io->readable.callback.cb = va_arg (ap, gcry_ac_data_read_cb_t); + ac_io->readable.callback.opaque = va_arg (ap, void *); + break; + + default: + /* FIXME? */ + break; + } + break; + case GCRY_AC_IO_WRITABLE: + switch (type) + { + case GCRY_AC_IO_STRING: + ac_io->writable.string.data = va_arg (ap, unsigned char **); + ac_io->writable.string.data_n = va_arg (ap, size_t *); + break; + + case GCRY_AC_IO_CALLBACK: + ac_io->writable.callback.cb = va_arg (ap, gcry_ac_data_write_cb_t); + ac_io->writable.callback.opaque = va_arg (ap, void *); + break; + + default: + /* FIXME? */ + break; + } + break; + default: + /* FIXME? */ + break; + } + + ac_io->mode = mode; + ac_io->type = type; +} + +void +gcry_ac_io_init_va (gcry_ac_io_t *ac_io, + gcry_ac_io_mode_t mode, gcry_ac_io_type_t type, va_list ap) +{ + _gcry_ac_io_init_va (ac_io, mode, type, ap); +} + +/* Initialize AC_IO according to MODE, TYPE and the variable list of + arguments. The list of variable arguments to specify depends on + the given TYPE. */ +static void +_gcry_ac_io_init (gcry_ac_io_t *ac_io, + gcry_ac_io_mode_t mode, gcry_ac_io_type_t type, ...) +{ + va_list ap; + + va_start (ap, type); + _gcry_ac_io_init_va (ac_io, mode, type, ap); + va_end (ap); +} + + +void +gcry_ac_io_init (gcry_ac_io_t *ac_io, + gcry_ac_io_mode_t mode, gcry_ac_io_type_t type, ...) +{ + va_list ap; + + va_start (ap, type); + _gcry_ac_io_init_va (ac_io, mode, type, ap); + va_end (ap); +} + +/* Write to the IO object AC_IO BUFFER_N bytes from BUFFER. Return + zero on success or error code. */ +static gcry_error_t +_gcry_ac_io_write (gcry_ac_io_t *ac_io, unsigned char *buffer, size_t buffer_n) +{ + gcry_error_t err; + + assert (ac_io->mode == GCRY_AC_IO_WRITABLE); + + switch (ac_io->type) + { + case GCRY_AC_IO_STRING: + { + unsigned char *p; + + if (*ac_io->writable.string.data) + { + p = gcry_realloc (*ac_io->writable.string.data, + *ac_io->writable.string.data_n + buffer_n); + if (! p) + err = gpg_error_from_errno (errno); + else + { + if (p != *ac_io->writable.string.data) + *ac_io->writable.string.data = p; + memcpy (p + *ac_io->writable.string.data_n, buffer, buffer_n); + *ac_io->writable.string.data_n += buffer_n; + err = 0; + } + } + else + { + if (gcry_is_secure (buffer)) + p = gcry_malloc_secure (buffer_n); + else + p = gcry_malloc (buffer_n); + if (! p) + err = gpg_error_from_errno (errno); + else + { + memcpy (p, buffer, buffer_n); + *ac_io->writable.string.data = p; + *ac_io->writable.string.data_n = buffer_n; + err = 0; + } + } + } + break; + + case GCRY_AC_IO_CALLBACK: + err = (*ac_io->writable.callback.cb) (ac_io->writable.callback.opaque, + buffer, buffer_n); + break; + } + + return err; +} + +/* Read *BUFFER_N bytes from the IO object AC_IO into BUFFER; NREAD + bytes have already been read from the object; on success, store the + amount of bytes read in *BUFFER_N; zero bytes read means EOF. + Return zero on success or error code. */ +static gcry_error_t +_gcry_ac_io_read (gcry_ac_io_t *ac_io, + unsigned int nread, unsigned char *buffer, size_t *buffer_n) +{ + gcry_error_t err; + + assert (ac_io->mode == GCRY_AC_IO_READABLE); + + switch (ac_io->type) + { + case GCRY_AC_IO_STRING: + { + size_t bytes_available; + size_t bytes_to_read; + size_t bytes_wanted; + + bytes_available = ac_io->readable.string.data_n - nread; + bytes_wanted = *buffer_n; + + if (bytes_wanted > bytes_available) + bytes_to_read = bytes_available; + else + bytes_to_read = bytes_wanted; + + memcpy (buffer, ac_io->readable.string.data + nread, bytes_to_read); + *buffer_n = bytes_to_read; + err = 0; + break; + } + + case GCRY_AC_IO_CALLBACK: + { + err = (*ac_io->readable.callback.cb) (ac_io->readable.callback.opaque, + buffer, buffer_n); + break; + } + } + + return err; +} + +/* Read all data available from the IO object AC_IO into newly + allocated memory, storing an appropriate pointer in *BUFFER and the + amount of bytes read in *BUFFER_N. Return zero on success or error + code. */ +static gcry_error_t +_gcry_ac_io_read_all (gcry_ac_io_t *ac_io, unsigned char **buffer, size_t *buffer_n) +{ + unsigned char *buffer_new; + size_t buffer_new_n; + unsigned char *p; + unsigned char buf[BUFSIZ]; + size_t buf_n; + gcry_error_t err; + + buffer_new = NULL; + buffer_new_n = 0; + err = 0; + + while (1) + { + buf_n = sizeof (buf); + err = _gcry_ac_io_read (ac_io, buffer_new_n, buf, &buf_n); + if (err) + break; + + if (buf_n) + { + p = gcry_realloc (buffer_new, buffer_new_n + buf_n); + if (! p) + { + err = gpg_error_from_errno (errno); + break; + } + + if (p != buffer_new) + buffer_new = p; + + memcpy (buffer_new + buffer_new_n, buf, buf_n); + buffer_new_n += buf_n; + } + else + break; + } + if (err) + goto out; + + *buffer_n = buffer_new_n; + *buffer = buffer_new; + + out: + + if (err) + gcry_free (buffer_new); + + return err; +} + +/* Read data chunks from the IO object AC_IO until EOF, feeding them + to the callback function CB. Return zero on success or error + code. */ +static gcry_error_t +_gcry_ac_io_process (gcry_ac_io_t *ac_io, + gcry_ac_data_write_cb_t cb, void *opaque) +{ + unsigned char buffer[BUFSIZ]; + unsigned int nread; + size_t buffer_n; + gcry_error_t err; + + nread = 0; + err = 0; + + while (1) + { + buffer_n = sizeof (buffer); + err = _gcry_ac_io_read (ac_io, nread, buffer, &buffer_n); + if (err) + break; + if (buffer_n) + { + err = (*cb) (opaque, buffer, buffer_n); + if (err) + break; + nread += buffer_n; + } + else + break; + } + + return err; +} + + + /* * Functions for converting data between the native ac and the * S-expression structure. @@ -908,15 +1185,14 @@ strncpy (value_name, data_raw, data_raw_n); value_name[data_raw_n] = 0; - err = _gcry_ac_data_set (data_new, GCRY_AC_FLAG_COPY, value_name, value_mpi); + err = _gcry_ac_data_set (data_new, GCRY_AC_FLAG_DEALLOC, value_name, value_mpi); if (err) break; - gcry_free (value_name); - value_name = NULL; - gcry_mpi_release (value_mpi); gcry_sexp_release (value_sexp); value_sexp = NULL; + value_name = NULL; + value_mpi = NULL; } if (err) goto out; @@ -974,8 +1250,11 @@ /* Fill list with MPIs. */ for (i = 0; i < data_length; i++) { - arg_list[(i * 2) + 0] = (void *) &data->data[i].name; - arg_list[(i * 2) + 1] = (void *) &data->data[i].mpi; + /* FIXME!! */ + arg_list[(i * 2) + 0] = (data->data[i].name + ? (void **) &data->data[i].name + : (void **) &data->data[i].name_provided); + arg_list[(i * 2) + 1] = &data->data[i].mpi; } /* Calculate size of format string. */ @@ -1053,7 +1332,6 @@ * Wrapper macros. */ -#define gcryerro @@ -1945,54 +2223,6 @@ -/* - * General functions. - */ - -/* Stores the textual representation of the algorithm whose id is - given in ALGORITHM in NAME. */ -gcry_error_t -gcry_ac_id_to_name (gcry_ac_id_t algorithm, const char **name) -{ - gcry_err_code_t err; - const char *n; - - n = gcry_pk_algo_name (algorithm); - if (! *n) - { - err = GPG_ERR_PUBKEY_ALGO; - goto out; - } - - *name = n; - err = 0; - - out: - - return gcry_error (err); -} - -/* Stores the numeric ID of the algorithm whose textual representation - is contained in NAME in ALGORITHM. */ -gcry_error_t -gcry_ac_name_to_id (const char *name, gcry_ac_id_t *algorithm) -{ - gcry_err_code_t err; - int algo; - - algo = gcry_pk_map_name (name); - if (! algo) - { - err = GPG_ERR_PUBKEY_ALGO; - goto out; - } - - *algorithm = algo; - - out: - - return gcry_error (err); -} /* * Implementation of encoding methods (em). @@ -2002,10 +2232,8 @@ message. */ typedef gcry_err_code_t (*gcry_ac_em_dencode_t) (unsigned int flags, void *options, - unsigned char *in, - size_t in_n, - unsigned char **out, - size_t *out_n); + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write); /* Fill the buffer BUFFER which is BUFFER_N bytes long with non-zero random bytes of random level LEVEL. */ @@ -2059,17 +2287,25 @@ `PKCS-V1_5' (EME-PKCS-V1_5). */ static gcry_err_code_t eme_pkcs_v1_5_encode (unsigned int flags, void *opts, - unsigned char *m, size_t m_n, - unsigned char **em, size_t *em_n) + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write) { gcry_ac_eme_pkcs_v1_5_t *options; gcry_err_code_t err; unsigned char *buffer; unsigned char *ps; + unsigned char *m; + size_t m_n; unsigned int ps_n; unsigned int k; options = opts; + buffer = NULL; + m = NULL; + + err = _gcry_ac_io_read_all (ac_io_read, &m, &m_n); + if (err) + goto out; /* Figure out key length in bytes. */ err = _gcry_ac_key_get_nbits (options->handle, options->key, &k); @@ -2112,11 +2348,14 @@ buffer[0] = 0x02; buffer[ps_n + 1] = 0x00; memcpy (buffer + ps_n + 2, m, m_n); - *em = buffer; - *em_n = k - 1; + + err = _gcry_ac_io_write (ac_io_write, buffer, k - 1); out: + gcry_free (buffer); + gcry_free (m); + return err; } @@ -2124,16 +2363,24 @@ `PKCS-V1_5' (EME-PKCS-V1_5). */ static gcry_err_code_t eme_pkcs_v1_5_decode (unsigned int flags, void *opts, - unsigned char *em, size_t em_n, - unsigned char **m, size_t *m_n) + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write) { gcry_ac_eme_pkcs_v1_5_t *options; unsigned char *buffer; + unsigned char *em; + size_t em_n; gcry_err_code_t err; unsigned int i; unsigned int k; options = opts; + buffer = NULL; + em = NULL; + + err = _gcry_ac_io_read_all (ac_io_read, &em, &em_n); + if (err) + goto out; err = _gcry_ac_key_get_nbits (options->handle, options->key, &k); if (err) @@ -2165,21 +2412,35 @@ } memcpy (buffer, em + i, em_n - i); - *m = buffer; - *m_n = em_n - i; - err = 0; + err = _gcry_ac_io_write (ac_io_write, buffer, em_n - i); out: + gcry_free (buffer); + gcry_free (em); + return err; } +static gcry_error_t +emsa_pkcs_v1_5_encode_data_cb (void *opaque, + unsigned char *buffer, size_t buffer_n) +{ + gcry_md_hd_t md_handle; + + md_handle = opaque; + gcry_md_write (md_handle, buffer, buffer_n); + + return 0; +} + + /* Encode a message according to the Encoding Method for Signatures with Appendix `PKCS-V1_5' (EMSA-PKCS-V1_5). */ static gcry_err_code_t emsa_pkcs_v1_5_encode (unsigned int flags, void *opts, - unsigned char *m, size_t m_n, - unsigned char **em, size_t *em_n) + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write) { gcry_ac_emsa_pkcs_v1_5_t *options; gcry_err_code_t err; @@ -2197,6 +2458,7 @@ unsigned int i; options = opts; + buffer = NULL; md = NULL; ps = NULL; t = NULL; @@ -2213,9 +2475,9 @@ h_n = gcry_md_get_algo_dlen (options->md); - /* Apply the hash function to the message M to produce a hash - value H. */ - gcry_md_write (md, m, m_n); + err = _gcry_ac_io_process (ac_io_read, emsa_pkcs_v1_5_encode_data_cb, md); + if (err) + goto out; h = gcry_md_read (md, 0); @@ -2287,13 +2549,13 @@ for (i = 0; i < t_n; i++) buffer[3 + ps_n + i] = t[i]; - *em = buffer; - *em_n = buffer_n; + err = _gcry_ac_io_write (ac_io_write, buffer, buffer_n); out: gcry_md_close (md); + gcry_free (buffer); gcry_free (ps); gcry_free (t); @@ -2316,8 +2578,8 @@ static gcry_err_code_t ac_data_dencode (gcry_ac_em_t method, dencode_action_t action, unsigned int flags, void *options, - unsigned char *buffer_in, size_t buffer_in_n, - unsigned char **buffer_out, size_t *buffer_out_n) + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write) { struct { @@ -2352,17 +2614,13 @@ case DATA_ENCODE: if (methods[i].encode) /* FIXME? */ - err = (*methods[i].encode) (flags, options, - buffer_in, buffer_in_n, - buffer_out, buffer_out_n); + err = (*methods[i].encode) (flags, options, ac_io_read, ac_io_write); break; case DATA_DECODE: if (methods[i].decode) /* FIXME? */ - err = (*methods[i].decode) (flags, options, - buffer_in, buffer_in_n, - buffer_out, buffer_out_n); + err = (*methods[i].decode) (flags, options, ac_io_read, ac_io_write); break; default: @@ -2381,11 +2639,11 @@ gcry_err_code_t _gcry_ac_data_encode (gcry_ac_em_t method, unsigned int flags, void *options, - unsigned char *m, size_t m_n, - unsigned char **em, size_t *em_n) + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write) { return ac_data_dencode (method, DATA_ENCODE, flags, options, - m, m_n, em, em_n); + ac_io_read, ac_io_write); } /* Dencode a message according to the encoding method METHOD. OPTIONS @@ -2394,22 +2652,23 @@ gcry_err_code_t _gcry_ac_data_decode (gcry_ac_em_t method, unsigned int flags, void *options, - unsigned char *m, size_t m_n, - unsigned char **em, size_t *em_n) + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write) { return ac_data_dencode (method, DATA_DECODE, flags, options, - m, m_n, em, em_n); + ac_io_read, ac_io_write); } gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method, unsigned int flags, void *options, - unsigned char *m, size_t m_n, - unsigned char **em, size_t *em_n) + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write) { gcry_err_code_t err; - err = _gcry_ac_data_encode (method, flags, options, m, m_n, em, em_n); + err = _gcry_ac_data_encode (method, flags, options, + ac_io_read, ac_io_write); return gcry_error (err); } @@ -2417,13 +2676,14 @@ gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method, unsigned int flags, void *options, - unsigned char *em, size_t em_n, - unsigned char **m, size_t *m_n) + gcry_ac_io_t *ac_io_read, + gcry_ac_io_t *ac_io_write) { gcry_err_code_t err; - err = _gcry_ac_data_decode (method, flags, options, em, em_n, m, m_n); - + err = _gcry_ac_data_decode (method, flags, options, + ac_io_read, ac_io_write); + return gcry_error (err); } @@ -2720,10 +2980,11 @@ gcry_ac_scheme_t scheme_id, unsigned int flags, void *opts, gcry_ac_key_t key, - unsigned char *m, size_t m_n, - unsigned char **c, size_t *c_n) + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_cipher) { gcry_err_code_t err; + gcry_ac_io_t io_em; unsigned char *em; size_t em_n; gcry_mpi_t mpi_plain; @@ -2738,6 +2999,7 @@ mpi_encrypted = NULL; mpi_plain = NULL; opts_em = NULL; + buffer = NULL; em = NULL; scheme = ac_scheme_get (scheme_id); @@ -2757,8 +3019,11 @@ if (err) goto out; - err = _gcry_ac_data_encode (scheme->scheme_encoding, - 0, opts_em, m, m_n, &em, &em_n); + _gcry_ac_io_init (&io_em, GCRY_AC_IO_WRITABLE, + GCRY_AC_IO_STRING, &em, &em_n); + + err = _gcry_ac_data_encode (scheme->scheme_encoding, 0, opts_em, + io_message, &io_em); if (err) goto out; @@ -2777,8 +3042,7 @@ if (err) goto out; - *c = buffer; - *c_n = buffer_n; + err = _gcry_ac_io_write (io_cipher, buffer, buffer_n); out: @@ -2786,6 +3050,7 @@ gcry_mpi_release (mpi_encrypted); gcry_mpi_release (mpi_plain); gcry_free (opts_em); + gcry_free (buffer); gcry_free (em); return err; @@ -2796,13 +3061,13 @@ gcry_ac_scheme_t scheme_id, unsigned int flags, void *opts, gcry_ac_key_t key, - unsigned char *m, size_t m_n, - unsigned char **c, size_t *c_n) + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_cipher) { gcry_err_code_t err; err = _gcry_ac_data_encrypt_scheme (handle, scheme_id, flags, opts, key, - m, m_n, c, c_n); + io_message, io_cipher); return gcry_error (err); } @@ -2818,21 +3083,22 @@ gcry_ac_scheme_t scheme_id, unsigned int flags, void *opts, gcry_ac_key_t key, - unsigned char *c, size_t c_n, - unsigned char **m, size_t *m_n) + gcry_ac_io_t *io_cipher, + gcry_ac_io_t *io_message) { + gcry_ac_io_t io_em; gcry_err_code_t err; gcry_ac_data_t data_encrypted; unsigned char *em; size_t em_n; gcry_mpi_t mpi_encrypted; gcry_mpi_t mpi_decrypted; - unsigned char *buffer; - size_t buffer_n; void *opts_em; ac_scheme_t *scheme; char *elements_enc; size_t elements_enc_n; + unsigned char *c; + size_t c_n; data_encrypted = NULL; mpi_encrypted = NULL; @@ -2840,6 +3106,7 @@ elements_enc = NULL; opts_em = NULL; em = NULL; + c = NULL; scheme = ac_scheme_get (scheme_id); if (! scheme) @@ -2854,6 +3121,10 @@ goto out; } + err = _gcry_ac_io_read_all (io_cipher, &c, &c_n); + if (err) + goto out; + mpi_encrypted = gcry_mpi_snew (0); gcry_ac_os_to_mpi (mpi_encrypted, c, c_n); @@ -2890,14 +3161,14 @@ if (err) goto out; - err = _gcry_ac_data_decode (scheme->scheme_encoding, - 0, opts_em, em, em_n, &buffer, &buffer_n); + _gcry_ac_io_init (&io_em, GCRY_AC_IO_READABLE, + GCRY_AC_IO_STRING, em, em_n); + + err = _gcry_ac_data_decode (scheme->scheme_encoding, 0, opts_em, + &io_em, io_message); if (err) goto out; - *m = buffer; - *m_n = buffer_n; - out: _gcry_ac_data_destroy (data_encrypted); @@ -2906,6 +3177,7 @@ free (elements_enc); gcry_free (opts_em); gcry_free (em); + gcry_free (c); return err; } @@ -2915,13 +3187,13 @@ gcry_ac_scheme_t scheme_id, unsigned int flags, void *opts, gcry_ac_key_t key, - unsigned char *c, size_t c_n, - unsigned char **m, size_t *m_n) + gcry_ac_io_t *io_cipher, + gcry_ac_io_t *io_message) { gcry_err_code_t err; err = _gcry_ac_data_decrypt_scheme (handle, scheme_id, flags, opts, key, - c, c_n, m, m_n); + io_cipher, io_message); return gcry_error (err); } @@ -2937,9 +3209,10 @@ gcry_ac_scheme_t scheme_id, unsigned int flags, void *opts, gcry_ac_key_t key, - unsigned char *m, size_t m_n, - unsigned char **s, size_t *s_n) + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_signature) { + gcry_ac_io_t io_em; gcry_err_code_t err; gcry_ac_data_t data_signed; unsigned char *em; @@ -2975,7 +3248,11 @@ if (err) goto out; - err = _gcry_ac_data_encode (scheme->scheme_encoding, 0, opts_em, m, m_n, &em, &em_n); + _gcry_ac_io_init (&io_em, GCRY_AC_IO_WRITABLE, + GCRY_AC_IO_STRING, &em, &em_n); + + err = _gcry_ac_data_encode (scheme->scheme_encoding, 0, opts_em, + io_message, &io_em); if (err) goto out; @@ -2994,8 +3271,7 @@ if (err) goto out; - *s = buffer; - *s_n = buffer_n; + err = _gcry_ac_io_write (io_signature, buffer, buffer_n); out: @@ -3003,6 +3279,7 @@ gcry_mpi_release (mpi_signed); gcry_mpi_release (mpi); gcry_free (opts_em); + gcry_free (buffer); gcry_free (em); return err; @@ -3014,13 +3291,13 @@ unsigned int flags, void *opts, gcry_ac_key_t key, - unsigned char *m, size_t m_n, - unsigned char **s, size_t *s_n) + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_signature) { gcry_err_code_t err; err = _gcry_ac_data_sign_scheme (handle, scheme_id, flags, opts, key, - m, m_n, s, s_n); + io_message, io_signature); return gcry_error (err); } @@ -3036,9 +3313,10 @@ gcry_ac_scheme_t scheme_id, unsigned int flags, void *opts, gcry_ac_key_t key, - unsigned char *m, size_t m_n, - unsigned char *s, size_t s_n) + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_signature) { + gcry_ac_io_t io_em; gcry_err_code_t err; gcry_ac_data_t data_signed; unsigned char *em; @@ -3049,12 +3327,16 @@ ac_scheme_t *scheme; char *elements_sig; size_t elements_sig_n; + unsigned char *s; + size_t s_n; mpi_signature = NULL; elements_sig = NULL; + data_signed = NULL; mpi_data = NULL; opts_em = NULL; em = NULL; + s = NULL; if (key->type != GCRY_AC_KEY_PUBLIC) { @@ -3073,14 +3355,21 @@ if (err) goto out; - err = _gcry_ac_data_encode (scheme->scheme_encoding, - 0, opts_em, m, m_n, &em, &em_n); + _gcry_ac_io_init (&io_em, GCRY_AC_IO_WRITABLE, + GCRY_AC_IO_STRING, &em, &em_n); + + err = _gcry_ac_data_encode (scheme->scheme_encoding, 0, opts_em, + io_message, &io_em); if (err) goto out; mpi_data = gcry_mpi_new (0); _gcry_ac_os_to_mpi (mpi_data, em, em_n); + err = _gcry_ac_io_read_all (io_signature, &s, &s_n); + if (err) + goto out; + mpi_signature = gcry_mpi_new (0); _gcry_ac_os_to_mpi (mpi_signature, s, s_n); @@ -3107,7 +3396,7 @@ gcry_mpi_release (mpi_signature); mpi_signature = NULL; - + err = _gcry_ac_data_verify (handle, key, mpi_data, data_signed); out: @@ -3118,6 +3407,7 @@ free (elements_sig); gcry_free (opts_em); gcry_free (em); + gcry_free (s); return err; } @@ -3127,13 +3417,65 @@ gcry_ac_scheme_t scheme_id, unsigned int flags, void *opts, gcry_ac_key_t key, - unsigned char *m, size_t m_n, - unsigned char *s, size_t s_n) + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_signature) { gcry_err_code_t err; err = _gcry_ac_data_verify_scheme (handle, scheme_id, flags, opts, key, - m, m_n, s, s_n); + io_message, io_signature); + + return gcry_error (err); +} + + + +/* + * General functions. + */ + +/* Stores the textual representation of the algorithm whose id is + given in ALGORITHM in NAME. */ +gcry_error_t +gcry_ac_id_to_name (gcry_ac_id_t algorithm, const char **name) +{ + gcry_err_code_t err; + const char *n; + + n = gcry_pk_algo_name (algorithm); + if (! *n) + { + err = GPG_ERR_PUBKEY_ALGO; + goto out; + } + + *name = n; + err = 0; + + out: + + return gcry_error (err); +} + +/* Stores the numeric ID of the algorithm whose textual representation + is contained in NAME in ALGORITHM. */ +gcry_error_t +gcry_ac_name_to_id (const char *name, gcry_ac_id_t *algorithm) +{ + gcry_err_code_t err; + int algo; + + algo = gcry_pk_map_name (name); + if (! algo) + { + err = GPG_ERR_PUBKEY_ALGO; + goto out; + } + + *algorithm = algo; + err = 0; + + out: return gcry_error (err); } From cvs at cvs.gnupg.org Thu Mar 31 05:44:00 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 31 06:42:10 2005 Subject: gnupg/g10 (ChangeLog keyserver.c) Message-ID: Date: Thursday, March 31, 2005 @ 05:58:53 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog keyserver.c * keyserver.c (keyserver_spawn): Don't mess about with the $PATH. Rather, call keyserver helpers with the full path. This fixes some PATH-inspired DLL problems on W32. Noted by Carlo Luciano Bianco. -------------+ ChangeLog | 7 +++++++ keyserver.c | 44 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 9 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.714 gnupg/g10/ChangeLog:1.715 --- gnupg/g10/ChangeLog:1.714 Wed Mar 30 12:39:13 2005 +++ gnupg/g10/ChangeLog Thu Mar 31 05:58:53 2005 @@ -1,3 +1,10 @@ +2005-03-30 David Shaw + + * keyserver.c (keyserver_spawn): Don't mess about with the $PATH. + Rather, call keyserver helpers with the full path. This fixes + some PATH-inspired DLL problems on W32. Noted by Carlo Luciano + Bianco. + 2005-03-30 Werner Koch * cardglue.c (pin_cb): Print a warning if the info string hack is Index: gnupg/g10/keyserver.c diff -u gnupg/g10/keyserver.c:1.82 gnupg/g10/keyserver.c:1.83 --- gnupg/g10/keyserver.c:1.82 Thu Mar 17 23:55:17 2005 +++ gnupg/g10/keyserver.c Thu Mar 31 05:58:53 2005 @@ -43,6 +43,8 @@ #define SEND 1 #define SEARCH 2 +#define GPGKEYS_PREFIX "gpgkeys_" + struct keyrec { KEYDB_SEARCH_DESC desc; @@ -860,20 +862,43 @@ opt.keyserver_options.options|=KEYSERVER_USE_TEMP_FILES; #endif - /* Push the libexecdir into path. If DISABLE_KEYSERVER_PATH is set, - use the 0 arg to replace the path. */ + /* Build the filename for the helper to execute */ + scheme=keyserver_typemap(keyserver->scheme); + #ifdef DISABLE_KEYSERVER_PATH + /* Destroy any path we might have. This is a little tricky, + portability-wise. It's not correct to delete the PATH + environment variable, as that may fall back to a system built-in + PATH. Similarly, it is not correct to set PATH to the null + string (PATH="") since this actually deletes the PATH environment + variable under MinGW. The safest thing to do here is to force + PATH to be GNUPG_LIBEXECDIR. All this is not that meaningful on + Unix-like systems (since we're going to give a full path to + gpgkeys_foo), but on W32 it prevents loading any DLLs from + directories in %PATH%. */ set_exec_path(GNUPG_LIBEXECDIR,0); #else - set_exec_path(GNUPG_LIBEXECDIR,opt.exec_path_set); + if(opt.exec_path_set) + { + /* If exec-path was set, and DISABLE_KEYSERVER_PATH is + undefined, then don't specify a full path to gpgkeys_foo, so + that the PATH can work. */ + command=m_alloc(strlen(GPGKEYS_PREFIX)+strlen(scheme)+1); + command[0]='\0'; + } + else #endif + { + /* Specify a full path to gpgkeys_foo. */ + command=m_alloc(strlen(GNUPG_LIBEXECDIR)+strlen(DIRSEP_S)+ + strlen(GPGKEYS_PREFIX)+strlen(scheme)+1); + strcpy(command,GNUPG_LIBEXECDIR); + strcat(command,DIRSEP_S); + } - /* Build the filename for the helper to execute */ - scheme=keyserver_typemap(keyserver->scheme); - command=m_alloc(strlen("gpgkeys_")+strlen(scheme)+1); - strcpy(command,"gpgkeys_"); + strcat(command,GPGKEYS_PREFIX); strcat(command,scheme); - + if(opt.keyserver_options.options&KEYSERVER_USE_TEMP_FILES) { if(opt.keyserver_options.options&KEYSERVER_KEEP_TEMP_FILES) @@ -1334,7 +1359,8 @@ break; case KEYSERVER_VERSION_ERROR: - log_error(_("gpgkeys_%s does not support handler version %d\n"), + log_error(_(GPGKEYS_PREFIX "%s does not support" + " handler version %d\n"), keyserver_typemap(keyserver->scheme), KEYSERVER_PROTO_VERSION); break; From cvs at cvs.gnupg.org Thu Mar 31 08:50:42 2005 From: cvs at cvs.gnupg.org (cvs user wk) Date: Thu Mar 31 08:50:49 2005 Subject: gnupg/g10 (ChangeLog g10.c keydb.c) Message-ID: Date: Thursday, March 31, 2005 @ 09:05:35 Author: wk Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog g10.c keydb.c * keydb.c (keydb_add_resource): Clarify meaning of flags. Add new flag 4. Use log_info for errors registering the default secret key. * g10.c (main): Flag the default keyrings. -----------+ ChangeLog | 6 ++++++ g10.c | 6 +++--- keydb.c | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.715 gnupg/g10/ChangeLog:1.716 --- gnupg/g10/ChangeLog:1.715 Thu Mar 31 05:58:53 2005 +++ gnupg/g10/ChangeLog Thu Mar 31 09:05:35 2005 @@ -1,3 +1,9 @@ +2005-03-31 Werner Koch + + * keydb.c (keydb_add_resource): Clarify meaning of flags. Add new + flag 4. Use log_info for errors registering the default secret key. + * g10.c (main): Flag the default keyrings. + 2005-03-30 David Shaw * keyserver.c (keyserver_spawn): Don't mess about with the $PATH. Index: gnupg/g10/g10.c diff -u gnupg/g10/g10.c:1.297 gnupg/g10/g10.c:1.298 --- gnupg/g10/g10.c:1.297 Thu Jan 20 12:42:03 2005 +++ gnupg/g10/g10.c Thu Mar 31 09:05:35 2005 @@ -2924,7 +2924,7 @@ case the secrings are stored on a floppy. We always need to add the keyrings if we are running under - SELinux, thi is so that the rings are added to the list of + SELinux, this is so that the rings are added to the list of secured files. */ if( ALWAYS_ADD_KEYRINGS || (cmd != aDeArmor && cmd != aEnArmor @@ -2935,12 +2935,12 @@ && cmd != aVerify && cmd != aSym)) { if (!sec_nrings || default_keyring) /* add default secret rings */ - keydb_add_resource ("secring" EXTSEP_S "gpg", 0, 1); + keydb_add_resource ("secring" EXTSEP_S "gpg", 4, 1); for (sl = sec_nrings; sl; sl = sl->next) keydb_add_resource ( sl->d, 0, 1 ); } if( !nrings || default_keyring ) /* add default ring */ - keydb_add_resource ("pubring" EXTSEP_S "gpg", 0, 0); + keydb_add_resource ("pubring" EXTSEP_S "gpg", 4, 0); for(sl = nrings; sl; sl = sl->next ) keydb_add_resource ( sl->d, sl->flags, 0 ); } Index: gnupg/g10/keydb.c diff -u gnupg/g10/keydb.c:1.14 gnupg/g10/keydb.c:1.15 --- gnupg/g10/keydb.c:1.14 Thu Oct 14 09:11:56 2004 +++ gnupg/g10/keydb.c Thu Mar 31 09:05:35 2005 @@ -1,5 +1,5 @@ /* keydb.c - key database dispatcher - * Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -195,7 +195,8 @@ * Note: this function may be called before secure memory is * available. * Flag 1 == force - * Flag 2 == default + * Flag 2 == mark resource as primary + * Flag 4 == This is a default resources */ int keydb_add_resource (const char *url, int flags, int secret) @@ -305,7 +306,18 @@ leave: if (rc) - log_error ("keyblock resource `%s': %s\n", filename, g10_errstr(rc)); + { + /* Secret keyrings are not required in all cases. To avoid + having gpg return failure we use log_info here if the + rewsource is a secret one and marked as default + resource. */ + if ((flags&4) && secret) + log_info (_("keyblock resource `%s': %s\n"), + filename, g10_errstr(rc)); + else + log_error (_("keyblock resource `%s': %s\n"), + filename, g10_errstr(rc)); + } else if (secret) any_secret = 1; else From cvs at cvs.gnupg.org Thu Mar 31 18:57:00 2005 From: cvs at cvs.gnupg.org (cvs user dshaw) Date: Thu Mar 31 18:57:03 2005 Subject: gnupg/g10 (ChangeLog exec.c exec.h g10.c keyserver.c) Message-ID: Date: Thursday, March 31, 2005 @ 19:11:53 Author: dshaw Path: /cvs/gnupg/gnupg/g10 Modified: ChangeLog exec.c exec.h g10.c keyserver.c * exec.h, exec.c (set_exec_path): Remove some dead code and change all callers. We no longer need to append to $PATH. -------------+ ChangeLog | 5 +++++ exec.c | 26 +++++++------------------- exec.h | 4 ++-- g10.c | 2 +- keyserver.c | 2 +- 5 files changed, 16 insertions(+), 23 deletions(-) Index: gnupg/g10/ChangeLog diff -u gnupg/g10/ChangeLog:1.716 gnupg/g10/ChangeLog:1.717 --- gnupg/g10/ChangeLog:1.716 Thu Mar 31 09:05:35 2005 +++ gnupg/g10/ChangeLog Thu Mar 31 19:11:53 2005 @@ -1,3 +1,8 @@ +2005-03-31 David Shaw + + * exec.h, exec.c (set_exec_path): Remove some dead code and change + all callers. We no longer need to append to $PATH. + 2005-03-31 Werner Koch * keydb.c (keydb_add_resource): Clarify meaning of flags. Add new Index: gnupg/g10/exec.c diff -u gnupg/g10/exec.c:1.18 gnupg/g10/exec.c:1.19 --- gnupg/g10/exec.c:1.18 Thu Oct 28 04:14:06 2004 +++ gnupg/g10/exec.c Thu Mar 31 19:11:53 2005 @@ -1,5 +1,5 @@ /* exec.c - generic call-a-program code - * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -51,7 +51,7 @@ int exec_read(struct exec_info *info) { return G10ERR_GENERAL; } int exec_finish(struct exec_info *info) { return G10ERR_GENERAL; } -int set_exec_path(const char *path,int method) { return G10ERR_GENERAL; } +int set_exec_path(const char *path) { return G10ERR_GENERAL; } #else /* ! NO_EXEC */ @@ -91,29 +91,17 @@ } #endif -/* method==0 to replace current $PATH, and 1 to append to current - $PATH. */ -int set_exec_path(const char *path,int method) +/* Replaces current $PATH */ +int set_exec_path(const char *path) { - char *p,*curpath=NULL; - size_t curlen=0; + char *p; - if(method==1 && (curpath=getenv("PATH"))) - curlen=strlen(curpath)+1; - - p=m_alloc(5+curlen+strlen(path)+1); + p=m_alloc(5+strlen(path)+1); strcpy(p,"PATH="); - - if(curpath) - { - strcat(p,curpath); - strcat(p,":"); - } - strcat(p,path); if(DBG_EXTPROG) - log_debug("set_exec_path method %d: %s\n",method,p); + log_debug("set_exec_path: %s\n",p); /* Notice that path is never freed. That is intentional due to the way putenv() works. This leaks a few bytes if we call Index: gnupg/g10/exec.h diff -u gnupg/g10/exec.h:1.5 gnupg/g10/exec.h:1.6 --- gnupg/g10/exec.h:1.5 Wed May 21 18:42:21 2003 +++ gnupg/g10/exec.h Thu Mar 31 19:11:53 2005 @@ -1,5 +1,5 @@ /* exec.h - * Copyright (C) 2001, 2002 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -38,6 +38,6 @@ const char *args_in,const char *name,int writeonly,int binary); int exec_read(struct exec_info *info); int exec_finish(struct exec_info *info); -int set_exec_path(const char *path,int method); +int set_exec_path(const char *path); #endif /* !_EXEC_H_ */ Index: gnupg/g10/g10.c diff -u gnupg/g10/g10.c:1.298 gnupg/g10/g10.c:1.299 --- gnupg/g10/g10.c:1.298 Thu Mar 31 09:05:35 2005 +++ gnupg/g10/g10.c Thu Mar 31 19:11:53 2005 @@ -2379,7 +2379,7 @@ break; case oTempDir: opt.temp_dir=pargs.r.ret_str; break; case oExecPath: - if(set_exec_path(pargs.r.ret_str,0)) + if(set_exec_path(pargs.r.ret_str)) log_error(_("unable to set exec-path to %s\n"),pargs.r.ret_str); else opt.exec_path_set=1; Index: gnupg/g10/keyserver.c diff -u gnupg/g10/keyserver.c:1.83 gnupg/g10/keyserver.c:1.84 --- gnupg/g10/keyserver.c:1.83 Thu Mar 31 05:58:53 2005 +++ gnupg/g10/keyserver.c Thu Mar 31 19:11:53 2005 @@ -876,7 +876,7 @@ Unix-like systems (since we're going to give a full path to gpgkeys_foo), but on W32 it prevents loading any DLLs from directories in %PATH%. */ - set_exec_path(GNUPG_LIBEXECDIR,0); + set_exec_path(GNUPG_LIBEXECDIR); #else if(opt.exec_path_set) {