[svn] gcry - r1420 - in trunk: . compat m4 random src tests

svn author wk cvs at cvs.gnupg.org
Thu Jan 21 22:36:43 CET 2010


Author: wk
Date: 2010-01-21 22:36:43 +0100 (Thu, 21 Jan 2010)
New Revision: 1420

Added:
   trunk/compat/
   trunk/compat/Makefile.am
   trunk/compat/clock.c
   trunk/compat/compat.c
   trunk/compat/getpid.c
   trunk/compat/libcompat.h
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/NEWS
   trunk/TODO
   trunk/autogen.sh
   trunk/configure.ac
   trunk/ltmain.sh
   trunk/m4/ltversion.m4
   trunk/random/ChangeLog
   trunk/random/random-csprng.c
   trunk/random/rndw32.c
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/dumpsexp.c
   trunk/src/g10lib.h
   trunk/src/global.c
   trunk/src/hmac256.c
   trunk/src/secmem.c
   trunk/tests/ChangeLog
   trunk/tests/Makefile.am
   trunk/tests/benchmark.c
Log:
Support WindowsCE.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/ChangeLog	2010-01-21 21:36:43 UTC (rev 1420)
@@ -1,3 +1,22 @@
+2010-01-21  Werner Koch  <wk at g10code.com>
+
+	* compat/Makefile.am: New.
+	* compat/compat.c: New.
+	* compat/libcompat.h: New.
+	* compat/getpid.c, compat/clock.c: New.
+
+	* configure.ac: Require libgpg-error 1.8.
+	(HAVE_W32CE_SYSTEM): New am_defines and am_conditionals.
+	(getpid): Check for replacement function.
+	(AC_CONFIG_LIBOBJ_DIR): New.
+	(AC_TYPE_PID_T): New.
+	(AM_INIT_AUTOMAKE): Use modern variant.
+	(AC_CONFIG_FILES): Add compat/Makfile.
+	* autogen.sh: Support W32CE.
+	* ltmain.sh: Update to 2.2.6b
+	(wrappers_required): Don't set for mingw32ce.
+	* Makefile.am (DIST_SUBDIRS, SUBDIRS): Add compat.
+
 2009-12-10  Werner Koch  <wk at g10code.com>
 
 	* configure.ac: Add option --disable-O-flag-munging.
@@ -29,7 +48,7 @@
 2009-01-22  Werner Koch  <wk at g10code.com>
 
 	Release 1.4.4.
-	
+
 	* configure.ac: Bump LT version to C16/A5/R2.
 
 2008-10-30  Werner Koch  <wk at g10code.com>

Modified: trunk/random/ChangeLog
===================================================================
--- trunk/random/ChangeLog	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/random/ChangeLog	2010-01-21 21:36:43 UTC (rev 1420)
@@ -1,3 +1,10 @@
+2010-01-21  Werner Koch  <wk at g10code.com>
+
+	* rndw32.c (read_mbm_data) [W32CE]: Do not build.
+	(slow_gatherer) [W32CE]: Do not call read_mbm_data.
+	(_gcry_rndw32_gather_random_fast) [W32CE]: Exclude some calls.
+	(_gcry_rndw32_gather_random): Adjust version test for WindowsCE.
+
 2009-12-10  Werner Koch  <wk at g10code.com>
 
 	* rndw32.c (system_is_w2000): New.

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/src/ChangeLog	2010-01-21 21:36:43 UTC (rev 1420)
@@ -1,3 +1,20 @@
+2010-01-21  Werner Koch  <wk at g10code.com>
+
+	* Makefile.am (arch_gpg_error_cflags, arch_gpg_error_libs): New.
+	(dumpsexp_CFLAGS): New.
+	(dumpsexp_LDADD): Add arch_gpg_error_libs.
+	(hmac256_CFLAGS, hmac256_LDADD): Add the arch variables.
+	(libgcrypt_la_DEPENDENCIES): Add libcompat.
+	* secmem.c (lock_pool): Mark unused args.
+	* global.c (do_malloc, gcry_realloc, gcry_free, gcry_calloc)
+	(gcry_calloc_secure, gcry_xcalloc, gcry_xcalloc_secure): Use
+	gpg_err_set_errno.
+	(_gcry_vcontrol): Call _gcry_compat_identification.
+	* hmac256.c [__MINGW32CE__]: Include gpg-error.h.
+	(_gcry_hmac256_file): Use gpg_err_set_errno.
+	(gpg_err_set_errno) [!GPG_ERR_INLINE]: Add macro.
+	* g10lib.h: Include libcompat.h.
+
 2010-01-05  Werner Koch  <wk at g10code.com>
 
 	* gcrypt.h.in (GCRY_PK_ECDH): New.

Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/tests/ChangeLog	2010-01-21 21:36:43 UTC (rev 1420)
@@ -1,3 +1,9 @@
+2010-01-21  Werner Koch  <wk at g10code.com>
+
+	* benchmark.c [_GCRYPT_IN_LIBGCRYPT]: Include libcompat.h.
+	(start_timer, stop_timer) [__MINGW32CE__]: Use GetThreadTimes.
+	* Makefile.am (LDADD): Add libcompat.
+
 2009-12-10  Werner Koch  <wk at g10code.com>
 
 	* basic.c (check_ctr_cipher): Add some return code checks.

Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/Makefile.am	2010-01-21 21:36:43 UTC (rev 1420)
@@ -22,8 +22,8 @@
 DISTCHECK_CONFIGURE_FLAGS = --enable-random-daemon \
   --enable-ciphers=arcfour:blowfish:cast5:des:aes:twofish:serpent:rfc2268:seed:camellia
 
