
Eigenschaftsänderungen: mpi
___________________________________________________________________
Name: svn:ignore
   - Makefile.in
Makefile
asm-syntax.h
mpi-asm-defs.h
mpih-add1.S
mpih-lshift.S
mpih-mul1.S
mpih-mul2.S
mpih-mul3.S
mpih-rshift.S
mpih-sub1.S
sysdep.h

   + .deps
.libs
Makefile
Makefile.in
asm-syntax.h
mod-source-info.h
mpi-asm-defs.h
mpih-add1.S
mpih-add1.c
mpih-lshift.S
mpih-lshift.c
mpih-mul1.S
mpih-mul1.c
mpih-mul2.S
mpih-mul2.c
mpih-mul3.S
mpih-mul3.c
mpih-rshift.S
mpih-rshift.c
mpih-sub1.S
mpih-sub1.c
sysdep.h


Index: mpi/mpi-bit.c
===================================================================
--- mpi/mpi-bit.c	(Revision 1279)
+++ mpi/mpi-bit.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
Index: mpi/mpi-cmp.c
===================================================================
--- mpi/mpi-cmp.c	(Revision 1279)
+++ mpi/mpi-cmp.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/mpi-div.c
===================================================================
--- mpi/mpi-div.c	(Revision 1279)
+++ mpi/mpi-div.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/mpi-mpow.c
===================================================================
--- mpi/mpi-mpow.c	(Revision 1279)
+++ mpi/mpi-mpow.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/mpi-add.c
===================================================================
--- mpi/mpi-add.c	(Revision 1279)
+++ mpi/mpi-add.c	(Arbeitskopie)
@@ -24,7 +24,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 
Index: mpi/mpi-mul.c
===================================================================
--- mpi/mpi-mul.c	(Revision 1279)
+++ mpi/mpi-mul.c	(Arbeitskopie)
@@ -24,7 +24,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/mpiutil.c
===================================================================
--- mpi/mpiutil.c	(Revision 1279)
+++ mpi/mpiutil.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: mpi/mpi-pow.c
===================================================================
--- mpi/mpi-pow.c	(Revision 1279)
+++ mpi/mpi-pow.c	(Arbeitskopie)
@@ -24,7 +24,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: mpi/mpi-inline.c
===================================================================
--- mpi/mpi-inline.c	(Revision 1279)
+++ mpi/mpi-inline.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 
Index: mpi/mpicoder.c
===================================================================
--- mpi/mpicoder.c	(Revision 1279)
+++ mpi/mpicoder.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
Index: mpi/mpi-scan.c
===================================================================
--- mpi/mpi-scan.c	(Revision 1279)
+++ mpi/mpi-scan.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/mpih-div.c
===================================================================
--- mpi/mpih-div.c	(Revision 1279)
+++ mpi/mpih-div.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/mpi-inv.c
===================================================================
--- mpi/mpi-inv.c	(Revision 1279)
+++ mpi/mpi-inv.c	(Arbeitskopie)
@@ -17,7 +17,9 @@
  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/mpi-gcd.c
===================================================================
--- mpi/mpi-gcd.c	(Revision 1279)
+++ mpi/mpi-gcd.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/mpih-mul.c
===================================================================
--- mpi/mpih-mul.c	(Revision 1279)
+++ mpi/mpih-mul.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: mpi/Makefile.am
===================================================================
--- mpi/Makefile.am	(Revision 1279)
+++ mpi/Makefile.am	(Arbeitskopie)
@@ -21,9 +21,7 @@
 # I was not able to build it with 64Megs - 1.6 fixes this.
 # not anymore required: AUTOMAKE_OPTIONS = 1.6
 
-# 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_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/mpi
 AM_CFLAGS = $(GPG_ERROR_CFLAGS)
 
 AM_ASFLAGS = $(MPI_SFLAGS)
Index: mpi/generic/udiv-w-sdiv.c
===================================================================
--- mpi/generic/udiv-w-sdiv.c	(Revision 1279)
+++ mpi/generic/udiv-w-sdiv.c	(Arbeitskopie)
@@ -20,7 +20,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/generic/mpih-add1.c
===================================================================
--- mpi/generic/mpih-add1.c	(Revision 1279)
+++ mpi/generic/mpih-add1.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/generic/mpih-lshift.c
===================================================================
--- mpi/generic/mpih-lshift.c	(Revision 1279)
+++ mpi/generic/mpih-lshift.c	(Arbeitskopie)
@@ -24,7 +24,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/generic/mpih-sub1.c
===================================================================
--- mpi/generic/mpih-sub1.c	(Revision 1279)
+++ mpi/generic/mpih-sub1.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/generic/mpih-mul1.c
===================================================================
--- mpi/generic/mpih-mul1.c	(Revision 1279)
+++ mpi/generic/mpih-mul1.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/generic/mpih-mul2.c
===================================================================
--- mpi/generic/mpih-mul2.c	(Revision 1279)
+++ mpi/generic/mpih-mul2.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/generic/mpih-rshift.c
===================================================================
--- mpi/generic/mpih-rshift.c	(Revision 1279)
+++ mpi/generic/mpih-rshift.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"
Index: mpi/generic/mpih-mul3.c
===================================================================
--- mpi/generic/mpih-mul3.c	(Revision 1279)
+++ mpi/generic/mpih-mul3.c	(Arbeitskopie)
@@ -25,7 +25,9 @@
  *	 to avoid revealing of sensitive data due to paging etc.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include "mpi-internal.h"

