From 3eff0ccc9115c4c5d52aff7201f8fb6d604408e7 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 15 Apr 2004 09:00:22 +0000 Subject: About to release 1.2 --- ChangeLog | 9 ++- NEWS | 8 ++- README | 30 +++------ configure.ac | 6 +- src/ChangeLog | 13 ++++ src/Manifest | 56 ++++++++++++++++ src/ath-pth.c | 177 --------------------------------------------------- src/ath-pthread.c | 175 -------------------------------------------------- src/gcrypt.h | 16 ++--- src/global.c | 68 +++++++++++++------- src/misc.c | 8 +-- src/missing-string.c | 3 +- src/secmem.c | 13 ++-- src/string.c | 47 -------------- 14 files changed, 154 insertions(+), 475 deletions(-) create mode 100644 src/Manifest delete mode 100644 src/ath-pth.c delete mode 100644 src/ath-pthread.c delete mode 100644 src/string.c diff --git a/ChangeLog b/ChangeLog index 611e86c6..dab1ecc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-04-15 Werner Koch + + Released 1.2.0. + + * configure.ac: Set LT to C12/A1/R1. + 2004-04-06 Werner Koch * config.guess, config.sub, ltmain.sh: Updated to those from @@ -948,7 +954,8 @@ Fri Feb 13 19:43:41 1998 Werner Koch (wk@isil.d.shuttle.de) * Makefile.am: Likewise - Copyright 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, + 2004 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 diff --git a/NEWS b/NEWS index 9deb1771..f5d3f1dc 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ -Noteworthy changes in version 1. -------------------------------------------------- +Noteworthy changes in version 1.2.0 (2004-04-15) +------------------------------------------------ + + * First stable release. Noteworthy changes in version 1.1.94 (2004-03-29) @@ -379,7 +381,7 @@ Noteworthy changes in version 1.1.3 (2001-05-31) into into libgcrypt and GnuPG. -Copyright 2001, 2002, 2003 Free Software Foundation, Inc. +Copyright 2001, 2002, 2003, 2004 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 diff --git a/README b/README index 276ed778..423b7de3 100644 --- a/README +++ b/README @@ -1,10 +1,6 @@ libgcrypt - The GNU crypto library ------------------------------------ - Version 1.1.94 - - THIS IS A PRE-RELEASE FOR THE FIRST STABLE VERSION 1.2.0, TO BE - RELEASED RSN. - + Version 1.2.0 Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc. @@ -32,22 +28,6 @@ installed correctly before Libgcrypt is to be built. - CVS - --- - - If you are using the CVS version, make sure that you have the - latest GNU build tools installed and run ./autogen.sh before - trying to build the library. Instead of running autogen.sh, - something like `autoreconf -i --symlink' can be used to prepare - the tree for building as well. - - You also need to enable maintainer mode at configure time with the - `--enable-maintainer-mode' configure switch; without this switch, - the documentation can not be build, since the file `version.texi', - which is needed for building the documentation, will only be - generated, if maintainer mode is enabled. - - Mailing List ------------ @@ -116,7 +96,7 @@ option to disable the use of version scripts. Note, that you should never ever use an undocumented symbol or one which is prefixed with - an underscore. + an underscore. --enable-ciphers=list --enable-pubkey-ciphers=list @@ -128,3 +108,9 @@ data types. With these switches it is possible to select exactly those algorithm modules, which should be built. + + Contact + ------- + + See the file AUTHORS. + diff --git a/configure.ac b/configure.ac index a55988e2..15194b9d 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ min_automake_version="1.7.6" # but remove a "-cvs" prefix right *before* a release and append it # soon later. -AC_INIT(libgcrypt, 1.1.95-cvs, bug-libgcrypt@gnupg.org) +AC_INIT(libgcrypt, 1.2.0, bug-libgcrypt@gnupg.org) # LT Version numbers, remember to change them just *before* a release. # (Interfaces removed: CURRENT++, AGE=0, REVISION=0) @@ -35,7 +35,7 @@ AC_INIT(libgcrypt, 1.1.95-cvs, bug-libgcrypt@gnupg.org) # (No interfaces changed: REVISION++) LIBGCRYPT_LT_CURRENT=12 LIBGCRYPT_LT_AGE=1 -LIBGCRYPT_LT_REVISION=0 +LIBGCRYPT_LT_REVISION=1 # If the API is changed in an incompatible way: increment the next counter. LIBGCRYPT_CONFIG_API_VERSION=1 @@ -823,5 +823,3 @@ fi # Give some feedback echo " Configured for: $PRINTABLE_OS_NAME ($target)" echo - - diff --git a/src/ChangeLog b/src/ChangeLog index 78bfefbd..6d39fe30 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2004-04-15 Werner Koch + + * secmem.c (_gcry_secmem_malloc_internal): Removed old extra info + error output. + (_gcry_secmem_term): Use wipememory2 here. + + * misc.c (_gcry_burn_stack): Use wipememory to avoid optimizations. + + * string.c: Removed. Was never used. + * global.c (gcry_strdup): Replaced by the version from string.c + (gcry_xstrdup): Rewritten. + * gcrypt.h: Removed duplicate prototype for gcry_strdup. + 2004-03-29 Werner Koch * secmem.c (_gcry_secmem_realloc): Fixed double unlock; bug diff --git a/src/Manifest b/src/Manifest new file mode 100644 index 00000000..acf86ce5 --- /dev/null +++ b/src/Manifest @@ -0,0 +1,56 @@ +# Manifest - checksums of the src directory +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of Libgcrypt. +# +# Libgcrypt is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser general Public License as +# published by the Free Software Foundation; either version 2.1 of +# the License, or (at your option) any later version. +# +# Libgcrypt is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +# Checksums for all source files in this directory. Format is +# filename, blanks, base-64 part of an OpenPGP detached signature +# without the header lines. Blank lines and lines beginning with a +# hash mark are ignored. A tool to process this file is available by +# cvs -d :pserver:anoncvs@cvs.gnupg.org:/cvs/wk co misc-scripts/manifest-tool +# +# The special entry "$names$" holds a signature over all sorted +# filenames excluding itself. + +gcrypt.h iQCVA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FwzEAnp832S/7AQJJ4wP9E3jVkcO9M0YtSBHIbjG3hDWKWXzi86AlUh51qiE8/2XP0FfjA4TosyvmicZs7j48HitAByr9tHOSxnbeo7NBf17ICwAo6Eqty+wKDg+eyLeEGUy7VpVK3RJRQAA4H+kl3S2l3YMTKf3WJlbc7qkWSXZspdy5c9sAxeodCKrAubU==oALf + +global.c iQCVAwUAQH5HFzEAnp832S/7AQJc+QQAvi53ZkMCzLnVULHvhI6W+EX537zi9n8cplYguvIJqUhAZrP68yGAIyqyCONbZVDyB7wqeXdUMLzMk7W8fg+xuk5JSDpppAQf2m/bdQyze6XVqJso682eYBM8+b9z/IVEvLaFwhZcOKO1bcXudBlBCcJgVDpupfTtAWgPnewil9Q==Xwy1 +misc.c iQCVAwUAQH5IIjEAnp832S/7AQKNJAQAkEpyY3fCG7tvADJFAW9xA7DEQwLCa8YmiUhHvrEsWOI4YgvS7LUbWWc7VqK+ryORvXLKRAVieznbnHAuy0TKtqdnmA/kUmiurS0ah5SWqR/iuAeJtt0RGsmZaZ6oa2m4PZ2Y2GCHSTZqcclvwsetS9eq5AipxHxYFUltu5wGZNI==twM2 +missing-string.c iQCVAwUAQH5JfjEAnp832S/7AQI3ZQQAg55eEJbGQQHyBEJGxvt/FXpQiXcoDit3ZHzvdaQn/NUgdLjCHiWVzhyCXACGivLWMNModDaSaZk073NXxVkWfPcX9vkF//Wugwzidd5P3Bfu5k35o+Xxz82fsk5KuFGGq1mBUZ07xUYQ8KkKkhADUkr0QiQAuypp079Yq0uUC7Q==zvKn +module.c iQCVAwUAQH5JvjEAnp832S/7AQKlMgQAjZYTXMpWb5kHxCMXzRi069Ku/4/xnWsD+S0dje1LiKzCnRpwTTxARzc/y10Y8OcygkMuR4unEaWedO+9syjjty3fBCcue/j7YlLitq5EC9UE4o23poWvWCuX9Tadm2DK5qf4p7smMJ22O22cLTYTVCyAoYTQ2xC8ajzBsBRkX80==yRRD +secmem.c iQCVAwUAQH5LLDEAnp832S/7AQKtFwQAw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.c b/src/ath-pth.c deleted file mode 100644 index b3c9dab2..00000000 --- a/src/ath-pth.c +++ /dev/null @@ -1,177 +0,0 @@ -/* ath-pth.c - Pth module for self-adapting thread-safeness library - Copyright (C) 2002, 2003 g10 Code GmbH - - 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 - General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with Libgcrypt; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include - -#include "ath.h" - - -/* The lock we take while checking for lazy lock initialization. */ -static pth_mutex_t check_init_lock = PTH_MUTEX_INIT; - -/* Initialize the mutex *PRIV. If JUST_CHECK is true, only do this if - it is not already initialized. */ -static int -mutex_pth_init (ath_mutex_t *priv, int just_check) -{ - int err = 0; - - if (just_check) - pth_mutex_acquire (&check_init_lock, 0, NULL); - if (!*priv || !just_check) - { - pth_mutex_t *lock = malloc (sizeof (pth_mutex_t)); - if (!lock) - err = ENOMEM; - if (!err) - { - err = pth_mutex_init (lock); - if (err == FALSE) - err = errno; - else - err = 0; - - if (err) - free (lock); - else - *priv = (ath_mutex_t) lock; - } - } - if (just_check) - pth_mutex_release (&check_init_lock); - return err; -} - - -void -ath_init (void) -{ - /* Nothing to do. */ -} - - -int -ath_mutex_init (ath_mutex_t *lock) -{ - return mutex_pth_init (lock, 0); -} - - -int -ath_mutex_destroy (ath_mutex_t *lock) -{ - int err = mutex_pth_init (lock, 1); - if (!err) - { - /* GNU Pth has no destructor function. */ - free (*lock); - } - return err; -} - - -int -ath_mutex_lock (ath_mutex_t *lock) -{ - int ret = mutex_pth_init (lock, 1); - if (ret) - return ret; - - ret = pth_mutex_acquire ((pth_mutex_t *) *lock, 0, NULL); - return ret == FALSE ? errno : 0; -} - - -int -ath_mutex_unlock (ath_mutex_t *lock) -{ - int ret = mutex_pth_init (lock, 1); - if (ret) - return ret; - - ret = pth_mutex_release ((pth_mutex_t *) *lock); - return ret == FALSE ? errno : 0; -} - - -ssize_t -ath_read (int fd, void *buf, size_t nbytes) -{ - return pth_read (fd, buf, nbytes); -} - - -ssize_t -ath_write (int fd, const void *buf, size_t nbytes) -{ - return pth_write (fd, buf, nbytes); -} - - -ssize_t -ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, - struct timeval *timeout) -{ - return pth_select (nfd, rset, wset, eset, timeout); -} - - -ssize_t -ath_waitpid (pid_t pid, int *status, int options) -{ - return pth_waitpid (pid, status, options); -} - - -int -ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr) -{ - return pth_accept (s, addr, length_ptr); -} - - -int -ath_connect (int s, struct sockaddr *addr, socklen_t length) -{ - return pth_connect (s, addr, length); -} - -int -ath_sendmsg (int s, const struct msghdr *msg, int flags) -{ - /* FIXME: GNU Pth is missing pth_sendmsg. */ - return sendmsg (s, msg, flags); -} - - -int -ath_recvmsg (int s, struct msghdr *msg, int flags) -{ - /* FIXME: GNU Pth is missing pth_recvmsg. */ - return recvmsg (s, msg, flags); -} - diff --git a/src/ath-pthread.c b/src/ath-pthread.c deleted file mode 100644 index b076fc92..00000000 --- a/src/ath-pthread.c +++ /dev/null @@ -1,175 +0,0 @@ -/* ath-pthread.c - PThread module for self-adapting thread-safeness library - Copyright (C) 2002 g10 Code GmbH - - 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 - General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with Libgcrypt; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#ifdef HAVE_SYS_SELECT_H -# include -#else -# include -#endif -#include -#include - -#include - -#include "ath.h" - - -/* The lock we take while checking for lazy lock initialization. */ -static pthread_mutex_t check_init_lock = PTHREAD_MUTEX_INITIALIZER; - -/* Initialize the mutex *PRIV. If JUST_CHECK is true, only do this if - it is not already initialized. */ -static int -mutex_pthread_init (ath_mutex_t *priv, int just_check) -{ - int err = 0; - - if (just_check) - pthread_mutex_lock (&check_init_lock); - if (!*priv || !just_check) - { - pthread_mutex_t *lock = malloc (sizeof (pthread_mutex_t)); - if (!lock) - err = ENOMEM; - if (!err) - { - err = pthread_mutex_init (lock, NULL); - if (err) - free (lock); - else - *priv = (ath_mutex_t) lock; - } - } - if (just_check) - pthread_mutex_unlock (&check_init_lock); - return err; -} - - -void -ath_init (void) -{ - /* Nothing to do. */ -} - - -int -ath_mutex_init (ath_mutex_t *lock) -{ - return mutex_pthread_init (lock, 0); -} - - -int -ath_mutex_destroy (ath_mutex_t *lock) -{ - int err = mutex_pthread_init (lock, 1); - if (!err) - { - err = pthread_mutex_destroy ((pthread_mutex_t *) *lock); - free (*lock); - } - return err; -} - - -int -ath_mutex_lock (ath_mutex_t *lock) -{ - int ret = mutex_pthread_init (lock, 1); - if (ret) - return ret; - - return pthread_mutex_lock ((pthread_mutex_t *) *lock); -} - - -int -ath_mutex_unlock (ath_mutex_t *lock) -{ - int ret = mutex_pthread_init (lock, 1); - if (ret) - return ret; - - return pthread_mutex_unlock ((pthread_mutex_t *) *lock); -} - - -ssize_t -ath_read (int fd, void *buf, size_t nbytes) -{ - return read (fd, buf, nbytes); -} - - -ssize_t -ath_write (int fd, const void *buf, size_t nbytes) -{ - return write (fd, buf, nbytes); -} - - -ssize_t -ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, - struct timeval *timeout) -{ - return select (nfd, rset, wset, eset, timeout); -} - - -ssize_t -ath_waitpid (pid_t pid, int *status, int options) -{ - return waitpid (pid, status, options); -} - - -int -ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr) -{ - return accept (s, addr, length_ptr); -} - - -int -ath_connect (int s, struct sockaddr *addr, socklen_t length) -{ - return connect (s, addr, length); -} - -int -ath_sendmsg (int s, const struct msghdr *msg, int flags) -{ - return sendmsg (s, msg, flags); -} - - -int -ath_recvmsg (int s, struct msghdr *msg, int flags) -{ - return recvmsg (s, msg, flags); -} diff --git a/src/gcrypt.h b/src/gcrypt.h index e0da89ff..49ac53f9 100644 --- a/src/gcrypt.h +++ b/src/gcrypt.h @@ -40,13 +40,13 @@ extern "C" { #endif #endif -/* The version of this header should match the one of the library It +/* The version of this header should match the one of the library. It should not be used by a program because gcry_check_version() should return the same version. The purpose of this macro is to let autoconf (using the AM_PATH_GCRYPT macro) check that this header matches the installed library. Note: Do not edit the next line as configure may fix the string here. */ -#define GCRYPT_VERSION "1.1.95-cvs" +#define GCRYPT_VERSION "1.2.0" /* Internal: We can't use the convenience macros for the multi precision integer functions when building this library. */ @@ -77,7 +77,7 @@ extern "C" { #define _GCRY_GCC_ATTR_MALLOC __attribute__ ((__malloc__)) #endif -#endif +#endif /*__GNUC__*/ #ifndef _GCRY_GCC_ATTR_DEPRECATED #define _GCRY_GCC_ATTR_DEPRECATED @@ -128,7 +128,7 @@ gcry_err_source (gcry_error_t err) /* Return a pointer to a string containing a description of the error code in the error value ERR. */ -const char * gcry_strerror (gcry_error_t err); +const char *gcry_strerror (gcry_error_t err); /* Return a pointer to a string containing a description of the error source in the error value ERR. */ @@ -1248,7 +1248,7 @@ gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen); version of the gcry_md_write function. */ #define gcry_md_putc(h,c) \ do { \ - gcry_md_hd_t h__ = (h); \ + gcry_md_hd_t h__ = (h); \ if( (h__)->bufpos == (h__)->bufsize ) \ gcry_md_write( (h__), NULL, 0 ); \ (h__)->buf[(h__)->bufpos++] = (c) & 0xff; \ @@ -1485,12 +1485,6 @@ void gcry_free (void *a); /* Return true if A is allocated in "secure" memory. */ int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE; -/* Create and return a copy of the null-terminated string STRING. If - it is contained in secure memory, the copy will be contained in - secure memory as well. In an out-of-memory condition, NULL is - returned. */ -char *gcry_strdup (const char *string); - /* Include support for Libgcrypt modules. */ #include diff --git a/src/global.c b/src/global.c index 162e8451..9e7165b2 100644 --- a/src/global.c +++ b/src/global.c @@ -1,5 +1,6 @@ /* global.c - global control functions - * Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + * 2004 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -159,13 +160,6 @@ gcry_control (enum gcry_ctl_cmds cmd, ...) va_start (arg_ptr, cmd); switch (cmd) { -#if 0 - case GCRYCTL_NO_MEM_IS_FATAL: - break; - case GCRYCTL_SET_FATAL_FNC: - break; -#endif - case GCRYCTL_ENABLE_M_GUARD: _gcry_private_enable_m_guard (); break; @@ -463,13 +457,13 @@ gcry_realloc (void *a, size_t n) void gcry_free( void *p ) { - if( !p ) - return; + if( !p ) + return; - if( free_func ) - free_func( p ); - else - _gcry_private_free( p ); + if (free_func) + free_func (p); + else + _gcry_private_free (p); } void * @@ -513,13 +507,27 @@ gcry_calloc_secure (size_t n, size_t m) } +/* Create and return a copy of the null-terminated string STRING. If + it is contained in secure memory, the copy will be contained in + secure memory as well. In an out-of-memory condition, NULL is + returned. */ char * -gcry_strdup( const char *string ) +gcry_strdup (const char *string) { - void *p = gcry_malloc( strlen(string)+1 ); - if (p) - strcpy (p, string); - return p; + char *string_cp = NULL; + size_t string_n = 0; + + string_n = strlen (string); + + if (gcry_is_secure (string)) + string_cp = gcry_malloc_secure (string_n + 1); + else + string_cp = gcry_malloc (string_n + 1); + + if (string_cp) + strcpy (string_cp, string); + + return string_cp; } @@ -583,11 +591,25 @@ gcry_xcalloc_secure( size_t n, size_t m ) } char * -gcry_xstrdup( const char *string ) +gcry_xstrdup (const char *string) { - void *p = gcry_xmalloc( strlen(string)+1 ); - strcpy( p, string ); - return p; + char *p; + + while ( !(p = gcry_strdup (string)) ) + { + size_t n = strlen (string); + int is_sec = !!gcry_is_secure (string); + + if (!outofcore_handler + || !outofcore_handler (outofcore_handler_value, n, is_sec) ) + { + _gcry_fatal_error (gpg_err_code_from_errno (errno), + is_sec? _("out of core in secure memory"):NULL); + } + } + + strcpy( p, string ); + return p; } diff --git a/src/misc.c b/src/misc.c index 94987cfa..6b630e6d 100644 --- a/src/misc.c +++ b/src/misc.c @@ -66,14 +66,14 @@ write2stderr( const char *s ) write( 2, s, strlen(s) ); } -/**************** +/* * This function is called for fatal errors. A caller might want to - * set his own handler becuase this function simply calls abort(). + * set his own handler because this function simply calls abort(). */ void _gcry_fatal_error (int rc, const char *text) { - if (! text) /* get a default text */ + if ( !text ) /* get a default text */ text = gpg_strerror (rc); if (fatal_error_handler) @@ -234,7 +234,7 @@ _gcry_burn_stack (int bytes) { char buf[64]; - memset (buf, 0, sizeof buf); + wipememory (buf, sizeof buf); bytes -= sizeof buf; if (bytes > 0) _gcry_burn_stack (bytes); diff --git a/src/missing-string.c b/src/missing-string.c index b648d292..80ff0521 100644 --- a/src/missing-string.c +++ b/src/missing-string.c @@ -1,5 +1,6 @@ /* missing-string.c - missing string utilities - * Copyright (C) 1994, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + * Copyright (C) 1994, 1998, 1999, 2000, 2001, + * 2003 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * diff --git a/src/secmem.c b/src/secmem.c index 544326eb..163bf20e 100644 --- a/src/secmem.c +++ b/src/secmem.c @@ -477,8 +477,7 @@ _gcry_secmem_malloc_internal (size_t size) if (!pool_okay) { log_info (_ - ("operation is not possible without initialized secure memory\n")); - log_info (_("(you may have used the wrong program for this task)\n")); + ("operation is not possible without initialized secure memory\n")); exit (2); } if (show_warning && !suspend_warning) @@ -487,7 +486,7 @@ _gcry_secmem_malloc_internal (size_t size) print_warn (); } - /* blocks are always a multiple of 32 */ + /* Blocks are always a multiple of 32. */ size = ((size + 31) / 32) * 32; mb = mb_get_new ((memblock_t *) pool, size); @@ -612,10 +611,10 @@ _gcry_secmem_term () if (!pool_okay) return; - memset (pool, 0xff, pool_size); - memset (pool, 0xaa, pool_size); - memset (pool, 0x55, pool_size); - memset (pool, 0x00, pool_size); + wipememory2 (pool, 0xff, pool_size); + wipememory2 (pool, 0xaa, pool_size); + wipememory2 (pool, 0x55, pool_size); + wipememory2 (pool, 0x00, pool_size); #if HAVE_MMAP if (pool_is_mmapped) munmap (pool, pool_size); diff --git a/src/string.c b/src/string.c deleted file mode 100644 index 9a5158eb..00000000 --- a/src/string.c +++ /dev/null @@ -1,47 +0,0 @@ -/* string.c - String functions - Copyright (C) 2003, Free Software Foundation, Inc. - - This file is part of Libgcrypt. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. */ - -#include - -#include -#include "g10lib.h" - -/* Create and return a copy of the null-terminated string STRING. If - it is contained in secure memory, the copy will be contained in - secure memory as well. In an out-of-memory condition, NULL is - returned. */ -char * -gcry_strdup (const char *string) -{ - char *string_cp = NULL; - size_t string_n = 0; - - string_n = strlen (string); - - if (gcry_is_secure (string)) - string_cp = gcry_malloc_secure (string_n + 1); - else - string_cp = gcry_malloc (string_n + 1); - - if (string_cp) - memcpy (string_cp, string, string_n + 1); - - return string_cp; -} -- cgit v1.2.1