-DIST_SUBDIRS = m4 mpi cipher random src doc tests
-SUBDIRS = mpi cipher random src doc tests
+DIST_SUBDIRS = m4 compat mpi cipher random src doc tests
+SUBDIRS =         compat mpi cipher random src doc tests
 EXTRA_DIST = autogen.sh README.SVN
 DISTCLEANFILES = 
 

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/NEWS	2010-01-21 21:36:43 UTC (rev 1420)
@@ -14,6 +14,8 @@
  * Boosted SHA-512 performance by 30% on ia32 boxes and gcc 4.3;
    SHA-256 went up by 25%.
 
+ * Support for WindowsCE. 
+
  * Interface changes relative to the 1.4.2 release:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  GCRY_CIPHER_MODE_AESWRAP   NEW.

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/TODO	2010-01-21 21:36:43 UTC (rev 1420)
@@ -1,4 +1,4 @@
-What's left to do                                 -*- outline -*-
+# What's left to do                                 -*- org -*-
 
 * Next API break:
 ** gcry_ac_io_t

Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/autogen.sh	2010-01-21 21:36:43 UTC (rev 1420)
@@ -36,9 +36,28 @@
   shift
 fi
 
+# Convenience option to use certain configure options for some hosts.
+myhost="" 
+myhostsub=""
+case "$1" in
+    --build-w32)
+        myhost="w32"
+        ;;
+    --build-w32ce)
+        myhost="w32"
+        myhostsub="ce"
+        ;;
+    --build-amd64)
+        myhost="amd64"
+        ;;
+     *)
+     ;;
+esac
+
+
 # ***** W32 build script *******
 # Used to cross-compile for Windows.
-if test "$1" = "--build-w32"; then
+if [ "$myhost" = "w32" ]; then
     tmp=`dirname $0`
     tsdir=`cd "$tmp"; pwd`
     shift
@@ -48,12 +67,21 @@
     fi
     build=`$tsdir/config.guess`
 
-    [ -z "$w32root" ] && w32root="$HOME/w32root"
+    case $myhostsub in
+        ce)
+          [ -z "$w32root" ] && w32root="$HOME/w32ce_root"
+          toolprefixes="arm-mingw32ce"
+          ;;
+        *)
+          [ -z "$w32root" ] && w32root="$HOME/w32root"
+          toolprefixes="i586-mingw32msvc i386-mingw32msvc"
+          ;;
+    esac
     echo "Using $w32root as standard install directory" >&2
     
     # Locate the cross compiler
     crossbindir=
-    for host in i586-mingw32msvc i386-mingw32msvc; do
+    for host in $toolprefixes; do
         if ${host}-gcc --version >/dev/null 2>&1 ; then
             crossbindir=/usr/${host}/bin
             conf_CC="CC=${host}-gcc"
@@ -62,8 +90,10 @@
     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 
+        if [ -z "$sub" ]; then 
+          echo "Under Debian GNU/Linux, you may install it using" >&2
+          echo "  apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2 
+        fi
         echo "Stop." >&2
         exit 1
     fi
@@ -85,7 +115,7 @@
 
 # ***** AMD64 cross build script *******
 # Used to cross-compile for AMD64 (for testing)