Eigenschaftsänderungen: src
___________________________________________________________________
Name: svn:ignore
   - Makefile.in
Makefile
gcrypt.h
gcryptrnd
getrandom
libgcrypt-config

   + .deps
.libs
Makefile
Makefile.in
gcrypt.h
gcryptrnd
getrandom
libgcrypt-config
versioninfo.rc
dumpsexp


Index: src/ath.h
===================================================================
--- src/ath.h	(Revision 1279)
+++ src/ath.h	(Arbeitskopie)
@@ -28,10 +28,12 @@
 #include <sys/socket.h>
 #endif
 #include <gpg-error.h>
+#include <gcrypt.h>
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
-
 /* Define _ATH_EXT_SYM_PREFIX if you want to give all external symbols
    a prefix.  */
 #define _ATH_EXT_SYM_PREFIX _gcry_
Index: src/gcrypt.h.in
===================================================================
--- src/gcrypt.h.in	(Revision 1279)
+++ src/gcrypt.h.in	(Arbeitskopie)
@@ -41,6 +41,8 @@
 
 #include <sys/time.h>
 
+struct msghdr;
+
 /* This is required for error code compatibility. */
 #define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT
 
@@ -1234,7 +1236,7 @@
 typedef enum gcry_ac_em
   {
     GCRY_AC_EME_PKCS_V1_5,
-    GCRY_AC_EMSA_PKCS_V1_5,
+    GCRY_AC_EMSA_PKCS_V1_5
   }
 gcry_ac_em_t;
 
@@ -1242,7 +1244,7 @@
 typedef enum gcry_ac_scheme
   {
     GCRY_AC_ES_PKCS_V1_5,
-    GCRY_AC_SSA_PKCS_V1_5,
+    GCRY_AC_SSA_PKCS_V1_5
   }
 gcry_ac_scheme_t;
 
Index: src/g10lib.h
===================================================================
--- src/g10lib.h	(Revision 1279)
+++ src/g10lib.h	(Arbeitskopie)
@@ -25,10 +25,6 @@
 #ifndef G10LIB_H
 #define G10LIB_H 1
 
-#ifdef _GCRYPT_H
-#error  gcrypt.h already included
-#endif
-
 #ifndef _GCRYPT_IN_LIBGCRYPT 
 #error something is wrong with config.h
 #endif
@@ -251,6 +247,10 @@
 gcry_err_code_t _gcry_pk_init (void);
 gcry_err_code_t _gcry_ac_init (void);
 
+void _gcry_cipher_finalize(void);
+void _gcry_md_finalize(void);
+void _gcry_pk_finalize(void);
+
 gcry_err_code_t _gcry_pk_module_lookup (int id, gcry_module_t *module);
 void _gcry_pk_module_release (gcry_module_t module);
 gcry_err_code_t _gcry_pk_get_elements (int algo, char **enc, char **sig);
Index: src/stdmem.c
===================================================================
--- src/stdmem.c	(Revision 1279)
+++ src/stdmem.c	(Arbeitskopie)
@@ -45,7 +45,9 @@
  *           libc: [ MM functions ]     secmem.c: [ secure MM functions]
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: src/mpi.h
===================================================================
--- src/mpi.h	(Revision 1279)
+++ src/mpi.h	(Arbeitskopie)
@@ -28,11 +28,13 @@
 #ifndef G10_MPI_H
 #define G10_MPI_H
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include "types.h"
 #include "memory.h"
-#include "../mpi/mpi-asm-defs.h"
+#include "mpi-asm-defs.h"
 
 #include "g10lib.h"
 
Index: src/global.c
===================================================================
--- src/global.c	(Revision 1279)
+++ src/global.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -105,6 +107,17 @@
 
 
 
