diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | THANKS | 4 | ||||
-rw-r--r-- | TODO | 12 | ||||
-rwxr-xr-x | autogen.sh | 99 | ||||
-rw-r--r-- | cipher/ChangeLog | 23 | ||||
-rw-r--r-- | cipher/Makefile.am | 8 | ||||
-rw-r--r-- | cipher/random.c | 2 | ||||
-rw-r--r-- | cipher/rndlinux.c | 23 | ||||
-rw-r--r-- | cipher/serpent.c | 2 | ||||
-rw-r--r-- | mpi/ChangeLog | 7 | ||||
-rw-r--r-- | mpi/Makefile.am | 18 | ||||
-rw-r--r-- | src/gcrypt.h.in | 2 | ||||
-rw-r--r-- | tests/ChangeLog | 9 | ||||
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rw-r--r-- | tests/ac-data.c | 2 | ||||
-rw-r--r-- | tests/keygen.c | 55 |
16 files changed, 250 insertions, 27 deletions
@@ -1,3 +1,7 @@ +2006-11-15 Werner Koch <wk@g10code.com> + + * autogen.sh: Add convenience option --build-amd64. + 2006-10-20 Werner Koch <wk@g10code.com> * Makefile.am (stowinstall): New convenience target. @@ -24,6 +24,7 @@ Daniel Koening dan@mail.isis.de David Ellement ellement@sdd.hp.com Detlef Lannert lannert@lannert.rz.uni-duesseldorf.de Dirk Lattermann dlatt@t-online.de +Dirk Stoecker gcrypt@dstoecker.de Ed Boraas ecxjo@esperanto.org Enzo Michelangeli em@MailAndNews.com Ernst Molitor ernst.molitor@uni-bonn.de @@ -70,6 +71,7 @@ Martin Kahlert martin.kahlert@provi.de Martin Hamilton Martin Schulte schulte@thp.uni-koeln.de Matthew Skala mskala@ansuz.sooke.bc.ca +Max Kellermann max@duempel.org Max Valianskiy maxcom@maxcom.ml.org Michael Fischer v. Mollard mfvm@gmx.de Michael Roth mroth@nessie.de @@ -92,6 +94,7 @@ Philippe Laliberte arsphl@oeil.qc.ca Peter Gutmann pgut001@cs.auckland.ac.nz QingLong qinglong@bolizm.ihep.su Rafael Ávila de Espíndola rafael.espindola@gmail.com +Rafaël Carré funman@videolan.org Ralf Fassel ralf@akutech.de Ralf Hildebrandt Ralf.Hildebrandt@innominate.com Ralf Schneider ralf@tapfere-schneiderleins.de @@ -130,6 +133,7 @@ Ulf Möller 3umoelle@informatik.uni-hamburg.de Umberto Salsi salsi@icosaedro.it Uoti Urpala Urko Lusa ulusa@euskalnet.net +Victor Stinner haypo@inl.fr Walter Koch koch@u32.de Werner Koch wk@gnupg.org Wim Vandeputte wim@kd85.com @@ -66,4 +66,16 @@ What's left to do -*- outline -*- * Add OAEP +* Next API break: +** gcry_ac_io_t + Remove use of anonymous union. + +* ac.c + There are still some things fishy. The fixes I did todat + (2006-10-23) seem to cure just a symptom. Needs a complete review. + +* gcryptrnd.c + Requires test for pth and other stuff. + + @@ -29,6 +29,103 @@ check_version () { } +DIE=no + +# ***** W32 build script ******* +# 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 + + # Locate the cross compiler + crossbindir= + for host in i586-mingw32msvc i386-mingw32msvc; do + if ${host}-gcc --version >/dev/null 2>&1 ; then + crossbindir=/usr/${host}/bin + conf_CC="CC=${host}-gcc" + break; + fi + done + if [ -z "$crossbindir" ]; then + echo "Cross compiler kit not installed" >&2 + echo "Under Debian GNU/Linux, you may install it using" >&2 + echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2 + echo "Stop." >&2 + exit 1 + 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=${host} --build=${build} \ + --with-gpg-error-prefix=${w32root} \ + --disable-shared + + exit $? +fi +# ***** end W32 build script ******* + + +# ***** AMD64 cross build script ******* +# Used to cross-compile for AMD64 (for testing) +if test "$1" = "--build-amd64"; 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 "$amd64root" ] && amd64root="$HOME/amd64root" + echo "Using $amd64root as standard install directory" >&2 + + # Locate the cross compiler + crossbindir= + for host in x86_64-linux-gnu amd64-linux-gnu; do + if ${host}-gcc --version >/dev/null 2>&1 ; then + crossbindir=/usr/${host}/bin + conf_CC="CC=${host}-gcc" + break; + fi + done + if [ -z "$crossbindir" ]; then + echo "Cross compiler kit not installed" >&2 + echo "Stop." >&2 + exit 1 + fi + + if [ -f "$tsdir/config.log" ]; then + if ! head $tsdir/config.log | grep "$host" >/dev/null; then + echo "Please run a 'make distclean' first" >&2 + exit 1 + fi + fi + + $tsdir/configure --enable-maintainer-mode --prefix=${amd64root} \ + --host=${host} --build=${build} \ + --with-gpg-error-prefix=${amd64root} + + rc=$? + exit $rc +fi +# ***** end AMD64 cross build script ******* + # Grep the required versions from configure.ac autoconf_vers=`sed -n '/^AC_PREREQ(/ { s/^.*(\(.*\))/\1/p @@ -65,8 +162,6 @@ ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX} #GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX} #MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX} -DIE=no - if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 2d913d7e..d534fdc6 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,26 @@ +2006-12-18 Werner Koch <wk@g10code.com> + + * rndlinux.c (set_cloexec_flag): New. + (open_device): Set close-on-exit flags. Suggested by Max + Kellermann. Fixes Debian#403613. + + * Makefile.am (AM_CPPFLAGS, AM_CFLAGS): Splitted and merged + Moritz' changes. + (INCLUDES): Removed. + +2006-11-30 Werner Koch <wk@g10code.com> + + * serpent.c (byte_swap_32): Remove trailing semicolon. + +2006-11-15 Werner Koch <wk@g10code.com> + + * Makefile.am (INCLUDES): Include ../src/ + +2006-11-03 Werner Koch <wk@g10code.com> + + * random.c [HAVE_GETTIMEOFDAY]: Included sys/time.h and not + sys/times.h. Reported by Rafal Carr. + 2006-11-05 Moritz Schulte <moritz@g10code.com> * Makefile.am (AM_CFLAGS): Added -I$(top_builddir)/src so that the diff --git a/cipher/Makefile.am b/cipher/Makefile.am index f9b8ebf0..49fcf3d2 100644 --- a/cipher/Makefile.am +++ b/cipher/Makefile.am @@ -21,7 +21,12 @@ # Process this file with automake to produce Makefile.in EXTRA_DIST = Manifest -INCLUDES = -I$(top_srcdir)/src + +# Need to include ../src in addition to top_srcdir because gcrypt.h is +# a built header. +AM_CPPFLAGS = -I../src -I$(top_srcdir)/src +AM_CFLAGS = $(GPG_ERROR_CFLAGS) + noinst_LTLIBRARIES = libcipher.la @@ -30,7 +35,6 @@ GCRYPT_MODULES = @GCRYPT_CIPHERS@ @GCRYPT_PUBKEY_CIPHERS@ @GCRYPT_DIGESTS@ \ libcipher_la_DEPENDENCIES = $(GCRYPT_MODULES) libcipher_la_LIBADD = $(GCRYPT_MODULES) -AM_CFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ libcipher_la_SOURCES = \ cipher.c pubkey.c ac.c md.c \ diff --git a/cipher/random.c b/cipher/random.c index 528111af..a18f57cd 100644 --- a/cipher/random.c +++ b/cipher/random.c @@ -43,7 +43,7 @@ #include <sys/times.h> #endif #ifdef HAVE_GETTIMEOFDAY -#include <sys/times.h> +#include <sys/time.h> #endif #ifdef HAVE_GETRUSAGE #include <sys/resource.h> diff --git a/cipher/rndlinux.c b/cipher/rndlinux.c index d87cd8bd..f23abfc5 100644 --- a/cipher/rndlinux.c +++ b/cipher/rndlinux.c @@ -41,6 +41,21 @@ int _gcry_rndlinux_gather_random (void (*add)(const void*, size_t, int), int requester, size_t length, int level ); + +static int +set_cloexec_flag (int fd) +{ + int oldflags; + + oldflags= fcntl (fd, F_GETFD, 0); + if (oldflags < 0) + return oldflags; + oldflags |= FD_CLOEXEC; + return fcntl (fd, F_SETFD, oldflags); +} + + + /* * Used to open the /dev/random devices (Linux, xBSD, Solaris (if it exists)). */ @@ -49,10 +64,14 @@ open_device( const char *name, int minor ) { int fd; - fd = open( name, O_RDONLY ); - if( fd == -1 ) + fd = open ( name, O_RDONLY ); + if ( fd == -1 ) log_fatal ("can't open %s: %s\n", name, strerror(errno) ); + if (set_cloexec_flag (fd)) + log_error ("error setting FD_CLOEXEC on fd %d: %s\n", + fd, strerror (errno)); + /* We used to do the follwing check, however it turned out that this is not portable since more OSes provide a random device which is sometimes implemented as anoteher device type. diff --git a/cipher/serpent.c b/cipher/serpent.c index 2fbed635..26267be7 100644 --- a/cipher/serpent.c +++ b/cipher/serpent.c @@ -59,7 +59,7 @@ static const char *serpent_test (void); #define byte_swap_32(x) \ (0 \ | (((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \ - | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)); + | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) /* These are the S-Boxes of Serpent. They are copied from Serpents reference implementation (the optimized one, contained in diff --git a/mpi/ChangeLog b/mpi/ChangeLog index 8083f86e..7c007a49 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,10 @@ +2006-11-15 Werner Koch <wk@g10code.com> + + * Makefile.am (.S.o): Check for srcdir also in in CPP pass. + (INCLUDES): Removed. + (AM_CPPFLAGS, AM_CFLAGS): New, modified. Merged with Moritz' + changes. + 2006-11-05 Moritz Schulte <moritz@g10code.com> * Makefile.am (AM_CFLAGS): Added -I$(top_builddir)/src so that the diff --git a/mpi/Makefile.am b/mpi/Makefile.am index 4a1c27fb..b6213341 100644 --- a/mpi/Makefile.am +++ b/mpi/Makefile.am @@ -21,10 +21,15 @@ # I was not able to build it with 64Megs - 1.6 fixes this. # not anymore required: AUTOMAKE_OPTIONS = 1.6 -INCLUDES = -I$(top_srcdir)/src -ASFLAGS = @MPI_SFLAGS@ +# Need to include ../src in addition to top_srcdir because gcrypt.h is +# a built header. +AM_CPPFLAGS = -I../src -I$(top_srcdir)/src +AM_CFLAGS = $(GPG_ERROR_CFLAGS) + +AM_ASFLAGS = $(MPI_SFLAGS) AM_CCASFLAGS = $(NOEXECSTACK_FLAGS) + # We don't have .S sources listed, so automake does not autocreate these CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) LTCCASCOMPILE = $(LIBTOOL) --mode=compile $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) @@ -151,7 +156,6 @@ CLEANFILES = _*.s __*.s noinst_LTLIBRARIES = libmpi.la -AM_CFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ libmpi_la_LDFLAGS = libmpi_la_SOURCES = longlong.h \ mpi-add.c \ @@ -182,7 +186,9 @@ libmpi_la_DEPENDENCIES = @MPI_MOD_LIST_LO@ SUFFIXES = .S .o .obj .lo .S.o: - $(CPP) $(INCLUDES) $(DEFS) $< | grep -v '^#' > $*.s + $(CPP) $(INCLUDES) $(AM_CPPFLAGS) $(DEFS) \ + `test -f '$<' || echo '$(srcdir)/'`$< \ + | grep -v '^#' > $*.s $(CCASCOMPILE) -c `test -f '$*.s' || echo '$(srcdir)/'`$*.s rm $*.s @@ -190,6 +196,8 @@ SUFFIXES = .S .o .obj .lo $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` .S.lo: - $(CPP) $(INCLUDES) $(DEFS) $< | grep -v '^#' > $*.s + $(CPP) $(INCLUDES) $(AM_CPPFLAGS) $(DEFS) \ + `test -f '$<' || echo '$(srcdir)/'`$< \ + | grep -v '^#' > $*.s $(LTCCASCOMPILE) -c -o $@ `test -f '$*.s' || echo '$(srcdir)/'`$*.s rm $*.s diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index 24620ebc..41e09df6 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -1,4 +1,4 @@ -/* gcrypt.h - GNU cryptographic library interface +/* gcrypt.h - GNU cryptographic library interface -*- c -*- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, * 2004, 2006 Free Software Foundation, Inc. * diff --git a/tests/ChangeLog b/tests/ChangeLog index 00f8fde8..fb32c390 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,12 @@ +2006-12-18 Werner Koch <wk@g10code.com> + + * Makefile.am (AM_CFLAGS, AM_CPPFLAGS): Splitted and merged with + Moritz' changes. + (INCLUDES): Removed. + + * keygen.c (progress_handler): New. + (main): Use it in verbose mode. + 2006-11-05 Moritz Schulte <moritz@g10code.com> * Makefile.am (AM_CFLAGS): Added -I$(top_builddir)/src so that the diff --git a/tests/Makefile.am b/tests/Makefile.am index 7eb8967e..ecaa6d8c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -21,10 +21,13 @@ TESTS = t-mpi-bit prime register ac ac-schemes ac-data basic \ tsexp keygen pubkey benchmark pkbench hmac keygrip -INCLUDES = -I$(top_srcdir)/src +# Need to include ../src in addition to top_srcdir because gcrypt.h is +# a built header. +AM_CPPFLAGS = -I../src -I$(top_srcdir)/src +AM_CFLAGS = $(GPG_ERROR_CFLAGS) + LDADD = ../src/libgcrypt.la EXTRA_PROGRAMS = testapi noinst_PROGRAMS = $(TESTS) -AM_CFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ diff --git a/tests/ac-data.c b/tests/ac-data.c index 9313da1a..fc4be8a5 100644 --- a/tests/ac-data.c +++ b/tests/ac-data.c @@ -78,6 +78,8 @@ check_sexp_conversion (gcry_ac_data_t data, const char **identifiers) assert_err (err); err = gcry_ac_data_get_index (data2, 0, i, &label2, &mpi2); assert_err (err); + fprintf (stderr, "Label1=`%s'\n", label1); + fprintf (stderr, "Label1=`%s'\n", label2); assert (! strcmp (label1, label2)); assert (! gcry_mpi_cmp (mpi1, mpi2)); } diff --git a/tests/keygen.c b/tests/keygen.c index 0d73275b..25f753ea 100644 --- a/tests/keygen.c +++ b/tests/keygen.c @@ -30,6 +30,7 @@ static int verbose; +static int debug; static int error_count; static void @@ -122,11 +123,32 @@ check_rsa_keys (void) { gcry_sexp_t keyparm, key; int rc; + int i; /* Check that DSA generation works and that it can grok the qbits argument. */ if (verbose) - fprintf (stderr, "creating 1536 bit DSA key using old interface\n"); + fprintf (stderr, "creating 5 1024 bit DSA keys\n"); + for (i=0; i < 5; i++) + { + rc = gcry_sexp_new (&keyparm, + "(genkey\n" + " (dsa\n" + " (nbits 4:1024)\n" + " ))", 0, 1); + if (rc) + die ("error creating S-expression: %s\n", gpg_strerror (rc)); + rc = gcry_pk_genkey (&key, keyparm); + gcry_sexp_release (keyparm); + if (rc) + die ("error generating DSA key: %s\n", gpg_strerror (rc)); + gcry_sexp_release (key); + if (verbose) + fprintf (stderr, " done\n"); + } + + if (verbose) + fprintf (stderr, "creating 1536 bit DSA key\n"); rc = gcry_sexp_new (&keyparm, "(genkey\n" " (dsa\n" @@ -139,17 +161,18 @@ check_rsa_keys (void) gcry_sexp_release (keyparm); if (rc) die ("error generating DSA key: %s\n", gpg_strerror (rc)); - { - char buffer[20000]; - gcry_sexp_sprint (key, GCRYSEXP_FMT_ADVANCED, buffer, sizeof buffer); - if (verbose) - printf ("=============================\n%s\n" - "=============================\n", buffer); - } + if (debug) + { + char buffer[20000]; + gcry_sexp_sprint (key, GCRYSEXP_FMT_ADVANCED, buffer, sizeof buffer); + if (verbose) + printf ("=============================\n%s\n" + "=============================\n", buffer); + } gcry_sexp_release (key); if (verbose) - fprintf (stderr, "creating 1024 bit RSA key using old interface\n"); + fprintf (stderr, "creating 1024 bit RSA key\n"); rc = gcry_sexp_new (&keyparm, "(genkey\n" " (rsa\n" @@ -243,11 +266,19 @@ check_nonce (void) } } + +static void +progress_cb (void *cb_data, const char *what, int printchar, + int current, int total) +{ + putchar (printchar); + fflush (stdout); +} + + int main (int argc, char **argv) { - int debug = 0; - if (argc > 1 && !strcmp (argv[1], "--verbose")) verbose = 1; else if (argc > 1 && !strcmp (argv[1], "--debug")) @@ -261,6 +292,8 @@ main (int argc, char **argv) gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u , 0); /* No valuable keys are create, so we can speed up our RNG. */ gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); + if (verbose) + gcry_set_progress_handler ( progress_cb, NULL ); check_rsa_keys (); check_nonce (); |