-if test "$1" = "--build-amd64"; then
+if [ "$myhost" = "amd64" ]; then
     tmp=`dirname $0`
     tsdir=`cd "$tmp"; pwd`
     shift

Added: trunk/compat/Makefile.am
===================================================================
--- trunk/compat/Makefile.am	                        (rev 0)
+++ trunk/compat/Makefile.am	2010-01-21 21:36:43 UTC (rev 1420)
@@ -0,0 +1,50 @@
+# Makefile for compat directory
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This file is part of Libgcrypt.
+#
+# Libgcrypt is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# Libgcrypt is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+# Process this file with automake to produce Makefile.in
+
+# We use this libcompat to work around problems with LIBOBJ stuff.
+# For example, we need some of the compat files also in tests/ but the
+# suggested way to do this (using the automake option subdir-objects)
+# leads to problems with "make distclean": The distclean target in
+# tests is run before the one src and it removes the deps files of the
+# libobj files which are in src.  Now when it comes to run make in src
+# the icnluded files are gone - bummer.  Instead of try to fix this
+# issue it seems better not to use subdir-objects but build them all
+# into a compat library and always link against that library.  This
+# also avoids the problem that a dependency on LTLIBOBJ is not setup
+# if -- disable-static was used.
+
+# Need to include ../src in addition to top_srcdir because gcrypt.h is
+# a built header.
+AM_CPPFLAGS = -I../src -I$(top_srcdir)/src $(GPG_ERROR_CFLAGS)
+
+noinst_LTLIBRARIES = libcompat.la
+
+# We only need one file so that the library is guaranteed to have at
+# least one member. 
+libcompat_la_SOURCES = compat.c libcompat.h
+libcompat_la_DEPENDENCIES = @LTLIBOBJS@ 
+libcompat_la_LIBADD =       @LTLIBOBJS@ 
+
+# AC_LIBOBJ files are:
+#    getpid.c
+#    clock.c
+#
+
+

Added: trunk/compat/clock.c
===================================================================
--- trunk/compat/clock.c	                        (rev 0)
+++ trunk/compat/clock.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -0,0 +1,36 @@
+/* clock.c - Replacement for WindowsCE
+   Copyright (C) 2010 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 file is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY, to the extent permitted by law; without even
+   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+   PURPOSE.  */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_W32CE_SYSTEM
+#include <windows.h>
+#include <time.h>
+#include <assert.h>
+
+clock_t 
+_gcry_clock (void)
+{
+  assert (CLOCKS_PER_SEC == 1000);
+#warning Replace by a correct implementaion. 
+  /* It seems that GetProcessTimes is available in the kernel but
+     without a declaration.  If that fails we would need to walk over
+     all threads and tally up the GetThreadTimes.  */
+
+  return GetTickCount ();
+}
+
+#else
+# error No replacement function for clock known
+#endif


Property changes on: trunk/compat/clock.c
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: trunk/compat/compat.c
===================================================================
--- trunk/compat/compat.c	                        (rev 0)
+++ trunk/compat/compat.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -0,0 +1,36 @@
+/* compat.c - Dummy file to avoid an empty library.
+ * Copyright (C) 2010  Free Software Foundation, Inc.
+ *
+ * This file is part of Libgcrypt.
+ *
+ * Libgcrypt is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * Libgcrypt is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "../src/g10lib.h"
+
+
+const char *
+_gcry_compat_identification (void)
+{
+  static const char blurb[] = 
+    "\n\n"
+    "This is Libgcrypt - The GNU Crypto Library\n"
+    "Copyright 2000, 2002, 2003, 2004, 2007, 2008, 2009,\n"
+    "          2010 Free Software Foundation, Inc.\n"
+    "\n\n";
+  return blurb;
+}
+

Added: trunk/compat/getpid.c
===================================================================
--- trunk/compat/getpid.c	                        (rev 0)
+++ trunk/compat/getpid.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -0,0 +1,29 @@
+/* getpid.c - Replacement for WindowsCE
+   Copyright (C) 2010 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 file is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY, to the extent permitted by law; without even
+   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+   PURPOSE.  */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_W32CE_SYSTEM
+#include <windows.h>
+#include <sys/types.h>
+
+pid_t 
+_gcry_getpid (void)
+{
+  return GetCurrentProcessId ();
+}
+
+#else
+# error No replacement function for getpid known
+#endif