+static void
+global_finalize (void)
+{
+  _gcry_pk_finalize();
+  _gcry_md_finalize();
+  _gcry_cipher_finalize();
+/*  ath_finalize(); */
+  _gcry_random_finalize();
+  any_init_done = 0;
+}
+
 /* Version number parsing.  */
 
 /* This function parses the first portion of the version number S and
@@ -390,6 +403,7 @@
       _gcry_fast_random_poll (); 
       break;
 
+#ifdef USE_RANDOM_DAEMON
     case GCRYCTL_SET_RNDEGD_SOCKET:
 #if USE_RNDEGD
       err = _gcry_rndegd_set_socket_name (va_arg (arg_ptr, const char *));
@@ -408,6 +422,7 @@
       _gcry_random_initialize (1);
       _gcry_use_random_daemon (!! va_arg (arg_ptr, int));
       break;
+#endif /*USE_RANDOM_DAEMON*/
       
       /* This command dumps information pertaining to the
          configuration of libgcrypt to the given stream.  It may be
@@ -420,6 +435,10 @@
       }
       break;
 
+    case GCRYCTL_FINALIZE:
+      global_finalize();
+      break;
+
     default:
       err = GPG_ERR_INV_OP;
     }
Index: src/secmem.c
===================================================================
--- src/secmem.c	(Revision 1279)
+++ src/secmem.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: src/missing-string.c
===================================================================
--- src/missing-string.c	(Revision 1279)
+++ src/missing-string.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: src/sexp.c
===================================================================
--- src/sexp.c	(Revision 1279)
+++ src/sexp.c	(Arbeitskopie)
@@ -20,7 +20,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: src/module.c
===================================================================
--- src/module.c	(Revision 1279)
+++ src/module.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <errno.h>
 #include "g10lib.h"
 
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(Revision 1279)
+++ src/Makefile.am	(Arbeitskopie)
@@ -20,6 +20,7 @@
 
 ## Process this file with automake to produce Makefile.in
 
+INCLUDES = -I$(top_srcdir)/mpi
 EXTRA_DIST = Manifest libgcrypt-config.in libgcrypt.m4 libgcrypt.vers \
              gcrypt.h.in libgcrypt.def
 bin_SCRIPTS = libgcrypt-config
Index: src/misc.c
===================================================================
--- src/misc.c	(Revision 1279)
+++ src/misc.c	(Arbeitskopie)
@@ -17,7 +17,9 @@
  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

Eigenschaftsänderungen: tests
___________________________________________________________________
Name: svn:ignore
   - ac-data
ac-schemes
ac
basic
benchmark
hmac
keygen
keygrip
pkbench
prime
pubkey
register
t-mpi-bit
tsexp

   + .deps
.libs
Makefile
Makefile.in
ac
ac-data
ac-schemes
basic
benchmark
hmac
keygen
keygrip
mpitests
pkbench
prime
pubkey
random
register
t-mpi-bit
tsexp
version


Index: tests/pubkey.c
===================================================================
--- tests/pubkey.c	(Revision 1279)
+++ tests/pubkey.c	(Arbeitskopie)
@@ -125,6 +125,7 @@
   /* Extract data from plaintext.  */
   l = gcry_sexp_find_token (plain0, "value", 0);
   x0 = gcry_sexp_nth_mpi (l, 1, GCRYMPI_FMT_USG);
+  gcry_sexp_release (l);
 
   /* Encrypt data.  */
   rc = gcry_pk_encrypt (&cipher, plain0, pkey);
@@ -170,6 +171,8 @@
   /* Compare.  */
   if (gcry_mpi_cmp (x0, x1))
     die ("data corrupted\n");
+  gcry_mpi_release (x0);
+  gcry_mpi_release (x1);
 }
 
 static void
@@ -205,6 +208,7 @@
 
   check_keys_crypt (pkey, skey, plain, decrypt_fail_code);
   gcry_sexp_release (plain);
+  gcry_mpi_release(x);
 }
 
 static void
@@ -365,5 +369,7 @@
   for (i=0; i < 2; i++)
     check_run ();
   
+  gcry_control (GCRYCTL_FINALIZE);
+
   return 0;
 }
Index: tests/tsexp.c
===================================================================
--- tests/tsexp.c	(Revision 1279)
+++ tests/tsexp.c	(Arbeitskopie)
@@ -64,6 +64,7 @@
 {
   int pass;
   gcry_sexp_t sexp;
+  gcry_mpi_t mpi;
   int idx;
   char *secure_buffer;
   size_t secure_buffer_len;
@@ -94,39 +95,46 @@
         case 0:
           string = ("(public-key (dsa (p #41424344#) (y this_is_y) "
                     "(q #61626364656667#) (g %m)))");
-          
-          if ( gcry_sexp_build (&sexp, NULL, string,
-                                gcry_mpi_set_ui (NULL, 42)) )
+          mpi = gcry_mpi_set_ui (NULL, 42);
+          if ( gcry_sexp_build (&sexp, NULL, string, mpi) )
             {
+              gcry_mpi_release(mpi);
               fail (" scanning `%s' failed\n", string);
               return;
             }
+          gcry_mpi_release(mpi);
           break;
           
         case 1:
           string = ("(public-key (dsa (p #41424344#) (y this_is_y) "
                     "(q %b) (g %m)))");
       
+          mpi = gcry_mpi_set_ui (NULL, 42);
           if ( gcry_sexp_build (&sexp, NULL, string, 
                                 15, "foo\0\x01\0x02789012345",
-                                gcry_mpi_set_ui (NULL, 42)) )
+                                mpi) )
             {
+              gcry_mpi_release(mpi);
               fail (" scanning `%s' failed\n", string);
               return;
             }
+          gcry_mpi_release(mpi);
           break;
 
         case 2:
           string = ("(public-key (dsa (p #41424344#) (y silly_y_value) "
                     "(q %b) (g %m)))");
       
+          mpi = gcry_mpi_set_ui (NULL, 17);
           if ( gcry_sexp_build (&sexp, NULL, string, 
                                 secure_buffer_len, secure_buffer,
-                                gcry_mpi_set_ui (NULL, 17)) )
+                                mpi) )
             {
+              gcry_mpi_release(mpi);
               fail (" scanning `%s' failed\n", string);
               return;
             }
+          gcry_mpi_release(mpi);
           if (!gcry_is_secure (sexp))
             fail ("gcry_sexp_build did not switch to secure memory\n");
           break;
@@ -148,62 +156,58 @@
 
           s1 = gcry_sexp_find_token (sexp, token, strlen(token) );
           if (!s1)