Property changes on: trunk/compat/getpid.c
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: trunk/compat/libcompat.h
===================================================================
--- trunk/compat/libcompat.h	                        (rev 0)
+++ trunk/compat/libcompat.h	2010-01-21 21:36:43 UTC (rev 1420)
@@ -0,0 +1,37 @@
+/* libcomapt.h - Prototypes for AC_REPLACE_FUNCtions.
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of Libgcrypt.
+ *
+ * Libgcrypt is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser general Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * Libgcrypt is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GCRY_LIBCOMPAT_H
+#define GCRY_LIBCOMPAT_H
+
+const char *_gcry_compat_identification (void);
+
+
+#ifndef HAVE_GETPID
+pid_t _gcry_getpid (void);
+#define getpid() _gcry_getpid ()
+#endif
+
+#ifndef HAVE_CLOCK
+clock_t _gcry_clock (void);
+#define clock() _gcry_clock ()
+#endif
+
+
+#endif /*GCRY_LIBCOMPAT_H*/


Property changes on: trunk/compat/libcompat.h
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/configure.ac	2010-01-21 21:36:43 UTC (rev 1420)
@@ -47,7 +47,7 @@
 # If the API is changed in an incompatible way: increment the next counter.
 LIBGCRYPT_CONFIG_API_VERSION=1
 
-NEED_GPG_ERROR_VERSION=1.4
+NEED_GPG_ERROR_VERSION=1.8
 
 is_development_version=my_issvn
 BUILD_REVISION=svn_revision
@@ -55,9 +55,10 @@
 VERSION=$PACKAGE_VERSION
 
 AC_CONFIG_SRCDIR([src/libgcrypt.vers])
-AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+AM_INIT_AUTOMAKE([])
 AM_CONFIG_HEADER(config.h)
 AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_LIBOBJ_DIR([compat])
 AC_CANONICAL_HOST
 AM_MAINTAINER_MODE
 
@@ -170,6 +171,7 @@
 # Other definitions.
 print_egd_notice=no
 have_w32_system=no
+have_w32ce_system=no
 
 # Setup some stuff depending on host.
 case "${host}" in
@@ -177,6 +179,7 @@
       available_random_modules="w32"
       ac_cv_have_dev_random=no
       have_w32_system=yes
+      case "${host}" in *-mingw32ce*) have_w32ce_system=yes ;; esac
       AC_DEFINE(USE_ONLY_8DOT3,1,
                 [set this to limit filenames to the 8.3 format])
       AC_DEFINE(HAVE_DRIVE_LETTERS,1,
@@ -227,13 +230,21 @@
 
 if test "$have_w32_system" = yes; then
    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
+   if test "$have_w32ce_system" = yes; then
+     AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
+   fi
 fi
 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
+AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
 
 
 
 # A printable OS Name is sometimes useful.
 case "${host}" in
+    *-*-mingw32ce*)
+        PRINTABLE_OS_NAME="MingW32CE"
+        ;;
+
     *-*-mingw32*)
         PRINTABLE_OS_NAME="MingW32"
         ;;
@@ -595,6 +606,7 @@
 AC_TYPE_SIZE_T
 AC_TYPE_SIGNAL
 AC_DECL_SYS_SIGLIST
+AC_TYPE_PID_T
 
 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
@@ -718,7 +730,12 @@
 
 GNUPG_CHECK_MLOCK
 
+#
+# Replacement functions.
+#
+AC_REPLACE_FUNCS([getpid clock])
 
+
 #
 # Check wether it is necessary to link against libdl.
 #
@@ -1128,6 +1145,7 @@
 AC_CONFIG_FILES([
 Makefile
 m4/Makefile
+compat/Makefile
 mpi/Makefile
 cipher/Makefile
 random/Makefile

Modified: trunk/ltmain.sh
===================================================================
--- trunk/ltmain.sh	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/ltmain.sh	2010-01-21 21:36:43 UTC (rev 1420)
@@ -1,6 +1,6 @@
 # Generated from ltmain.m4sh.
 
-# ltmain.sh (GNU libtool) 2.2.6
+# ltmain.sh (GNU libtool) 2.2.6b
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
@@ -65,7 +65,7 @@
 #       compiler:		$LTCC
 #       compiler flags:		$LTCFLAGS
 #       linker:		$LD (gnu? $with_gnu_ld)
-#       $progname:		(GNU libtool) 2.2.6 Debian-2.2.6a-4
+#       $progname:		(GNU libtool) 2.2.6b Debian-2.2.6b-2
 #       automake:		$automake_version
 #       autoconf:		$autoconf_version
 #
@@ -73,9 +73,9 @@
 
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION="2.2.6 Debian-2.2.6a-4"
+VERSION="2.2.6b Debian-2.2.6b-2"
 TIMESTAMP=""
-package_revision=1.3012
+package_revision=1.3017
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -7681,15 +7681,15 @@
 
       wrappers_required=yes
       case $host in
+      *cegcc | *mingw32ce* )
+        # Disable wrappers for cegcc, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
       *cygwin* | *mingw* )
         if test "$build_libtool_libs" != yes; then
           wrappers_required=no
         fi
         ;;
-      *cegcc)
-        # Disable wrappers for cegcc, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
       *)
         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
           wrappers_required=no

Modified: trunk/m4/ltversion.m4
===================================================================
--- trunk/m4/ltversion.m4	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/m4/ltversion.m4	2010-01-21 21:36:43 UTC (rev 1420)
@@ -9,15 +9,15 @@
 
 # Generated from ltversion.in.
 
-# serial 3012 ltversion.m4
+# serial 3017 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.2.6])
-m4_define([LT_PACKAGE_REVISION], [1.3012])
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6'
-macro_revision='1.3012'
+[macro_version='2.2.6b'
+macro_revision='1.3017'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])

Modified: trunk/random/random-csprng.c
===================================================================
--- trunk/random/random-csprng.c	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/random/random-csprng.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -682,6 +682,7 @@
 static int
 lock_seed_file (int fd, const char *fname, int for_write)
 {
+#warning Check whether we can lock on Windows.
 #if LOCK_SEED_FILE
   struct flock lck;
   struct timeval tv;
@@ -709,7 +710,7 @@
       if (backoff < 10)
         backoff++ ;
     }
-#endif /*LOCK_SEED_FILE*/
+#endif /*!LOCK_SEED_FILE*/
   return 0;
 }
 

Modified: trunk/random/rndw32.c
===================================================================
--- trunk/random/rndw32.c	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/random/rndw32.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -1,5 +1,6 @@
 /* rndw32.c  -  W32 entropy gatherer
- * Copyright (C) 1999, 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999, 2000, 2002, 2003, 2007,
+ *               2010 Free Software Foundation, Inc.
  * Copyright Peter Gutmann, Matt Thomlinson and Blake Coverett 1996-2006
  *
  * This file is part of Libgcrypt.
@@ -328,6 +329,7 @@
 
 /* Read data from MBM.  This communicates via shared memory, so all we
    need to do is map a file and read the data out.  */
+#ifndef HAVE_W32CE_SYSTEM
 static void
 read_mbm_data (void (*add)(const void*, size_t, enum random_origins), 
                enum random_origins requester)
@@ -350,6 +352,7 @@
       CloseHandle (hMBMData);
     }
 }
+#endif /*!HAVE_W32CE_SYSTEM*/
 
 
 /* Fallback method using the registry to poll the statistics.  */
@@ -556,8 +559,10 @@
     }
   
   read_system_rng ( add, requester );
+#ifndef HAVE_W32CE_SYSTEM
   read_mbm_data ( add, requester );