+            fail ("didn't found `%s'\n", token);
+          else
             {
-              fail ("didn't found `%s'\n", token);
-              continue;
-            }
+              p = gcry_sexp_nth_data (s1, 0, &n);
+              if (!p)
+                fail ("no car for `%s'\n", token);
+              else
+                {
+                  info ("car=`%.*s'\n", (int)n, p);
 
-          p = gcry_sexp_nth_data (s1, 0, &n);
-          if (!p)
-            {
-              fail ("no car for `%s'\n", token);
-              continue;
-            }
-          info ("car=`%.*s'\n", (int)n, p);
+                  s2 = gcry_sexp_cdr (s1);
+                  if (!s2) 
+                    fail ("no cdr for `%s'\n", token);
+                  else
+                    {
+                      p = gcry_sexp_nth_data (s2, 0, &n);
+                      if (p)
+                        fail ("data at car of `%s'\n", token);
+                      else if (parm)
+                        {
+                          gcry_sexp_release (s2);
+                          s2 = gcry_sexp_find_token (s1, parm, strlen (parm));
+                          if (!s2)
+                            fail ("didn't found `%s'\n", parm);
+                          else
+                            {
+                              p = gcry_sexp_nth_data (s2, 0, &n);
+                              if (!p) 
+                                fail("no car for `%s'\n", parm );
+                              else
+                                {
+                                  info ("car=`%.*s'\n", (int)n, p);
+                                  p = gcry_sexp_nth_data (s2, 1, &n);
+                                  if (!p) 
+                                    fail("no cdr for `%s'\n", parm );
+                                  else
+                                    {
+                                      info ("cdr=`%.*s'\n", (int)n, p);
 
-          s2 = gcry_sexp_cdr (s1);
-          if (!s2) 
-            {
-              fail ("no cdr for `%s'\n", token);
-              continue;
-            }
-
-          p = gcry_sexp_nth_data (s2, 0, &n);
-          if (p)
-            {
-              fail ("data at car of `%s'\n", token);
-              continue;
-            }
-
-          if (parm)
-            {
-              s2 = gcry_sexp_find_token (s1, parm, strlen (parm));
-              if (!s2)
-                {
-                  fail ("didn't found `%s'\n", parm);
-                  continue;
+                                      a = gcry_sexp_nth_mpi (s2, 0, GCRYMPI_FMT_USG);
+                                      if (!a)
+                                        fail("failed to cdr the mpi for `%s'\n", parm);
+                                      gcry_mpi_release (a);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                  if (s2)
+                    gcry_sexp_release (s2);
                 }
-              p = gcry_sexp_nth_data (s2, 0, &n);
-              if (!p) 
-                {
-                  fail("no car for `%s'\n", parm );
-                  continue;
-                }
-              info ("car=`%.*s'\n", (int)n, p);
-              p = gcry_sexp_nth_data (s2, 1, &n);
-              if (!p) 
-                {
-                  fail("no cdr for `%s'\n", parm );
-                  continue;
-                }
-              info ("cdr=`%.*s'\n", (int)n, p);
-          
-              a = gcry_sexp_nth_mpi (s2, 0, GCRYMPI_FMT_USG);
-              if (!a)
-                {
-                  fail("failed to cdr the mpi for `%s'\n", parm);
-                  continue;
-                }
+              gcry_sexp_release (s1);
             }
         }
      
@@ -426,6 +430,8 @@
   canon_len ();
   back_and_forth ();
   check_sscan ();
+
+  gcry_control (GCRYCTL_FINALIZE);
   
   return error_count? 1:0;
 }
Index: tests/ac-schemes.c
===================================================================
--- tests/ac-schemes.c	(Revision 1279)
+++ tests/ac-schemes.c	(Arbeitskopie)
@@ -320,6 +320,14 @@
       es_checks (handle, key_public, key_secret);
       ssa_checks (handle, key_public, key_secret);
     }
+
+  if(handle)
+    gcry_ac_close (handle);
+
+  if(key_secret)
+    gcry_ac_key_destroy (key_secret);
+  if(key_public)
+    gcry_ac_key_destroy (key_public);
   
   assert (! err);
 }
@@ -342,6 +350,8 @@
     gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
 
   check_run ();
+
+  gcry_control (GCRYCTL_FINALIZE);
   
   return 0;
 }
Index: tests/hmac.c
===================================================================
--- tests/hmac.c	(Revision 1279)
+++ tests/hmac.c	(Arbeitskopie)
@@ -167,5 +167,7 @@
     gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
   check_hmac ();
 
+  gcry_control (GCRYCTL_FINALIZE);
+
   return error_count ? 1 : 0;
 }
Index: tests/testapi.c
===================================================================
--- tests/testapi.c	(Revision 1279)
+++ tests/testapi.c	(Arbeitskopie)
@@ -108,5 +108,7 @@
 	return 1;
     }
 
+    gcry_control (GCRYCTL_FINALIZE);
+
     return 0;
 }
Index: tests/keygrip.c
===================================================================
--- tests/keygrip.c	(Revision 1279)
+++ tests/keygrip.c	(Arbeitskopie)
@@ -140,5 +140,7 @@
 
   check ();
 
+  gcry_control (GCRYCTL_FINALIZE);
+
   return 0;
 }
Index: tests/pkbench.c
===================================================================
--- tests/pkbench.c	(Revision 1279)
+++ tests/pkbench.c	(Arbeitskopie)
@@ -472,5 +472,7 @@
       exit (1);
     }
   
+  gcry_control (GCRYCTL_FINALIZE);
+
   return error_count ? 1 : 0;
 }
Index: tests/prime.c
===================================================================
--- tests/prime.c	(Revision 1279)
+++ tests/prime.c	(Arbeitskopie)
@@ -95,6 +95,7 @@
       gcry_mpi_add_ui (prime, prime, 1);
       err = gcry_prime_check (prime, 0);
       assert (err);
+      gcry_mpi_release(prime);
     }
 }
 
@@ -118,5 +119,7 @@
 
   check_primes ();
 
+  gcry_control (GCRYCTL_FINALIZE);
+
   return 0;
 }
Index: tests/basic.c
===================================================================
--- tests/basic.c	(Revision 1279)
+++ tests/basic.c	(Arbeitskopie)
@@ -1820,6 +1820,8 @@
 
   get_keys_new (&pkey, &skey);
   do_check_one_pubkey (n, skey, pkey, NULL, FLAG_SIGN | FLAG_CRYPT);
+  gcry_sexp_release (pkey);
+  gcry_sexp_release (skey);
 }
 
 /* Run all tests for the public key functions. */
@@ -1983,6 +1985,7 @@
   check_hmac ();
   check_pubkey ();
 
+  gcry_control (GCRYCTL_FINALIZE, 0);
   if (verbose)
     fprintf (stderr, "\nAll tests completed. Errors: %i\n", error_count);
 
Index: tests/keygen.c
===================================================================
--- tests/keygen.c	(Revision 1279)
+++ tests/keygen.c	(Arbeitskopie)
@@ -305,6 +305,8 @@
 
   check_rsa_keys ();
   check_nonce ();
+
+  gcry_control (GCRYCTL_FINALIZE);
   
   return error_count? 1:0;
 }
Index: tests/ac.c
===================================================================
--- tests/ac.c	(Revision 1279)
+++ tests/ac.c	(Arbeitskopie)
@@ -75,6 +75,8 @@
   err = gcry_ac_key_pair_generate (handle, 1024, &rsa_spec, &key_pair, NULL);
   assert (! err);
 
+  gcry_mpi_release(rsa_spec.e);
+
   key_sec = gcry_ac_key_pair_extract (key_pair, GCRY_AC_KEY_SECRET);
   key_copy (handle, GCRY_AC_KEY_SECRET, &key_sec_cp, key_sec);
 
@@ -120,6 +122,11 @@
   }
 
   gcry_ac_close (handle);
+  gcry_ac_data_destroy (data);
+  gcry_mpi_release(x2);
+  gcry_ac_key_destroy(key_sec_cp);
+  gcry_ac_key_destroy(key_pub_cp);
+  gcry_ac_key_pair_destroy(key_pair);
 }
 
 void
@@ -158,5 +165,7 @@
   for (; i > 0; i--)
     check_run ();
   
+  gcry_control (GCRYCTL_FINALIZE);
+
   return 0;
 }
Index: tests/register.c
===================================================================
--- tests/register.c	(Revision 1279)
+++ tests/register.c	(Arbeitskopie)
@@ -100,6 +100,8 @@
     if (list[i] == algorithm)
       ret = 1;
 
+  free(list);
+
   return ret;
 }
 
@@ -166,5 +168,7 @@
   for (; i > 0; i--)
     check_run ();
   
+  gcry_control (GCRYCTL_FINALIZE);
+
   return 0;
 }
Index: tests/benchmark.c
===================================================================
--- tests/benchmark.c	(Revision 1279)
+++ tests/benchmark.c	(Arbeitskopie)
@@ -1046,6 +1046,8 @@
       return 1;
     }
   
+  gcry_control (GCRYCTL_FINALIZE);
+
   return 0;
 }
 
Index: tests/ac-data.c
===================================================================
--- tests/ac-data.c	(Revision 1279)
+++ tests/ac-data.c	(Arbeitskopie)
@@ -180,7 +180,8 @@
  
   gcry_ac_data_destroy (data);
  
-
+  gcry_mpi_release (mpi0);
+  gcry_mpi_release (mpi2);
 }
 
 int
@@ -204,5 +205,7 @@
   for (; i > 0; i--)
     check_run ();
   
+  gcry_control (GCRYCTL_FINALIZE);
+
   return 0;
 }
Index: doc/Makefile.am
===================================================================
--- doc/Makefile.am	(Revision 1279)
+++ doc/Makefile.am	(Arbeitskopie)
@@ -33,3 +33,7 @@
 	  $${user}@cvs.gnupg.org:$${dir} ); \
         rsync -v gcrypt.pdf gcrypt.info $${user}@cvs.gnupg.org:$${dir}
 
+gcrypt.info: version.texi
+
+version.texi: stamp-vti
+

Eigenschaftsänderungen: cipher
___________________________________________________________________
Name: svn:ignore
   - Makefile.in
Makefile

   + .deps
.libs
Makefile.in
Makefile


Index: cipher/pubkey.c
===================================================================
--- cipher/pubkey.c	(Revision 1279)
+++ cipher/pubkey.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -519,14 +521,14 @@
           err = _gcry_dsa_generate2
             (algorithm, nbits, qbits, 0, skey, retfactors);
         }