-  
+#endif  
+
   /* Get network statistics.    Note: Both NT Workstation and NT Server by
      default will be running both the workstation and server services.  The
      heuristic below is probably useful though on the assumption that the
@@ -774,8 +779,13 @@
       OSVERSIONINFO osvi = { sizeof( osvi ) };
 
       GetVersionEx( &osvi );
-      if ( osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)
+#ifdef HAVE_W32CE_SYSTEM
+      if (osvi.dwPlatformId != VER_PLATFORM_WIN32_CE)
+        log_fatal ("can only run on a Windows CE platform\n" );
+#else
+      if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)
         log_fatal ("can only run on a Windows NT platform\n" );
+#endif
       system_is_w2000 = (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0);
       init_system_rng ();
       is_initialized = 1;
@@ -821,23 +831,28 @@
                      memcpy (bufptr, &along, sizeof (along) );  \
                      bufptr += sizeof (along);                  \
                    } while (0)
+#ifdef HAVE_W32CE_SYSTEM
+# define ADD_NO_CE(f)
+#else
+# define ADD_NO_CE(f)  ADD(f)
+#endif
 
     ADD ( GetActiveWindow ());
     ADD ( GetCapture ());
     ADD ( GetClipboardOwner ());
-    ADD ( GetClipboardViewer ());
+    ADD_NO_CE ( GetClipboardViewer ());
     ADD ( GetCurrentProcess ());
     ADD ( GetCurrentProcessId ());
     ADD ( GetCurrentThread ());
     ADD ( GetCurrentThreadId ());
     ADD ( GetDesktopWindow ());
     ADD ( GetFocus ());
-    ADD ( GetInputState ());
+    ADD_NO_CE ( GetInputState ());
     ADD ( GetMessagePos ());
-    ADD ( GetMessageTime ());
+    ADD_NO_CE ( GetMessageTime ());
     ADD ( GetOpenClipboardWindow ());
     ADD ( GetProcessHeap ());
-    ADD ( GetProcessWindowStation ());
+    ADD_NO_CE ( GetProcessWindowStation ());
     ADD ( GetQueueStatus (QS_ALLEVENTS));
     ADD ( GetTickCount ());
 
@@ -883,9 +898,15 @@
     (*add) ( &kernelTime, sizeof (kernelTime), origin );
     (*add) ( &userTime, sizeof (userTime), origin );
 
+#ifdef HAVE_W32CE_SYSTEM
+    handle = GetCurrentThread ();
+    GetThreadTimes (handle, &creationTime, &exitTime,
+                     &kernelTime, &userTime);
+#else
     handle = GetCurrentProcess ();
     GetProcessTimes (handle, &creationTime, &exitTime,
                      &kernelTime, &userTime);
+#endif
     (*add) ( &creationTime, sizeof (creationTime), origin );
     (*add) ( &exitTime, sizeof (exitTime), origin );
     (*add) ( &kernelTime, sizeof (kernelTime), origin );
@@ -893,17 +914,20 @@
 
     /* Get the minimum and maximum working set size for the current
        process.  */
+#ifndef HAVE_W32CE_SYSTEM
     GetProcessWorkingSetSize (handle, &minimumWorkingSetSize,
                               &maximumWorkingSetSize);
     (*add) ( &minimumWorkingSetSize,
              sizeof (minimumWorkingSetSize), origin );
     (*add) ( &maximumWorkingSetSize,
              sizeof (maximumWorkingSetSize), origin );
+#endif /*!HAVE_W32CE_SYSTEM*/
   }
 
 
   /* The following are fixed for the lifetime of the process so we only
    * add them once */
+#ifndef HAVE_W32CE_SYSTEM
   if (!addedFixedItems)
     {
       STARTUPINFO startupInfo;
@@ -916,6 +940,7 @@
       (*add) ( &startupInfo, sizeof (STARTUPINFO), origin );
       addedFixedItems = 1;
     }
+#endif /*!HAVE_W32CE_SYSTEM*/
 
   /* The performance of QPC varies depending on the architecture it's
      running on and on the OS, the MS documentation is vague about the

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/src/Makefile.am	2010-01-21 21:36:43 UTC (rev 1420)
@@ -14,14 +14,15 @@
 # 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
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 
+
 ## Process this file with automake to produce Makefile.in
 
 EXTRA_DIST = Manifest libgcrypt-config.in libgcrypt.m4 libgcrypt.vers \
              gcrypt.h.in libgcrypt.def
+
 bin_SCRIPTS = libgcrypt-config
 m4datadir = $(datadir)/aclocal
 m4data_DATA = libgcrypt.m4
@@ -34,14 +35,23 @@
 bin_PROGRAMS += getrandom
 endif USE_RANDOM_DAEMON
 
+# Depending on the architecture some targets require libgpg-error.
+if HAVE_W32CE_SYSTEM
+arch_gpg_error_cflags = $(GPG_ERROR_CFLAGS)
+arch_gpg_error_libs   = $(GPG_ERROR_LIBS)
+else
+arch_gpg_error_cflags =
+arch_gpg_error_libs   = 
+endif
 
+
 if HAVE_LD_VERSION_SCRIPT
   libgcrypt_version_script_cmd = -Wl,--version-script=$(srcdir)/libgcrypt.vers
 else
   libgcrypt_version_script_cmd = 
 endif
 
-libgcrypt_la_CFLAGS = @GPG_ERROR_CFLAGS@
+libgcrypt_la_CFLAGS = $(GPG_ERROR_CFLAGS)
 libgcrypt_la_SOURCES = g10lib.h visibility.c visibility.h types.h \
 	cipher.h cipher-proto.h \
 	misc.c global.c sexp.c hwfeatures.c \
@@ -94,19 +104,22 @@
 	../cipher/libcipher.la \
 	../random/librandom.la \
 	../mpi/libmpi.la \
-	$(srcdir)/libgcrypt.vers $(gcrypt_deps)
+	../compat/libcompat.la \
+	$(srcdir)/libgcrypt.vers $(gcrypt_deps) 
 libgcrypt_la_LIBADD = $(gcrypt_res) \
 	../cipher/libcipher.la \
 	../random/librandom.la \
-	../mpi/libmpi.la @LTLIBOBJS@ @GPG_ERROR_LIBS@
+	../mpi/libmpi.la \
+	../compat/libcompat.la  $(GPG_ERROR_LIBS)
 
 
 dumpsexp_SOURCES = dumpsexp.c
-dumpsexp_LDADD = 
+dumpsexp_CFLAGS = $(arch_gpg_error_cflags)
+dumpsexp_LDADD = $(arch_gpg_error_libs)
 
 hmac256_SOURCES = hmac256.c
-hmac256_CFLAGS = -DSTANDALONE
-hmac256_LDADD = 
+hmac256_CFLAGS = -DSTANDALONE $(arch_gpg_error_cflags)
+hmac256_LDADD = $(arch_gpg_error_libs)
 
 if USE_RANDOM_DAEMON
 gcryptrnd_SOURCES = gcryptrnd.c

Modified: trunk/src/dumpsexp.c
===================================================================
--- trunk/src/dumpsexp.c	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/src/dumpsexp.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -22,6 +22,11 @@
 #include <assert.h>
 #include <stdarg.h>
 #include <errno.h>
+/* For a native WindowsCE binary we need to include gpg-error.h to
+   provide a replacement for strerror.  */
+#ifdef __MINGW32CE__
+# include <gpg-error.h>
+#endif
 
 #define PGM "dumpsexp"
 #define MYVERSION_LINE PGM " (Libgcrypt) " VERSION

Modified: trunk/src/g10lib.h
===================================================================
--- trunk/src/g10lib.h	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/src/g10lib.h	2010-01-21 21:36:43 UTC (rev 1420)
@@ -201,6 +201,9 @@
 int strcasecmp (const char *a, const char *b) _GCRY_GCC_ATTR_PURE;
 #endif
 
+#include "../compat/libcompat.h"
+
+
 /* Macros used to rename missing functions.  */
 #ifndef HAVE_STRTOUL
 #define strtoul(a,b,c)  ((unsigned long)strtol((a),(b),(c)))

Modified: trunk/src/global.c
===================================================================
--- trunk/src/global.c	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/src/global.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -566,6 +566,8 @@
 
 
     default:
+      /* A call to make sure that the dummy code is linked in.  */
+      _gcry_compat_identification ();
       err = GPG_ERR_INV_OP;
     }
 
@@ -742,7 +744,7 @@
       /* Make sure that ERRNO has been set in case a user supplied
          memory handler didn't it correctly. */
       if (!errno)
-        errno = ENOMEM;
+        gpg_err_set_errno (ENOMEM);
       err = gpg_err_code_from_errno (errno);
     }
   else
@@ -805,7 +807,7 @@
   else
     p =  _gcry_private_realloc (a, n);
   if (!p && !errno)
-    errno = ENOMEM;
+    gpg_err_set_errno (ENOMEM);
   return p;
 }
 
@@ -827,7 +829,7 @@
     _gcry_private_free (p);
 
   if (save_errno)
-    errno = save_errno;
+    gpg_err_set_errno (save_errno);
 }
 
 void *
@@ -840,7 +842,7 @@
                     defined. */
   if (m && bytes / m != n) 
     {
-      errno = ENOMEM;
+      gpg_err_set_errno (ENOMEM);
       return NULL;
     }
 
@@ -860,7 +862,7 @@
                     defined. */
   if (m && bytes / m != n) 
     {
-      errno = ENOMEM;
+      gpg_err_set_errno (ENOMEM);
       return NULL;
     }
   
@@ -958,7 +960,7 @@
   nbytes = n * m; 
   if (m && nbytes / m != n) 
     {
-      errno = ENOMEM;
+      gpg_err_set_errno (ENOMEM);
       _gcry_fatal_error(gpg_err_code_from_errno (errno), NULL );
     }
 
@@ -976,7 +978,7 @@
   nbytes = n * m; 
   if (m && nbytes / m != n) 
     {
-      errno = ENOMEM;
+      gpg_err_set_errno (ENOMEM);
       _gcry_fatal_error(gpg_err_code_from_errno (errno), NULL );
     }
 