-#ifdef USE_ELGAMAL
+#if USE_ELGAMAL
       else if (xvalue && pubkey->spec == &_gcry_pubkey_spec_elg)
         {
           err = _gcry_elg_generate_using_x
             (algorithm, nbits, xvalue, skey, retfactors);
         }
 #endif /*USE_ELGAMAL*/
-#ifdef USE_ECC
+#if USE_ECC
       else if (curve_name && pubkey->spec == &_gcry_pubkey_spec_ecdsa)
         {
           err = _gcry_ecc_generate
@@ -805,6 +807,7 @@
   return err;
 }
 
+#if USE_ECC
 /* Internal function used for ecc.  Note, that this function makes use
    of its intimate knowledge about the ECC parameters from ecc.c. */
 static gcry_err_code_t
@@ -887,9 +890,9 @@
     }
   return err;
 }
+#endif
 
 
-
 /****************
  * Convert a S-Exp with either a private or a public key to our
  * internal format. Currently we do only support the following
@@ -933,7 +936,9 @@
   gcry_mpi_t *array;
   gcry_module_t module;
   gcry_pk_spec_t *pubkey;
+#if USE_ECC
   int is_ecc;
+#endif
 
   /* Check that the first element is valid.  */
   list = gcry_sexp_find_token (sexp, 
@@ -955,6 +960,7 @@
   module = gcry_pk_lookup_name (name);
   ath_mutex_unlock (&pubkeys_registered_lock);
   
+#if USE_ECC
   /* Fixme: We should make sure that an ECC key is always named "ecc"
      and not "ecdsa".  "ecdsa" should be used for the signature
      itself.  We need a function to test whether an algorithm given
@@ -962,6 +968,7 @@
      encryption).  For RSA this is easy, but ECC is the first
      algorithm which has many flavours. */
   is_ecc = ( !strcmp (name, "ecdsa") || !strcmp (name, "ecc") );
+#endif
   gcry_free (name);
   
   if (!module)
@@ -978,9 +985,11 @@
     err = gpg_err_code_from_errno (errno);
   if (!err)
     {
+#if USE_ECC
       if (is_ecc)
         err = sexp_elements_extract_ecc (list, elems, array);
       else
+#endif
         err = sexp_elements_extract (list, elems, array, pubkey->name);
     }
   
@@ -2576,6 +2585,20 @@
   return err;
 }
 
+void
+_gcry_pk_finalize(void)
+{
+  if(default_pubkeys_registered)
+  {
+    ath_mutex_lock(&pubkeys_registered_lock);
+    while(pubkeys_registered)
+    {
+      _gcry_module_release(pubkeys_registered);
+    }
+    default_pubkeys_registered = 0;
+    ath_mutex_unlock(&pubkeys_registered_lock);
+  }
+}
 
 gcry_err_code_t
 _gcry_pk_module_lookup (int algorithm, gcry_module_t *module)
Index: cipher/md.c
===================================================================
--- cipher/md.c	(Revision 1279)
+++ cipher/md.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1254,6 +1256,20 @@
   return err;
 }
 
+void
+_gcry_md_finalize(void)
+{
+  if(default_digests_registered)
+  {
+    ath_mutex_lock(&digests_registered_lock);
+    while(digests_registered)
+    {
+      _gcry_module_release(digests_registered);
+    }
+    default_digests_registered = 0;
+    ath_mutex_unlock(&digests_registered_lock);
+  }
+}
 
 int
 gcry_md_is_secure (gcry_md_hd_t a) 
Index: cipher/rndlinux.c
===================================================================
--- cipher/rndlinux.c	(Revision 1279)
+++ cipher/rndlinux.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
Index: cipher/sha512.c
===================================================================
--- cipher/sha512.c	(Revision 1279)
+++ cipher/sha512.c	(Arbeitskopie)
@@ -49,7 +49,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <string.h>
 #include "g10lib.h"
 #include "bithelp.h"
Index: cipher/primegen.c
===================================================================
--- cipher/primegen.c	(Revision 1279)
+++ cipher/primegen.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
Index: cipher/crc.c
===================================================================
--- cipher/crc.c	(Revision 1279)
+++ cipher/crc.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/sha256.c
===================================================================
--- cipher/sha256.c	(Revision 1279)
+++ cipher/sha256.c	(Arbeitskopie)
@@ -36,7 +36,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/cipher.c
===================================================================
--- cipher/cipher.c	(Revision 1279)
+++ cipher/cipher.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1560,6 +1562,21 @@
   return err;
 }
 
+void
+_gcry_cipher_finalize(void)
+{
+  if(default_ciphers_registered)
+  {
+    ath_mutex_lock(&ciphers_registered_lock);
+    while(ciphers_registered)
+    {
+      _gcry_module_release(ciphers_registered);
+    }
+    default_ciphers_registered = 0;
+    ath_mutex_unlock(&ciphers_registered_lock);
+  }
+}
+
 /* Get a list consisting of the IDs of the loaded cipher modules.  If
    LIST is zero, write the number of loaded cipher modules to
    LIST_LENGTH and return.  If LIST is non-zero, the first
Index: cipher/cast5.c
===================================================================
--- cipher/cast5.c	(Revision 1279)
+++ cipher/cast5.c	(Arbeitskopie)
@@ -35,7 +35,9 @@
  *	   ciphertext  = 7A C8 16 D1 6E 9B 30 2E
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/rndw32.c
===================================================================
--- cipher/rndw32.c	(Revision 1279)
+++ cipher/rndw32.c	(Arbeitskopie)
@@ -68,7 +68,9 @@
  *==========
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
Index: cipher/whirlpool.c
===================================================================
--- cipher/whirlpool.c	(Revision 1279)
+++ cipher/whirlpool.c	(Arbeitskopie)
@@ -29,7 +29,9 @@
    from the reference implementation available from
    http://planeta.terra.com.br/informatica/paulobarreto/whirlpool.zip.  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/twofish.c
===================================================================
--- cipher/twofish.c	(Revision 1279)
+++ cipher/twofish.c	(Arbeitskopie)
@@ -36,7 +36,9 @@
  * are unrolled, precomputation tables are used, etc., for maximum speed at
  * some cost in memory consumption. */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h> /* for memcmp() */