Modified: trunk/src/hmac256.c
===================================================================
--- trunk/src/hmac256.c	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/src/hmac256.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -56,6 +56,15 @@
 # include <fcntl.h> /* We need setmode().  */
 #endif
 
+/* For a native WindowsCE binary we need to include gpg-error.h to
+   provide a replacement for strerror.  In other cases we need a
+   replacement macro for gpg_err_set_errno.  */
+#ifdef __MINGW32CE__
+# include <gpg-error.h>
+#else
+# define gpg_err_set_errno(a) (errno = (a))
+#endif
+
 #include "hmac256.h"
 
 
@@ -502,7 +511,7 @@
   if (digestlen > resultsize)
     {
       _gcry_hmac256_release (hd);
-      errno = EINVAL;
+      gpg_err_set_errno (EINVAL);
       return -1;
     }
   memcpy (result, digest, digestlen);

Modified: trunk/src/secmem.c
===================================================================
--- trunk/src/secmem.c	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/src/secmem.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -319,18 +319,23 @@
   /* QNX does not page at all, so the whole secure memory stuff does
    * not make much sense.  However it is still of use because it
    * wipes out the memory on a free().
-   * Therefore it is sufficient to suppress the warning
-   */
+   * Therefore it is sufficient to suppress the warning.  */
+  (void)p;
+  (void)n;
 #elif defined (HAVE_DOSISH_SYSTEM) || defined (__CYGWIN__)
     /* It does not make sense to print such a warning, given the fact that 
-     * this whole Windows !@#$% and their user base are inherently insecure
-     */
+     * this whole Windows !@#$% and their user base are inherently insecure. */
+  (void)p;
+  (void)n;
 #elif defined (__riscos__)
-    /* no virtual memory on RISC OS, so no pages are swapped to disc,
+    /* No virtual memory on RISC OS, so no pages are swapped to disc,
      * besides we don't have mmap, so we don't use it! ;-)
-     * But don't complain, as explained above.
-     */
+     * But don't complain, as explained above.  */
+  (void)p;
+  (void)n;
 #else
+  (void)p;
+  (void)n;
   log_info ("Please note that you don't have secure memory on this system\n");
 #endif
 }

Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/tests/Makefile.am	2010-01-21 21:36:43 UTC (rev 1420)
@@ -36,7 +36,7 @@
 AM_CPPFLAGS = -I../src -I$(top_srcdir)/src
 AM_CFLAGS = $(GPG_ERROR_CFLAGS)
 
-LDADD = ../src/libgcrypt.la $(DL_LIBS)
+LDADD = ../src/libgcrypt.la $(DL_LIBS) ../compat/libcompat.la
 
 EXTRA_PROGRAMS = testapi pkbench
 noinst_PROGRAMS = $(TESTS) fipsdrv rsacvt

Modified: trunk/tests/benchmark.c
===================================================================
--- trunk/tests/benchmark.c	2010-01-21 13:33:34 UTC (rev 1419)
+++ trunk/tests/benchmark.c	2010-01-21 21:36:43 UTC (rev 1420)
@@ -32,6 +32,7 @@
 
 #ifdef _GCRYPT_IN_LIBGCRYPT
 # include "../src/gcrypt.h"
+# include "../compat/libcompat.h"
 #else
 # include <gcrypt.h>
 #endif
@@ -290,9 +291,15 @@
 start_timer (void)
 {
 #ifdef _WIN32
+#ifdef __MINGW32CE__
+  GetThreadTimes (GetCurrentThread (),
+                   &started_at.creation_time, &started_at.exit_time,
+                   &started_at.kernel_time, &started_at.user_time);
+#else
   GetProcessTimes (GetCurrentProcess (),
                    &started_at.creation_time, &started_at.exit_time,
                    &started_at.kernel_time, &started_at.user_time);
+#endif
   stopped_at = started_at;
 #else
   struct tms tmp;
@@ -306,9 +313,15 @@
 stop_timer (void)
 {
 #ifdef _WIN32
+#ifdef __MINGW32CE__
+  GetThreadTimes (GetCurrentThread (),
+                   &stopped_at.creation_time, &stopped_at.exit_time,
+                   &stopped_at.kernel_time, &stopped_at.user_time);
+#else
   GetProcessTimes (GetCurrentProcess (),
                    &stopped_at.creation_time, &stopped_at.exit_time,
                    &stopped_at.kernel_time, &stopped_at.user_time);
+#endif
 #else
   struct tms tmp;
 




More information about the Gnupg-commits mailing list