Index: cipher/md4.c
===================================================================
--- cipher/md4.c	(Revision 1279)
+++ cipher/md4.c	(Arbeitskopie)
@@ -47,7 +47,9 @@
  * 78901234567890") = e33b4ddc9c38f2199c3e7b164fcc0536
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/md5.c
===================================================================
--- cipher/md5.c	(Revision 1279)
+++ cipher/md5.c	(Arbeitskopie)
@@ -31,7 +31,9 @@
  * "message digest"    F9 6B 69 7D 7C B7 93 8D  52 5A 2F 31 AA F1 61 D0
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/rfc2268.c
===================================================================
--- cipher/rfc2268.c	(Revision 1279)
+++ cipher/rfc2268.c	(Arbeitskopie)
@@ -28,7 +28,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/arcfour.c
===================================================================
--- cipher/arcfour.c	(Revision 1279)
+++ cipher/arcfour.c	(Arbeitskopie)
@@ -23,7 +23,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/elgamal.c
===================================================================
--- cipher/elgamal.c	(Revision 1279)
+++ cipher/elgamal.c	(Arbeitskopie)
@@ -22,7 +22,9 @@
  *   ISBN 0-471-11709-9. Pages 476 ff.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/rndegd.c
===================================================================
--- cipher/rndegd.c	(Revision 1279)
+++ cipher/rndegd.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -27,8 +29,8 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
+/*#include <sys/un.h>*/
+#include "gcrypt.h"
 #include "types.h"
 #include "g10lib.h"
 #include "cipher.h"
Index: cipher/dsa.c
===================================================================
--- cipher/dsa.c	(Revision 1279)
+++ cipher/dsa.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/rmd160.c
===================================================================
--- cipher/rmd160.c	(Revision 1279)
+++ cipher/rmd160.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/tiger.c
===================================================================
--- cipher/tiger.c	(Revision 1279)
+++ cipher/tiger.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/des.c
===================================================================
--- cipher/des.c	(Revision 1279)
+++ cipher/des.c	(Arbeitskopie)
@@ -111,7 +111,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <string.h>	       /* memcpy, memcmp */
 #include "types.h"             /* for byte and u32 typedefs */
Index: cipher/blowfish.c
===================================================================
--- cipher/blowfish.c	(Revision 1279)
+++ cipher/blowfish.c	(Arbeitskopie)
@@ -29,7 +29,9 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/random.c
===================================================================
--- cipher/random.c	(Revision 1279)
+++ cipher/random.c	(Arbeitskopie)
@@ -26,7 +26,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
@@ -390,6 +392,13 @@
 
 
 void
+_gcry_random_finalize (void)
+{
+  if(rndpool) { gcry_free(rndpool); rndpool = 0; }
+  if(keypool) { gcry_free(keypool); keypool = 0; }
+}
+
+void
 _gcry_random_dump_stats ()
 {
   /* FIXME: don't we need proper locking here? -mo.  
@@ -425,17 +434,14 @@
 }
 
 
+#ifdef USE_RANDOM_DAEMON
 void
 _gcry_set_random_daemon_socket (const char *socketname)
 {
-#ifdef USE_RANDOM_DAEMON
   if (daemon_socket_name)
     BUG ();
 
   daemon_socket_name = gcry_xstrdup (socketname);
-#else /*!USE_RANDOM_DAEMON*/
-  (void)socketname;
-#endif /*!USE_RANDOM_DAEMON*/
 }
 
 /* With ONOFF set to 1, enable the use of the daemon.  With ONOFF set
@@ -444,7 +450,6 @@
 int
 _gcry_use_random_daemon (int onoff)
 {
-#ifdef USE_RANDOM_DAEMON
   int last;
   
   /* FIXME: This is not really thread safe. */
@@ -453,11 +458,8 @@
     allow_daemon = onoff;
 
   return last;
-#else /*!USE_RANDOM_DAEMON*/
-  (void)onoff;
-  return 0;
+}
 #endif /*!USE_RANDOM_DAEMON*/
-}
 
 
 /* This function returns true if no real RNG is available or the
Index: cipher/serpent.c
===================================================================
--- cipher/serpent.c	(Revision 1279)
+++ cipher/serpent.c	(Arbeitskopie)
@@ -19,7 +19,9 @@
  * 02111-1307, USA.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <string.h>
 #include <stdio.h>
Index: cipher/ac.c
===================================================================
--- cipher/ac.c	(Revision 1279)
+++ cipher/ac.c	(Arbeitskopie)
@@ -18,7 +18,9 @@
    License along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -722,15 +724,15 @@
       /* Store next S-Expression pair, which is supposed to consist of
 	 a name and an MPI value, in SEXP_TMP.  */
 
-      sexp_tmp = gcry_sexp_nth (sexp_cur, i + skip_name);
-      if (! sexp_tmp)
+      gcry_sexp_t sexp_tmp2 = gcry_sexp_nth (sexp_cur, i + skip_name);
+      if (! sexp_tmp2)
 	{
 	  err = gcry_error (GPG_ERR_INV_SEXP);
 	  break;
 	}
 
       /* Extract name from current S-Expression pair.  */
-      data = gcry_sexp_nth_data (sexp_tmp, 0, &data_n);
+      data = gcry_sexp_nth_data (sexp_tmp2, 0, &data_n);
       string = gcry_malloc (data_n + 1);
       if (! string)
 	{
@@ -741,7 +743,7 @@
       string[data_n] = 0;
 
       /* Extract MPI value.  */
-      mpi = gcry_sexp_nth_mpi (sexp_tmp, 1, 0);
+      mpi = gcry_sexp_nth_mpi (sexp_tmp2, 1, 0);
       if (! mpi)
 	{
 	  err = gcry_error (GPG_ERR_INV_SEXP); /* FIXME? */
@@ -749,17 +751,17 @@
 	}
 
       /* Store named MPI in data_set_new.  */
-      err = gcry_ac_data_set (data_set_new, GCRY_AC_FLAG_DEALLOC, string, mpi);
+      err = gcry_ac_data_set (data_set_new, GCRY_AC_FLAG_COPY |
+                              GCRY_AC_FLAG_DEALLOC, string, mpi);
       if (err)
 	break;
 
-/*       gcry_free (string); */
+      gcry_free (string);
       string = NULL;
-/*       gcry_mpi_release (mpi); */
+      gcry_mpi_release (mpi);
       mpi = NULL;
 
-      gcry_sexp_release (sexp_tmp);
-      sexp_tmp = NULL;
+      gcry_sexp_release (sexp_tmp2);
     }
   if (err)
     goto out;
@@ -1202,11 +1204,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_DEALLOC, value_name, value_mpi);
+      err = _gcry_ac_data_set (data_new, GCRY_AC_FLAG_DEALLOC |
+                               GCRY_AC_FLAG_COPY, value_name, value_mpi);
       if (err)
 	break;
 
       gcry_sexp_release (value_sexp);
+      gcry_mpi_release (value_mpi);
+      gcry_free (value_name);
       value_sexp = NULL;
       value_name = NULL;
       value_mpi = NULL;
@@ -1477,7 +1482,7 @@
   gcry_ac_key_pair_t key_pair_new;
   gcry_ac_key_t key_secret;
   gcry_ac_key_t key_public;
-  gcry_sexp_t key_sexp;
+  gcry_sexp_t key_sexp = NULL;
   gcry_error_t err;
   char *genkey_format;
   size_t genkey_format_n;
@@ -1629,6 +1634,7 @@
   
   gcry_free (genkey_format);
   gcry_free (arg_list);
+  gcry_sexp_release (key_sexp);
   gcry_sexp_release (genkey_sexp_request);
   gcry_sexp_release (genkey_sexp_reply);
   if (err)
@@ -1672,17 +1678,10 @@
 void
 _gcry_ac_key_destroy (gcry_ac_key_t key)
 {
-  unsigned int i;
-
   if (key)
     {
       if (key->data)
-        {
-          for (i = 0; i < key->data->data_n; i++)
-            if (key->data->data[i].mpi != NULL)
-              gcry_mpi_release (key->data->data[i].mpi);
-          gcry_free (key->data);
-        }
+        gcry_ac_data_destroy (key->data);
       gcry_free (key);
     }
 }
Index: cipher/random.h
===================================================================
--- cipher/random.h	(Revision 1279)
+++ cipher/random.h	(Arbeitskopie)
@@ -23,6 +23,7 @@
 #include "types.h"
 
 void _gcry_random_initialize (int full);
+void _gcry_random_finalize(void);
 void _gcry_register_random_progress (void (*cb)(void *,const char*,int,int,int),
                                      void *cb_data );
 void _gcry_random_dump_stats(void);
Index: cipher/rsa.c
===================================================================
--- cipher/rsa.c	(Revision 1279)
+++ cipher/rsa.c	(Arbeitskopie)
@@ -23,7 +23,9 @@
    patent into the public domain on Sep 6th, 2000.
 */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: cipher/rijndael.c
===================================================================
--- cipher/rijndael.c	(Revision 1279)
+++ cipher/rijndael.c	(Arbeitskopie)
@@ -32,7 +32,9 @@
  *------------------------------------------
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h> /* for memcmp() */
Index: cipher/Makefile.am
===================================================================
--- cipher/Makefile.am	(Revision 1279)
+++ cipher/Makefile.am	(Arbeitskopie)
@@ -22,9 +22,7 @@
 
 EXTRA_DIST = Manifest
 
-# 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_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/mpi
 AM_CFLAGS = $(GPG_ERROR_CFLAGS)
 
 
Index: cipher/sha1.c
===================================================================
--- cipher/sha1.c	(Revision 1279)
+++ cipher/sha1.c	(Arbeitskopie)
@@ -29,7 +29,9 @@
  */
 
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
