diff --git a/ChangeLog b/ChangeLog index f192d20a..01c12135 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,1436 +1,1440 @@ +2011-02-18 Werner Koch + + * configure.ac [GCC]: Remove the use of -fno-strict-aliasing. + 2011-02-11 Werner Koch * configure.ac: Add option --disbale-aesni-support. (ENABLE_AESNI_SUPPORT): New macro. 2011-02-04 Werner Koch * autogen.sh: Install the git pre-commit if not yet done. 2010-12-23 Werner Koch * configure.ac (BUILD_REVISION): Use git_revision. 2010-08-19 Werner Koch * configure.ac: Define GPG_ERR_ENABLE_ERRNO_MACROS. Remove definition of _GNU_SOURCE. (AC_GNU_SOURCE): New. 2010-08-16 Werner Koch * configure.ac (INSERT_SYS_SELECT_H): New. 2010-07-09 Werner Koch * configure.ac: Bump LT version to C18/A7/R0 to prepare a backport of a new API to the 1.4 series. 2010-04-19 Marcus Brinkmann * configure.ac: Check for -fno-strict-aliasing. 2010-04-12 Brad Hards (wk) * configure.ac: Print more verbose info at the end. 2010-03-24 Werner Koch * configure.ac (USE_RNDW32CE): New. 2010-03-15 Werner Koch * configure.ac (emacs_local_vars_begin) (emacs_local_vars_read_only, emacs_local_vars_end): New. 2010-01-21 Werner Koch * 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 * configure.ac: Add option --disable-O-flag-munging. 2009-12-08 Marcus Brinkmann Update to libtool 2.2.6a. * configure.ac: Invoke AC_CONFIG_MACRO_DIR. (AC_LIBTOOL_WIN32_DLL, AC_LIBTOOL_RC): Replace by ... (LT_PREREQ, LT_INIT, LT_LANG): ... these. * config.guess, config.sub, install-sh, ltmain.sh, m4/libtool.m4: Updated to libtool 2.2.6a. * m4/ltoptions.m4, m4/ltsugar.m4, m4/ltversion.m4, m4/lt~obsolete.m4: New files from libtool 2.2.6a. 2009-08-05 Werner Koch * configure.ac: Test for sys/msg.h. 2009-04-23 Werner Koch * README: Add a section on build problems. 2009-01-22 Werner Koch * configure.ac: Bump LT version to C17/A6/R0 to mark the start of a new development series. 2009-01-22 Werner Koch Release 1.4.4. * configure.ac: Bump LT version to C16/A5/R2. 2008-10-30 Werner Koch * configure.ac: Remove option --enable-gcc-warnings. Autodetect useful gcc warnings in maintainer mode. 2008-09-18 Werner Koch Release 1.4.3. * configure.ac: Bump LT version to C16/A5/R1. 2008-09-15 Werner Koch * configure.ac: Cehck for syslog. 2008-09-08 Werner Koch Release 1.4.2. 2008-09-01 Werner Koch Release 1.4.2rc2. * configure.ac: Update svn_revision macro. 2008-08-22 Werner Koch * configure.ac: Add option --enable-hmac-binary-check. (DL_LIBS): Check whether -ldl is required. 2008-08-19 Werner Koch Release 1.4.2rc1. * configure.ac: Bump LT version to C16/A5/R0. 2008-08-18 Werner Koch * Makefile.am (EXTRA_DIST): Remove the unused BUGS file. 2008-08-15 Werner Koch * configure.ac (AH_BOTTOM): Define GCRY_GPG_ERR_NOT_OPERATIONAL. 2008-07-05 Werner Koch * random/: New. * Makefile.am (DIST_SUBDIRS): Add random. * configure.ac (AC_CONFIG_FILES): Add random/Makefile. 2008-04-25 Werner Koch Release 1.4.1. * configure.ac: Bump LT version to C15/A4/R4. 2008-04-22 Werner Koch * configure.ac: Set version to 1.4.1rc1. 2008-04-18 Werner Koch * configure.ac (AH_BOTTOM): Add CAMELLIA_EXT_SYM_PREFIX. (NAME_OF_DEV_RANDOM): Remove special cases for Solaris etc. This matches the gnupg 1.4.9 version. 2008-04-01 Werner Koch * configure.ac (AC_INIT): Fix quoting. 2008-03-19 Werner Koch * configure.ac: Fix the tests for USE_ to either define or undef the macros. Suggested by Dirk Stoecker. 2008-03-18 Werner Koch * configure.ac: Test for uintptr_t. 2008-02-18 Werner Koch * configure.ac (IS_DEVELOPMENT_VERSION): Set depending on the my_svn. 2007-12-11 Werner Koch * configure.ac: We actually require libgpg-error 1.4. Reported by Tim Mooney. 2007-12-10 Werner Koch Released 1.4.0. * configure.ac: Set LT to C15/A4/R3. 2007-12-05 Werner Koch * configure.ac: Add option --disable-padlock-support. 2007-12-03 Werner Koch Released 1.3.2. * configure.ac: Set LT to C15/A4/R2. * config.sub, config.guess: Update to version 2007-11-19. 2007-10-30 Werner Koch * configure.ac: Protect config.h against double inclusion. 2007-10-26 Werner Koch Released 1.3.1. * configure.ac: Set LT to C15/A4/R1. 2007-08-22 Werner Koch * README: Rewrite the license description. * configure.ac (USE_RNDW32, USE_RNDUNIX): Unmark as GPL modules. 2007-08-08 Werner Koch * configure.ac: Use $host and not $target. 2007-07-26 Werner Koch * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Fix a syntax error in the test program which lurked there for 4 years. Adjusted name of libtools global_system_pipe variable and add extra cut stage. Reported by Gregor Riepl. 2007-06-15 Werner Koch * autogen.sh (FORCE): Use = and not == in test to be POSIXly correct. 2007-05-30 Werner Koch * configure.ac: Camellia is no longer GPL. 2007-05-24 Werner Koch * configure.ac: Try to use -Wpointer-arith. 2007-05-19 Marcus Brinkmann * configure.ac: Fix test for optional UDIV and UDIV_QRNND MPI modules. 2007-05-09 Marcus Brinkmann * configure.ac (ac_cv_mpi_config_done): Unused variable removed. (ac_cv_mpi_mod_list, MPI_MOD_LIST_LO, MPI_MOD_LIST_O): Removed. (MPI_MOD_ASM_MPIH_ADD1, MPI_MOD_ASM_MPIH_SUB1, MPI_MOD_ASM_MPIH_MUL1, MPI_MOD_ASM_MPIH_MUL2, MPI_MOD_ASM_MPIH_MUL3, MPI_MOD_ASM_MPIH_LSHIFT, MPI_MOD_ASM_MPIH_RSHIFT, MPI_MOD_ASM_MPIH_UDIV, MPI_MOD_ASM_MPIH_UDIV_QRNND, MPI_MOD_C_MPIH_ADD1, MPI_MOD_C_MPIH_SUB1, MPI_MOD_C_MPIH_MUL1, MPI_MOD_C_MPIH_MUL2, MPI_MOD_C_MPIH_MUL3, MPI_MOD_C_MPIH_LSHIFT, MPI_MOD_C_MPIH_RSHIFT, MPI_MOD_C_MPIH_UDIV, MPI_MOD_C_MPIH_UDIV_QRNND): New automake variables. 2007-05-04 Werner Koch Released 1.3.0. * configure.ac: Set LT to C15/A4/R0. * configure.ac: Require automake 1.10 (AM_PROG_CC_C_O): New. 2007-05-03 Werner Koch * configure.ac: Fix detection of GPLed random modules. 2007-05-02 Werner Koch * configure.ac (LIBGCRYPT_DIGESTS, LIBGCRYPT_CIPHERS) (LIBGCRYPT_PUBKEY_CIPHERS): Ac_define lists of algorithms. (default_ciphers): Don't make camellia a default. 2007-05-02 David Shaw * NEWS, configure.ac: Add Camellia. 2007-04-30 Werner Koch * README.apichanges: Move to doc/. * Makefile.am (EXTRA_DIST): Removed that file. 2007-04-28 Marcus Brinkmann * configure.ac: Allow to specify additional search directories with --enable-mpi-path. 2007-04-16 Werner Koch * configure.ac: Check for sysconf. * acinclude.m4 (GNUPG_CHECK_MLOCK): Try to use sysconf to get the page size and use getpagesize only then if available. 2007-03-22 Werner Koch * configure.ac: Add support for ECC. 2007-02-22 Werner Koch * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Use --enable-random-daemon. * configure.ac: New option --enable-random-daemon. Create versioninfo.rc and provide the build information. 2007-02-21 Werner Koch * Makefile.am, configure.ac: Ignore w32-dll/. 2007-02-20 Werner Koch * configure.ac: Bump LT version to C14/A3/R0 in preparation for a release. * autogen.sh: Add option --force. * configure.ac: New option --disable-endian-check. Use a real noexecstack test instead of requiring an option. Add SVN version magic. 2007-02-02 Werner Koch * configure.ac (FALLBACK_SOCKLEN_T): Special case for mingw32. 2006-11-15 Werner Koch * autogen.sh: Add convenience option --build-amd64. 2006-10-20 Werner Koch * Makefile.am (stowinstall): New convenience target. 2006-10-12 Marcus Brinkmann * configure.ac (FALLBACK_SOCKLEN_T): Third time is a charm. Define gcry_socklen_t, to avoid conflicts with socklen_t definitions by autoconf. 2006-10-11 Marcus Brinkmann * configure.ac (FALLBACK_SOCKLEN_T): Rewrite in terms of socklen.m4. 2006-10-11 Marcus Brinkmann * acinclude.m4 (GNUPG_FIX_HDR_VERSION): Removed. * configure.ac: Do not call GNUPG_FIX_HDR_VERSION. 2006-10-10 Marcus Brinkmann * configure.ac: Invoke AC_CHECK_SOCKLEN_TYPE. (AC_CONFIG_FILES): Add src/gcrypt.h. (AC_CONFIG_SRCDIR): Change to src/libgcrypt.vers. 2006-10-02 Werner Koch * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Test on HOST and not TARGET. Hardwire for mingw32. Allow setting via command line when cross compiling. 2006-08-29 Werner Koch * configure.ac (USE_SEED): New. 2006-07-26 Werner Koch * configure.ac: New options --enable-noexecstack and --disable-optimization. 2006-07-04 Marcus Brinkmann * configure.ac: Call AC_LIBTOO_WIN32_DLL and AC_LIBTOOL_RC. * configure.ac: Call gl_TYPE_SOCKLEN_T instead of the other socklen_t checks. 2006-06-08 Marcus Brinkmann * configure.ac (PTH_LIBS): Add --all to pth-config invocation. 2006-03-14 Werner Koch * configure.ac: Check for fctnl and ftruncate. (HAVE_PTH): Check for GNU Pth. (HAVE_W32_SYSTEM): Define it. * acinclude.m4 (GNUPG_PTH_VERSION_CHECK): New. Taken from GnuPG 1.4. 2005-12-08 Werner Koch * configure.ac: Changed the random device names for netbsd. From Christian Biere. 2005-11-02 Moritz Schulte * NEWS: Documented minor API changes. 2005-09-15 Moritz Schulte * Makefile.am (EXTRA_DIST): Depend on README.SVN, not on README.CVS. 2005-06-25 Moritz Schulte * configure.ac: Removed src/libgcrypt.pc from AC_CONFIG_FILES. 2005-06-10 Werner Koch * configure.ac: Move detection of basic stuff to the top. For example we need to know whether gcc is used before testing for it. Reported by Ralf Fassel. 2005-04-23 Moritz Schulte * acinclude.m4 (TYPE_SOCKLEN_T): New type definition test; provided by Albert Chin. * configure.ac: Don't use $(CMD) as it's not portable; use CMD in backticks instead. Simpler -lnsl/-lsocket test. Use TYPE_SOCKLEN_T test. Don't forget to set `random_modules' correctly. 2005-04-22 Moritz Schulte * configure.ac: Added support for pkgconfig; provided by Albert Chin. 2005-04-11 Moritz Schulte * configure.ac: Integrate Whirlpool. 2005-01-04 Werner Koch Updated to automake 1.9. * acinclude.m4: Updated for use with automake 1.9. * configure.ac: Require libgpg-error 1.0; not really needed but that is the first stable version. * Makefile.am (ACLOCAL_AMFLAGS): New for -I m4. (AUTOMAKE_OPTIONS): New to create a bzip archive. 2005-02-03 Moritz Schulte * THANKS: Updated. 2004-08-09 Moritz Schulte * THANKS: Updated. 2004-07-04 Moritz Schulte * THANKS: Updated. 2004-04-21 Werner Koch * configure.ac: Don't print a warning if GNU make was not found. 2004-05-07 Moritz Schulte * THANKS: Updated. 2004-04-02 Thomas Schwinge * autogen.sh: Added ACLOCAL_FLAGS. 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 libtools 1.5.4. 2004-03-29 Werner Koch Released 1.1.94. * configure.ac: Set LT to C12/A1/R0. 2004-03-10 Marcus Brinkmann * configure.ac (LIBGCRYPT_CONFIG_LIBS_PTHREAD, LIBGCRYPT_CONFIG_CFLAGS_PTHREAD, LIBGCRYPT_CONFIG_LIBS_PTH, LIBGCRYPT_CONFIG_CFLAGS_PTH, have_pth, have_pthread, AC_CHECK_PTH, AC_CHECK_LIB(pthread), HAVE_PTH, HAVE_PTHREAD): Removed. 2004-03-06 Werner Koch Released 1.1.93. * configure.ac (LIBGCRYPT_CONFIG_SONAME_NUMBER): Replaced by LIBGCRYPT_CONPIG_API_VERSION. Set it to 1. Set LT to C11/A0/R1. 2004-03-05 Werner Koch * configure.ac (LIBGCRYPT_CONFIG_SONAME_NUMBER): New. 2004-02-20 Werner Koch Released 1.1.92. * configure.ac: Set LT to C11/A0/R0. 2004-02-11 Werner Koch * autogen.sh (check_version): Removed bashism and simplified. 2004-02-06 Werner Koch * configure.ac: Add rfc2268 cipher algorithm. 2004-01-25 Moritz Schulte * THANKS: Updated. 2003-12-19 Werner Koch Released 1.1.91. * configure.ac: Bumbed LT version to C10/A3/R1. 2003-12-08 Werner Koch * Makefile.am (dist-hook): Don't distribute stuff from the now obsolete scripts dir. (EXTRA_DIST): Remove README_alpha * README-alpha: Removed. * configure.ac (AM_CONFIG_AUX_DIR): Removed. * COPYING.DOC: Removed. * Makefile.am (EXTRA_DIST): Added README.CVS and autogen.sh. Removed COPYING.DOC. 2003-11-14 Werner Koch Released 1.1.90. * configure.ac: Bumbed LT version to C10/A3/R0. * configure.ac (have_ld_version_script): Set the default in a separate test. (PRINTABLE_OS_NAME): Don't handle the Hurd extra, this leads to conflicts with BSD based GNU systems. The Hurd has now a working uname. 2003-11-04 Werner Koch * configure.ac (USE_SHA1): Make sure it is always included. (USE_RMD160): Removed this AM conditional. 2003-10-31 Werner Koch * configure.ac: Bumbed version number to 1.1.90-cvs for futher development Released 1.1.44. * acinclude.m4 (AC_CHECK_PTH): Added. * configure.ac: Use it here instead of the generic lib test. Bumbed LT vesion to C9/A2/R0. 2003-10-27 Werner Koch * configure.ac: Give a hint on where libgpg-error is available. Reformatted long lines. Don't include gcrypt-defs.h. (--enable-gcc-warnings): New option. 2003-10-24 Moritz Schulte * configure.ac: Check for socklen_t. 2003-10-11 Moritz Schulte * acinclude.m4: Update AM_PATH_GPG_ERROR macro. 2003-09-04 Werner Koch Released 1.1.43. * configure.ac: Require libgpg-error 0.4 due to the prime interface. 2003-08-29 Werner Koch * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Re-implemented. * configure.ac: Use it here. 2003-08-27 Moritz Schulte * configure.ac: Substitute: LIBGCRYPT_CONFIG_LIBS_PTHREAD, LIBGCRYPT_CONFIG_CFLAGS_PTHREAD, LIBGCRYPT_CONFIG_LIBS_PTH, LIBGCRYPT_CONFIG_CFLAGS_PTH, LIBGCRYPT_THREAD_MODULES. 2003-08-07 Moritz Schulte * configure.ac: Fail, if libgpg-error could not be found. 2003-07-31 Werner Koch Released 1.1.42. * configure.ac: Set LT version to 7/0/0. 2003-07-30 Werner Koch * AUTHORS (Maintainer): Assigned Moritz as Maintainer. 2003-07-30 Moritz Schulte * NEWS: Include much more complete list of `Interface changes relative to the 1.1.12 release'. 2003-07-14 Moritz Schulte * configure.ac: Bumbed version number up to 1.1.42-cvs. 2003-07-09 Moritz Schulte * configure.ac: Reintroduce --disable-asm, since it is needed by mpi/config.links. 2003-07-05 Moritz Schulte * README: Few changes, mention libgpg-error. 2003-06-18 Moritz Schulte * configure.ac (available_ciphers): Removed Serpent, hrrm. 2003-06-17 Moritz Schulte * acinclude.m4: Removed macro definitions: GNUPG_CHECK_FAQPROG, GNUPG_CHECK_ENDIAN, GNUPG_CHECK_CACHE, GNUPG_CHECK_PIC, GNUPG_CHECK_EXPORTDYNAMIC, GNUPG_CHECK_IPC, GNUPG_PROG_NM, GNUPG_SYS_SYMBOL_UNDERSCORE, GNUPG_FUNC_MKDIR_TAKES_ONE_ARG, GPH_PROG_DB2ANY. Added macro definitions: AM_PATH_GPG_ERROR. * configure.ac: Use alternative approach for building based on conditional sources, which does not make automake eat all your memory, etc. Removed unused tests. Renamed --enable-static-rnd to --enable-random. Use Autoconf's AC_C_BIGENDIAN macro instead of our own. Re-organized the whole file. 2003-06-16 Moritz Schulte * configure.ac (AC_CONFIG_FILES): Removed doc/version.sgml. 2003-06-11 Moritz Schulte * configure.ac: Remove --enable-libgpg-error flag. Ue AC_PATH_GPG_ERROR. 2003-06-09 Moritz Schulte * NEWS: Mention API changes and libgpg-error. 2003-05-25 Moritz Schulte * configure.ac (USE_LIBGPG_ERROR): Implementation of the --enable-libgpg-error switch. Define USE_LIBGPG_ERROR in LIBGCRYPT_CONFIG_FLAGS, in case libgpg-error is used. 2003-05-22 Moritz Schulte * configure.ac (AC_CHECK_HEADERS): Removed unused headers: termio.h, langinfo.h. (AC_CHECK_FUNCS): Removed unused functions: strsep, strlwr, tcgetattr, setrlimit, strftime, nl_langinfo, sigaction, sigprocmask, fopen64, fstat64. 2003-04-27 Moritz Schulte * README: Documented new configure switches. Mention the --enable-maintainer-switch. * configure.ac: Merged some code from GnuPG's configure.ac for disabling sha512/tiger in case no 64 data types are available. 2003-04-17 Moritz Schulte * configure.ac: Include support for sha512. 2003-04-17 Moritz Schulte * AUTHORS: Updated. 2003-04-16 Moritz Schulte * configure.ac: Implement command line switches: --enable-ciphers, --enable-pubkey-ciphers and --enable-digests. Set Automake conditionals and config.h symbols depending on the selected ciphers, pubkey-ciphers, digests and random-modules. * acinclude.m4 (LIST_MEMBER): New macro. * configure.ac: Simplified, removed code for parsing EXTRA_PROGRAMS from Makefile.am. 2003-04-08 Moritz Schulte * configure.ac: Merged random-module selection code from GnuPG's configure.ac. 2003-04-07 Moritz Schulte * configure.ac: Removed code for generating contruct.c. Remove digest modules from the static_modules list, only handle random module selection. 2003-03-24 Moritz Schulte * NEWS: Mention new CBC_MAC flag. * AUTHORS (Maintainer): Update entry for Simon Josefsson. 2003-03-04 Moritz Schulte * TODO: Remove item about resetting handles, since gcry_cipher_reset is implemented by now. * NEWS: Mentioned gcry_cipher_reset. 2003-01-21 Werner Koch * README (Configure options): New. * configure.ac (have_ld_version_script): New option --enable-ld-version-script. 2003-01-20 Simon Josefsson * configure.ac (MODULES_IN_CIPHER): Add crc. 2003-01-20 Werner Koch Released 1.1.12. * configure.ac (LIBGCRYPT_LT_REVISION): Bumbed up. 2002-12-21 Werner Koch Released 1.1.11. * configure.ac (LIBGCRYPT_LT_CURRENT: Bumbed to 6/5/0 due to a new interface 2002-12-19 Werner Koch * configure.ac (have_pthread): Check for pthreads in libc. (have_ld_version_script): New. 2002-11-10 Werner Koch * configure.ac (MODULES_IN_CIPHER): Add md4.c. By Simon Josefsson. 2002-09-20 Werner Koch Released 1.1.10. * configure.ac (HAVE_DEV_RANDOM_IOCTL): Don't check for it; it is not used. (AS_CHECK_HEADERS): Check for sys/select.h. * Makefile.am (DIST_SUBDIRS): New to include the w32-dll directory 2002-09-18 Timo Schulz * configure.ac: Added makefile for the W32 DLL. 2002-09-17 Werner Koch * configure.ac: Check for Pth and Pthreads. 2002-08-23 Werner Koch Released 1.1.9. * configure.ac (LIBGCRYPT_CONFIG_CFLAGS): Renamed from LIBGCRYPT_CFLAGS and removed the libpath because it is set by the config script. (LIBGCRYPT_LT_REVISION): Set LT version to 5/4/1. 2002-06-25 Werner Koch Released 1.1.8. * configure.ac: Set LT version to 5/4/0. 2002-05-21 Werner Koch Released 1.1.7. * configure.ac: Set LT version to 4/3/0. 2002-05-17 Werner Koch * configure.ac: Removed all the dynamic loading stuff. 2002-05-16 Werner Koch * configure.ac: Reordered the C_CHECK_FUNCS. 2002-05-15 Werner Koch * configure.ac: Adjusted for new MPI module stuff. 2002-05-14 Werner Koch Changed license to the LGPL. 2002-05-02 Werner Koch * jnlib/: Removed. * Makefile.am (SUBDIRS): Removed jnlib. * configure.ac (jnlib/Makefile): Removed. * configure.ac: Define _REENTRANT. 2002-02-18 Werner Koch * configure.ac (MPI_EXTRA_ASM_OBJS): Use .lo suffix. (AC_CANONICAL_TARGET): Added. 2002-02-07 Werner Koch Released 1.1.6. 2002-01-24 Werner Koch * jnlib/: Replaced by a fresh copy from GnuPG (actually the NewPG development branch). Adjusted Makefile.am and jnlib-config.h accordingly. 2001-12-18 Werner Koch Released 1.1.5. * Makefile.am (dist-hook): Only look in mpi and scripts for distfiles; this way we don't include those of a stale "make dist" directory. * acinclude.m4 (GNUPG_FIX_HDR_VERSION): Make it work with the new automake. * configure.ac: Don't chmod db2any. 2001-08-06 Werner Koch * configure.ac: Removed cross compiling hacks. 2001-08-03 Werner Koch Released 1.1.4. * acinclude.m4 (GNUPG_CHECK_TYPEDEF): Define GNU Source. Migrated to autoconf 2.52. * acinclude.m4: Removed GNUPG_LINK_FILES and converted. * acconfig.h: Removed * configure.in: Replaced by... * configure.ac: and modified for use with autoconf 2.52. Replaced GNUPG_LINK_FILES with AC_CONFIG_LINKS and moved some informational messages to the end. Removed --enable-m-debug * tests/: New. * Makefile.am: Included tests directory * configure.in (DYNLINK_MOD_CFLAGS): Use -shared with dec-osf. Reported by Chris Adams. Merged some cases. 2001-05-31 Werner Koch Released 1.1.3. * configure.in: Use _gcry_ prefix when creating the cipher constructor. * acconfig.h (_GCRYPT_IN_LIBGCRYPT): Define it here. 2001-05-28 Werner Koch * acinclude.m4 (GPH_PROG_DOCBOOK): Removed. (GPH_PROG_DB2ANY): New. Taken from GPH. * configure.in: Use it here. 2000-12-19 Werner Koch Major change: Removed all GnuPG stuff and renamed this piece of software to gcrypt. The directory gcrypt has been renamed to src. 2000-11-14 Werner Koch Version 1.1.2 released. 2000-11-13 Werner Koch * acinclude.m4 (GNUPG_FIX_HDR_VERSION): VPATH build fix. 2000-10-10 Werner Koch * Makefile.am (dist-hook): Create the version file. * configure.in: Set the libtool version here, removed the need for the version file. Mon Sep 18 16:35:45 CEST 2000 Werner Koch * acinclude.m4 (GNUPG_CHECK_MLOCK): Removed that silly mkdir(). * configure.in: Changes to allow for Solaris random device. By Nils Ellmenreich. (--with-egd-socket): New. * configure.in (GNUPG_HOMEDIR): New. * configure.in: Check for fstat64 and fopen64 * acinclude.m4 (GNUPG_CHECK_FAQPROG): New. * configure.in: Test for this. * configure.in (DYNLINK_MOD_CFLAGS): Fix by David Champion. Tue Aug 22 14:31:15 CEST 2000 Werner Koch Version 1.1.1 Fri Aug 18 14:27:14 CEST 2000 Werner Koch * agent/: New. * Makefile.am, configure.in: Support for the new directory. Mon Jul 17 16:35:47 CEST 2000 Werner Koch * configure.in (mingw32): Changes to allow for mingw32msvc Fri Jul 14 19:38:23 CEST 2000 Werner Koch The big merge between this one and the stable branch 1.0. Still need to merge TNANKS, AUTHORS and such. It probaly does not compile yet. * acinclude.m4 (GNUPG_CHECK_MLOCK): Fixed syntax error in C code. * configure.in: Add check for termio.h, wait unctiosn and sigaction. * acinclude.m4, configure.in (GNUPG_CHECK_GNUMAKE): New. * acinclude.m4 (MKDIR_TAKES_ONE_ARG): Check some headers. By Gaël Quéri. * configure.in (AM_INIT_AUTOMAKE): Use this now. By Gaël. * acinclude.m4 (GNUPG_CHECK_EXPORTDYNAMIC): Replacement for GNUPG_CHECK_RDYNAMIC which should handle gcc with non GNU ld nicer. Contributed by Dave Dykstra. * configure.in (GNYPG_CHECK_RDYNAMIC): Replaced by the new check. * configure.in: Add a test for unisgned long long. * configure.in (DYNLINK_MOD_CFLAGS): Set different for NetBSD. * configure.in: Add check for clock_gettime * configure.in (ALL_LINGUAS): Add nl. * configure.in (ALL_LINGUAS): Add Esperanto. * configure.in (ALL_LINGUAS): Add sv and ja. * configure.in: Use /usr/local for CFLAGS and LDFLAGS when target is freebsd. By Rémi. * configure.in: Do not set development version when the version has a dash in it. Suggested by Dave Dykstra. * configure.in: Removed substitution for doc/gph/Makefile. Do all the gcc warning only in maintainer mode. * configure.in (dlopen): Use CHECK_FUNC for a test of dlopen in libc. Suggested by Alexandre Oliva. (-Wall): Moved the settting of gcc warning options near to the end so that tests don't get confused. Suggested by Paul D. Smith. * acinclude.m4 (GNUPG_SYS_NM_PARSE): Added BSDI support. (GNUPG_CHECK_RDYNAMIC): Ditto. * acinclude.m4 (GNUPG_CHECK_MLOCK): Changed the way to test for librt. Test suggested by Jeff Long. * acinclude.m4 (GNUPG_CHECK_MLOCK): Do librt check only when we can't link a test program. This way GNU systems don't need to link against linrt. (GNUPG_CHECK_IPC): Fixed use of TRY_COMPILE macro. From Tim Mooney. * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Add support for DJGPP. (GNUPG_CHECK_MLOCK): Check whether mlock sits in librt. * acinclude.m4 (GNUPG_CHECK_RDYNAMIC): Add NetBSD. By Thomas Klausner. * acconfig.h (HAVE_MLOCK): Added Mon Mar 13 19:22:46 CET 2000 Werner Koch * configure.in: Now uses the Docbook M4s from GPH. Mon Jan 31 17:46:35 CET 2000 Werner Koch * Makefile.am: Re-added tools. By Rémi. Mon Jan 31 16:37:34 CET 2000 Werner Koch * configure.in: Create a symlink for types.h in gcrypt/. Thu Jan 27 18:00:44 CET 2000 Werner Koch * configure.in (g10defs.h): Replaced by gnupg-defs.h Mon Jan 24 13:04:28 CET 2000 Werner Koch * jnlib/ : New. * configure.in: Do set development version when the version has a dash in it. Suggested by Dave Dykstra. Thu Dec 9 17:22:27 CET 1999 Werner Koch * acinclude.m4 (GNUPG_FIX_HDR_VERSION): New. * configure.in: Check and fix the version number of gcrypt/gcrypt.h so that it is always the save as VERSION. Thu Oct 28 16:17:46 CEST 1999 Werner Koch * Started with development series 1.1 on 1999-10-26 Tue Oct 26 14:10:21 CEST 1999 Werner Koch * README-alpha: New * configure.in: Fixed quoting in test for development version. * THANKS: Add entries for Michael, Brenno and J Horacio who did very nice Howto documents - I apoligize for forgetting to mention them earlier. Fri Sep 17 12:56:42 CEST 1999 Werner Koch * configure.in: Add "-lcap" when capabilities are requested. Add the conditional CROSS_COMPILING. * Makefile.am: Don't use checks when CROSS_COMPILING. Wed Sep 15 16:22:17 CEST 1999 Werner Koch * configure.in (ALL_LINGUAS): Add pt_PT. * configure.in: Some tweaks for cross compiling under MingW32 * acconfig.h (USE_STATIC_RNDW32): New. Tue Sep 7 17:08:10 CEST 1999 Werner Koch * VERSION: Set to 1.0.0. Mon Sep 6 19:59:08 CEST 1999 Werner Koch * configure.in: Create makefile in doc/gph * acinclude.m4 (GNUPG_FUNC_MKDIR_TAKES_ONE_ARG): New * configure.in: use the above. Thu Sep 2 16:40:55 CEST 1999 Werner Koch * VERSION: Set to 0.9.11. Tue Aug 31 17:20:44 CEST 1999 Werner Koch * configure.in: Minor changes to the OS/2 and Mingw32 system labels. Add a printable name for Hurd. Mon Aug 30 20:38:33 CEST 1999 Werner Koch * configure.in: Some support for DJGPP (Mark Elbrecht) Wed Aug 4 10:34:46 CEST 1999 Werner Koch * VERSION: Set to 0.9.10. Mon Jul 26 09:34:46 CEST 1999 Werner Koch * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): remove init of ac_cv_... * Makefile.am (DISCLEANFILES): New Fri Jul 23 13:53:03 CEST 1999 Werner Koch * VERSION: Set to 0.9.9. * configure.in: Print a notice when rndunix is used. Thu Jul 15 10:15:35 CEST 1999 Werner Koch * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Fixed last modification. Wed Jul 7 13:08:40 CEST 1999 Werner Koch * Makefile.am: Support for libtool. * configure.in: Ditto. Tue Jun 29 21:44:25 CEST 1999 Werner Koch * configure.in (use_local_zlib): The lost dollar is back. * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Add EMX case. * configure.in: Another variant of the MX vendor string * configure.in (--with-capabilities): Some test code (Remi). Sat Jun 26 12:15:59 CEST 1999 Werner Koch * acinclude.m4 (GNUPG_CHECK_RDYNAMIC): Support for HPUX and IRIX. * configure.in (HAVE_DL_SHL_LOAD): New for HPUX (Dave Dykstra). * VERSION: Now 0.9.8 Wed Jun 16 20:16:21 CEST 1999 Werner Koch * configure.in: Add test for docbook-to-man Tue Jun 15 12:21:08 CEST 1999 Werner Koch * acinclude.m4 (GNUPG_SYS_NM_PARSE): Support for {net,free}bsd, Thu Jun 10 14:18:23 CEST 1999 Werner Koch * configure.in (ZLIB,GDBM): Check both, header and lib. Sat Jun 5 15:30:33 CEST 1999 Werner Koch * pkclist.c (key_present_in_pk_list): New (Michael). Tue May 25 19:50:32 CEST 1999 Werner Koch * configure.in (IS_DEVELOPMENT_VERSION): Fixed detection. Sun May 23 14:20:22 CEST 1999 Werner Koch * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): assume yes when cross-compiling. Mon May 17 21:54:43 CEST 1999 Werner Koch * configure.in (socket): Fix for Unisys by Katsuhiro Kondou. Sat May 8 19:28:08 CEST 1999 Werner Koch * NEWS: Add a marker line which I forgot to do for 0.9.6. Thu May 6 14:18:17 CEST 1999 Werner Koch * README: Minor updates * VERSION: Now 0.9.6 Thu Apr 8 09:35:53 CEST 1999 Werner Koch * acinclude.m4 (GNUPG_CHECK_RDYNAMIC): Fix for amiga-openbsd (Peter Reich) (GNUPG_PROG_NM): Ditto Wed Apr 7 20:51:39 CEST 1999 Werner Koch * Makefile.am (g10defs.h): Removed. * configure.in (AC_OUTPUT_COMMANDS): Create g10defs.h Sat Mar 20 12:55:33 CET 1999 Werner Koch * VERSION: Now 0.9.5 Sun Mar 14 19:34:36 CET 1999 Werner Koch * acinclude.m4 (AM_SYS_SYMBOL_UNDERSCORE): Removed because it is now in the latest libtool. Thu Mar 11 16:39:46 CET 1999 Werner Koch * configure.in: Removed the need for libtool Mon Mar 8 20:47:17 CET 1999 Werner Koch * configure.in (DLSYM_NEEDS_UNDERSCORE): Replaced. * acinclude.in (AM_SYS_SYMBOL_UNDERSCORE): New. * VERSION: Now 0.9.4 Sun Feb 28 19:11:00 CET 1999 Werner Koch * configure.in (dld): Test disabled. Fri Feb 26 17:55:41 CET 1999 Werner Koch * encode.c (encode_simple): temporary fix. Wed Feb 24 11:07:27 CET 1999 Werner Koch * configure.in: New option --enable-static-rnd. Mon Feb 22 20:04:00 CET 1999 Werner Koch * BUGS: Now we assign bug numbers. * OBUGS: New to keep rack o fixed bugs (CVS only) Fri Feb 19 18:01:54 CET 1999 Werner Koch * VERSION: Released 0.9.3 Fri Feb 19 15:49:15 CET 1999 Werner Koch * acinclude.m4: Removed gettext macros. Tue Feb 16 14:10:02 CET 1999 Werner Koch * configure.in (socket): Check for -lsocket and -lnsl. (osf4): Disable all warnings for DEC's cc. (-Wall): Add more warning options for gcc Sat Feb 13 12:04:43 CET 1999 Werner Koch * configure.in: Changed detection of compiler flags. * intl/ : Removed directory Wed Feb 10 17:15:39 CET 1999 Werner Koch * acinclude.m4 (GNUPG_CHECK_RDYNAMIC): Fix for freebsd 2.2 * configure.in: a lot of changes to allow selection of modules. Add support for OS/2. * acinclude.m4: add some more caching * README: Spelling and grammar corrections (John A. Martin) * INSTALL: Ditto. Wed Jan 20 21:40:21 CET 1999 Werner Koch * configure.in: --enable-m-guard is now default Wed Jan 13 12:49:36 CET 1999 Werner Koch * INSTALL: Applied new information how to build rpms by Fabio Coatti * Makefile.in (gnupg.spec): Changed the names. Tue Jan 12 11:17:18 CET 1999 Werner Koch * config.links (m68k-atari-mint): New Tue Jan 12 09:17:19 CET 1999 Gaël Quéri * all: Fixed typos all over the place Sat Jan 9 16:02:23 CET 1999 Werner Koch * configure.in: Add a way to statically link rndunix Sun Jan 3 15:28:44 CET 1999 Werner Koch * acinclude.m4 (GNUPG_CHECK_RDYNAMIC): New. * configure.in (DYNLOAD_CFLAGS): Use result from CHECK_RDYNAMIC Wed Dec 23 13:18:14 CET 1998 Werner Koch * README: Replaced the command overview with a short intro. Sat Dec 12 18:40:32 CET 1998 Werner Koch * configure.in: Add check for dlopen in libc (Greg Troxel) and a new define * acconfig.h (DLSYM_NEEDS_UNDERSCORE): New. Thu Dec 10 20:15:36 CET 1998 Werner Koch * acinclude.m (GNUPG_CHECK_PIC): New * configure.in, acinclude.m4: Renamed all WK_ to GNUPG_ Tue Dec 8 15:09:29 CET 1998 Werner Koch * VERSION: Set to 0.4.5 Wed Nov 25 12:38:29 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (USE_RNDLINUX): New. Fri Nov 20 19:34:57 1998 Werner Koch (wk@isil.d.shuttle.de) * VERSION: Released 0.4.4 * configure.in (try_asm_modules): For option --disable-asm Tue Nov 10 19:32:40 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (MPI_SFLAGS): New. Tue Nov 10 13:44:53 1998 Werner Koch (wk@isil.d.shuttle.de) * ABOUT-NLS: New * configure.in (AC_REVISION): New. Sun Nov 8 18:20:35 1998 Werner Koch (wk@isil.d.shuttle.de) * VERSION: Set to 0.4.3 Sun Oct 25 19:49:37 1998 Werner Koch (wk@isil.d.shuttle.de) * Makefile.am (g10defs.h): New macro GNUPG_DATADIR. Wed Oct 21 17:24:24 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in: Removed gettext kludge * acinclude.m4: Add patched AM_WITH_NKS macro Tue Oct 20 19:03:36 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in: Kludge to make AM_GNU_GETTEXT work, changed some macors to more modern versions. Also changeg the all makefiles to remove duplicate ../intl. * acinclude.m4: Removed the gettext stuff, as this already comes with automake now. Wed Oct 14 12:11:34 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (NAME_OF_DEV_RANDOM): New. (DYNLINK_MOD_CFLAGS): New. Thu Oct 8 10:55:15 1998 Werner Koch (wk@isil.d.shuttle.de) * Makefile.am (g10defs.h): creates include file * acconfig.h: now includes g10defs.h * configure.in: Removed G10_LOCALEDIR and GNUPG_LIB Thu Sep 17 18:49:40 1998 Werner Koch (wk@(none)) * Makefile.am (dist-hook): Now creates RPM file. * scripts/gnupg.spec: New template file for RPMs Thu Jul 30 19:17:07 1998 Werner Koch (wk@(none)) * acinclude.h (WK_CHECK_IPC): New * configure.in : Add checks for SysV IPC Thu Jun 25 11:18:49 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (--disable-dynload): New. Wed Jun 10 07:48:59 1998 Werner Koch,mobil,,, (wk@tobold) * configure.in (GNUPG_LIBDIR): New. Mon May 25 19:10:59 1998 Werner Koch (wk@isil.d.shuttle.de) * rand-unix.c (fast_random_poll): fixed syntax bug. Mon May 11 10:21:31 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (PRINTABLE_OS_NAME): Linux is now GNU/Linux Tue Apr 14 19:08:05 1998 Werner Koch (wk@isil.d.shuttle.de) * [all files]: Applied Matthew Skala's typo and grammar fixes. Wed Mar 4 10:32:40 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (getrusage,gettimeofday): New tests. Fri Feb 27 13:14:17 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (--disable-m-guard): New. Thu Feb 26 17:09:27 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in, acinclude.m4, intl/, po/: New macros taken from GNOME, switched to automake 1.2f Thu Feb 26 09:05:46 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (doc/Makefile): New Thu Feb 26 07:40:47 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in: Changed gettext stuff Wed Feb 25 11:44:10 1998 Werner Koch (wk@isil.d.shuttle.de) * checks/*test : restructured the directory. Tue Feb 24 15:59:12 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in: Changed the name of the package to GNUPG and chnaged several other names too. Wed Feb 18 17:36:45 1998 Werner Koch (wk@isil.d.shuttle.de) * Makefile.am (checks): New. Sat Feb 14 15:37:55 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (mpi_config_done): Removed asm links caching. Sat Feb 14 14:02:20 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (PRINTABLE_OS_NAME): New. * acconfig.h: Likewise. Fri Feb 13 19:43:41 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in : Fixed zlib stuff * Makefile.am: Likewise Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 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. diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 85dd43f0..d10ce07f 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,4069 +1,4075 @@ +2011-02-18 Werner Koch + + * rijndael.c (u32_a_t): New. + (do_encrypt_aligned, do_encrypt_aligned): Use the new type to + avoid problems with strict aliasing rules. + 2011-02-16 Werner Koch * rijndael.c (do_aesni_cfb) [USE_AESNI]: New. (_gcry_aes_cfb_enc, _gcry_aes_cfb_dec) [USE_AESNI]: Use new fucntion. 2011-02-15 Werner Koch * rijndael.c (do_aesni_enc_aligned, do_aesni_dec_aligned): Use movdqa for the key but keep using movdqu for the data. (do_aesni): Remove alignment detection. Don't burn the stack. (aesni_prepare, aesni_cleanup): New macros. (rijndael_encrypt, _gcry_aes_cfb_enc, _gcry_aes_cbc_enc) (rijndael_decrypt, _gcry_aes_cfb_dec, _gcry_aes_cbc_dec): Use these macros. Don't burn the stack in the USE_AESNI case. (do_setkey): Add disabled code to use aeskeygenassist. 2011-02-14 Werner Koch * rijndael.c (ATTR_ALIGNED_16): New (do_aesni): Do not copy if already aligned. (do_encrypt, do_decrypt): Ditto. (rijndael_decrypt, rijndael_encrypt): Increase stack burning amount. * rijndael.c (RIJNDAEL_context): Reorder fields. Change fieldname ROUNDS to rounds. Move padlock_key into u1. (keySched, keySched2): Rename macros to keyscherr and keyschdec and change all users. (padlockkey): New macro. Change all users of padlock_key. * cipher.c (NEED_16BYTE_ALIGNED_CONTEXT): Always define if using gcc. (struct gcry_cipher_handle): Align U_IV to at least 16 byte. 2011-02-13 Werner Koch * rijndael.c (USE_AESNI): New. Define for ia32 and gcc >= 4. (m128i_t) [USE_AESNI]: New. (RIJNDAEL_context) [USE_AESNI]: Add field use_aesni. (do_setkey): Set USE_AESNI for all key lengths. (prepare_decryption) [USE_AESNI]: Use aesimc instn if requested. (do_aesni_enc_aligned, do_aesni_dec_aligned) (do_aesni) [USE_AESNI]: New. (rijndael_encrypt, _gcry_aes_cfb_enc, _gcry_aes_cbc_enc) (rijndael_decrypt, _gcry_aes_cfb_dec) (_gcry_aes_cbc_dec) [USE_AESNI]: Use do_aesni. 2011-02-01 Werner Koch * pubkey.c (gcry_pk_get_curve): New. (sexp_to_key): Add arg OVERRIDE_ELEMS. (sexp_elements_extract_ecc): Allow for params only. (gcry_pk_get_param): New. * ecc.c (ecc_get_curve): New. (ecc_get_param_sexp): New. 2011-01-28 Werner Koch * pubkey.c (gcry_pk_genkey): Hack to insert the used curve name. 2011-01-27 Werner Koch * ecc.c (fill_in_curve): Remove. (generate_curve): Rename to .. (fill_in_curve): this. Remove setting of NAME_OID. (ecc_encrypt_raw): Change name of arg DATA to K for better readability. Use ECC_public_key instead of ECC_secret_key. Require a caller to pass a complete pkey array. (ecc_decrypt_raw): Require a caller to pass a complete skey array. (elliptic_curve_t): Add field NAME. (fill_in_curve): Set field. (generate_key): Add arg R_USED_CURVE. (ecc_generate_ext): Return used curve name. 2011-01-13 Andrey Jivsov (wk) * ecc.c (ec2os): Do not free passed parameters X and Y. Adjust callers. (ecc_encrypt_raw, ecc_decrypt_raw): New. (ecdh_names, _gcry_pubkey_spec_ecdh): New. * pubkey.c (pubkey_table): Support ECDH. 2010-08-19 Werner Koch * cipher.c (gcry_cipher_open): Remove double release of the module. Fixes bug#1263. 2010-06-10 Jeff Johnson (wk) * ecc.c (ecc_generate_ext): Parse transient-key flag. (generate_key): Add arg TRANSIENT_KEY and use it to set the random level. 2010-04-12 Brad Hards (wk) Spelling fixes. 2010-03-26 Werner Koch * tiger.c (asn): Unfetter the old TIGER from an OID. (TIGER_CONTEXT): Add field VARIANT. (tiger_init): Factor code out to ... (do_init): New. (tiger1_init, tiger2_init): New. (_gcry_digest_spec_tiger1, _gcry_digest_spec_tiger2): New. * md.c (digest_table): Add TIGER1 and TIGER2 variants. 2009-12-11 Werner Koch * sha256.c (Cho, Maj, Sum0, Sum1): Turn macros into inline functions. (transform): Partly unroll to interweave the chain variables * sha512.c (ROTR, Ch, Maj, Sum0, Sum1): Turn macros into inline functions. (transform): Partly unroll to interweave the chain variables. Suggested by Christian Grothoff. 2009-12-10 Werner Koch * Makefile.am (o_flag_munging): New. (tiger.o, tiger.lo): Use it. * cipher.c (do_ctr_encrypt): Add arg OUTBUFLEN. Check for suitable value. Add check for valid inputlen. Wipe temporary memory. (do_ctr_decrypt): Likewise. (do_cbc_encrypt, do_cbc_decrypt): Add arg OUTBUFLEN. Check for suitable value. Move check for valid inputlen to here; change returned error from INV_ARG to INV_LENGTH. (do_ecb_encrypt, do_ecb_decrypt): Ditto. (do_cfb_encrypt, do_cfb_decrypt): Ditto. (do_ofb_encrypt, do_ofb_decrypt): Ditto. (cipher_encrypt, cipher_encrypt): Adjust for above changes. (gcry_cipher_encrypt, gcry_cipher_decrypt): Simplify. 2009-12-09 Werner Koch * cipher.c (gcry_cipher_open): Allow for GCRY_CIPHER_MODE_AESWRAP. (cipher_encrypt, cipher_decrypt): Ditto. (do_aeswrap_encrypt, do_aeswrap_decrypt): New. (struct gcry_cipher_handle): Add field marks. (cipher_setkey, cipher_setiv): Update marks flags. (cipher_reset): Reset marks. (cipher_encrypt, cipher_decrypt): Add new arg OUTBUFLEN. (gcry_cipher_encrypt, gcry_cipher_decrypt): Pass outbuflen to cipher_encrypt. Replace GPG_ERR_TOO_SHORT by GPG_ERR_BUFFER_TOO_SHORT. 2009-08-21 Werner Koch * dsa.c (dsa_generate_ext): Release retfactors array before setting it to NULL. Reported by Daiko Ueno. 2009-07-02 Werner Koch * md.c (md_read): Fix incomplete check for NULL. Reported by Fabian Kail. 2009-03-31 Werner Koch * rsa.c (rsa_check_secret_key): Return GPG_ERR_BAD_SECKEY and not GPG_ERR_PUBKEY_ALGO. 2009-02-16 Werner Koch * rsa.c (generate_x931): Do not initialize TBL with automatic variables. * whirlpool.c, tiger.c, sha256.c, sha1.c, rmd160.c, md5.c * md4.c, crc.c: Remove memory.h. This is garbage from gnupg. Reported by Dan Fandrich. 2009-01-22 Werner Koch * ecc.c (compute_keygrip): Remove superfluous const. 2009-01-06 Werner Koch * rmd160.c (oid_spec_rmd160): Add TeleTrust identifier. 2008-12-10 Werner Koch * dsa.c (generate): Add arg DOMAIN and use it if specified. (generate_fips186): Ditto. (dsa_generate_ext): Parse and check the optional "domain" parameter and pass them to the generate functions. * rijndael.c (rijndael_names): Add "AES128" and "AES-128". (rijndael192_names): Add "AES-192". (rijndael256_names): Add "AES-256". 2008-12-05 Werner Koch * dsa.c (generate): Add arg TRANSIENT_KEY and use it to detrmine the RNG quality needed. (dsa_generate_ext): Parse the transient-key flag und pass it to generate. 2008-11-28 Werner Koch * dsa.c (generate_fips186): Add arg DERIVEPARMS and use the seed value if available. * primegen.c (_gcry_generate_fips186_2_prime): Fix inner p loop. 2008-11-26 Werner Koch * primegen.c (_gcry_generate_fips186_3_prime): New. * dsa.c (generate_fips186): Add arg USE_FIPS186_2. (dsa_generate_ext): Parse new flag use-fips183-2. 2008-11-25 Werner Koch * dsa.c (generate_fips186): New. (dsa_generate_ext): Use new function if derive-parms are given or if in FIPS mode. * primegen.c (_gcry_generate_fips186_2_prime): New. 2008-11-24 Werner Koch * pubkey.c (gcry_pk_genkey): Insert code to output extrainfo. (pubkey_generate): Add arg R_EXTRAINFO and pass it to the extended key generation function. * rsa.c (gen_x931_parm_xp, gen_x931_parm_xi): New. (generate_x931): Generate params if not given. (rsa_generate_ext): Parse use-x931 flag. Return p-q-swapped indicator. * dsa.c (dsa_generate_ext): Put RETFACTORS into R_EXTRAINFO if possible. * pubkey.c (gcry_pk_genkey): Remove parsing of almost all parameters and pass the parameter S-expression to pubkey_generate. (pubkey_generate): Simplify by requitring modules to parse the parameters. Remove the special cases for Elgamal and ECC. (sexp_elements_extract_ecc): Add arg EXTRASPEC and use it. Fix small memory leak. (sexp_to_key): Pass EXTRASPEC to sexp_elements_extract_ecc. (pubkey_table) [USE_ELGAMAL]: Add real extraspec. * rsa.c (rsa_generate_ext): Adjust for new calling convention. * dsa.c (dsa_generate_ext): Ditto. * elgamal.c (_gcry_elg_generate): Ditto. Rename to elg_generate_ext. (elg_generate): New. (_gcry_elg_generate_using_x): Remove after merging code with elg_generate_ext. (_gcry_pubkey_extraspec_elg): New. (_gcry_elg_check_secret_key, _gcry_elg_encrypt, _gcry_elg_sign) (_gcry_elg_verify, _gcry_elg_get_nbits): Make static and remove _gcry_ prefix. * ecc.c (_gcry_ecc_generate): Rename to ecc_generate_ext and adjust for new calling convention. (_gcry_ecc_get_param): Rename to ecc_get_param and make static. (_gcry_pubkey_extraspec_ecdsa): Add ecc_generate_ext and ecc_get_param. 2008-11-20 Werner Koch * pubkey.c (pubkey_generate): Add arg DERIVEPARMS. (gcry_pk_genkey): Parse derive-parms and pass it to above. * rsa.c (generate_x931): New. (rsa_generate_ext): Add arg DERIVEPARMS and call new function in fips mode or if DERIVEPARMS is given. * primegen.c (_gcry_derive_x931_prime, find_x931_prime): New. 2008-11-19 Werner Koch * rsa.c (rsa_decrypt): Use gcry_create_nonce for blinding. (generate): Rename to generate_std. 2008-11-05 Werner Koch * md.c (md_open): Use a switch to set the Bsize. (prepare_macpads): Fix long key case for SHA384 and SHA512. * cipher.c (gcry_cipher_handle): Add field EXTRASPEC. (gcry_cipher_open): Set it. (gcry_cipher_ctl): Add private control code to disable weak key detection and to return the current input block. * des.c (_tripledes_ctx): Add field FLAGS. (do_tripledes_set_extra_info): New. (_gcry_cipher_extraspec_tripledes): Add new function. (do_tripledes_setkey): Disable weak key detection. 2008-10-24 Werner Koch * md.c (digest_table): Allow MD5 in fips mode. (md_register_default): Take special action for MD5. (md_enable, gcry_md_hash_buffer): Ditto. 2008-09-30 Werner Koch * rijndael.c (do_setkey): Properly align "t" and "tk". (prepare_decryption): Properly align "w". Fixes bug #936. 2008-09-18 Werner Koch * pubkey.c (gcry_pk_genkey): Parse domain parameter. (pubkey_generate): Add new arg DOMAIN and remove special case for DSA with qbits. * rsa.c (rsa_generate): Add dummy args QBITS, NAME and DOMAIN and rename to rsa_generate_ext. Change caller. (_gcry_rsa_generate, _gcry_rsa_check_secret_key) (_gcry_rsa_encrypt, _gcry_rsa_decrypt, _gcry_rsa_sign) (_gcry_rsa_verify, _gcry_rsa_get_nbits): Make static and remove _gcry_ prefix. (_gcry_pubkey_spec_rsa, _gcry_pubkey_extraspec_rsa): Adjust names. * dsa.c (dsa_generate_ext): New. (_gcry_dsa_generate): Replace code by a call to dsa_generate. (_gcry_dsa_check_secret_key, _gcry_dsa_sign, _gcry_dsa_verify) (_gcry_dsa_get_nbits): Make static and remove _gcry prefix. (_gcry_dsa_generate2): Remove. (_gcry_pubkey_spec_dsa): Adjust to name changes. (_gcry_pubkey_extraspec_rsa): Add dsa_generate_ext. 2008-09-16 Werner Koch * ecc.c (run_selftests): Add arg EXTENDED. 2008-09-12 Werner Koch * rsa.c (test_keys): Do a bad case signature check. * dsa.c (test_keys): Do a bad case check. * cipher.c (_gcry_cipher_selftest): Add arg EXTENDED and pass it to the called tests. * md.c (_gcry_md_selftest): Ditto. * pubkey.c (_gcry_pk_selftest): Ditto. * rijndael.c (run_selftests): Add arg EXTENDED and pass it to the called tests. (selftest_fips_128): Add arg EXTENDED and run only one test non-extended mode. (selftest_fips_192): Add dummy arg EXTENDED. (selftest_fips_256): Ditto. * hmac-tests.c (_gcry_hmac_selftest): Ditto. (run_selftests): Ditto. (selftests_sha1): Add arg EXTENDED and run only one test non-extended mode. (selftests_sha224, selftests_sha256): Ditto. (selftests_sha384, selftests_sha512): Ditto. * sha1.c (run_selftests): Add arg EXTENDED and pass it to the called test. (selftests_sha1): Add arg EXTENDED and run only one test non-extended mode. * sha256.c (run_selftests): Add arg EXTENDED and pass it to the called tests. (selftests_sha224): Add arg EXTENDED and run only one test non-extended mode. (selftests_sha256): Ditto. * sha512.c (run_selftests): Add arg EXTENDED and pass it to the called tests. (selftests_sha384): Add arg EXTENDED and run only one test non-extended mode. (selftests_sha512): Ditto. * des.c (run_selftests): Add arg EXTENDED and pass it to the called test. (selftest_fips): Add dummy arg EXTENDED. * rsa.c (run_selftests): Add dummy arg EXTENDED. * dsa.c (run_selftests): Add dummy arg EXTENDED. * rsa.c (extract_a_from_sexp): New. (selftest_encr_1024): Check that the ciphertext does not match the plaintext. (test_keys): Improve tests and return an error status. (generate): Return an error if test_keys fails. * dsa.c (test_keys): Add comments and return an error status. (generate): Return an error if test_keys failed. 2008-09-11 Werner Koch * rsa.c (_gcry_rsa_decrypt): Return an error instead of calling BUG in case of a practically impossible condition. (sample_secret_key, sample_public_key): New. (selftest_sign_1024, selftest_encr_1024): New. (selftests_rsa): Implement tests. * dsa.c (sample_secret_key, sample_public_key): New. (selftest_sign_1024): New. (selftests_dsa): Implement tests. 2008-09-09 Werner Koch * hmac-tests.c (selftests_sha1): Add tests. (selftests_sha224, selftests_sha384, selftests_sha512): Make up tests. * hash-common.c, hash-common.h: New. * sha1.c (selftests_sha1): Add 3 tests. * sha256.c (selftests_sha256, selftests_sha224): Ditto. * sha512.c (selftests_sha512, selftests_sha384): Ditto. 2008-08-29 Werner Koch * pubkey.c (gcry_pk_get_keygrip): Remove the special case for RSA and check whether a custom computation function has been setup. * rsa.c (compute_keygrip): New. (_gcry_pubkey_extraspec_rsa): Setup this function. * ecc.c (compute_keygrip): New. (_gcry_pubkey_extraspec_ecdsa): Setup this function. 2008-08-28 Werner Koch * cipher.c (cipher_decrypt, cipher_encrypt): Return an error if mode NONE is used. (gcry_cipher_open): Allow mode NONE only with a debug flag set and if not in FIPS mode. 2008-08-26 Werner Koch * pubkey.c (pubkey_generate): Add arg KEYGEN_FLAGS. (gcry_pk_genkey): Implement new parameter "transient-key" and pass it as flags to pubkey_generate. (pubkey_generate): Make use of an ext_generate function. * rsa.c (generate): Add new arg transient_key and pass appropriate args to the prime generator. (_gcry_rsa_generate): Factor all code out to ... (rsa_generate): .. new func with extra arg KEYGEN_FLAGS. (_gcry_pubkey_extraspec_ecdsa): Setup rsa_generate. * primegen.c (_gcry_generate_secret_prime) (_gcry_generate_public_prime): Add new arg RANDOM_LEVEL. 2008-08-21 Werner Koch * primegen.c (_gcry_generate_secret_prime) (_gcry_generate_public_prime): Use a constant macro for the random level. 2008-08-19 Werner Koch * pubkey.c (sexp_elements_extract_ecc) [!USE_ECC]: Do not allow allow "curve" parameter. 2008-08-15 Werner Koch * pubkey.c (_gcry_pk_selftest): New. * dsa.c (selftests_dsa, run_selftests): New. * rsa.c (selftests_rsa, run_selftests): New. * ecc.c (selftests_ecdsa, run_selftests): New. * md.c (_gcry_md_selftest): New. * sha1.c (run_selftests, selftests_sha1): New. * sha256.c (selftests_sha224, selftests_sha256, run_selftests): New. * sha512.c (selftests_sha384, selftests_sha512, run_selftests): New. * des.c (selftest): Remove static variable form selftest. (des_setkey): No on-the-fly self test in fips mode. (tripledes_set3keys): Ditto. * cipher.c (_gcry_cipher_setkey, _gcry_cipher_setiv): * dsa.c (generate): Bail out in fips mode if NBITS is less than 1024. * rsa.c (generate): Return an error code if the the requested size is less than 1024 and we are in fpis mode. (_gcry_rsa_generate): Take care of that error code. * ecc.c (generate_curve): In fips mode enable only NIST curves. * cipher.c (_gcry_cipher_selftest): New. * sha512.c (_gcry_digest_extraspec_sha384) (_gcry_digest_extraspec_sha512): New. * sha256.c (_gcry_digest_extraspec_sha224) (_gcry_digest_extraspec_sha256): New. * sha1.c (_gcry_digest_extraspec_sha1): New. * ecc.c (_gcry_pubkey_extraspec_ecdsa): New. * dsa.c (_gcry_pubkey_extraspec_dsa): New. * rsa.c (_gcry_pubkey_extraspec_rsa): New. * rijndael.c (_gcry_cipher_extraspec_aes) (_gcry_cipher_extraspec_aes192, _gcry_cipher_extraspec_aes256): New. * des.c (_gcry_cipher_extraspec_tripledes): New. * cipher.c (gcry_cipher_register): Rename to _gcry_cipher_register. Add arg EXTRASPEC. (dummy_extra_spec): New. (cipher_table_entry): Add extraspec field. * md.c (_gcry_md_register): Rename to _gcry_md_register. Add arg EXTRASPEC. (dummy_extra_spec): New. (digest_table_entry): Add extraspec field. * pubkey.c (gcry_pk_register): Rename to _gcry_pk_register. Add arg EXTRASPEC. (dummy_extra_spec): New. (pubkey_table_entry): Add extraspec field. * ac.c: Let most public functions return GPG_ERR_UNSUPPORTED in fips mode. * pubkey.c (pubkey_table_entry): Add field FIPS_ALLOWED and mark appropriate algorithms. (dummy_generate, dummy_check_secret_key, dummy_encrypt) (dummy_decrypt, dummy_sign, dummy_verify, dummy_get_nbits): Signal a fips error when used. (gcry_pk_register): In fips mode do not allow to register new algorithms. * md.c (digest_table): Add field FIPS_ALLOWED and mark appropriate algorithms. (md_register_default): In fips mode register only fips algorithms. (gcry_md_register): In fips mode do not allow to register new algorithms. (gcry_md_get): Signal a fips error if called. (gcry_md_hash_buffer): Do not allow rmd160 when not in fips mode. (md_start_debug): Disable in fips_mode. * md.c (gcry_md_register_default): Rename to .. (md_register_default): .. this. (md_digest): Remove this commented fucntion. * pubkey.c (gcry_pk_register_default): Rename to .. (pk_register_default): .. this. * cipher.c (cipher_table_entry): Add field FIPS_ALLOWED. (gcry_cipher_register_default): Register only fips approved algorithms. (gcry_cipher_register): Do not allow to register new ciphers. (cipher_setiv): Signal fips error. * cipher (gcry_cipher_register_default): Rename to .. (cipher_register_default): .. this. (REGISTER_DEFAULT_CIPHERS): Adjust for that change. 2008-07-05 Werner Koch * random-daemon.c, random.h, rndhw.c, rndunix.c, rand-internal.h * random.c, rndegd.c, rndlinux.c, rndw32.c: Move to ../cipher. * Makefile.am: Remove random stuff. 2008-06-24 Szakats Istvan (wk) * ac.c (_gcry_ac_key_destroy, _gcry_ac_key_pair_generate): Relase some more memory. 2008-04-22 Werner Koch * rijndael.c (_gcry_aes_cfb_enc, _gcry_aes_cbc_enc) (_gcry_aes_cfb_dec, _gcry_aes_cbc_dec): Use Padlock if possible. 2008-04-18 Werner Koch * sha1.c (transform_aligned): Remove. That is will obviosuly not work because we need a scratch working area and our internal API does not allow to modify the buffers. * rijndael.c: Factor tables out to .. * rijndael-tables.h: .. new. * ac.c (ac_data_extract): Make static. * camellia.h [HAVE_CONFIG_H]: Include config.h. * rndw32.c (registry_poll): Only print the performance data problem warning once. Suggested by Simon Josefsson. 2008-03-19 Werner Koch * cipher.c (gcry_cipher_open) [USE_AES]: Init bulk encryption only if requested. Suggested by Dirk Stoecker. 2008-03-18 Werner Koch * sha1.c: Include stdint.h. (transform): Add arg NBLOCKS so that we can work on more than one block and avoid updates of the chaining variables. Changed all callers to use 1. (sha1_write): Replace loop around transform. (transform_aligned) [WORDS_BIGENDIAN]: New. (TRANSFORM): New macro to replace all direct calls of transform. 2008-03-17 Werner Koch * rijndael.c (_gcry_aes_cfb_dec): New. (do_encrypt): Factor code out to .. (do_encrypt_aligned): .. New. (_gcry_aes_cfb_enc, _gcry_aes_cfb_dec): Use new function. (do_decrypt): Factor code out to .. (do_decrypt_aligned): .. new. (_gcry_aes_cbc_enc, _gcry_aes_cbc_dec): New. * cipher.c (struct gcry_cipher_handle): Put field IV into new union U_IV to enforce proper alignment. Change all users. (do_cfb_decrypt): Optimize. (do_cbc_encrypt, do_cbc_decrypt): Optimize. 2008-03-15 Werner Koch * rijndael.c (_gcry_aes_cfb_enc): New. * cipher.c (struct gcry_cipher_handle): Add field ALGO and BULK. (gcry_cipher_open): Set ALGO and BULK. (do_cfb_encrypt): Optimize. 2008-02-18 Werner Koch * rsa.c (_gcry_rsa_verify) [IS_DEVELOPMENT_VERSION]: Print intermediate results. 2008-01-08 Werner Koch * random.c (add_randomness): Do not just increment POOL_FILLED_COUNTER but update it by the actual amount of data. 2007-12-13 Werner Koch * pubkey.c (sexp_data_to_mpi): Support SHA-224. 2007-12-05 Werner Koch * rijndael.c (USE_PADLOCK): Depend on ENABLE_PADLOCK_SUPPORT. * rndhw.c (USE_PADLOCK): Ditto * rsa.c (secret): Fixed condition test for using CRT. Reported by Dean Scarff. Fixes bug#864. (_gcry_rsa_check_secret_key): Return an erro if the optional parameters are missing. * pubkey.c (sexp_elements_extract): Add arg ALGO_NAME. Changed all callers to pass NULL. Add hack to allow for optional RSA parameters. (sexp_to_key): Pass algo name to sexp_elements_extract. 2007-12-03 Werner Koch * random.c (gcry_random_add_bytes): Implement it. * rand-internal.h (RANDOM_ORIGIN_EXTERNAL): New. 2007-11-30 Werner Koch * rndhw.c: New. * rndlinux.c (_gcry_rndlinux_gather_random): Try to read 50% directly from the hwrng. * random.c (do_fast_random_poll): Also run the hw rng fast poll. (_gcry_random_dump_stats): Tell whether the hw rng failed. 2007-11-29 Werner Koch * rijndael.c (USE_PADLOCK): Define new macro used for ia32. (RIJNDAEL_context) [USE_PADLOCK]: Add fields USE_PADLOCK and PADLOCK_KEY. (do_setkey) [USE_PADLOCK]: Enable padlock if available for 128 bit AES. (do_padlock) [USE_PADLOCK]: New. (rijndael_encrypt, rijndael_decrypt) [USE_PADLOCK]: Divert to do_padlock. * cipher.c (cipher_context_alignment_t): New. Use it in this module in place of PROPERLY_ALIGNED_TYPE. (NEED_16BYTE_ALIGNED_CONTEXT): Define macro for ia32. (struct gcry_cipher_handle): Add field HANDLE_OFFSET. (gcry_cipher_open): Take care of increased alignment requirements. (gcry_cipher_close): Ditto. 2007-11-28 Werner Koch * sha256.c (asn224): Fixed wrong template. It happened due to a bug in RFC4880. SHA-224 is not in the stable version of libgcrypt so the consequences are limited to users of this devel version. 2007-10-31 Werner Koch * ac.c (gcry_ac_data_new): Remove due to the visibility wrapper. (gcry_ac_data_destroy, gcry_ac_data_copy, gcry_ac_data_length) (gcry_ac_data_set, gcry_ac_data_get_name, gcry_ac_data_get_index) (gcry_ac_data_to_sexp, gcry_ac_data_from_sexp) (gcry_ac_data_clear, gcry_ac_io_init, gcry_ac_open) (gcry_ac_close, gcry_ac_key_init, gcry_ac_key_pair_generate) (gcry_ac_key_pair_extract, gcry_ac_key_destroy) (gcry_ac_key_pair_destroy, gcry_ac_key_data_get) (gcry_ac_key_test, gcry_ac_key_get_nbits, gcry_ac_key_get_grip) (gcry_ac_data_encrypt, gcry_ac_data_decrypt, gcry_ac_data_sign) (gcry_ac_data_verify, gcry_ac_data_encode, gcry_ac_data_decode) (gcry_ac_mpi_to_os, gcry_ac_mpi_to_os_alloc, gcry_ac_os_to_mpi) (gcry_ac_data_encrypt_scheme, gcry_ac_data_decrypt_scheme) (gcry_ac_data_sign_scheme, gcry_ac_data_verify_scheme) (gcry_ac_io_init_va): Ditto. (gcry_ac_id_to_name, gcry_ac_name_to_id): Remove as these deprecated functions are now implemented by visibility.c. 2007-10-26 Werner Koch * rndw32.c: Disable debug flag. 2007-10-25 Werner Koch * rndw32.c: Updated from current cryptlib snapshot and modified for our use. Removed support from pre NT systems. (slow_gatherer_windows95): Remove. (_gcry_rndw32_gather_random): Require an NT platform. (init_system_rng, read_system_rng, read_mbm_data): New. (slow_gatherer_windowsNT): Rename to ... (slow_gatherer): .. this. Read system RNG and MBM. (registry_poll): New with code factored out from slow_gatherer. 2007-08-23 Werner Koch * random.c (pool_filled_counter): New. (add_randomness): Use it. 2007-08-22 Werner Koch * rndw32.c, rndunix.c: Switched to LGPL. 2007-05-30 Werner Koch * camellia.h, camellia.c: Replace by new LGPL version and adjusted camellia.h. 2007-05-09 Marcus Brinkmann * ac.c (_gcry_ac_io_init_va, _gcry_ac_io_write, _gcry_ac_io_read): Adjust users of gcry_ac_io_t because union is not anonymous anymore. 2007-05-02 Werner Koch * camellia-glue.c (camellia_setkey, camellia_encrypt) (camellia_decrypt): Recalculated used stack size in called functions. * camellia.h: Redefine external symbols. 2007-05-02 David Shaw * Makefile.am, cipher.c: Add Camellia. * camellia-glue.c: New. The necessary glue to interface libgcrypt to the stock NTT Camellia distribution. * camellia.h, camellia.c: The stock NTT Camellia distribution (GPL). 2007-04-30 David Shaw * cipher.c: Use #if instead of #ifdef as configure defines the USE_cipher defines as 0 for disabled. 2007-04-30 Werner Koch * rndegd.c (_gcry_rndegd_set_socket_name): New. 2007-04-30 Marcus Brinkmann * ecc.c (ec2os): Fix relocation of short numbers. * ecc.c (generate_key): Do not allocate D, which will be allocated by GEN_K. Remove G. Fix test if g_x, g_y resp. q_x, q_y are requested. (_gcry_ecc_generate): Release unneeded members of SK. * pubkey.c (sexp_to_key): Release NAME. 2007-04-28 Marcus Brinkmann * ac.c (gcry_ac_mpi): Remove member NAME_PROVIDED. (ac_data_mpi_copy, _gcry_ac_data_set, _gcry_ac_data_get_name) (_gcry_ac_data_get_index, ac_data_construct): Adjust handling of NAME accordingly. 2007-04-20 Werner Koch * ecc.c (domain_parms): Add standard brainpool curves. 2007-04-18 Werner Koch * ecc.c (generate_curve): Implement alias mechanism. * pubkey.c (sexp_elements_extract_ecc): New. (sexp_to_key): Add special case for ecc. (sexp_to_key, sexp_to_sig, sexp_to_enc, gcry_pk_genkey): Replace name_terminated stuff by a call to _gcry_sexp_nth_string. (gcry_pk_get_keygrip): Ditto. 2007-04-16 Werner Koch * ecc.c (_gcry_ecc_generate): Renamed DUMMY to CURVE and use it. 2007-04-13 Marcus Brinkmann * ac.c (ac_data_construct): Cast const away to suppress compiler warning. * ecc.c (ecc_generate): Avoid compiler warning for unused argument DUMMY. (ecc_verify): Avoid compiler warning for unused arguments CMP and OPAQUEV. 2007-04-06 Werner Koch * sha1.c (oid_spec_sha1): Add another oid from X9.62. 2007-03-28 Werner Koch * pubkey.c (gcry_pk_genkey): Do not issue misc-key-info if it is empty. (gcry_pk_genkey): New parameter "curve". * ecc.c: Entirely rewritten with only a few traces of the old code left. (_gcry_ecc_generate): New. (generate_key) New arg NAME. (generate_curve): Ditto. Return actual number of NBITS. 2007-03-26 Werner Koch * pubkey.c (gcry_pk_genkey): Increase size of SKEY array and add a runtime bounds check. 2007-03-23 Werner Koch * ecc.c (ecc_ctx_init, ecc_ctx_free, ecc_mod, ecc_mulm): New. (duplicate_point, sum_points, escalar_mult): Don't use a copy of base->p. Replaced all mpi_mulm by ecc_mulm so that we can experiment with different algorithms. (generate_key, check_secret_key, sign, verify): Initialize a computation context for use by ecc_mulm. 2007-03-22 Werner Koch * pubkey.c (pubkey_table): Initialize ECC. * Makefile.am (EXTRA_libcipher_la_SOURCES): Add ecc.c. * ecc.c: New. Heavily reformatted and changed for use in libgcrypt. (point_init): New. (escalar_mult): Make arg R the first arg to be similar to the mpi functions. (duplicate_point): Ditto (sum_points): Ditto (sign, verify): Remove unneeded copy operations. (sum_points): Removed memory leaks and optimized some compares. (verify): Simplified input check. 2007-03-14 Werner Koch * random.c (MASK_LEVEL): Removed macro as it was used only at one place. Open coded it there. (gcry_randomize, _gcry_update_random_seed_file) (_gcry_fast_random_poll): Factor lock code out to .. (lock_pool, unlock_pool): .. new. (initialize): Look the pool while allocating. (read_random_source, do_fast_random_poll): Moved intialization to ... (initialize): .. here. (_gcry_enable_quick_random_gen): No more need for initialization. (is_initialized): Moved this global flag to .. (initialize): .. here and changed all users to unconditionally call initialize. (add_randomness): Remove initalization here. It simply can't happen. * random.c (enum random_origins): Moved to .. * rand-internal.h: .. here. * rndunix.c (_gcry_rndunix_gather_random): Use enum in prototype for ORIGIN and renamed REQUESTOR to ORIGIN. * rndegd.c (_gcry_rndegd_gather_random): Ditto. * rndlinux.c (_gcry_rndlinux_gather_random): Ditto. * rndw32.c (_gcry_rndw32_gather_random): Ditto. (_gcry_rndw32_gather_random_fast): Ditto. 2007-03-13 Werner Koch * random.c (enum random_origins): New. (add_randomness): Renamed arg SOURCE to ORIGIN. (read_random_source): Renamed arg REQUESTOR to ORIGIN. (getfnc_gather_random): Removed static variable because this function is only called one and thus we don't need this optimization. (_gcry_quick_random_gen): Removed and replaced by.. (_gcry_enable_quick_random_gen): .. this. It is onlyu used to enable it and it does not make sense to disable it later. Changed the only one caller too. (get_random_bytes): Removed. (gcry_random_bytes, gcry_random_bytes_secure): Implement in terms of gcry_randomize. * random-daemon.c (_gcry_daemon_get_random_bytes): Removed. 2007-02-23 Werner Koch * elgamal.c (generate): Removed unused variable TEMP. (test_keys): New arg NODIE. (generate_using_x, _gcry_elg_generate_using_x): New. * pubkey.c (pubkey_generate): New arg XVALUE and direct call to the new elgamal generate fucntion. (gcry_pk_genkey): Parse the new "xvalue" tag. 2007-02-22 Werner Koch * pubkey.c (sexp_data_to_mpi): Handle dynamically allocated algorithms. Suggested by Neil Dunbar. Fixes bug#596. * rndw32.c (_gcry_rndw32_gather_random_fast): Make it return void. * cipher.c (gcry_cipher_algo_name): Simplified. * random.c: Use the daemon only if compiled with USE_RANDOM_DAEMON. * Makefile.am (libcipher_la_SOURCES): Build random-daemon support only if requested. 2007-02-21 Werner Koch * random.c (rndpool, keypool): Make unsigned. (mix_pool): Change char* variables to unsigned char*. (gcry_randomize): Make arg BUFFER a void*. (gcry_create_nonce): Ditto. * rmd160.c (gcry_rmd160_mixblock): Make BUFFER a void*. (_gcry_rmd160_hash_buffer): Make OUTBUF and BUFFER void*. * sha1.c (_gcry_sha1_hash_buffer): Ditto. * cipher.c (gcry_cipher_encrypt, cry_cipher_decrypt): Change buffer args to void*. (gcry_cipher_register): Make ALGORITHM_ID a int *. * md.c (md_start_debug): Make SUFFIX a const char*. Use snprintf. (gcry_md_debug): New. (gcry_md_ctl): Changed arg BUFFER from unsigned char*. * md.c (md_write): Make INBUF a const void*. (gcry_md_write): Remove needless cast. * crc.c (crc32_write): Make INBUF a const void* (update_crc32, crc24rfc2440_write): Ditto. * sha512.c (sha512_write, transform): Ditto. * sha256.c (sha256_write, transform): Ditto. * rmd160.c (rmd160_write, transform): Ditto. * md5.c (md5_write, transform): Ditto. * md4.c (md4_write, transform): Ditto. * sha1.c (sha1_write, transform): Ditto. * tiger.c (tiger_write, transform): Ditto. * whirlpool.c (whirlpool_write, whirlpool_add, transform): Ditto. * elgamal.c (elg_names): Change to a const*. * dsa.c (dsa_names): Ditto. * rsa.c (rsa_names): Ditto. * pubkey.c (gcry_pk_lookup_func_name): Make ALIASES a const. 2007-02-20 Werner Koch * rndlinux.c (open_device): Remove unsused arg MINOR. 2007-01-30 Werner Koch * sha256.c (oid_spec_sha256): Add alias from pkcs#1. * sha512.c (oid_spec_sha512): Ditto. (oid_spec_sha384): Ditto. 2006-12-18 Werner Koch * rndlinux.c (set_cloexec_flag): New. (open_device): Set close-on-exit flags. Suggested by Max Kellermann. Fixes Debian#403613. * Makefile.am (AM_CPPFLAGS, AM_CFLAGS): Splitted and merged Moritz' changes. (INCLUDES): Removed. 2006-11-30 Werner Koch * serpent.c (byte_swap_32): Remove trailing semicolon. 2006-11-15 Werner Koch * Makefile.am (INCLUDES): Include ../src/ 2006-11-03 Werner Koch * random.c [HAVE_GETTIMEOFDAY]: Included sys/time.h and not sys/times.h. Reported by Rafaël Carré. 2006-11-05 Moritz Schulte * Makefile.am (AM_CFLAGS): Added -I$(top_builddir)/src so that the new gcrypt.h is used, not the one installed in the system. 2006-10-25 Werner Koch * primegen.c (prime_generate_internal): Tweaked use of secure memory and entropy use. Safe unused primes from the pool. Allocate at least a pool of 30. (save_pool_prime, get_pool_prime): New. 2006-10-23 Werner Koch * ac.c (_gcry_ac_data_from_sexp): Reset sexp_tmp for failsafe means. Release sexp_cur if needed. Reported by Dirk Stoecker. * pubkey.c (pubkeys_registered_lock): Intialized it. It is not realy needed because this is a mere initialization to 0 anyway. Noted by Victor Stinner. 2006-10-17 Werner Koch * dsa.c (_gcry_dsa_generate2): New. (generate): New arg QBITS. Add sanity checks for reasonable qbits and nbits. * pubkey.c (gcry_pk_genkey): Parse an qbits element. (pubkey_generate): New arg QBITS. Pass it to the DSA generation. 2006-10-05 Werner Koch * md.c (gcry_md_algo_info) : Check that the algo is available. 2006-10-04 David Shaw (wk) * tiger.c (round): Rename to tiger_round as gcc 4 has a built-in round function that this conflicts with. 2006-09-11 Werner Koch * rndw32.c (slow_gatherer_windowsNT): While adding data use the size of the diskPerformance and not its address. Has been fixed in GnuPG more than a year ago. Noted by Lee Fisher. 2006-08-30 Werner Koch * pubkey.c (sexp_data_to_mpi): Need to allow "ripemd160" here as this is the canonical name. 2006-08-29 Hye-Shik Chang (wk) * seed.c: New. 2006-08-03 Werner Koch * random-daemon.c (_gcry_daemon_initialize_basics): Don't initialize the socket. Remove arg SOCKETNAME. (connect_to_socket): Make sure that daemon is set to -1 on error. (call_daemon): Initialize the socket on the first call. (_gcry_daemon_randomize, _gcry_daemon_get_random_bytes) (_gcry_daemon_create_nonce): New arg SOCKETNAME. * random.c (initialize): Call new daemon initializator. (get_random_bytes, gcry_randomize, gcry_create_nonce): Pass socket name to daemon call and reset allow_daemon on failure. 2006-07-26 Werner Koch * rmd160.c (_gcry_rmd160_mixblock): Add cast to transform call. * blowfish.c (selftest): Cast string to usnigned char*. * primegen.c (prime_generate_internal): Cast unsigned/char* mismatch in calling m_out_of_n. (is_prime): Changed COUNT to unsigned int *. * ac.c (_gcry_ac_data_copy): Initialize DATA_MPIS. * random.c (gcry_create_nonce): Update the pid after a fork. Reported by Uoti Urpala. 2006-07-04 Marcus Brinkmann * sha512.c: Fix typo in copyright notice. 2006-06-21 Werner Koch * rsa.c (_gcry_rsa_generate): Replace xcalloc by calloc. * pubkey.c (gcry_pk_encrypt, gcry_pk_sign): Ditto. (sexp_to_key, sexp_to_sig, sexp_to_enc, gcry_pk_encrypt) (gcry_pk_sign, gcry_pk_genkey, gcry_pk_get_keygrip): Ditto. * md.c (md_copy): Ditto. 2006-04-22 Moritz Schulte * random-daemon.c (_gcry_daemon_initialize_basics): New argument: SOCKETNAME. Passing on to connect_to_socket() if non-NULL. (connect_to_socket, writen, readn, call_daemon): New functions. (_gcry_daemon_randomize, _gcry_daemon_get_random_bytes) (_gcry_daemon_create_nonce): Call call_daemon(). (RANDOM_DAEMON_SOCKET): New symbol. (daemon_socket): New static variable. * random.h (_gcry_daemon_initialize_basics): New parameter: SOCKETNAME. (_gcry_set_random_daemon_socket): New declaration. * random.c (initialize_basics): Pass DAEMON_SOCKET_NAME to _gcry_daemon_initialize_basics. (_gcry_set_random_daemon_socket): New function, setting DAEMON_SOCKET_NAME. 2006-04-01 Moritz Schulte * ac.c (eme_pkcs_v1_5_encode): Use KEY_SIZE directly, no need to call gcry_ac_key_get_nbits. (eme_pkcs_v1_5_decode): Likewise. (ac_es_dencode_prepare_pkcs_v1_5): Fill options_em structure with key_size. (_gcry_ac_data_dump, gcry_ac_data_dump): New functions. (_gcry_ac_data_to_sexp, _gcry_ac_data_from_sexp): More or less rewritten; changed S-Expression format so that it matches the one used in pubkey.c. 2006-03-15 Werner Koch * random-daemon.c: New. * random.c (_gcry_use_random_daemon): New. (get_random_bytes, gcry_randomize, gcry_create_nonce): Try diverting to the daemon functions. 2006-03-14 Werner Koch * random.c (lock_seed_file): New. (read_seed_file, _gcry_update_random_seed_file): Use it. * random.c (gcry_create_nonce): Detect a fork and re-seed. (read_pool): Fixed the fork detection; it used to work only for multi-threaded processes. 2006-03-12 Brad Hards (wk) * md.c (md_open): Use new variable macpads_Bsize instead of hardwiring the block size. Changed at all places. 2006-03-10 Brad Hards (wk, patch 2005-04-22) * md.c, sha256.c: Add support for SHA-224. (sha224_init): New. 2006-01-18 Brad Hards (wk 2006-03-07) * cipher.c (cipher_encrypt, cipher_decrypt, do_ofb_encrypt) (do_ofb_decrypt, gcry_cipher_open): Implement Output Feedback Mode. 2005-11-02 Moritz Schulte * pubkey.c (gcry_pk_algo_name): Return "?" instead of NULL for unknown algorithm IDs. * cipher.c (cipher_algo_to_string): Likewise. 2005-11-01 Moritz Schulte * pubkey.c (gcry_pk_algo_info): Don't forget to break after switch case. 2005-09-19 Werner Koch * dsa.c (generate): Add preliminary support for 2 and 4 keys. Return an error code if the key size is not supported. (_gcry_dsa_generate): Return an error. 2005-08-22 Werner Koch * primegen.c (check_prime): New arg RM_ROUNDS. (prime_generate_internal): Call it here with 5 rounds as used before. (gcry_prime_check): But here with 64 rounds. (is_prime): Make sure never to use less than 5 rounds. 2005-04-16 Moritz Schulte * ac.c (_gcry_ac_init): New function. 2005-04-12 Moritz Schulte * ac.c (_gcry_ac_io_write, _gcry_ac_io_read): Initialize err to make the compiler happy. Always use errno, now that gcry_malloc() is guaranteed to set errno on failure. (_gcry_ac_data_to_sexp): Don't forget to goto out after error in loop. (_gcry_ac_data_to_sexp): Remove unused variable: mpi_list; (_gcry_ac_data_to_sexp): Always deallocate sexp_buffer. (_gcry_ac_data_from_sexp): Don't forget to initialize data_set_new. (_gcry_ac_data_from_sexp): Handle special case, which is necessary, since gcry_sexp_nth() does not distinguish between "element does not exist" and "element is the empty list". (_gcry_ac_io_init_va): Use assert to make sure that mode and type are correct. Use gcry_error_t types where gcry_err_code_t types have been used before. 2005-04-11 Moritz Schulte * ac.c (_gcry_ac_data_sign_scheme): Don't forget to initialize buffer. * whirlpool.c: New file. * md.c (digest_table): Add whirlpool. * Makefile.am (EXTRA_libcipher_la_SOURCES): Added: whirlpool.c. 2005-03-30 Moritz Schulte * ac.c (_gcry_ac_data_from_sexp): Use length of SEXP_CUR, not length of SEXP; do not forget to set SEXP_TMP to NULL after it has been released. (struct gcry_ac_mpi): New member: name_provided. (_gcry_ac_data_set): Rename variable `name_final' to `name_cp'; remove const qualifier; change code to not cast away const qualifiers; use name_provided member as well. (_gcry_ac_data_set, _gcry_ac_data_get_name): Use name_provided member of named mpi structure. (gcry_ac_name_to_id): Do not forget to initialize err. (_gcry_ac_data_get_index): Do not forget to initialize mpi_return; use gcry_free() instead of free(); remove unnecessary cast; rename mpi_return and name_return to mpi_cp and name_cp; adjust code. (ac_data_mpi_copy): Do not cast away const qualifier. (ac_data_values_destroy): Likewise. (ac_data_construct): Likewise. (ac_data_mpi_copy): Initialize flags to GCRY_AC_FLAG_DEALLOC. (ac_data_extract): Use GCRY_AC_FLAG_DEALLOC instead of GCRY_AC_FLAG_COPY. (_gcry_ac_io_init_va, _gcry_ac_io_init, gcry_ac_io_init) (gcry_ac_io_init_va, _gcry_ac_io_write, _gcry_ac_io_read) (_gcry_ac_io_read_all, _gcry_ac_io_process): New functions. (gry_ac_em_dencode_t): Use gcry_ac_io_t in prototype instead of memroy strings directly; adjust encode/decode functions to use io objects. (emsa_pkcs_v1_5_encode_data_cb): New function ... (emsa_pkcs_v1_5_encode): ... use it here. (ac_data_dencode): Use io objects. (_gcry_ac_data_encode, _gcry_ac_data_decode, gcry_ac_data_encode) (gcry_ac_data_decode): Likewise. (_gcry_ac_data_encrypt_scheme, gcry_ac_data_encrypt_scheme) (_gcry_ac_data_decrypt_scheme, gcry_ac_data_decrypt_scheme) (_gcry_ac_data_sign_scheme, gcry_ac_data_sign_scheme) (_gcry_ac_data_verify_scheme, gcry_ac_data_verify_scheme): Likewise. 2005-03-23 Werner Koch * rndw32.c (_gcry_rndw32_gather_random_fast): While adding data use the size of the object and not the one of its address. Bug reported by Sascha Kiefer. 2005-03-19 Moritz Schulte * cipher.c (do_cbc_encrypt): Be careful to not overwrite data, which is to be used later on. This happend, in case CTS is enabled and OUTBUF is equal to INBUF. 2005-02-25 Werner Koch * pubkey.c (gcry_pk_get_keygrip): Allow for shadowed-private-key. 2005-02-13 Moritz Schulte * serpent.c: Updated from 1.2 branch: s/u32_t/u32/ and s/byte_t/byte/. Too match what we have always used and are using in all other files too (serpent_test): Moved prototype out of a fucntion. 2005-02-07 Moritz Schulte * ac.c: Major parts rewritten. * pubkey.c (_gcry_pk_get_elements): New function. 2004-12-09 Werner Koch * serpent.c (serpent_setkey): Moved prototype of serpent_test to outer scope. 2004-09-11 Moritz Schulte * pubkey.c (pubkey_table): Added an alias entry for GCRY_PK_ELG_E. 2004-08-23 Moritz Schulte * ac.c: Do not include . * rndegd.c: Likewise. * sha1.c: Likewise. * rndunix.c: Likewise. * rndlinux.c: Likewise. * rmd160.c: Likewise. * md5.c: Likewise. * md4.c: Likewise. * cipher.c: Likewise. * crc.c: Likewise. * blowfish.c: Likewise. * pubkey.c (dummy_generate, dummy_check_secret_key) (dummy_encrypt, dummy_decrypt, dummy_sign, dummy_verify): Return err code GPG_ERR_NOT_IMPLEMENTED instead of aborting through log_bug(). (dummy_get_nbits): Return 0 instead of aborting though log_bug(). 2004-08-19 Werner Koch * pubkey.c (sexp_data_to_mpi): Changed the zero random byte substituting code to actually do clever things. Thanks to Matthias Urlichs for noting the implementation problem. 2004-08-09 Moritz Schulte * pubkey.c (gcry_pk_sign): Fixed memory leak; fix provided by Modestas Vainius. 2004-07-16 Werner Koch * rijndael.c (do_encrypt): Fix alignment problem. Bugs found by Matthias Urlichs. (do_decrypt): Ditto. (keySched, keySched2): Use 2 macros along with unions in the key schedule context. 2004-07-14 Moritz Schulte * rsa.c (_gcry_rsa_decrypt): Don't forget to free "a". Thanks to Nikos Mavroyanopoulos. 2004-05-09 Werner Koch * random.c (read_pool): Mix the PID in to better protect after a fork. 2004-07-04 Moritz Schulte * serpent.c: Use "u32_t" instead of "unsigned long", do not declare S-Box variables as "register". Fixes failure on OpenBSD/sparc64, reported by Nikolay Sturm. 2004-05-07 Werner Koch * random.c (initialize): Factored out some code to .. (initialize_basics): .. new function. (_gcry_random_initialize): Just call initialize_basics unless the new arg FULL is set to TRUE. (_gcry_fast_random_poll): Don't do anything unless the random system has been really initialized. 2004-05-07 Moritz Schulte * ac.c (gcry_ac_open): Do not dereference NULL pointer. Reported by Umberto Salsi. 2004-02-20 Werner Koch * primegen.c (check_prime): New args CB_FUNC and CB_ARG; call them at different stages. Pass these arguments through all callers. 2004-02-06 Werner Koch * des.c: Add a new OID as used by pkcs#12. * rfc2268.c: New. Taken from libgcrypt. * cipher.c: Setup the rfc2268 algorithm. 2004-01-25 Moritz Schulte * primegen.c (prime_generate_internal): Do not forget to free `q_factor'; fixed by Brieuc Jeunhomme. (prime_generate_internal): Do not forget to free `prime'. 2004-01-14 Moritz Schulte * ac.c (gcry_ac_data_set): New argument: flags; slightly rewritten. (gcry_ac_data_get_name, gcry_ac_data_get_index): Likewise. (gcry_ac_key_pair_generate): New argument: misc_data; modified order of arguments. (gcry_ac_key_test): New argument: handle. (gcry_ac_key_get_nbits, gcry_ac_key_get_grip): Likewise. Use GCRY_AC_FLAG_NO_BLINDING instead of GCRY_AC_DATA_FLAG_NO_BLINDING. (gcry_ac_mpi): New member: flags. (gcry_ac_data_search, gcry_ac_data_add): Removed functions. 2003-12-22 Werner Koch * primegen.c (is_prime): Release A2. 2003-12-19 Werner Koch * md.c: Moved a couple of functions down below the data structure definitions. (struct gcry_md_context): New field ACTUAL_HANDLE_SIZE. (md_open): Set it here. (strcut gcry_md_list): New field ACTUAL_STRUCT_SIZE. (md_enable): Set it here. (md_close): Wipe the context memory. secure memory. * cipher.c (struct gcry_cipher_handle): New field ACTUAL_HANDLE_SIZE. (gcry_cipher_open): Set it here. (gcry_cipher_close): Use it to always wipe out the handle data. * ac.c (gcry_ac_open): Make sure HANDLE gets initialized even when the function is not successful. (gcry_ac_close): Allow a NULL handle. (gcry_ac_key_destroy, gcry_ac_key_pair_destroy): Ditto. (gcry_ac_key_get_grip): Return INV_OBJ on error. * primegen.c (prime_generate_internal): Fixed error code for failed malloc. Replaced the !err if chain by gotos. (gcry_prime_group_generator): Remove the extra sanity check. * md.c: Minor code and comment cleanups. 2003-12-16 Werner Koch * primegen.c (gen_prime): Doc fix. Thanks to Newton Hammet. 2003-12-11 Werner Koch * rndunix.c (slow_poll): Don't use #warning but #error. * rndegd.c: Changed indentation. (my_make_filename): Removd the var_arg cruft becuase we don't need it here. Changed caller. * rndlinux.c: Changed indentation. (open_device): Remove the superfluous stat call and clarify comment. * rsa.c: Changed indentation. (secret): Use the standard algorithm if p, q and u are not available. (rsa_blind, rsa_unblind): Renamed from _gcry_rsa_blind, _gcry_rsa_unblind and moved more to the top. * md4.c: Changed indentation. Removed unnecessary casts. * md5.c, rmd160.c, sha1.c, tiger.c: Ditto. * rijndael.c, twofish.c: Ditto. * serpent.c: Removed unnecessary casts. * sha256.c, sha512.c: Ditto. 2003-12-09 Werner Koch * dsa.c: Unified indentation style. * elgamal.c: Ditto. * des.c (des_key_schedule): Code beautifications. * blowfish.c: Changed indentation style. * cast5.c (do_cast_setkey): Ditto. * pubkey.c (gcry_pk_encrypt): Replaced the chain of if(!err) tests by straightforward gotos. Other cleanups. (gcry_pk_decrypt): Ditto. (gcry_pk_sign): Ditto. (gcry_pk_verify): Ditto. (gcry_pk_genkey): Ditto. Use strtoul instead of strtol. (gcry_pk_ctl): Use GPG_ERR_INV_ARG to indicate bad arguments. 2003-12-07 Werner Koch * pubkey.c (gcry_pk_register_default): Undef the helper macro. (gcry_pk_map_name): Allow NULL for string. (sexp_to_key): Use memcpy and not strncpy. Use gcry_free and not free. (sexp_to_sig): Ditto. (sexp_to_enc): Ditto. Replaced the chain of if(!err) tests by straightforward gotos. 2003-12-05 Werner Koch * cipher.c: Documentation cleanups. (gcry_cipher_mode_from_oid): Allow NULL for STRING. 2003-12-03 Werner Koch * elgamal.c (sign, do_encrypt, gen_k): Make sure that a small K is only used for encryption. 2003-11-18 Werner Koch * random.h (rndw32_set_dll_name): Removed unused prototype. * Makefile.am (EXTRA_DIST): Added Manifest. 2003-11-11 Werner Koch * Manifest: New. 2003-11-04 Werner Koch * md.c (gcry_md_hash_buffer): Use shortcut for SHA1 * sha1.c (_gcry_sha1_hash_buffer): New. * random.c: Reformatted most functions. (mix_pool): Moved the failsafe_digest from global scope to here. (do_fast_random_poll): Use the generic fucntions even if a fast gathering function has been used. (read_pool): Detect a fork and retry. (gcry_randomize, get_random_bytes): Don't distinguish anymore between weak and strong random. (gcry_create_nonce): New. 2003-10-31 Werner Koch * rndw32.c (slow_gatherer_windowsNT): Use a plain buffer for the disk performance values and not the W32 API structure. * dsa.c (verify): s/exp/ex/ due to shadowing of a builtin. * elgamal.c (verify): Ditto. * ac.c (gcry_ac_data_get_index): s/index/idx/ (gcry_ac_data_copy_internal): Remove the cast in _gcry_malloc. (gcry_ac_data_add): Must use gcry_realloc instead of realloc. * pubkey.c (sexp_elements_extract): s/index/idx/ as tribute to the forehackers. (gcry_pk_encrypt): Removed shadowed definition of I. Reordered arguments to malloc for clarity. (gcry_pk_sign, gcry_pk_genkey): Ditto. * primegen.c (prime_generate_internal): s/random/randomlevel/. 2003-10-27 Moritz Schulte * pubkey.c (gcry_pk_encrypt): Don't forget to deallocate pkey. 2003-10-27 Werner Koch * random.c (gcry_random_add_bytes): Return if buflen is zero to avoid gcc warning about unsed parameter. (MASK_LEVEL): Simplified; does now work for signed and unsigned w/o warnings. * md.c (md_start_debug): Removed the const from SUFFIX, because this function is called from the control fucntion which does not require const. Prefixed all (pubkey,digest,cipher}_spec_* globale variables with _gcry_. * ac.c (ac_key_identifiers): Made static. * random.c (getfnc_gather_random,getfnc_fast_random_poll): Move prototypes to .. * rand-internal.h: .. here * random.c (getfnc_gather_random): Include rndw32 gatherer. * rndunix.c, rndw32.c, rndegd.c: Include them here. * rndlinux.c (_gcry_rndlinux_gather_random): Prepend the _gcry_ prefix. Changed all callers. * rndegd.c (_gcry_rndegd_gather_random): Likewise. (_gcry_rndegd_connect_socket): Likewise. * rndunix.c (_gcry_rndunix_gather_random): Likewise. (waitpid): Made static. * rndw32.c: Removed the old and unused winseed.dll cruft. (_gcry_rndw32_gather_random_fast): Renamed from gather_random_fast. (_gcry_rndw32_gather_random): Renamed from gather_random. Note, that the changes 2003-04-08 somehow got lost. * sha512.c (sha512_init, sha384_init): Made static. * cipher.c (do_ctr_decrypt): Removed "return" from this void function. 2003-10-24 Moritz Schulte * serpent.c: Fix an issue on big-endian systems. * rndw32.c: Removed IS_MODULE -cruft. * rndlinux.c (rndlinux_gather_random): Likewise. 2003-10-10 Werner Koch * primegen.c (gen_prime): Bail out if NBITS is less than 16. (prime_generate_internal): Initialize prime variable to suppress compiler warning. Check pbits, initialize qbits when passed as zero. * primegen.c (prime_generate_internal): New arg ALL_FACTORS. Changed all callers. (gcry_prime_generate): Make the factors arg optional. Request all_factors. Make sure PRIME is set to NULL even on error. (gcry_prime_group_generator): New. (gcry_prime_release_factors): New. 2003-10-06 Werner Koch * primegen.c (gen_prime): Assert that NBITS is never zero, it would cause a segv. 2003-09-28 Moritz Schulte * ac.c: Include "cipher.h". 2003-09-27 Moritz Schulte * rndegd.c (do_read): Return nread instead of nbytes; thanks to Michael Caerwyn. 2003-09-04 Werner Koch * pubkey.c (_gcry_pk_aliased_algo_name): New. * ac.c (gcry_ac_open): Use it here. * Makefile.am (EXTRA_libcipher_la_SOURCES): Add serpent.c 2003-09-02 Moritz Schulte * primegen.c (gcry_prime_check, gcry_prime_generate): New functions. (prime_generate_internal): New function, based on _gcry_generate_elg_prime. (_gcry_generate_elg_prime): Rewritten as a wrapper for prime_generate_internal. 2003-08-28 Werner Koch * pubkey.c (gcry_pk_encrypt): Don't include the flags list in the return value. This does not make sense and breaks any programs parsing the output strictly (e.g. current gpgsm). (gcry_pk_encrypt): If aliases for the algorithm name exists, take the first one instead of the regular name to adhere to SPKI conventions. (gcry_pk_genkey): Ditto. (gcry_pk_sign): Ditto. Removed unused KEY_ALGO_NAME. 2003-08-19 Moritz Schulte * cipher.c: Add support for Serpent * serpent.c: New file. 2003-08-10 Moritz Schulte * rsa.c (_gcry_rsa_blind, _gcry_rsa_unblind): Declare static. 2003-08-09 Timo Schulz * random.c (getfnc_gather_random): Don't check NAME_OF_DEV_RANDOM two times, but also the NAME_OF_DEV_URANDOM device. 2003-08-08 Moritz Schulte * pubkey.c (sexp_to_enc): Fixed extraction of S-Expression: do not fail if no `flags' sub S-Expression is found. 2003-07-27 Werner Koch * md.c (gcry_md_lookup_func_oid): Allow for empty OID lists. 2003-07-23 Moritz Schulte * ac.c (gcry_ac_data_construct): New argument: include_flags, only include `flags' S-expression, if include_flags is true. Adjust callers. Thanks for triggering a bug caused by `flags' sub-S-expression where they are not expected to Ralf Schneider. 2003-07-21 Moritz Schulte * pubkey.c (gcry_pk_lookup_func_name): Use new member name `aliases' instead of `sexp_names'. * ac.c (gcry_ac_key_data_get): New function. * cipher.c (gcry_cipher_lookup_func_name): Fix return value. 2003-07-20 Moritz Schulte * blowfish.c: Adjusted for new gcry_cipher_spec_t structure. * cast5.c: Likewise. * twofish.c: Likewise. * arcfour.c: Likewise. * rijndael.c (rijndael_oids, rijndael192_oids, rijndael256_oids): New variables, adjust for new gcry_cipher_spec_t structure. * des.c (oids_tripledes): New variable, adjust for new gcry_cipher_spec_t structure. * md.c (oid_table): Removed. * tiger.c (oid_spec_tiger): New variable. (digest_spec_tiger): Adjusted for new gry_md_spec_t structure. * sha512.c (oid_spec_sha512): New variable. (digest_spec_sha512): Adjusted for new gry_md_spec_t structure. * sha512.c (oid_spec_sha384): New variable. (digest_spec_sha384): Adjusted for new gry_md_spec_t structure. * sha256.c (oid_spec_sha256): New variable. (digest_spec_sha256): Adjusted for new gry_md_spec_t structure. * sha1.c (oid_spec_sha1): New variable. (digest_spec_sha1): Adjusted for new gry_md_spec_t structure. * rmd160.c (oid_spec_rmd160): New variable. (digest_spec_rnd160): Adjusted for new gry_md_spec_t structure. * md5.c (oid_spec_md5): New variable. (digest_spec_md5): Adjusted for new gry_md_spec_t structure. * md4.c (oid_spec_md4): New variable. (digest_spec_md4): Adjusted for new gry_md_spec_t structure. * crc.c (digest_spec_crc32, digest_spec_crc32_rfc1510, digest_spec_crc32_rfc2440): Adjusted for new gry_md_spec_t structure. 2003-07-19 Moritz Schulte * md.c (gcry_md_lookup_func_oid): New function. (search_oid): New function, copied from cipher.c. (gcry_md_map_name): Adjust for new search_oid_interface. * cipher.c (oid_table): Removed table. (gcry_cipher_lookup_func_oid): New function. (search_oid): Rewritten to use the module functions. (gcry_cipher_map_name): Adjust for new search_oid interface. (gcry_cipher_mode_from_oid): Likewise. 2003-07-18 Werner Koch * md.c (gcry_md_hash_buffer): Convert ERR to gpg_error_t in gpg_strerror. 2003-07-14 Moritz Schulte * cipher.c (gcry_cipher_lookup_func_name): Also check the cipher name aliases, not just the primary name. (gcry_cipher_map_name): Remove kludge for aliasing Rijndael to AES. * arcfour.c, blowfish.c, cast5.c, des.c, twofish.c: Adjust cipher specification structures. * rijndael.c (rijndael_names, rijndael192_names, rijndael256_names): New variables, use them in the cipher specifications. * rmd160test.c: Removed file. * ac.c, arcfour.c, blowfish.c, cast5.c, cipher.c, des.c, dsa.c, elgamal.c, md.c, pubkey.c, random.c, rijndael.c, rsa.c, twofish.c: Used gcry_err* wrappers for libgpg symbols. * primegen.c (gen_prime): Correct the order arguments to extra_check. 2003-07-12 Moritz Schulte * ac.c: Replaced all public occurences of gpg_error_t with gcry_error_t. * cipher.c: Likewise. * md.c: Likewise. * pubkey.c: Likewise. * random.c: Likewise. * cipher.c: Added support for TWOFISH128. 2003-07-08 Moritz Schulte * ac.c (gcry_ac_data_copy_internal): New function, based on gcry_ac_data_copy. (gcry_ac_data_copy): Made public, use gcry_ac_data_copy_internal. (gcry_ac_key_init): Use gcry_ac_data_copy_internal. 2003-07-07 Moritz Schulte * ac.c (gcry_ac_data_set): Only release old MPI value if it is different from the new value. Bug reported by Simon Josefsson . * pubkey.c (gcry_pk_list): New function. * md.c (gcry_md_list): New function. * ac.c (gcry_ac_key_pair_generate): Fix calculation of format string size. 2003-07-05 Moritz Schulte * md.c: Named struct of digest_table `digest_table_entry'. (digest_table_entry): New member: algorithm; filled in. (digest_table_entry): Removed unused member: flags. (gcry_md_register): New argument: algorithm_id, filled in. (gcry_md_register_default): Used algorithm ID from module structure. (gcry_md_map_name): Likewise. (md_enable): Likewise. (md_read): Likewise. (gcry_md_info): Likewise. * pubkey.c: Named truct for pubkey_table `pubkey_table_entry'. (pubkey_table_entry): New member: algorithm; filled in. (gcry_pk_register_default): Used algorithm ID from pubkey_table. (gcry_pk_register): New argument: algorithm_id, filled in. (gcry_pk_map_name): Used algorithm ID from module structure. (gcry_pk_decrypt): Likewise. (gcry_pk_encrypt): Likewise. (gcry_pk_verify): Likewise. (gcry_pk_sign): Likewise. (gcry_pk_testkey): Likewise. (gcry_pk_genkey): Likewise. (gcry_pk_get_nbits): Likewise. (sexp_to_key): Removed unused variable: algo. (sexp_to_sig): Likewise. * cipher.c: Named struct for cipher_table `cipher_table_entry'. (cipher_table_entry): New member: algorithm; filled in. (gcry_cipher_register_default): Used algorithm ID from cipher_table. (gcry_cipher_register): New argument: algorithm_id, filled in. (gcry_cipher_map_name): Used algorithm ID from module structure. * arcfour.c (cipher_spec_arcfour): Removed algorithm ID. * blowfish.c (cipher_spec_blowfish): Likewise. * cast5.c (cipher_spec_cast5): Likewise. * crc.c (digest_spec_crc32): Likewise. * crc.c (digest_spec_crc32_rfc1510): Likewise. * crc.c (digest_spec_crc32_rfc2440): Likewise. * des.c (cipher_spec_des): Likewise. * des.c (cipher_spec_tripledes): Likewise. * dsa.c (pubkey_spec_dsa): Likewise. * elgamal.c (pubkey_spec_elg): Likewise. * md4.c (digest_spec_md4): Likewise. * md5.c (digest_spec_md5): Likewise. * aes.c (cipher_spec_aes): Likewise. * aes.c (cipher_spec_aes192): Likewise. * aes.c (cipher_spec_aes256): Likewise. * rsa.c (pubkey_spec_rsa): Likewise. * sha1.c (digest_spec_sha1): Likewise. * sha256.c (digest_spec_sha256): Likewise. * sha512.c (digest_spec_sha512): Likewise. * tiger.c (digest_spec_tiger): Likewise. * twofish.c (cipher_spec_twofish): Likewise. * twofish.c (cipher_spec_twofish128): Likewise. * Makefile.am (EXTRA_libcipher_la_SOURCES): Fix list of source files; reported by Simon Josefsson . * pubkey.c: Replaced all occurences of `id' with `algorithm', since `id' is a keyword in obj-c. * md.c: Likewise. * cipher.c: Likewise. * crc.c, md4.c, md5.c, rmd160.c, sha1.c, sha256.c, tiger.c: Replaced all occurences of gcry_digest_spec_t with gcry_md_spec_t. * dsa.c, rsa.c, elgamal.c: Replaced all occurencens of gcry_pubkey_spec_t with gcry_pk_spec_t. * md.c: Replaced all occurences of gcry_digest_spec_t with gcry_md_spec_t. (gcry_digest_register_default): Renamed to ... (gcry_md_register_default): ... this; adjusted callers. (gcry_digest_lookup_func_name): Renamed to ... (gcry_md_lookup_func_name): ... this; adjusted callers. (gcry_digest_lookup_name): Renamed to ... (gcry_md_lookup_name): ... this; adjusted callers. (gcry_digest_register): Renamed to ... (gcry_md_register): ... this. (gcry_digest_unregister): Renamed to ... (gcry_md_unregister): ... this. * pubkey.c (gcry_pubkey_register): Renamed to ... (gcry_pk_register): ... this. (gcry_pubkey_unregister): Renamed to ... (gcry_pk_unregister): ... this. Replaced all occurences of gcry_pubkey_spec_t with gcry_pk_spec_t. (gcry_pubkey_register_default): Renamed to ... (gcry_pk_register_default): ... this; adjusted callers. (gcry_pubkey_lookup_func_name): Renamed to ... (gcry_pk_lookup_func_name): ... this; adjusted callers. (gcry_pubkey_lookup_name): Renamed to ... (gcry_pk_lookup_name): ... this; adjusted callers. * md.c (gcry_md_hash_buffer): Fix error checking. Thanks to Simon Josefsson . 2003-07-04 Moritz Schulte * cipher.c (gcry_cipher_list): New function. 2003-07-01 Moritz Schulte * pubkey.c (sexp_to_sig): Accept a `flags' S-expression to be more consistent with sexp_to_enc. 2003-06-30 Moritz Schulte * Makefile.am (libcipher_la_SOURCES): Added: ac.c. * pubkey.c (_gcry_pk_module_lookup): New function. (_gcry_pk_module_release): New function. 2003-06-29 Moritz Schulte * ac.c: New file. 2003-06-26 Werner Koch * md.c (gcry_md_hash_buffer): Trigger BUG correcly with new API. 2003-06-19 Werner Koch * md.c (gcry_md_is_enabled): Fixed. 2003-06-18 Werner Koch * cipher.c (gcry_cipher_get_algo_keylen): New. (gcry_cipher_get_algo_blklen): New. 2003-06-18 Moritz Schulte * arcfour.c, cipher.c, blowfish.c, md.c, cast5.c, pubkey.c, crc.c, des.c, dsa.c, elgamal.c, md4.c, md5.c, random.c, rijndael.c, rmd160.c, rsa.c, sha1.c, sha256.c, sha512.c, tiger.c, twofish.c: Replaced older types GcryDigestSpec, GcryCipherSpec and GcryPubkeySpec with newer types: gcry_digest_spec_t, gcry_cipher_spec_t and gcry_pubkey_spec_t. * md.c (gcry_digest_id_new): Removed function. (gcry_digest_register): Removed code for generating a new module ID. * pubkey.c (gcry_pubkey_id_new): Removed function. (gcry_pubkey_register): Removed code for generating a new module ID. * cipher.c, md.c, pubkey.c: Replace old type GcryModule with newer one: gcry_module_t. (gcry_cipher_id_new): Removed function. (gcry_cipher_register): Removed code for generating a new module ID. * cipher.c (gcry_cipher_register): Adjust call to _gcry_module_add. (gcry_cipher_register_default): Likewise. * pubkey.c (gcry_pubkey_register_default): Likewise. (gcry_pubkey_register): Likewise. * md.c (gcry_digest_register_default): Likewise. (gcry_digest_register): Likewise. * md.c (gcry_digest_lookup_func_id): Removed function. (gcry_digest_lookup_id): Likewise. (gcry_digest_id_new): Use _gcry_module_lookup_id instead of gcry_digest_lookup_id. (digest_algo_to_string): Likewise. (check_digest_algo): Likewise. (md_enable): Likewise. (md_digest_length): Likewise. (md_asn_oid): Likewise. * pubkey.c (gcry_pubkey_lookup_id): Removed function. (gcry_pubkey_lookup_func_id): Likewise. (gcry_pubkey_id_new): Use _gcry_module_lookup_id instead of gcry_pubkey_id_new. (gcry_pk_algo_name): Likewise. (disable_pubkey_algo): Likewise. (check_pubkey_algo): Likewise. (pubkey_get_npkey): Likewise. (pubkey_get_nskey): Likewise. (pubkey_get_nsig): Likewise. (pubkey_get_nenc): Likewise. (pubkey_generate): Likewise. (pubkey_check_secret_key): Likewise. (pubkey_encrypt): Likewise. (pubkey_decrypt): Likewise. (pubkey_sign): Likewise. (pubkey_verify): Likewise. (gcry_pk_algo_info): Likewise. * cipher.c (gcry_cipher_lookup_func_id): Removed function. (gcry_cipher_lookup_id): Likewise. (cipher_algo_to_string): use _gcry_module_lookup_id instead of gcry_cipher_lookup_id. (disable_cipher_algo): Likewise. (check_cipher_algo): Likewise. (cipher_get_blocksize): Likewise. (gcry_cipher_open): Likewise. (gcry_cipher_id_new): Likewise. 2003-06-17 Moritz Schulte * Makefile.am (GCRYPT_MODULES): Set to @GCRYPT_CIPHERS@, @GCRYPT_PUBKEY_CIPHERS@, @GCRYPT_DIGESTS@ and @GCRYPT_RANDOM@. (libcipher_la_DEPENDENCIES): Set to $(GCRYPT_MODULES). (libcipher_la_LIBADD): Likewise. (AM_CFLAGS): Added: @GPG_ERROR_CFLAGS@. (EXTRA_libcipher_la_SOURCES): Added all conditional sources. * md.c (md_open): Use _gcry_fast_random_poll instead of fast_random_poll. * cipher.c (gcry_cipher_open): Likewise. * random.h (fast_random_poll): Removed macro. * blowfish.c, md4.c, md5.c, rmd160.c, sha1.c, sha256.c, sha512.c, tiger.c: Use Autoconf's WORDS_BIGENDIAN instead of our own BIG_ENDIAN_HOST. 2003-06-16 Moritz Schulte * random.c (getfnc_gather_random): Do not special-case USE_ALL_RANDOM_MODULES, make it the default. * dsa.c: Replace last occurences of old type names with newer names (i.e. replace MPI with gcry_mpi_t). * elgamal.c: Likewise. * primegen.c: Likewise. * pubkey.c: Likewise. * rsa.c: Likewise. 2003-06-14 Moritz Schulte * des.c (des_setkey): Add selftest check. (tripledes_set3keys): Likewise. (do_tripledes_setkey): Remove selftest check. (do_des_setkey): Likewise. 2003-06-11 Moritz Schulte * md.c (_gcry_md_init): New function. * cipher.c (_gcry_cipher_init): New function. * pubkey.c (_gcry_pk_init): New function. 2003-06-13 Werner Koch * md.c (gcry_md_get_algo): Reverted to old API. This is a convenience function anyway and error checking is not approriate. (gcry_md_is_secure): New. (gcry_md_is_enabled): New. 2003-06-12 Werner Koch * cipher.c (gcry_cipher_open): Make sure HANDLE is set to NULL on error. 2003-06-11 Werner Koch * md.c (gcry_md_open): Make sure H receives either NULL or an valid handle. (gcry_md_copy): Swapped arguments so that it is more in lione with md_open and most other API fucntions like memcpy (destination comes first). Make sure HANDLE is set to NULL on error. * rijndael.c (do_encrypt): Hack to force correct alignment. It seems not to be not sufficient, though. We should rework this fucntions and remove all these ugly casts. Let the compiler optimize or have an assembler implementation. 2003-06-09 Moritz Schulte * Makefile.am: Removed rules serpent, since that is not commited yet. 2003-06-08 Moritz Schulte * pubkey.c (gcry_pk_encrypt): Improve calculation for size of the format string. 2003-06-07 Moritz Schulte * arcfour.c, bithelp.h, blowfish.c, cast5.c, cipher.c, crc.c, des.c, dsa.c, elgamal.c, md4.c, md5.c, md.c, primegen.c, pubkey.c, rand-internal.h, random.c, random.h, rijndael.c, rmd160.c, rmd160test.c, rmd.h, rndeged.c, rndlinux.c, rndunix.c, rndw32.c, rsa.c, sha1.c, sha256.c, sha512.c, tiger.c, twofish.c: Edited all preprocessor instructions to remove whitespace before the '#'. This is not required by C89, but there are some compilers out there that don't like it. Replaced any occurence of the now deprecated type names with the new ones. 2003-06-04 Moritz Schulte * pubkey.c (gcry_pk_encrypt): Construct an arg_list and use gcry_sexp_build_array instead of gcry_sexp_build. (gcry_pk_sign): Likewise. (gcry_pk_genkey): Likewise. 2003-06-01 Moritz Schulte * dsa.c (_gcry_dsa_generate): Do not check wether the algorithm ID does indeed belong to DSA. (_gcry_dsa_sign): Likewise. (_gcry_dsa_verify): Likewise. (_gcry_dsa_get_nbits): Likewise. * elgamal.c (_gcry_elg_check_secret_key): Do not check wether the algorithm ID does indeed belong to ElGamal. (_gcry_elg_encrypt): Likewise. (_gcry_elg_decrypt): Likewise. (_gcry_elg_sign): Likewise. (_gcry_elg_verify): Likewise. (_gcry_elg_get_nbits): Likewise. (_gcry_elg_generate): Likewise. * rsa.c (_gcry_rsa_generate): Do not check wether the algorithm ID does indeed belong to RSA. (_gcry_rsa_encrypt): Likewise. (_gcry_rsa_decrypt): Likewise. (_gcry_rsa_sign): Likewise. (_gcry_rsa_verify): Likewise. (_gcry_rsa_get_nbits): Likewise. 2003-05-30 Moritz Schulte * md.c (md_get_algo): Return zero in case to algorithm is enabled. * md.c (gcry_md_info): Adjusted for new no-errno-API. (md_final): Likewise. (gcry_md_get_algo): Likewise. * pubkey.c (gcry_pk_get_keygrip): Likewise. (gcry_pk_ctl): Likewise. (gcry_pk_algo_info): Likewise. * des.c (selftest): Likewise. 2003-05-29 Moritz Schulte * md.c (md_enable): Do not forget to release module on error. (gcry_md_open): Adjusted for new no-errno-API. (md_open): Likewise. (md_copy): Likewise. (gcry_md_copy): Likewise. (gcry_md_setkey): Likewise. (gcry_md_algo_info): Likewise. * cipher.c (gcry_cipher_open): Adjusted for new no-errno-API and also fixed a locking bug. (gcry_cipher_encrypt): Adjusted for new no-errno-API. (gcry_cipher_decrypt): Likewise. (gcry_cipher_ctl): Likewise. (gcry_cipher_info): Likewise. (gcry_cipher_algo_info): Likewise. 2003-05-28 Moritz Schulte * md.c (md_enable): Adjusted for libgpg-error. (gcry_md_enable): Likewise. (gcry_digest_register_default): Likewise. (gcry_digest_register): Likewise. (check_digest_algo): Likewise. (prepare_macpads): Likewise. (gcry_md_setkey): Likewise. (gcry_md_ctl): Likewise. (gcry_md_get): Likewise. (gcry_md_algo_info): Likewise. (gcry_md_info): Likewise. * dsa.c (_gcry_dsa_generate): Likewise. (_gcry_dsa_check_secret_key): Likewise. (_gcry_dsa_sign): Likewie. (_gcry_dsa_verify): Likewise. * twofish.c (do_twofish_setkey): Likewise. (twofish_setkey): Likewise. * cipher.c (gcry_cipher_register): Likewise. 2003-05-25 Moritz Schulte * rijndael.c (do_setkey): Adjusted for libgpg-error. (rijndael_setkey): Likewise. * random.c (gcry_random_add_bytes): Likewise. * elgamal.c (_gcry_elg_generate): Likewise. (_gcry_elg_check_secret_key): Likewise. (_gcry_elg_encrypt): Likewise. (_gcry_elg_decrypt): Likewise. (_gcry_elg_sign): Likewise. (_gcry_elg_verify): Likewise. * rsa.c (_gcry_rsa_generate): Likewise. (_gcry_rsa_check_secret_key): Likewise. (_gcry_rsa_encrypt): Likewise. (_gcry_rsa_decrypt): Likewise. (_gcry_rsa_sign): Likewise. (_gcry_rsa_verify): Likewise. * pubkey.c (dummy_generate, dummy_check_secret_key, dummy_encrypt, dummy_decrypt, dummy_sign, dummy_verify): Likewise. (gcry_pubkey_register): Likewise. (check_pubkey_algo): Likewise. (pubkey_generate): Likewise. (pubkey_check_secret_key): Likewise. (pubkey_encrypt): Likewise. (pubkey_decrypt): Likewise. (pubkey_sign): Likewise. (pubkey_verify): Likewise. (sexp_elements_extract): Likewise. (sexp_to_key): Likewise. (sexp_to_sig): Likewise. (sexp_to_enc): Likewise. (sexp_data_to_mpi): Likewise. (gcry_pk_encrypt): Likewise. (gcry_pk_decrypt): Likewise. (gcry_pk_sign): Likewise. (gcry_pk_verify): Likewise. (gcry_pk_testkey): Likewise. (gcry_pk_genkey): Likewise. (gcry_pk_ctl): Likewise. * cipher.c (dummy_setkey): Likewise. (check_cipher_algo): Likewise. (gcry_cipher_open): Likewise. (cipher_setkey): Likewise. (gcry_cipher_ctl): Likewise. (cipher_encrypt): Likewise. (gcry_cipher_encrypt): Likewise. (cipher_decrypt): Likewise. (gcry_cipher_decrypt): Likewise. (gcry_cipher_info): Likewise. (gcry_cipher_algo_info): Likewise. * cast5.c (cast_setkey): Likewise. (do_cast_setkey): Likewise. * arcfour.c (arcfour_setkey): Likewise. (do_arcfour_setkey): Likewise. * blowfish.c (do_bf_setkey): Likewise. (bf_setkey): Likewise. * des.c (do_des_setkey): Likewise. (do_tripledes_setkey): Likewise. 2003-05-22 Moritz Schulte * tiger.c: Merged code ussing the U64_C macro from GnuPG. * sha512.c: Likewise. 2003-05-17 Moritz Schulte * pubkey.c (gcry_pk_genkey): Fix type: acquire a lock, instead of releasing it. 2003-05-11 Moritz Schulte * pubkey.c (gcry_pk_testkey): Call REGISTER_DEFAULT_CIPHERS. (gcry_pk_ctl): Likewise. 2003-04-27 Moritz Schulte * pubkey.c (gcry_pk_genkey): Release sexp after extracted data has been used. * md.c (gcry_md_get_algo_dlen): Simplified, simply call md_digest_length to do the job. * des.c (do_des_setkey): Check for selftest failure not only during initialization. (do_tripledes_setkey): Include check for selftest failure. * pubkey.c (gcry_pubkey_register_default): New macro `pubkey_use_dummy', use it. * elgamal.c (elg_names): New variable. (pubkey_spec_elg): Include elg_names. * dsa.c (dsa_names): New variable. (pubkey_spec_dsa): Include dsa_names. * rsa.c (rsa_names): New variable. (pubkey_spec_rsa): Include rsa_names. * pubkey.c (gcry_pubkey_lookup_func_name): Compare name also with the names listed in `sexp_names'. 2003-04-24 Moritz Schulte * pubkey.c (sexp_to_key): New variables: module, pubkey. Adjusted to new module interface. (sexp_to_key): Changend type of argument `retalgo' from `int *' to `GcryModule **'. Adjusted all callers. Removed argument: r_algotblidx. (sexp_to_sig): Changend type of argument `retalgo' from `int *' to `GcryModule **'. Adjusted all callers. (sexp_to_enc): Likewise. (pubkey_get_npkey, pubkey_get_nskey, pubkey_get_nsig, pubkey_get_nenc): Use strlen to find out the number. * rsa.c: Adjust pubkey_spec_rsa to new internal interface. * dsa.c: Likewise. * elgamal.c: Likewise. 2003-04-17 Moritz Schulte * pubkey.c (sexp_elements_extract): New function. * pubkey.c (sexp_to_key): Removed variable `idx', added `err', use sexp_elements_extract. (sexp_to_sig): Likewise. (sexp_to_enc): Likewise. * pubkey.c: Terminate list correctly. * md.c: Include sha512/sha384 in digest_table. 2003-04-16 Moritz Schulte * Makefile.am: Include support for sha512.c. * sha512.c: New file, merged from GnuPG, with few modifications for libgcrypt. * rand-internal.h: Removed declarations for constructor functions. * md.c (md_copy): Call _gcry_module_use for incrementing the usage counter of the digest modules. * rsa.c: Do not include "rsa.h". * dsa.c: Do not include "dsa.h". * elgamal.c: Do not include "elgamal.h". * des.c: Do not include "des.h". * cast5.c: Do not include "cast5.h". * blowfish.c: Do not include "blowfish.h". * arcfour.c: Do not include "arcfour.h". * Makefile.am (libcipher_la_DEPENDENCIES): Removed. (libcipher_la_LIBADD): Removed. Use Automake conditionals for conditional compilation. 2003-04-13 Moritz Schulte * cipher.c (gcry_cipher_open): Call REGISTER_DEFAULT_CIPHERS. * md.c (gcry_md_list): New member: module. (md_enable): New variable: module, changed use of module and digest. (md_enable): Initialize member: module. (md_close): Call _gcry_module_release. * cipher.c (gcry_cipher_open): New variable: module, changed use of module and cipher. (struct gcry_cipher_handle): New member: module. (gcry_cipher_open): Initialize member: module. (gcry_cipher_close): Call _gcry_module_release. 2003-04-09 Moritz Schulte * cipher.c: Include "ath.h". * md.c: Likewise. * pubkey.c: Likewise. * cipher.c (ciphers_registered_lock): New variable. * md.c (digests_registered_lock): New variable. * pubkey.c (pubkeys_registered_lock): New variable. * rndlinux.c (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_rndlinux_constructor): Removed function. * rndegd.c (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_rndegd_constructor): Removed function. * rndunix.c (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_rndunix_constructor): Removed function. * rndw32.c (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_rndw32_constructor): Removed function. * rndegd.c (rndegd_connect_socket): Simplify code for creating the egd socket address. (rndegd_connect_socket): Call log_fatal use instead of g10_log_fatal. (egd_gather_random): Renamed to ... (rndegd_gather_random): ... here. 2003-04-08 Moritz Schulte * rndlinux.c: Do not include "dynload.h". * rndunix.c: Likewise. * rndw32.c: Likewise. * rndegd.c (rndegd_connect_socket): Factored out from ... (egd_gather_random): here; call it. (egd_socket): New variable. (egd_gather_random): Initialize fd with egd_socket, do not declare fd static. (do_read): Merged few changes from GnuPG. FIXME - not finished? Do not include "dynload.h". * rndw32.c (gather_random): Renamed to rndw32_gather_random, do not declare static. (gather_random_fast): Renamed to rndw32_gather_random_fast, do not declare static. * rndunix.c (gather_random): Renamed to rndunix_gather_random, do not declare static. * rndegd.c (gather_random): Renamed to rndegd_gather_random, do not declare static. * rndlinux.c (gather_random): Renamed to rndlinux_gather_random, do not declare static. 2003-04-07 Moritz Schulte * Makefile.am (libcipher_la_SOURCES): Removed construct.c. (libcipher_la_SOURCES): Added sha1.c, sha256.c, rmd160.c, md4.c, md5.c, tiger.c and crc.c (EXTRA_PROGRAMS): Removed sha1, sha256, rmd160, md4, md5, tiger and crc. Removed definitions: EXTRA_md4_SOURCES, EXTRA_md5_SOURCES, EXTRA_rmd160_SOURCES, EXTRA_sha1_SOURCES, EXTRA_sha256_SOURCES, EXTRA_tiger_SOURCES and EXTRA_crc_SOURCES, BUILT_SOURCES, DISTCLEANFILES. * pubkey.c: Do not include "elgamal.h", "dsa.h" and "rsa.h". * Makefile.am (libcipher_la_SOURCES): Removed rsa.h, elgamal.h, dsa.h, des.h, cast5.h, arcfour.h and blowfish.h. * rsa.h: Removed file. * elgamal.h: Removed file. * dsa.h: Removed file. * des.h: Removed file. * cast5.h: Removed file. * arcfour.h: Removed file. * blowfish.h: Removed file. * Makefile.am (libcipher_la_SOURCES): Removed dynload.c and dynload.h. * rsa.c (pubkey_spec_rsa): New variable. * dsa.c (pubkey_spec_rsa): New variable. * elgamal.c (pubkey_spec_elg): New variable. * rsa.c (_gcry_rsa_get_info): Removed function. * elgamal.c (_gcry_elg_get_info): Removed function. * dsa.c (_gcry_dsa_get_info): Removed function. * tiger.c (tiger_get_info): Removed function. (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_tiger_constructor): Removed function. * sha1.c (sha1_get_info): Removed function. (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_sha1_constructor): Removed function. * sha256.c (sha256_get_info): Removed function. (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_sha256_constructor): Removed function. * rmd160.c (rmd160_get_info): Removed function. (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_rmd160_constructor): Removed function. * md5.c (md5_get_info): Removed function. (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_md5_constructor): Removed function. * md4.c (md4_get_info): Removed function. (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func): Removed function. (_gcry_md4_constructor): Removed function. * crc.c (crc_get_info): Removed function. * arcfour.c (do_arcfour_setkey): Changed type of context argument to `void *', added local variable for cast, adjusted callers. (arcfour_setkey): Likewise. (encrypt_stream): Likewise. * cast5.c (cast_setkey): Likewise. (encrypt_block): Likewise. * rijndael.c (rijndael_setkey): Likewise. (rijndael_encrypt): Likewise. (rijndael_decrypt): Likewise. * twofish.c (twofish_setkey): Likewise. (twofish_encrypt): Likewise. (twofish_decrypt): Likewise. * des.c (do_des_setkey): Likewise. (do_des_encrypt): Likewise. (do_des_encrypt): Likewise. (do_tripledes_encrypt): Likewise. (do_tripledes_encrypt): Likewise. * blowfish.c (bf_setkey: Likewise. (encrypt_block): Likewise. (decrypt_block): Likewise. * arcfour.c (encrypt_stream): Likewise. * rijndael.c (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func) Removed function. * twofish.c (gnupgext_version, func_table): Removed definitions. (gnupgext_enum_func) Removed function. * cast5.c (CIPHER_ALGO_CAST5): Removed. * blowfish.c (FNCCAST_SETKEY, FNCCAST_CRYPT): Removed macros. (CIPHER_ALGO_BLOWFISH): Removed symbol. * cast5.c (FNCCAST_SETKEY, FNCCAST_CRYPT): Likewise. * des.c (selftest_failed): Removed. (initialized): New variable. (do_des_setkey): Run selftest, if not yet done. (FNCCAST_SETKEY, FNCCAST_CRYPT): Removed macros. * arcfour.c (_gcry_arcfour_get_info): Removed function. * blowfish.c (_gcry_blowfish_get_info): Removed function. * cast5.c (_gcry_cast5_get_info): Removed function. * des.c (_gcry_des_get_info): Removed function. * rijndael.c (_gcry_rijndael_get_info): Removed function. * twofish.c (_gcry_twofish_get_info): Removed function. * arcfour.c (cipher_spec_arcfour): New variable. * twofish.c (cipher_spec_twofish, cipher_spec_twofish128): New variables. * rijndael.c (cipher_spec_aes, cipher_spec_aes192, cipher_spec256): New variables. * des.c (cipher_spec_des, cipher_spec_tripledes): New variables. * cast5.c (cipher_spec_cast5): New variable. * blowfish.c (cipher_spec_blowfish): Likewise. * twofish.c: Do not include "dynload.h". * rijndael.c: Likewise. * des.c: Likewise. * cast5.c: Likewise. * blowfish.c: Likewise. * cipher.c: Likewise. * crc.c: Likewise. * md4.c: Likewise. * md5.c: Likewise. * md.c: Likewise. * pubkey.c: Likewise. * rijndael.c: Likewise. * sha1.c: Likewise. * sha256.c: Likewise. * arcfour.c: Include "cipher.h". * twofish.c: Likewise. * rijndael.c: Likewise. * des.c: Likewise. * cast5.c: Likewise. * blowfish.c: Likewise. * twofish.c (twofish_setkey): Declared argument `key' const. (twofish_encrypt): Declared argument `inbuf' const. (twofish_decrypt): Likewise. * rijndael.c (rijndael_setkey): Declared argument `key' const. (rijndael_encrypt): Declared argument `inbuf' const. (rijndael_decrypt): Likewise. * des.c (do_des_setkey): Declared argument `key' const. (do_tripledes_setkey): Likewise. (do_des_encrypt): Declared argument `inbuf' const. (do_des_decrypt): Likewise. (do_tripledes_encrypt): Likewise. (do_tripledes_decrypt): Likewise. * cast5.c (encrypt_block): Declared argument `inbuf' const. (decrypt_block): Likewise. (cast_setkey): Declared argument `key' const. * blowfish.c (do_bf_setkey): Declared argument `key' const. (encrypt_block): Declared argument `inbuf' const. (encrypt_block): Likewise. * cipher.c: Remove CIPHER_ALGO_DUMMY related code. Removed struct cipher_table_s. Changed definition of cipher_table. Removed definition of disabled_algos. (ciphers_registered, default_ciphers_registered): New variables. (REGISTER_DEFAULT_CIPHERS): New macro. (dummy_setkey): Declared argument `key' const. (dummy_encrypt_block): Declared argument `inbuf' const. (dummy_encrypt_block): Likewise. (dummy_encrypt_stream): Likewise. (dummy_encrypt_stream): Likewise. (dummy_setkey): Use `unsigned char' instead of `byte'. (dummy_encrypt_block): Likewise. (dummy_decrypt_block): Likewise. (dummy_encrypt_stream): Likewise. (dummy_decrypt_stream): Likewise. (gcry_cipher_register_default): New function. (gcry_cipher_lookup_func_id): New function. (gcry_cipher_lookup_func_name): New function. (gcry_cipher_lookup_id): New function. (gcry_cipher_lookup_name): New function. (gcry_cipher_id_new): New function. (gcry_cipher_register): New function. (gcry_cipher_unregister): New function. (setup_cipher_table): Removed function. (load_cipher_modules): Removed function. (gcry_cipher_map_name): Adjusted to use new module management. (cipher_algo_to_string): Likewise. (disable_cipher_algo): Likewise. (check_cipher_algo): Likewise. (cipher_get_keylen): Likewise. (cipher_get_blocksize): Likewise. (gcry_cipher_open): Likewise. (struct gcry_cipher_handle): Replaced members algo, algo_index, blocksize, setkey, encrypt, decrypt, stencrypt, stdecrypt with one member: cipher. (gcry_cipher_open): Adjusted code for new handle structure. (cipher_setkey): Likewise. (cipher_setiv): Likewise. (cipher_reset): Likewise. (do_ecb_encrypt): Likewise. (do_ecb_decrypt): Likewise. (do_cbc_encrypt): Likewise. (do_cbc_decrypt): Likewise. (do_cfb_encrypt): Likewise. (do_cfb_decrypt): Likewise. (do_ctr_encrypt): Likewise. (cipher_encrypt): Likewise. (gcry_cipher_encrypt): Likewise. (cipher_decrypt): Likewise. (gcry_cipher_decrypt): Likewise. (cipher_sync): Likewise. (gcry_cipher_ctl): Likewise. * pubkey.c: Removed struct pubkey_table_s. Changed definition of pubkey_table. Removed definition of disabled_algos. (pubkeys_registered, default_pubkeys_registered): New variables. (REGISTER_DEFAULT_PUBKEYS): New macro. (setup_pubkey_table): Removed function. (load_pubkey_modules): Removed function. (gcry_pubkey_register_default): New function. (gcry_pubkey_lookup_func_id): New function. (gcry_pubkey_lookup_func_name): New function. (gcry_pubkey_lookup_id): New function. (gcry_pubkey_lookup_name): New function. (gcry_pubkey_id_new): New function. (gcry_pubkey_register): New function. (gcry_pubkey_unregister): New function. (gcry_pk_map_name): Adjusted to use new module management. (gcry_pk_algo_name): Likewise. (disable_pubkey_algo): Likewise. (check_pubkey_algo): Likewise. (pubkey_get_npkey): Likewise. (pubkey_get_nskey): Likewise. (pubkey_get_nsig): Likewise. (pubkey_get_nenc): Likewise. (pubkey_generate): Likewise. (pubkey_check_secret_key): Likewise. (pubkey_encrypt): Likewise. (pubkey_decrypt): Likewise. (pubkey_sign): Likewise. (pubkey_verify): Likewise. (gcry_pk_get_nbits): Likewise. (gcry_pk_algo_info): Likewise. * md.c: Removed struct md_digest_list_s. (digest_list): Changed definition. (digests_registered, default_digests_registered): New variables. (REGISTER_DEFAULT_DIGESTS): New macro. (new_list_item): Removed function. (setup_md_table): Removed function. (load_digest_module): Removed function. (gcry_digest_register_default): New function. (gcry_digest_lookup_func_id): New function. (gcry_digest_lookup_func_name): New function. (gcry_digest_lookup_id): New function. (gcry_digest_lookup_name): New function. (gcry_digest_id_new): New function. (gcry_digest_register): New function. (gcry_digest_unregister): New function. (GcryDigestEntry): New type. (struct gcry_md_context): Adjusted type of `list'. (gcry_md_map_name): Adjusted to use new module management. (digest_algo_to_string): Likewise. (check_digest_algo): Likewise. (md_enable): Likewise. (md_digest_length): Likewise. (md_asn_oid): Likewise. 2003-04-07 Moritz Schulte * pubkey.c: Replaced PUBKEY_ALGO_DSA with GCRY_PK_DSA, PUBKEY_ALGO_RSA with GCRY_PK_RSA and PUBKEY_ALGO_ELGAMAL with GCRY_PK_ELG. * dsa.c: Replaced PUBKEY_ALGO_DSA with GCRY_PK_DSA. 2003-04-01 Moritz Schulte * des.c: Removed checks for GCRY_CIPHER_3DES and GCRY_CIPHER_DES. 2003-03-31 Moritz Schulte * tiger.c (tiger_get_info): Do not declare static. * sha256.c (sha256_get_info): Likewise. * sha1.c (sha1_get_info): Likewise. * rmd160.c (rmd160_get_info): Likewise. * md5.c (md5_get_info): Likewise. * md4.c (md4_get_info): Likewise. * crc.c (crc_get_info): Likewise. * md.c (load_digest_module): Call setup_md_table during initialization. (new_list_item): Link new element into digest_list. * cipher.c (do_ctr_decrypt): Made do_ctr_encrypt act as a wrapper for do_ctr_encrypt, since these functions are identical. 2003-03-30 Simon Josefsson * cipher.c (struct gcry_cipher_handle): Add counter field. (gcry_cipher_open): Add CTR. (cipher_reset): Clear counter field. (do_ctr_encrypt, do_ctr_decrypt): New functions. (cipher_encrypt, cipher_decrypt): Call CTR functions. (gcry_cipher_ctl): Add SET_CTR to set counter. 2003-03-30 Moritz Schulte * rsa.c (_gcry_rsa_blind): New function. (_gcry_rsa_unblind): New function. (_gcry_rsa_decrypt): Use _gcry_rsa_blind and _gcry_rsa_decrypt. 2003-03-26 Moritz Schulte * dynload.c (_gcry_enum_gnupgext_pubkeys): Adjust `encrypt' and `decrypt' function arguments. (_gcry_enum_gnupgext_pubkeys): Likewise. * dynload.h: Likewise. * pubkey.c (dummy_decrypt): Add argument: int flags. (dummy_encrypt): Likewise. * elgamal.c (_gcry_elg_encrypt): Add argument: int flags. (_gcry_elg_decrypt): Likewise. * rsa.c (_gcry_rsa_encrypt): Add argument: int flags. (_gcry_rsa_decrypt): Likewise. * pubkey.c: Add `flags' argument to members `encrypt' and `decrypt' of struct `pubkey_table_s'. * rsa.h: Add `flags' argument to function declarations. * elgamal.h: Likewise. * pubkey.c (sexp_data_to_mpi): New variable: int parsed_flags. (sexp_data_to_mpi): Set `parsed_flags'. (sexp_data_to_mpi): New argument: int *flags. (gcry_pk_encrypt): New variable: int flags. (gcry_pk_encrypt): Pass `flags' to pubkey_encrypt. (pubkey_encrypt): New variable: int flags. (pubkey_encrypt): Pass `flags' to pubkey encrypt function. (pubkey_decrypt): Likewise. (pubkey_decrypt): Pass `flags' to pubkey encrypt function. (gcry_pk_encrypt): Include `flags' s-exp in return list. (sexp_to_enc): New argument: int *flags. (gcry_pk_decrypt): New variable: int flags. (gcry_pk_decrypt): Pass `flags' to pubkey_decrypt. (sexp_to_enc): New variable: int parsed_flags. (sexp_to_enc): Set `parsed_flags'. 2003-03-22 Simon Josefsson * cipher.c (gcry_cipher_open, do_cbc_encrypt) (gcry_cipher_encrypt): Support GCRY_CIPHER_CBC_MAC. (gcry_cipher_ctl): Support GCRYCTL_SET_CBC_MAC. 2003-03-19 Werner Koch * primegen.c (gen_prime): New args EXTRA_CHECK and EXTRA_CHECK_ARG to allow for a user callback. Changed all callers. (_gcry_generate_secret_prime) (_gcry_generate_public_prime): Ditto, pass them to gen_prime. * rsa.c (check_exponent): New. (generate): Use a callback to ensure that a given exponent is actually generated. 2003-03-12 Moritz Schulte * primegen.c: Initialize `no_of_small_prime_numbers' statically. (gen_prime): Remove calculation of `no_of_small_prime_numbers'. 2003-03-03 Moritz Schulte * md.c (gcry_md_ctl): Rewritten to use same style like the other functions dispatchers. 2003-03-02 Moritz Schulte * cipher.c (struct gcry_cipher_handle): New member: algo_index. (gcry_cipher_open): Allocate memory for two cipher contexts. Initialize algo_index. (cipher_setkey): Duplicate context into reserved memory. (cipher_reset): New function, which resets the context and clear the IV. (gcry_cipher_ctl): Call cipher_reset. 2003-02-23 Moritz Schulte * cipher.c: Remove (bogus) `digitp' macro definition. * md.c: Likewise. * blowfish.c (burn_stack): Removed. * arcfour.c (burn_stack): Likewise. * cast5.c (burn_stack): Likewise. * des.c (burn_stack): Likewise. * md4.c (burn_stack): Likewise. * md5.c (burn_stack): Likewise. * random.c (burn_stack): Likewise. * rijndael.c (burn_stack): Likewise. * rmd160.c (burn_stack): Likewise. * sha1.c (burn_stack): Likewise. * sha256.c (burn_stack): Likewise. * tiger.c (burn_stack): Likewise. * twofish.c (burn_stack): Likewise. * blowfish.c: Changed all occurences of burn_stack to _gcry_burn_stack. * arcfour.c: Likewise. * cast5.c: Likewise. * des.c: Likewise. * md4.c: Likewise. * md5.c: Likewise. * random.c: Likewise. * rijndael.c: Likewise. * rmd160.c: Likewise. * sha1.c: Likewise. * sha256.c: Likewise. * tiger.c: Likewise. * twofish.c: Likewise. * arcfour.c (_gcry_arcfour_get_info): Use GCRY_CIPHER_ARCFOUR instead of hard-coded value `301'. 2003-01-24 Werner Koch * random.c (_gcry_register_random_progress): New. (_gcry_random_progress): New. * rndlinux.c (gather_random): Call the random progress function. 2003-01-23 Werner Koch * rsa.c (generate): New arg USE_E to request a specific public exponent. (_gcry_rsa_generate): Ditto. * elgamal.c (_gcry_elg_generate): Must add an dummy argument instead of USE_E. * dsa.c (_gcry_dsa_generate): Ditto. * pubkey.c (dummy_generate): Ditto. (pubkey_generate): Add USE_E arg and pass it down. (gcry_pk_genkey): Detect "rsa-use-e" parameter and pass it to generate. * pubkey.c (sexp_to_enc): New arg RET_MODERN. (gcry_pk_decrypt): Make use of it to return a real S-expression. Return better error codes. (gcry_pk_verify): Return better error codes. 2003-01-21 Werner Koch * random.c (gcry_random_add_bytes): Add QUALITY argument, let function return an error code and disable its core for now. 2003-01-21 Timo Schulz * random.c (gcry_random_add_bytes): New. Function to add external random to the pool. 2003-01-20 Simon Josefsson * crc.c: New. * Makefile.am (EXTRA_PROGRAMS, EXTRA_crc_SOURCES): Add crc.c. * md.c (gcry_md_get_algo_dlen): Add values for CRC. 2003-01-20 Werner Koch * sha256.c: New. * bithelp.h (ror): New. * Makfile.am: Add sha256.c. * md.c (oid_table): Add values for SHA256 et al. (gcry_md_get_algo_dlen): Likewise 2003-01-20 Werner Koch * pubkey.c (gcry_pk_get_keygrip): Implemented keygrips for DSA and ElGamal. 2003-01-17 Werner Koch * cipher.c (gcry_cipher_encrypt): Reworked so that the output will never contain the plaintext even if the caller did not checked the return value. * md.c (gcry_md_get_algo): Changed error code to GCRYERR_GENERAL because we don't have an invalid md algo but no algorithm enabled. * pubkey.c (gcry_pk_genkey): Changed error code for bounds check of table parameters to GCRYERR_INTERNAL. * md.c (gcry_md_open): Partly reverted Timo's change from 2002-10-10 by removing the check for the algorithm. An algorithm of 0 is allowed and anyway we should not double check it or check it using a different function. Also fixed the flags check. * pubkey.c (gcry_pk_encrypt): Make sure that R_CIPH points to NULL on error. (gcry_pk_decrypt): Ditto for R_PLAIN. (gcry_pk_sign): Ditto for R_SIG. (gcry_pk_genkey): Ditto for R_KEY. 2003-01-16 Werner Koch * md.c (gcry_md_write): Changed 2nd argument type to void*. (gcry_md_hash_buffer): Changed type of boths buffers to void*. (gcry_md_setkey): Changed 2nd argument type to void*. 2003-01-15 Werner Koch * pubkey.c (sexp_data_to_mpi): New. This handles pkcs1 padding. (gcry_pk_sign, gcry_pk_verify): Use it here. (gcry_pk_encrypt): And here. (pubkey_verify): Add debug code. (sexp_to_enc): Handle flags in the input and return the pkcs1 flag in a new parameter. (gcry_pk_decrypt): Prepare for future pkcs1 handling. 2002-12-19 Werner Koch * random.c (_gcry_random_initialize): New. 2002-12-16 Werner Koch * cipher.c: Added a Teletrust specific OID for 3DES. 2002-12-12 Werner Koch * md.c: Added another oddball OIW OID (sha-1WithRSAEncryption). 2002-11-23 Werner Koch * md.c (load_digest_module): Enlarged checked_algos bitmap. * md4.c (func_table): Fixed entry for md4. Both by Simon Josephson. (transform): Copy data to get the alignment straight. Tested only on i386. 2002-11-10 Simon Josefsson * cipher.c (gcry_cipher_open): Don't reject CTS flag. (do_cbc_encrypt, do_cbc_decrypt, cipher_encrypt) (gcry_cipher_encrypt, cipher_decrypt) (gcry_cipher_decrypt): Support CTS flag. (gcry_cipher_ctl): Toggle CTS flag. 2002-11-10 Werner Koch * md4.c: New. By Simon Josefsson. * Makefile.am (EXTRA_PROGRAMS): Add md4.c. * md.c (oid_table,gcry_md_get_algo_dlen): MD4 support. 2002-10-14 Werner Koch * arcfour.c (do_encrypt_stream): Don't use increment op when assigning to the same variable. 2002-10-10 Timo Schulz * pubkey.c (gcry_pk_genkey): Check boundaries. * md.c (gcry_md_open): Check that algo is available and only valid flag values are used. (gcry_md_get_algo): Add error handling. 2002-09-26 Werner Koch * md.c: Include an OID for TIGER. * tiger.c (tiger_get_info): Use a regular OID. 2002-09-17 Werner Koch * random.c: Replaced mutex.h by the new ath.h. Changed all calls. 2002-09-16 Werner Koch * arcfour.c (do_encrypt_stream): Use register modifier and modulo. According to Nikos Mavroyanopoulos this increases perfromace on i386 system noticable. And I always tought gcc is clever enough. * md5.c (transform): Use register modifier. * rmd160.c (transform): Ditto. * sha1.c (transform): Ditto. We hope that there are 6 free registers. * random.c (gcry_randomize): Rewrote to avoid malloc calls. * rndlinux.c (gather_random): Replaced remaining fprintfs by log_*. * arcfour.c (do_arcfour_setkey): Ditto. * twofish.c (do_twofish_setkey): Ditto. * rndegd.c (gather_random): Ditto. * rijndael.c (do_setkey): Ditto. * random.c (_gcry_random_dump_stats): Ditto. * primegen.c (_gcry_generate_elg_prime): Ditto. * des.c (_gcry_des_get_info): Ditto. * cast5.c (do_cast_setkey): Ditto. * blowfish.c (do_bf_setkey): Ditto. 2002-08-26 Werner Koch * des.c (weak_keys): Fixed one entry in the table and compared all entries against the literature. (selftest): Checksum the weak key table. 2002-08-21 Werner Koch * pubkey.c: Enable keygrip calculation for "openpgp-rsa". 2002-08-17 Werner Koch * cipher.c (setup_cipher_table): Don't overwrite the DES entry with the entry for DUMMY. 2002-08-14 Werner Koch * des.c (do_des_setkey,do_des_encrypt, do_des_decrypt): New. (_gcry_des_get_info): Support plain old DES. * cipher.c (setup_cipher_table): Put DES into the table. 2002-07-25 Werner Koch * rndunix.c (_gcry_rndunix_constructor): Prefixed with _gcry_. Noted by Stephan Austermuehle. 2002-07-08 Timo Schulz * rndw32.c: Replaced the m_ memory functions with the real gcry_ functions. Renamed all g10_ prefixed functions to log_. 2002-06-12 Werner Koch * rsa.c (generate): Use e = 65537 for now. 2002-06-11 Werner Koch * pubkey.c (gcry_pk_get_keygrip): Allow a "protected-private-key". 2002-06-05 Timo Schulz * cipher.c (gcry_cipher_encrypt, gcry_cipher_decrypt): Check that the input size is a multiple of the blocksize. 2002-05-23 Werner Koch * md.c (oid_table): Add an rsadsi OID for MD5. 2002-05-21 Werner Koch * primegen.c, elgamal.c, dsa.c (progress): Do not print anything by default. Pass an extra identifying string to the callback and reserved 2 argumenst for current and total counters. Changed the register function prototype. 2002-05-17 Werner Koch * rndegd.c (rndegd_constructor): Fixed name of register function and prefixed the function name with _gcry_. * rndw32.c (rndw32_constructor): Ditto. * tiger.c (tiger_constructor): Ditto. * Makefile.am: Removed all dynamic loading stuff. * dynload.c: Ditto. Now only used for the constructor system. 2002-05-15 Werner Koch * random.c (gcry_random_bytes,gcry_random_bytes_secure) (gcry_randomize): Make sure we are initialized. 2002-05-14 Werner Koch Changed license of most files to the LGPL. 2002-05-02 Werner Koch * random.c (_gcry_fast_random_poll): Initialize the module so the mutex can be used. * primegen.c (small_prime_numbers): Moved table from smallprime.c * smallprime.c: File removed. * des.c (leftkey_swap, rightkey_swap, working_memcmp): Made static. * cipher.c (gcry_cipher_map_name): Map "RIJNDAEL" to "AES". * rijndael.c (rijndael_get_info): We do only support a 128 bit blocksize so it makes sense to change the algorithm strings to AES. * tiger.c (tiger_final): Removed superfluous token pasting operators. * md5.c (md5_final): Ditto. 2002-04-30 Werner Koch * cipher.c: Fixed list of copyright years. 2002-03-18 Werner Koch * random.c (initialize): Initialize the new pool lock mutex. (_gcry_fast_random_poll): Add locking and moved main code out to... (do_fast_random_poll): new function. (read_pool): Use the new function here. (get_random_bytes): Add locking. (_gcry_update_random_seed_file): Ditto. 2002-03-11 Werner Koch * md.c: Add rsaSignatureWithripemd160 to OID table. 2002-02-20 Werner Koch * sha1.c: Removed a left over comment note. The code has been rewritten from scratch in 1998. Thanks to Niels Möller for reporting this misleading comment. 2002-02-18 Werner Koch * rndunix.c (rndunix_constructor): Use the the new prefixed function name. Reported by Jordi Mallach. 2002-02-10 Werner Koch * random.c (mix_pool): Carry an extra failsafe_digest buffer around to make the function more robust. 2002-02-08 Werner Koch * random.c (add_randomness): Xor new data into the pool and not just copy it. This avoids any choosen input attacks which are not serious in our setting because an outsider won't be able to mix data in and even then we keep going with a PRNG. Thanks to Stefan Keller for pointing this out. 2002-01-04 Werner Koch * pubkey.c (gcry_pk_genkey): Do not release skey - it is static. * primegen.c (gen_prime): Of course we should use set_bit and not set_highbit to set the second high bit. 2001-12-18 Werner Koch * rsa.c (generate): Loop until we find the exact modulus size. Changed the exponent to 41. (rsa_get_info): s/usage/r_usage/ to avoid shadow warnings. * primegen.c (gen_prime): Set 2 high order bits for secret primes. * Makefile.am (DISTCLEANFILES): Include construct.c. 2001-12-17 Werner Koch * pubkey.c (gcry_pk_get_keygrip): New - experimental. 2001-12-11 Werner Koch * cipher.c: Added OIDs for AES. (gcry_cipher_mode_from_oid): New. (gcry_cipher_map_name): Moved OID search code to .. (search_oid): .. new function. 2001-12-10 Werner Koch * pubkey.c (gcry_pk_encrypt): Find the signature algorithm by name and not by number. * pubkey.c (gcry_pk_encrypt,gcry_pk_decrypt,gcry_pk_sign) (gcry_pk_verify,gcry_pk_testkey, gcry_pk_genkey) (gcry_pk_get_nbits): Release the arrays. Noted by Nikos Mavroyanopoulos. 2001-12-06 Werner Koch * cipher.c (gcry_cipher_map_name): Look also for OIDs prefixed with "oid." or "OID.". 2001-12-05 Werner Koch * pubkey.c (algo_info_table): Fixed entry for openpgp-rsa. 2001-11-24 Werner Koch * pubkey.c: Added the rsaEncryption OID to the tables. (sexp_to_key): Add an arg to return the index of the algorithm, changed all callers. (gcry_pk_sign): Find the signature algorithm by name and not by number. (gcry_pk_get_nbits): Fixed so that we can now really pass a secret key to get the result. * md.c (gcry_md_map_name): Look also for OIDs prefixed with "oid." or "OID." so that an OID string can be used as an S-Exp token. 2001-11-20 Werner Koch * md.c (gcry_md_map_name): Lookup by OID if the the name begins with a digit. (oid_table): New. 2001-11-16 Werner Koch * md.c (gcry_md_info): New operator GCRYCTL_IS_ALGO_ENABLED. 2001-11-07 Werner Koch * md.c (gcry_md_hash_buffer): Close the handle which was left open for algorithms other than rmd160. 2001-08-08 Werner Koch * rndw32.c (gather_random): Use toolhelp in addition to the NT gatherer for Windows2000. Suggested by Sami Tolvanen. * random.c (read_pool): Fixed length check, this used to be one byte to strict. Made an assert out of it because the caller has already made sure that only poolsize bytes are requested. Reported by Marcus Brinkmann. 2001-08-03 Werner Koch * cipher.c (cipher_encrypt, cipher_decrypt): Prepare to return errors. We have to change the interface to all ciphers to make this really work but we should do so to prepare for hardware encryption modules. (gcry_cipher_encrypt, gcry_cipher_decrypt): Return the error and set lasterr. (gcry_cipher_ctl): Make sure that errors from setkey are returned. 2001-08-02 Werner Koch * rndlinux.c (gather_random): casted a size_t arg to int so that the format string is correct. Casting is okay here and avoids translation changes. * random.c (fast_random_poll): Do not check the return code of getrusage. * rndunix.c: Add a signal.h header to avoid warnings on Solaris 7 and 8. * tiger.c (print_abc,print_data): Removed. * rijndael.c, des.c, blowfish.c, twofish.c, cast5.c, arcfour.c (burn_stack): New. Add wrappers for most functions to be able to call burn_stack after the function invocation. This methods seems to be the most portable way to zeroise the stack used. It does only work on stack frame based machines but it is highly portable and has no side effects. Just setting the automatic variables at the end of a function to zero does not work well because the compiler will optimize them away - marking them as volatile would be bad for performance. * md5.c, sha1.c, rmd160.c, tiger.c (burn_stack): Likewise. * random.c (burn_stack): New. (mix_pool): Use it here to burn the stack of the mixblock function. * primegen.c (_gcry_generate_elg_prime): Freed q at 3 places. Thanks to Tommi Komulainen. * arcfour.c (arcfour_setkey): Check the minimim keylength against bytes and not bits. (selftest): Must reset the key before decryption. 2001-05-31 Werner Koch * sha1.c (sha1_init): Made static. Changed all g10_ prefixed function names as well as some mpi_ function names to cope with the introduced naming changes. * md.c (prepare_macpads): Made key const. 2001-05-28 Werner Koch * rndegd.c (gather_random): Removed the use of tty_printf. 2001-03-29 Werner Koch * md5.c (md5_final): Fixed calculation of hashed length. Thanks to disastry@saiknes.lv for pointing out that it was horrible wrong for more than 512MB of input. * sha1.c (sha1_final): Ditto. * rmd160.c (rmd160_final): Ditto. * tiger.c (tiger_final): Ditto. * blowfish.c (encrypt,do_encrypt): Changed name to do_encrypt to avoid name clashes with an encrypt function in stdlib.h of Dynix/PIX. Thanks to Gene Carter. * elgamal.c (encrypt,do_encrypt): Ditto. * twofish.c (gnupgext_enum_func): Use only when when compiled as a module. * rijndael.c (gnupgext_enum_func): Ditto. * tiger.c (tiger_get_info): Return "TIGER192" and not just "TIGER". By Edwin Woudt. * random.c: Always include time.h - standard requirement. Thanks to James Troup. * rndw32.c: Fixes to the macros. 2001-01-11 Werner Koch * cipher.c (cipher_encrypt,gcry_cipher_encrypt): Use blocksize and not 8. 2000-12-19 Werner Koch Major change: Removed all GnuPG stuff and renamed this piece of software to gcrypt. 2000-11-14 Werner Koch * dsa.c (test_keys): Replaced mpi_alloc by gcry_mpi_new and mpi_free by gcry_mpi_release. * elgamal.c (test_keys,generate): Ditto, also for mpi_alloc_secure. * rsa.c (test_keys,generate,rsa_verify): Ditto. * primegen.c (generate_elg_prime): Ditto. (gen_prime): Ditto and removed nlimbs. * rsa.c (generate): Allocate 2 more vars in secure memory. * Makefile.am (OMIT_DEPENDENCIES): Hack to work around dependency problems. 2000-10-09 Werner Koch * arcfour.c, arcfour.h: New. * cipher.c (cipher_encrypt, cipher_decrypt): Add stream mode. (setup_cipher_table): Add Arcfour. (gcry_cipher_open): Kludge to allow stream mode. Wed Oct 4 13:16:18 CEST 2000 Werner Koch * sha1.c (transform): Use rol() macro. Actually this is not needed for a newer gcc but there are still aoter compilers. * rsa.c (test_keys): Use new random function. * md.c (gcry_md_setkey): New function to overcome problems with const conflics. (gcry_md_ctl): Pass set key to the new functions. * rijndael.c: New. * cipher.c: Add Rijndael support. Mon Sep 18 16:35:45 CEST 2000 Werner Koch * rndlinux.c (open_device): Loose random device checking. By Nils Ellmenreich. * random.c (fast_random_poll): Check ENOSYS for getrusage. * rndunix.c: Add 2 sources for QNX. By Sam Roberts. * pubkey.c (gcry_pk_algo_info): Add GCRYCTL_GET_ALGO_USAGE. * rsa.c: Changed the comment about the patent. (secret): Speed up by using the CRT. For a 2k keys this is about 3 times faster. (stronger_key_check): New but unused code to check the secret key. * Makefile.am: Included rsa.[ch]. * pubkey.c: Enabled RSA support. (pubkey_get_npkey): Removed RSA workaround. Mon Jul 31 10:04:47 CEST 2000 Werner Koch * pubkey.c: Replaced all gcry_sexp_{car,cdr}_{data,mpi} by the new gcry_sexp_nth_{data,mpi} functions. Tue Jul 25 17:44:15 CEST 2000 Werner Koch * pubkey.c (exp_to_key,sexp_to_sig,sexp_to_enc,gcry_pk_encrypt, gcry_pk_decrypt,gcry_pk_sign,gcry_pk_genkey): Changed to work with the new S-Exp interface. Mon Jul 17 16:35:47 CEST 2000 Werner Koch * random.c (gather_faked): Replaced make_timestamp by time(2) again. Fri Jul 14 19:38:23 CEST 2000 Werner Koch * md.c (gcry_md_ctl): Support GCRYCTL_{START,STOP}_DUMP. * Makefile.am: Never compile mingw32 as module. * Makefile.am: Tweaked module build and removed libtool * Makefile.am: Replaced -O1 by -O. Suggested by Alec Habig. * elgamal.c (sign): Removed inactive code. * rsa.c, rsa.h: New based on the old module version (only in CVS for now). * pubkey.c (setup_pubkey_table): Added commented support for RSA. * rndunix.c (waitpid): New. For UTS 2.1. All by Dave Dykstra. (my_popen): Do the FD_CLOEXEC only if it is available (start_gatherer): Cope with missing _SC_OPEN_MAX * rndunix.c: Add some more headers for QNX. By Sam Roberts. * rndegd.c (gather_random): Shortcut level 0. * rndunix.c (gather_random): Ditto. * rndw32.c (gather_random): Ditto. * rndw32.c: Replaced with code from Cryptlib and commented the old stuff. * rndw32.c: Add some debuging code enabled by an environment variable. * random.c (read_seed_file): Binary open for DOSish system (update_random_seed_file): Ditto. * random.c [MINGW32]: Include process.h for getpid. * random.c (fast_random_poll): Add clock_gettime() as fallback for system which support this POSIX.4 fucntion. By Sam Roberts. * random.c (read_seed_file): Removed the S_ISLNK test becuase it is already covered by !S_ISREG and is not defined in Unixware. Reported by Dave Dykstra. (update_random_seed_file): Silently ignore update request when pool is not filled. * random.c (read_seed_file): New. (set_random_seed_file): New. (read_pool): Try to read the seeding file. (update_random_seed_file): New. (read_pool): Do an initial extra seeding when level 2 quality random is requested the first time. This requestes at least POOLSIZE/2 bytes of entropy. Compined with the seeding file this should make normal random bytes cheaper and increase the quality of the random bytes used for key generation. * random.c (read_pool): Print a more friendly error message in cases when too much random is requested in one call. * random.c (fast_random_poll): Check whether RUSAGE_SELF is defined; this is not the case for some ESIX and Unixware, although they have getrusage(). * primegen.c (generate_elg_prime): All primes are now generated with the lowest random quality level. Because they are public anyway we don't need stronger random and by this we do not drain the systems entropy so much. * primegen.c (register_primegen_progress): New. * dsa.c (register_pk_dsa_progress): New. * elgamal.c (register_pk_elg_progress): New. * elgamal.c (wiener_map): New. (gen_k): Use a much smaller k. (generate): Calculate the qbits using the wiener map and choose an x at a size comparable to the one choosen in gen_k * rmd160.c (rmd160_get_info): Moved casting to the left side due to a problem with UTS4.3. Suggested by Dave Dykstra. * sha1.c (sha1_get_info): Ditto. * tiger.c (tiger_get_info): Ditto. * md5.c (md5_get_info): Ditto * des.c (des_get_info): Ditto. * blowfish.c (blowfish_get_info): Ditto. * cast5.c (cast5_get_info): Ditto. * twofish.c (twofish_get_info): Ditto. Fri Mar 24 11:25:45 CET 2000 Werner Koch * md.c (md_open): Add hmac arg and allocate space for the pads. (md_finalize): Add HMAC support. (md_copy): Ditto. (md_close): Ditto. (gcry_md_reset): Ditto. (gcry_md_ctl): Ditto. (prepare_macpdas): New. Mon Mar 13 19:22:46 CET 2000 Werner Koch * md.c (gcry_md_hash_buffer): Add support for the other algorithms. Mon Jan 31 16:37:34 CET 2000 Werner Koch * genprime.c (generate_elg_prime): Fixed returned factors which never worked for non-DSA keys. Thu Jan 27 18:00:44 CET 2000 Werner Koch * pubkey.c (sexp_to_key): Fixed mem leaks in case of errors. Mon Jan 24 22:24:38 CET 2000 Werner Koch * pubkey.c (gcry_pk_decrypt): Implemented. (gcry_pk_encrypt): Implemented. (gcry_pk_testkey): New. (gcry_pk_genkey): New. (pubkey_decrypt): Made static. (pubkey_encrypt): Ditto. (pubkey_check_secret_key): Ditto. (pubkey_generate): Ditto. Mon Jan 24 13:04:28 CET 2000 Werner Koch * pubkey.c (pubkey_nbits): Removed and replaced by ... (gcry_pk_get_nbits): this new one. Wed Dec 8 21:58:32 CET 1999 Werner Koch * dsa.c: s/mpi_powm/gcry_mpi_powm/g * elgamal.c: Ditto. * primegen.c: Ditto. * : Replaced g10_opt_verbose by g10_log_verbosity(). * Makefile.am (INCLUDES): removed intl, add ../gcrypt Fri Nov 19 17:15:20 CET 1999 Werner Koch * dynload.c (cmp_filenames): New to replaced compare_filename() in module. (register_cipher_extension): Removed the tilde expansion stuff. * rndeg.c (my_make_filename): New. * : Replaced header util.h by g10lib.h * random.c (gather_faked): Replaced make_timestamp by time(2). Disabled wrning printed with tty_printf. * rndlinux.c (gather_random): Always use fprintf instead of tty_xxx; this should be replaced by a callback function. * primegen.c (gen_prime): Use gcry_mpi_randomize. (is_prime): Ditto. * elgamal.c (test_keys): Ditto. * dsa.c (test_keys): Ditto. * cipher.c (gcry_cipher_close): Die on invalid handle. Mon Nov 15 21:36:02 CET 1999 Werner Koch * elgamal.c (gen_k): Use the new random API. (generate): Ditto. * dsa.c (gen_k): Ditto. (generate): Ditto. Sat Nov 13 17:44:23 CET 1999 Werner Koch * pubkey.c (disable_pubkey_algo): Made static. (gcry_pk_ctl): New. * random.c (get_random_bits): Renamed to ... (get_random_bytes): ... this and made static. (gcry_random_bytes): New. (gcry_random_bytes_secure): New. (randomize_buffer): Renamed to ... (gcry_randomize): ...this. * md.c (gcry_md_hash_buffer): New. * pubkey.c (gcry_pk_algo_info): 4 new commands. (pubkey_get_npkey): Made static. (pubkey_get_nskey): Made static. (pubkey_get_nsig): Made static. (pubkey_get_nenc): Made static. * pubkey.c: Removed all G10ERR_xxx. * cipher.c: Changed all GCRYERR_INV_ALGO to GCRYERR_INV_CIPHER_ALGO. * md.c: Changed all GCRYERR_INV_ALGO to GCRYERR_INV_MD_ALGO. * cast5.c (cast_setkey): Changed errocodes to GCRYERR_xxx. * blowfish.c: Ditto. * des.c: Ditto. * twofish.c: Ditto. * dsa.c: Ditto. * elgamal.c: Ditto. * g10c.c: Removed * cipher.c (gcry_cipher_open): Replaced alloc functions and return NULL if we are out of core. * dynload.c: Replaced all memory allocation functions. * md.c: Ditto. * primegen.c: Ditto. * pubkey.c: Ditto. * random.c: Ditto. * rndw32.c: Ditto. * elgamal.c: Ditto. * dsa.c: Ditto. Tue Oct 26 14:10:21 CEST 1999 Werner Koch * elgamal.c (sign): Hugh found strange code here. Replaced by BUG(). * cipher.c: Merged with gcrypt/symapi.c. * pubkey.c (string_to_pubkey_algo): Renamed function to ... (gcry_pk_map_name): ... this. (pubkey_algo_to_string): Renamed function to ... (gcry_pk_algo_name): ... this. (gcry_pk_algo_info): New. * pubkey.c: Merged with gcrypt/pkapi.c. * md.c (md_reset): Clear finalized; thanks to Ulf Moeller for fixing this bug. * md.c: Merged with gcrypt/mdapi.c Wed Sep 15 14:39:59 CEST 1999 Michael Roth * des.c: Various speed improvements: One bit pre rotation trick after initial permutation (Richard Outerbridge). Finished test of SSLeay Tripple-DES patterns. Wed Sep 15 16:22:17 CEST 1999 Werner Koch * rndw32.c: New. Mon Sep 13 10:51:29 CEST 1999 Werner Koch * bithelp.h: New. * rmd160.h, sha1.h, md5.h: Use the rol macro from bithelp.h Tue Sep 7 16:23:36 CEST 1999 Werner Koch * Makefile.am: Fixed seds for latest egcc. By Ollivier Robert. Mon Sep 6 19:59:08 CEST 1999 Werner Koch * des.c (selftest): Add some testpattern Mon Aug 30 20:38:33 CEST 1999 Werner Koch * cipher.c (do_cbc_encrypt): Fixed serious bug occuring when not using in place encryption. Pointed out by Frank Stajano. Mon Jul 26 09:34:46 CEST 1999 Werner Koch * md5.c (md5_final): Fix for a SCO cpp bug. Thu Jul 15 10:15:35 CEST 1999 Werner Koch * elgamal.c (elg_check_secret_key,elg_encrypt elg_decrypt,elg_sign,elg_verify): Sanity check on the args. * dsa.c (dsa_check_secret_key,dsa_sign,dsa_verify): Ditto. * pubkey.c (disable_pubkey_algo): New. (check_pubkey_algo2): Look at disabled algo table. * cipher.c (disable_cipher_algo): New. (check_cipher_algo): Look at disabled algo table. Wed Jul 7 13:08:40 CEST 1999 Werner Koch * Makefile.am: Support for libtool. Fri Jul 2 11:45:54 CEST 1999 Werner Koch * dsa.c (gen_k): Changed algorithm to consume less random bytes * elgamal.c (gen_k): Ditto. * random.c (random_dump_stats): New. Thu Jul 1 12:47:31 CEST 1999 Werner Koch * primegen.c, elgamal.c, dsa.c (progess): New and replaced all fputc with a call to this function. Sat Jun 26 12:15:59 CEST 1999 Werner Koch * rndegd.c (do_write): s/ssize_t/int/ due to SunOS 4.1 probs. * cipher.c (do_cbc_encrypt, do_cbc_decrypt): New. * dynload.c (HAVE_DL_SHL_LOAD): Map hpux API to dlopen (Dave Dykstra). * Makefile.am (install-exec-hook): Removed. Sun May 23 14:20:22 CEST 1999 Werner Koch * cipher.c (setup_cipher_table): Enable Twofish * random.c (fast_random_poll): Disable use of times() for mingw32. Mon May 17 21:54:43 CEST 1999 Werner Koch * dynload.c (register_internal_cipher_extension): Minor init fix. Tue May 4 15:47:53 CEST 1999 Werner Koch * primegen.c (gen_prime): Readded the Fermat test. Fixed the bug that we didn't correct for step when passing the prime to the Rabin-Miller test which led to bad performance (Stefan Keller). (check_prime): Add a first Fermat test. Sun Apr 18 10:11:28 CEST 1999 Werner Koch * cipher.c (cipher_setiv): Add ivlen arg, changed all callers. * random.c (randomize_buffer): alway use secure memory because we can't use m_is_secure() on a statically allocated buffer. * twofish.c: Replaced some macros by a loop to reduce text size. * Makefile.am (twofish): No more need for sed editing. Fri Apr 9 12:26:25 CEST 1999 Werner Koch * cipher.c (cipher_open): Reversed the changes for AUTO_CFB. * blowfish.c: Dropped the Blowfish 160 mode. * cipher.c (cipher_open): Ditto. (setup_cipher_table): Ditto. And removed support of twofish128 Wed Apr 7 20:51:39 CEST 1999 Werner Koch * random.c (get_random_bits): Can now handle requests > POOLSIZE * cipher.c (cipher_open): Now uses standard CFB for automode if the blocksize is gt 8 (according to rfc2440). * twofish.c: Applied Matthew Skala's patches for 256 bit key. Tue Apr 6 19:58:12 CEST 1999 Werner Koch * random.c (get_random_bits): Can now handle requests > POOLSIZE * cipher.c (cipher_open): Now uses standard CFB for automode if the blocksize is gt 8 (according to rfc2440). Sat Mar 20 11:44:21 CET 1999 Werner Koch * rndlinux.c (tty_printf) [IS_MODULE]: Removed. * rndegd.c (gather_random): Some fixes. Wed Mar 17 13:09:03 CET 1999 Werner Koch * rndegd.c (do_read): New. (gather_random): Changed the implementation. Mon Mar 8 20:47:17 CET 1999 Werner Koch * dynload.c (DLSYM_NEEDS_UNDERSCORE): Renamed. Fri Feb 26 17:55:41 CET 1999 Werner Koch * md.c: Nearly a total rewrote. Wed Feb 24 11:07:27 CET 1999 Werner Koch * cipher.c (context): Fixed alignment * md.c: Ditto. * rndegd.c: New Mon Feb 22 20:04:00 CET 1999 Werner Koch * rndegd.c: New. Wed Feb 10 17:15:39 CET 1999 Werner Koch * Makefile.am: Modules are now figured out by configure * construct.c: New. Generated by configure. Changed all modules to work with that. * sha1.h: Removed. * md5.h: Removed. * twofish.c: Changed interface to allow Twofish/256 * rndunix.c (start_gatherer): Die on SIGPIPE. Wed Jan 20 18:59:49 CET 1999 Werner Koch * rndunix.c (gather_random): Fix to avoid infinite loop. Sun Jan 17 11:04:33 CET 1999 Werner Koch * des.c (is_weak_key): Replace system memcmp due to bugs in SunOS's memcmp. (des_get_info): Return error on failed selftest. * twofish.c (twofish_setkey): Return error on failed selftest or invalid keylength. * cast5.c (cast_setkey): Ditto. * blowfish.c (bf_setkey): Return error on failed selftest. Tue Jan 12 11:17:18 CET 1999 Werner Koch * random.c (random_is_faked): New. * tiger.c: Only compile if we have the u64 type Sat Jan 9 16:02:23 CET 1999 Werner Koch * rndunix.c (gather_random): check for setuid. * Makefile.am: Add a way to staically link random modules Thu Jan 7 18:00:58 CET 1999 Werner Koch * md.c (md_stop_debug): Do a flush first. (md_open): size of buffer now depends on the secure parameter Sun Jan 3 15:28:44 CET 1999 Werner Koch * rndunix.c (start_gatherer): Fixed stupid ==/= bug 1998-12-31 Geoff Keating * des.c (is_weak_key): Rewrite loop end condition. Tue Dec 29 14:41:47 CET 1998 Werner Koch * random.c: add unistd.h for getpid(). (RAND_MAX): Fallback value for Sun. Wed Dec 23 17:12:24 CET 1998 Werner Koch * md.c (md_copy): Reset debug. Mon Dec 14 21:18:49 CET 1998 Werner Koch * random.c (read_random_source): Changed the interface to the random gathering function. (gather_faked): Use new interface. * dynload.c (dynload_getfnc_fast_random_poll): Ditto. (dynload_getfnc_gather_random): Ditto. * rndlinux.c (gather_random): Ditto. * rndunix.c (gather_random): Ditto. Sat Dec 12 18:40:32 CET 1998 Werner Koch * dynload.c (SYMBOL_VERSION): New to cope with system which needs underscores. * rndunix.c: Rewrote large parts Thu Dec 10 20:15:36 CET 1998 Werner Koch * dynload.c (load_extension): increased needed verbosity level. * random.c (fast_random_poll): Fallback to a default fast random poll function. (read_random_source): Always use the faked entroy gatherer if no gather module is available. * rndlinux.c (fast_poll): Removed. * rndunix.c (fast_poll): Removed. Wed Nov 25 12:33:41 1998 Werner Koch (wk@isil.d.shuttle.de) * rand-*.c: Removed. * rndlinux.c : New. * rndunix.c : New. * random.c : Restructured the interface to the gather modules. (intialize): Call constructor functions (read_radnom_source): Moved to here. * dynload.c (dynload_getfnc_gather_random): New. (dynload_getfnc_fast_random_poll): New. (register_internal_cipher_extension): New. (register_cipher_extension): Support of internal modules. Sun Nov 8 17:44:36 1998 Werner Koch (wk@isil.d.shuttle.de) * rand-unix.c (read_random_source): Removed the assert. Mon Oct 19 18:34:30 1998 me,,, (wk@tobold) * pubkey.c: Hack to allow us to give some info about RSA keys back. Thu Oct 15 11:47:57 1998 Werner Koch (wk@isil.d.shuttle.de) * dynload.c: Support for DLD Wed Oct 14 12:13:07 1998 Werner Koch (wk@isil.d.shuttle.de) * rand-unix.c: Now uses names from configure for /dev/random. 1998-10-10 SL Baur * Makefile.am: fix sed -O substitutions to catch -O6, etc. Tue Oct 6 10:06:32 1998 Werner Koch (wk@isil.d.shuttle.de) * rand-unix.c (HAVE_GETTIMEOFDAY): Fixed (was ..GETTIMEOFTIME :-) * rand-dummy.c (HAVE_GETTIMEOFDAY): Ditto. Mon Sep 28 13:23:09 1998 Werner Koch (wk@isil.d.shuttle.de) * md.c (md_digest): New. (md_reset): New. Wed Sep 23 12:27:02 1998 Werner Koch (wk@isil.d.shuttle.de) * tiger.c (TIGER_CONTEXT): moved "buf", so that it is 64 bit aligned. Mon Sep 21 06:22:53 1998 Werner Koch (wk@(none)) * des.c: Some patches from Michael. Thu Sep 17 19:00:06 1998 Werner Koch (wk@(none)) * des.c : New file from Michael Roth Mon Sep 14 11:10:55 1998 Werner Koch (wk@(none)) * blowfish.c (bf_setkey): Niklas Hernaeus patch to detect weak keys. Mon Sep 14 09:19:25 1998 Werner Koch (wk@(none)) * dynload.c (RTLD_NOW): Now defined to 1 if it is undefined. Mon Sep 7 17:04:33 1998 Werner Koch (wk@(none)) * Makefile.am: Fixes to allow a different build directory Thu Aug 6 17:25:38 1998 Werner Koch,mobil,,, (wk@tobold) * random.c (get_random_byte): Removed and changed all callers to use get_random_bits() Mon Jul 27 10:30:22 1998 Werner Koch (wk@(none)) * cipher.c : Support for other blocksizes (cipher_get_blocksize): New. * twofish.c: New. * Makefile.am: Add twofish module. Mon Jul 13 21:30:52 1998 Werner Koch (wk@isil.d.shuttle.de) * random.c (read_pool): Simple alloc if secure_alloc is not set. (get_random_bits): Ditto. Thu Jul 9 13:01:14 1998 Werner Koch (wk@isil.d.shuttle.de) * dynload.c (load_extension): Function now nbails out if the program is run setuid. Wed Jul 8 18:58:23 1998 Werner Koch (wk@isil.d.shuttle.de) * rmd160.c (rmd160_hash_buffer): New. Thu Jul 2 10:50:30 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.c (cipher_open): algos >=100 use standard CFB Thu Jun 25 11:18:25 1998 Werner Koch (wk@isil.d.shuttle.de) * Makefile.am: Support for extensions Thu Jun 18 12:09:38 1998 Werner Koch (wk@isil.d.shuttle.de) * random.c (mix_pool): simpler handling for level 0 Mon Jun 15 14:40:48 1998 Werner Koch (wk@isil.d.shuttle.de) * tiger.c: Removed from dist, will reappear as dynload module Sat Jun 13 14:16:57 1998 Werner Koch (wk@isil.d.shuttle.de) * pubkey.c: Major changes to allow extensions. Changed the inteface of all public key ciphers and added the ability to load extensions on demand. * misc.c: Removed. Wed Jun 10 07:52:08 1998 Werner Koch,mobil,,, (wk@tobold) * dynload.c: New. * cipher.c: Major changes to allow extensions. Mon Jun 8 22:43:00 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.c: Major internal chnages to support extensions. * blowfish.c (blowfish_get_info): New and made all internal functions static, changed heder. * cast5.c (cast5_get_info): Likewise. Mon Jun 8 12:27:52 1998 Werner Koch (wk@isil.d.shuttle.de) * tiger.c (transform): Fix for big endian * cipher.c (do_cfb_decrypt): Big endian fix. Fri May 22 07:30:39 1998 Werner Koch (wk@isil.d.shuttle.de) * md.c (md_get_oid): Add a new one for TIGER. Thu May 21 13:24:52 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.c: Add support for a dummy cipher Thu May 14 15:40:36 1998 Werner Koch (wk@isil.d.shuttle.de) * rmd160.c (transform): fixed sigbus - I should better add Christian von Roques's new implemenation of rmd160_write. Fri May 8 18:07:44 1998 Werner Koch (wk@isil.d.shuttle.de) * rand-internal.h, rand-unix.c, rand-w32.c, rand_dummy.c: New * random.c: Moved system specific functions to rand-****.c Fri May 8 14:01:17 1998 Werner Koch (wk@isil.d.shuttle.de) * random.c (fast_random_poll): add call to gethrtime. Tue May 5 21:28:55 1998 Werner Koch (wk@isil.d.shuttle.de) * elgamal.c (elg_generate): choosing x was not correct, could yield 6 bytes which are not from the random pool, tsss, tsss.. Tue May 5 14:09:06 1998 Werner Koch (wk@isil.d.shuttle.de) * primegen.c (generate_elg_prime): Add arg mode, changed all callers and implemented mode 1. Mon Apr 27 14:41:58 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.c (cipher_get_keylen): New. Sun Apr 26 14:44:52 1998 Werner Koch (wk@isil.d.shuttle.de) * tiger.c, tiger.h: New. Wed Apr 8 14:57:11 1998 Werner Koch (wk@isil.d.shuttle.de) * misc.c (check_pubkey_algo2): New. Tue Apr 7 18:46:49 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.c: New * misc.c (check_cipher_algo): Moved to cipher.c * cast5.c: Moved many functions to cipher.c * blowfish.c: Likewise. Sat Apr 4 19:52:08 1998 Werner Koch (wk@isil.d.shuttle.de) * cast5.c: Implemented and tested. Wed Apr 1 16:38:27 1998 Werner Koch (wk@isil.d.shuttle.de) * elgamal.c (elg_generate): Faster generation of x in some cases. Thu Mar 19 13:54:48 1998 Werner Koch (wk@isil.d.shuttle.de) * blowfish.c (blowfish_decode_cfb): changed XOR operation (blowfish_encode_cfb): Ditto. Thu Mar 12 14:04:05 1998 Werner Koch (wk@isil.d.shuttle.de) * sha1.c (transform): Rewrote * blowfish.c (encrypt): Unrolled for rounds == 16 (decrypt): Ditto. Tue Mar 10 16:32:08 1998 Werner Koch (wk@isil.d.shuttle.de) * rmd160.c (transform): Unrolled the loop. Tue Mar 10 13:05:14 1998 Werner Koch (wk@isil.d.shuttle.de) * random.c (read_pool): Add pool_balance stuff. (get_random_bits): New. * elgamal.c (elg_generate): Now uses get_random_bits to generate x. Tue Mar 10 11:33:51 1998 Werner Koch (wk@isil.d.shuttle.de) * md.c (md_digest_length): New. Tue Mar 10 11:27:41 1998 Werner Koch (wk@isil.d.shuttle.de) * dsa.c (dsa_verify): Works. Mon Mar 9 12:59:08 1998 Werner Koch (wk@isil.d.shuttle.de) * dsa.c, dsa.h: Removed some unused code. Wed Mar 4 10:39:22 1998 Werner Koch (wk@isil.d.shuttle.de) * md.c (md_open): Add call to fast_random_poll. blowfish.c (blowfish_setkey): Ditto. Tue Mar 3 13:32:54 1998 Werner Koch (wk@isil.d.shuttle.de) * rmd160.c (rmd160_mixblock): New. * random.c: Restructured to start with a new RNG implementation. * random.h: New. Mon Mar 2 19:21:46 1998 Werner Koch (wk@isil.d.shuttle.de) * gost.c, gost.h: Removed because they did only contain trash. Sun Mar 1 16:42:29 1998 Werner Koch (wk@isil.d.shuttle.de) * random.c (fill_buffer): removed error message if n == -1. Fri Feb 27 16:39:34 1998 Werner Koch (wk@isil.d.shuttle.de) * md.c (md_enable): No init if called twice. Thu Feb 26 07:57:02 1998 Werner Koch (wk@isil.d.shuttle.de) * primegen.c (generate_elg_prime): Changed the progress printing. (gen_prime): Ditto. Tue Feb 24 12:28:42 1998 Werner Koch (wk@isil.d.shuttle.de) * md5.c, md.5 : Replaced by a modified version of md5.c from GNU textutils 1.22. Wed Feb 18 14:08:30 1998 Werner Koch (wk@isil.d.shuttle.de) * md.c, md.h : New debugging support Mon Feb 16 10:08:47 1998 Werner Koch (wk@isil.d.shuttle.de) * misc.c (cipher_algo_to_string): New (pubkey_algo_to_string): New. (digest_algo_to_string): New. Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 2007, 2008, 2009, 2010, 2011 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. diff --git a/cipher/rijndael.c b/cipher/rijndael.c index 4c498470..fb97274e 100644 --- a/cipher/rijndael.c +++ b/cipher/rijndael.c @@ -1,1757 +1,1765 @@ /* Rijndael (AES) for GnuPG * Copyright (C) 2000, 2001, 2002, 2003, 2007, * 2008, 2011 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 . ******************************************************************* * The code here is based on the optimized implementation taken from * http://www.esat.kuleuven.ac.be/~rijmen/rijndael/ on Oct 2, 2000, * which carries this notice: *------------------------------------------ * rijndael-alg-fst.c v2.3 April '2000 * * Optimised ANSI C code * * authors: v1.0: Antoon Bosselaers * v2.0: Vincent Rijmen * v2.3: Paulo Barreto * * This code is placed in the public domain. *------------------------------------------ * * The SP800-38a document is available at: * http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf * */ #include #include #include #include /* for memcmp() */ #include "types.h" /* for byte and u32 typedefs */ #include "g10lib.h" #include "cipher.h" #define MAXKC (256/32) #define MAXROUNDS 14 #define BLOCKSIZE (128/8) /* Helper macro to force alignment to 16 bytes. */ #ifdef __GNUC__ # define ATTR_ALIGNED_16 __attribute__ ((aligned (16))) #else # define ATTR_ALIGNED_16 #endif /* USE_PADLOCK indicates whether to compile the padlock specific code. */ #undef USE_PADLOCK #ifdef ENABLE_PADLOCK_SUPPORT # if defined (__i386__) && SIZEOF_UNSIGNED_LONG == 4 && defined (__GNUC__) # define USE_PADLOCK 1 # endif #endif /*ENABLE_PADLOCK_SUPPORT*/ /* USE_AESNI inidicates whether to compile with Intel AES-NI code. We need the vector-size attribute which seems to be available since gcc 3. However, to be on the safe side we require at least gcc 4. */ #undef USE_AESNI #ifdef ENABLE_AESNI_SUPPORT # if defined (__i386__) && SIZEOF_UNSIGNED_LONG == 4 && __GNUC__ >= 4 # define USE_AESNI 1 # endif #endif /* ENABLE_AESNI_SUPPORT */ #ifdef USE_AESNI typedef int m128i_t __attribute__ ((__vector_size__ (16))); #endif /*USE_AESNI*/ +/* Define an u32 variant for the sake of gcc 4.4's strict aliasing. */ +#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 ) +typedef u32 __attribute__ ((__may_alias__)) u32_a_t; +#else +typedef u32 u32_a_t; +#endif + + static const char *selftest(void); /* Our context object. */ typedef struct { /* The first fields are the keyschedule arrays. This is so that they are aligned on a 16 byte boundary if using gcc. This alignment is required for the AES-NI code and a good idea in any case. The alignment is guaranteed due to the way cipher.c allocates the space for the context. The PROPERLY_ALIGNED_TYPE hack is used to force a minimal alignment if not using gcc of if the alignment requirement is higher that 16 bytes. */ union { PROPERLY_ALIGNED_TYPE dummy; byte keyschedule[MAXROUNDS+1][4][4]; #ifdef USE_PADLOCK /* The key as passed to the padlock engine. It is only used if the padlock engine is used (USE_PADLOCK, below). */ unsigned char padlock_key[16] __attribute__ ((aligned (16))); #endif /*USE_PADLOCK*/ } u1; union { PROPERLY_ALIGNED_TYPE dummy; byte keyschedule[MAXROUNDS+1][4][4]; } u2; int rounds; /* Key-length-dependent number of rounds. */ int decryption_prepared; /* The decryption key schedule is available. */ #ifdef USE_PADLOCK int use_padlock; /* Padlock shall be used. */ #endif /*USE_PADLOCK*/ #ifdef USE_AESNI int use_aesni; /* AES-NI shall be used. */ #endif /*USE_AESNI*/ } RIJNDAEL_context; /* Macros defining alias for the keyschedules. */ #define keyschenc u1.keyschedule #define keyschdec u2.keyschedule #define padlockkey u1.padlock_key /* Two macros to be called prior and after the use of AESNI instructions. There should be no external function calls between the use of these macros. There purpose is to make sure that the SSE regsiters are cleared and won't reveal any information about the key or the data. */ #ifdef USE_AESNI # define aesni_prepare() do { } while (0) # define aesni_cleanup() \ do { asm volatile ("pxor %%xmm0, %%xmm0\n\t" \ "pxor %%xmm1, %%xmm1\n" :: ); \ } while (0) #else # define aesni_prepare() do { } while (0) # define aesni_cleanup() do { } while (0) #endif /* All the numbers. */ #include "rijndael-tables.h" /* Perform the key setup. */ static gcry_err_code_t do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen) { static int initialized = 0; static const char *selftest_failed=0; int rounds; int i,j, r, t, rconpointer = 0; int KC; union { PROPERLY_ALIGNED_TYPE dummy; byte k[MAXKC][4]; } k; #define k k.k union { PROPERLY_ALIGNED_TYPE dummy; byte tk[MAXKC][4]; } tk; #define tk tk.tk /* The on-the-fly self tests are only run in non-fips mode. In fips mode explicit self-tests are required. Actually the on-the-fly self-tests are not fully thread-safe and it might happen that a failed self-test won't get noticed in another thread. FIXME: We might want to have a central registry of succeeded self-tests. */ if (!fips_mode () && !initialized) { initialized = 1; selftest_failed = selftest (); if (selftest_failed) log_error ("%s\n", selftest_failed ); } if (selftest_failed) return GPG_ERR_SELFTEST_FAILED; ctx->decryption_prepared = 0; #ifdef USE_PADLOCK ctx->use_padlock = 0; #endif #ifdef USE_AESNI ctx->use_aesni = 0; #endif if( keylen == 128/8 ) { rounds = 10; KC = 4; if (0) ; #ifdef USE_PADLOCK else if ((_gcry_get_hw_features () & HWF_PADLOCK_AES)) { ctx->use_padlock = 1; memcpy (ctx->padlockkey, key, keylen); } #endif #ifdef USE_AESNI else if ((_gcry_get_hw_features () & HWF_INTEL_AESNI)) { ctx->use_aesni = 1; } #endif } else if ( keylen == 192/8 ) { rounds = 12; KC = 6; if (0) { ; } #ifdef USE_AESNI else if ((_gcry_get_hw_features () & HWF_INTEL_AESNI)) { ctx->use_aesni = 1; } #endif } else if ( keylen == 256/8 ) { rounds = 14; KC = 8; if (0) { ; } #ifdef USE_AESNI else if ((_gcry_get_hw_features () & HWF_INTEL_AESNI)) { ctx->use_aesni = 1; } #endif } else return GPG_ERR_INV_KEYLEN; ctx->rounds = rounds; if (0) ; #ifdef USE_PADLOCK else if (ctx->use_padlock) { /* Nothing to do as we support only hardware key generation for now. */ } #endif /*USE_PADLOCK*/ #ifdef USE_AESNI_is_disabled_here else if (ctx->use_aesni && ctx->rounds == 10) { /* Note: This code works for AES-128 but it is not much better than than using the standard key schedule. We disable it for now and don't put any effort into implementing this for AES-192 and AES-256. */ asm volatile ("movl %[key], %%esi\n\t" "movdqu (%%esi), %%xmm1\n\t" /* xmm1 := key */ "movl %[ksch], %%esi\n\t" "movdqa %%xmm1, (%%esi)\n\t" /* ksch[0] := xmm1 */ "aeskeygenassist $0x01, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x10(%%esi)\n\t" /* ksch[1] := xmm1 */ "aeskeygenassist $0x02, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x20(%%esi)\n\t" /* ksch[2] := xmm1 */ "aeskeygenassist $0x04, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x30(%%esi)\n\t" /* ksch[3] := xmm1 */ "aeskeygenassist $0x08, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x40(%%esi)\n\t" /* ksch[4] := xmm1 */ "aeskeygenassist $0x10, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x50(%%esi)\n\t" /* ksch[5] := xmm1 */ "aeskeygenassist $0x20, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x60(%%esi)\n\t" /* ksch[6] := xmm1 */ "aeskeygenassist $0x40, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x70(%%esi)\n\t" /* ksch[7] := xmm1 */ "aeskeygenassist $0x80, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x80(%%esi)\n\t" /* ksch[8] := xmm1 */ "aeskeygenassist $0x1b, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0x90(%%esi)\n\t" /* ksch[9] := xmm1 */ "aeskeygenassist $0x36, %%xmm1, %%xmm2\n\t" "call .Lexpand128_%=\n\t" "movdqa %%xmm1, 0xa0(%%esi)\n\t" /* ksch[10] := xmm1 */ "jmp .Lleave%=\n" ".Lexpand128_%=:\n\t" "pshufd $0xff, %%xmm2, %%xmm2\n\t" "movdqa %%xmm1, %%xmm3\n\t" "pslldq $4, %%xmm3\n\t" "pxor %%xmm3, %%xmm1\n\t" "pslldq $4, %%xmm3\n\t" "pxor %%xmm3, %%xmm1\n\t" "pslldq $4, %%xmm3\n\t" "pxor %%xmm3, %%xmm2\n\t" "pxor %%xmm2, %%xmm1\n\t" "ret\n" ".Lleave%=:\n\t" "pxor %%xmm1, %%xmm1\n\t" "pxor %%xmm2, %%xmm2\n\t" "pxor %%xmm3, %%xmm3\n" : : [key] "g" (key), [ksch] "g" (ctx->keyschenc) : "%esi", "cc", "memory" ); } #endif /*USE_AESNI*/ else { #define W (ctx->keyschenc) for (i = 0; i < keylen; i++) { k[i >> 2][i & 3] = key[i]; } for (j = KC-1; j >= 0; j--) { *((u32*)tk[j]) = *((u32*)k[j]); } r = 0; t = 0; /* Copy values into round key array. */ for (j = 0; (j < KC) && (r < rounds + 1); ) { for (; (j < KC) && (t < 4); j++, t++) { *((u32*)W[r][t]) = *((u32*)tk[j]); } if (t == 4) { r++; t = 0; } } while (r < rounds + 1) { /* While not enough round key material calculated calculate new values. */ tk[0][0] ^= S[tk[KC-1][1]]; tk[0][1] ^= S[tk[KC-1][2]]; tk[0][2] ^= S[tk[KC-1][3]]; tk[0][3] ^= S[tk[KC-1][0]]; tk[0][0] ^= rcon[rconpointer++]; if (KC != 8) { for (j = 1; j < KC; j++) { *((u32*)tk[j]) ^= *((u32*)tk[j-1]); } } else { for (j = 1; j < KC/2; j++) { *((u32*)tk[j]) ^= *((u32*)tk[j-1]); } tk[KC/2][0] ^= S[tk[KC/2 - 1][0]]; tk[KC/2][1] ^= S[tk[KC/2 - 1][1]]; tk[KC/2][2] ^= S[tk[KC/2 - 1][2]]; tk[KC/2][3] ^= S[tk[KC/2 - 1][3]]; for (j = KC/2 + 1; j < KC; j++) { *((u32*)tk[j]) ^= *((u32*)tk[j-1]); } } /* Copy values into round key array. */ for (j = 0; (j < KC) && (r < rounds + 1); ) { for (; (j < KC) && (t < 4); j++, t++) { *((u32*)W[r][t]) = *((u32*)tk[j]); } if (t == 4) { r++; t = 0; } } } #undef W } return 0; #undef tk #undef k } static gcry_err_code_t rijndael_setkey (void *context, const byte *key, const unsigned keylen) { RIJNDAEL_context *ctx = context; int rc = do_setkey (ctx, key, keylen); _gcry_burn_stack ( 100 + 16*sizeof(int)); return rc; } /* Make a decryption key from an encryption key. */ static void prepare_decryption( RIJNDAEL_context *ctx ) { int r; #ifdef USE_AESNI if (ctx->use_aesni) { /* The AES-NI decrypt instructions use the Equivalent Inverse Cipher, thus we can't use the the standard decrypt key preparation. */ m128i_t *ekey = (m128i_t*)ctx->keyschenc; m128i_t *dkey = (m128i_t*)ctx->keyschdec; int rr; dkey[0] = ekey[ctx->rounds]; for (r=1, rr=ctx->rounds-1; r < ctx->rounds; r++, rr--) { asm volatile ("movdqu %[ekey], %%xmm1\n\t" /*"aesimc %%xmm1, %%xmm1\n\t"*/ ".byte 0x66, 0x0f, 0x38, 0xdb, 0xc9\n\t" "movdqu %%xmm1, %[dkey]" : [dkey] "=m" (dkey[r]) : [ekey] "m" (ekey[rr]) ); } dkey[r] = ekey[0]; } else #endif /*USE_AESNI*/ { union { PROPERLY_ALIGNED_TYPE dummy; byte *w; } w; #define w w.w for (r=0; r < MAXROUNDS+1; r++ ) { *((u32*)ctx->keyschdec[r][0]) = *((u32*)ctx->keyschenc[r][0]); *((u32*)ctx->keyschdec[r][1]) = *((u32*)ctx->keyschenc[r][1]); *((u32*)ctx->keyschdec[r][2]) = *((u32*)ctx->keyschenc[r][2]); *((u32*)ctx->keyschdec[r][3]) = *((u32*)ctx->keyschenc[r][3]); } #define W (ctx->keyschdec) for (r = 1; r < ctx->rounds; r++) { w = W[r][0]; *((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]]) ^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]); w = W[r][1]; *((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]]) ^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]); w = W[r][2]; *((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]]) ^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]); w = W[r][3]; *((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]]) ^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]); } #undef W #undef w } } /* Encrypt one block. A and B need to be aligned on a 4 byte boundary. A and B may be the same. */ static void do_encrypt_aligned (const RIJNDAEL_context *ctx, unsigned char *b, const unsigned char *a) { #define rk (ctx->keyschenc) int rounds = ctx->rounds; int r; union { u32 tempu32[4]; /* Force correct alignment. */ byte temp[4][4]; } u; - *((u32*)u.temp[0]) = *((u32*)(a )) ^ *((u32*)rk[0][0]); - *((u32*)u.temp[1]) = *((u32*)(a+ 4)) ^ *((u32*)rk[0][1]); - *((u32*)u.temp[2]) = *((u32*)(a+ 8)) ^ *((u32*)rk[0][2]); - *((u32*)u.temp[3]) = *((u32*)(a+12)) ^ *((u32*)rk[0][3]); - *((u32*)(b )) = (*((u32*)T1[u.temp[0][0]]) - ^ *((u32*)T2[u.temp[1][1]]) - ^ *((u32*)T3[u.temp[2][2]]) - ^ *((u32*)T4[u.temp[3][3]])); - *((u32*)(b + 4)) = (*((u32*)T1[u.temp[1][0]]) - ^ *((u32*)T2[u.temp[2][1]]) - ^ *((u32*)T3[u.temp[3][2]]) - ^ *((u32*)T4[u.temp[0][3]])); - *((u32*)(b + 8)) = (*((u32*)T1[u.temp[2][0]]) - ^ *((u32*)T2[u.temp[3][1]]) - ^ *((u32*)T3[u.temp[0][2]]) - ^ *((u32*)T4[u.temp[1][3]])); - *((u32*)(b +12)) = (*((u32*)T1[u.temp[3][0]]) - ^ *((u32*)T2[u.temp[0][1]]) - ^ *((u32*)T3[u.temp[1][2]]) - ^ *((u32*)T4[u.temp[2][3]])); + *((u32_a_t*)u.temp[0]) = *((u32_a_t*)(a )) ^ *((u32_a_t*)rk[0][0]); + *((u32_a_t*)u.temp[1]) = *((u32_a_t*)(a+ 4)) ^ *((u32_a_t*)rk[0][1]); + *((u32_a_t*)u.temp[2]) = *((u32_a_t*)(a+ 8)) ^ *((u32_a_t*)rk[0][2]); + *((u32_a_t*)u.temp[3]) = *((u32_a_t*)(a+12)) ^ *((u32_a_t*)rk[0][3]); + *((u32_a_t*)(b )) = (*((u32_a_t*)T1[u.temp[0][0]]) + ^ *((u32_a_t*)T2[u.temp[1][1]]) + ^ *((u32_a_t*)T3[u.temp[2][2]]) + ^ *((u32_a_t*)T4[u.temp[3][3]])); + *((u32_a_t*)(b + 4)) = (*((u32_a_t*)T1[u.temp[1][0]]) + ^ *((u32_a_t*)T2[u.temp[2][1]]) + ^ *((u32_a_t*)T3[u.temp[3][2]]) + ^ *((u32_a_t*)T4[u.temp[0][3]])); + *((u32_a_t*)(b + 8)) = (*((u32_a_t*)T1[u.temp[2][0]]) + ^ *((u32_a_t*)T2[u.temp[3][1]]) + ^ *((u32_a_t*)T3[u.temp[0][2]]) + ^ *((u32_a_t*)T4[u.temp[1][3]])); + *((u32_a_t*)(b +12)) = (*((u32_a_t*)T1[u.temp[3][0]]) + ^ *((u32_a_t*)T2[u.temp[0][1]]) + ^ *((u32_a_t*)T3[u.temp[1][2]]) + ^ *((u32_a_t*)T4[u.temp[2][3]])); for (r = 1; r < rounds-1; r++) { - *((u32*)u.temp[0]) = *((u32*)(b )) ^ *((u32*)rk[r][0]); - *((u32*)u.temp[1]) = *((u32*)(b+ 4)) ^ *((u32*)rk[r][1]); - *((u32*)u.temp[2]) = *((u32*)(b+ 8)) ^ *((u32*)rk[r][2]); - *((u32*)u.temp[3]) = *((u32*)(b+12)) ^ *((u32*)rk[r][3]); - - *((u32*)(b )) = (*((u32*)T1[u.temp[0][0]]) - ^ *((u32*)T2[u.temp[1][1]]) - ^ *((u32*)T3[u.temp[2][2]]) - ^ *((u32*)T4[u.temp[3][3]])); - *((u32*)(b + 4)) = (*((u32*)T1[u.temp[1][0]]) - ^ *((u32*)T2[u.temp[2][1]]) - ^ *((u32*)T3[u.temp[3][2]]) - ^ *((u32*)T4[u.temp[0][3]])); - *((u32*)(b + 8)) = (*((u32*)T1[u.temp[2][0]]) - ^ *((u32*)T2[u.temp[3][1]]) - ^ *((u32*)T3[u.temp[0][2]]) - ^ *((u32*)T4[u.temp[1][3]])); - *((u32*)(b +12)) = (*((u32*)T1[u.temp[3][0]]) - ^ *((u32*)T2[u.temp[0][1]]) - ^ *((u32*)T3[u.temp[1][2]]) - ^ *((u32*)T4[u.temp[2][3]])); + *((u32_a_t*)u.temp[0]) = *((u32_a_t*)(b )) ^ *((u32_a_t*)rk[r][0]); + *((u32_a_t*)u.temp[1]) = *((u32_a_t*)(b+ 4)) ^ *((u32_a_t*)rk[r][1]); + *((u32_a_t*)u.temp[2]) = *((u32_a_t*)(b+ 8)) ^ *((u32_a_t*)rk[r][2]); + *((u32_a_t*)u.temp[3]) = *((u32_a_t*)(b+12)) ^ *((u32_a_t*)rk[r][3]); + + *((u32_a_t*)(b )) = (*((u32_a_t*)T1[u.temp[0][0]]) + ^ *((u32_a_t*)T2[u.temp[1][1]]) + ^ *((u32_a_t*)T3[u.temp[2][2]]) + ^ *((u32_a_t*)T4[u.temp[3][3]])); + *((u32_a_t*)(b + 4)) = (*((u32_a_t*)T1[u.temp[1][0]]) + ^ *((u32_a_t*)T2[u.temp[2][1]]) + ^ *((u32_a_t*)T3[u.temp[3][2]]) + ^ *((u32_a_t*)T4[u.temp[0][3]])); + *((u32_a_t*)(b + 8)) = (*((u32_a_t*)T1[u.temp[2][0]]) + ^ *((u32_a_t*)T2[u.temp[3][1]]) + ^ *((u32_a_t*)T3[u.temp[0][2]]) + ^ *((u32_a_t*)T4[u.temp[1][3]])); + *((u32_a_t*)(b +12)) = (*((u32_a_t*)T1[u.temp[3][0]]) + ^ *((u32_a_t*)T2[u.temp[0][1]]) + ^ *((u32_a_t*)T3[u.temp[1][2]]) + ^ *((u32_a_t*)T4[u.temp[2][3]])); } /* Last round is special. */ - *((u32*)u.temp[0]) = *((u32*)(b )) ^ *((u32*)rk[rounds-1][0]); - *((u32*)u.temp[1]) = *((u32*)(b+ 4)) ^ *((u32*)rk[rounds-1][1]); - *((u32*)u.temp[2]) = *((u32*)(b+ 8)) ^ *((u32*)rk[rounds-1][2]); - *((u32*)u.temp[3]) = *((u32*)(b+12)) ^ *((u32*)rk[rounds-1][3]); + *((u32_a_t*)u.temp[0]) = *((u32_a_t*)(b )) ^ *((u32_a_t*)rk[rounds-1][0]); + *((u32_a_t*)u.temp[1]) = *((u32_a_t*)(b+ 4)) ^ *((u32_a_t*)rk[rounds-1][1]); + *((u32_a_t*)u.temp[2]) = *((u32_a_t*)(b+ 8)) ^ *((u32_a_t*)rk[rounds-1][2]); + *((u32_a_t*)u.temp[3]) = *((u32_a_t*)(b+12)) ^ *((u32_a_t*)rk[rounds-1][3]); b[ 0] = T1[u.temp[0][0]][1]; b[ 1] = T1[u.temp[1][1]][1]; b[ 2] = T1[u.temp[2][2]][1]; b[ 3] = T1[u.temp[3][3]][1]; b[ 4] = T1[u.temp[1][0]][1]; b[ 5] = T1[u.temp[2][1]][1]; b[ 6] = T1[u.temp[3][2]][1]; b[ 7] = T1[u.temp[0][3]][1]; b[ 8] = T1[u.temp[2][0]][1]; b[ 9] = T1[u.temp[3][1]][1]; b[10] = T1[u.temp[0][2]][1]; b[11] = T1[u.temp[1][3]][1]; b[12] = T1[u.temp[3][0]][1]; b[13] = T1[u.temp[0][1]][1]; b[14] = T1[u.temp[1][2]][1]; b[15] = T1[u.temp[2][3]][1]; - *((u32*)(b )) ^= *((u32*)rk[rounds][0]); - *((u32*)(b+ 4)) ^= *((u32*)rk[rounds][1]); - *((u32*)(b+ 8)) ^= *((u32*)rk[rounds][2]); - *((u32*)(b+12)) ^= *((u32*)rk[rounds][3]); + *((u32_a_t*)(b )) ^= *((u32_a_t*)rk[rounds][0]); + *((u32_a_t*)(b+ 4)) ^= *((u32_a_t*)rk[rounds][1]); + *((u32_a_t*)(b+ 8)) ^= *((u32_a_t*)rk[rounds][2]); + *((u32_a_t*)(b+12)) ^= *((u32_a_t*)rk[rounds][3]); #undef rk } static void do_encrypt (const RIJNDAEL_context *ctx, unsigned char *bx, const unsigned char *ax) { /* BX and AX are not necessary correctly aligned. Thus we might need to copy them here. We try to align to a 16 bytes. */ if (((size_t)ax & 0x0f) || ((size_t)bx & 0x0f)) { union { u32 dummy[4]; byte a[16] ATTR_ALIGNED_16; } a; union { u32 dummy[4]; byte b[16] ATTR_ALIGNED_16; } b; memcpy (a.a, ax, 16); do_encrypt_aligned (ctx, b.b, a.a); memcpy (bx, b.b, 16); } else { do_encrypt_aligned (ctx, bx, ax); } } /* Encrypt or decrypt one block using the padlock engine. A and B may be the same. */ #ifdef USE_PADLOCK static void do_padlock (const RIJNDAEL_context *ctx, int decrypt_flag, unsigned char *bx, const unsigned char *ax) { /* BX and AX are not necessary correctly aligned. Thus we need to copy them here. */ unsigned char a[16] __attribute__ ((aligned (16))); unsigned char b[16] __attribute__ ((aligned (16))); unsigned int cword[4] __attribute__ ((aligned (16))); /* The control word fields are: 127:12 11:10 9 8 7 6 5 4 3:0 RESERVED KSIZE CRYPT INTER KEYGN CIPHR ALIGN DGEST ROUND */ cword[0] = (ctx->rounds & 15); /* (The mask is just a safeguard.) */ cword[1] = 0; cword[2] = 0; cword[3] = 0; if (decrypt_flag) cword[0] |= 0x00000200; memcpy (a, ax, 16); asm volatile ("pushfl\n\t" /* Force key reload. */ "popfl\n\t" "xchg %3, %%ebx\n\t" /* Load key. */ "movl $1, %%ecx\n\t" /* Init counter for just one block. */ ".byte 0xf3, 0x0f, 0xa7, 0xc8\n\t" /* REP XSTORE ECB. */ "xchg %3, %%ebx\n" /* Restore GOT register. */ : /* No output */ : "S" (a), "D" (b), "d" (cword), "r" (ctx->padlockkey) : "%ecx", "cc", "memory" ); memcpy (bx, b, 16); } #endif /*USE_PADLOCK*/ #ifdef USE_AESNI /* Encrypt one block using the Intel AES-NI instructions. A and B may be the same; they need to be properly aligned to 16 bytes. Our problem here is that gcc does not allow the "x" constraint for SSE registers in asm unless you compile with -msse. The common wisdom is to use a separate file for SSE instructions and build it separately. This would require a lot of extra build system stuff, similar to what we do in mpi/ for the asm stuff. What we do instead is to use standard registers and a bit more of plain asm which copies the data and key stuff to the SSE registers and later back. If we decide to implement some block modes with parallelized AES instructions, it might indeed be better to use plain asm ala mpi/. */ static void do_aesni_enc_aligned (const RIJNDAEL_context *ctx, unsigned char *b, const unsigned char *a) { #define aesenc_xmm1_xmm0 ".byte 0x66, 0x0f, 0x38, 0xdc, 0xc1\n\t" #define aesenclast_xmm1_xmm0 ".byte 0x66, 0x0f, 0x38, 0xdd, 0xc1\n\t" /* Note: For now we relax the alignment requirement for A and B: It does not make much difference because in many case we would need to memcpy them to an extra buffer; using the movdqu is much faster that memcpy and movdqa. For CFB we know that the IV is properly aligned but that is a special case. We should better implement CFB direct in asm. */ asm volatile ("movdqu %[src], %%xmm0\n\t" /* xmm0 := *a */ "movl %[key], %%esi\n\t" /* esi := keyschenc */ "movdqa (%%esi), %%xmm1\n\t" /* xmm1 := key[0] */ "pxor %%xmm1, %%xmm0\n\t" /* xmm0 ^= key[0] */ "movdqa 0x10(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x20(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x30(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x40(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x50(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x60(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x70(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x80(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x90(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xa0(%%esi), %%xmm1\n\t" "cmp $10, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xb0(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xc0(%%esi), %%xmm1\n\t" "cmp $12, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xd0(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xe0(%%esi), %%xmm1\n" ".Lenclast%=:\n\t" aesenclast_xmm1_xmm0 "movdqu %%xmm0, %[dst]\n" : [dst] "=m" (*b) : [src] "m" (*a), [key] "r" (ctx->keyschenc), [rounds] "r" (ctx->rounds) : "%esi", "cc", "memory"); #undef aesenc_xmm1_xmm0 #undef aesenclast_xmm1_xmm0 } static void do_aesni_dec_aligned (const RIJNDAEL_context *ctx, unsigned char *b, const unsigned char *a) { #define aesdec_xmm1_xmm0 ".byte 0x66, 0x0f, 0x38, 0xde, 0xc1\n\t" #define aesdeclast_xmm1_xmm0 ".byte 0x66, 0x0f, 0x38, 0xdf, 0xc1\n\t" asm volatile ("movdqu %[src], %%xmm0\n\t" /* xmm0 := *a */ "movl %[key], %%esi\n\t" "movdqa (%%esi), %%xmm1\n\t" "pxor %%xmm1, %%xmm0\n\t" /* xmm0 ^= key[0] */ "movdqa 0x10(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0x20(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0x30(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0x40(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0x50(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0x60(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0x70(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0x80(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0x90(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0xa0(%%esi), %%xmm1\n\t" "cmp $10, %[rounds]\n\t" "jz .Ldeclast%=\n\t" aesdec_xmm1_xmm0 "movdqa 0xb0(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0xc0(%%esi), %%xmm1\n\t" "cmp $12, %[rounds]\n\t" "jz .Ldeclast%=\n\t" aesdec_xmm1_xmm0 "movdqa 0xd0(%%esi), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0xe0(%%esi), %%xmm1\n" ".Ldeclast%=:\n\t" aesdeclast_xmm1_xmm0 "movdqu %%xmm0, %[dst]\n" : [dst] "=m" (*b) : [src] "m" (*a), [key] "r" (ctx->keyschdec), [rounds] "r" (ctx->rounds) : "%esi", "cc", "memory"); #undef aesdec_xmm1_xmm0 #undef aesdeclast_xmm1_xmm0 } /* Perform a CFB encryption or decryption round using the initialization vector IV and the input block A. Write the result to the output block B and update IV. IV needs to be 16 byte aligned. */ static void do_aesni_cfb (const RIJNDAEL_context *ctx, int decrypt_flag, unsigned char *iv, unsigned char *b, const unsigned char *a) { #define aesenc_xmm1_xmm0 ".byte 0x66, 0x0f, 0x38, 0xdc, 0xc1\n\t" #define aesenclast_xmm1_xmm0 ".byte 0x66, 0x0f, 0x38, 0xdd, 0xc1\n\t" asm volatile ("movdqa %[iv], %%xmm0\n\t" /* xmm0 := IV */ "movl %[key], %%esi\n\t" /* esi := keyschenc */ "movdqa (%%esi), %%xmm1\n\t" /* xmm1 := key[0] */ "pxor %%xmm1, %%xmm0\n\t" /* xmm0 ^= key[0] */ "movdqa 0x10(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x20(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x30(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x40(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x50(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x60(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x70(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x80(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0x90(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xa0(%%esi), %%xmm1\n\t" "cmp $10, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xb0(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xc0(%%esi), %%xmm1\n\t" "cmp $12, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xd0(%%esi), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xe0(%%esi), %%xmm1\n" ".Lenclast%=:\n\t" aesenclast_xmm1_xmm0 "movdqu %[src], %%xmm1\n\t" /* Save input. */ "pxor %%xmm1, %%xmm0\n\t" /* xmm0 = input ^ IV */ "cmp $1, %[decrypt]\n\t" "jz .Ldecrypt_%=\n\t" "movdqa %%xmm0, %[iv]\n\t" /* [encrypt] Store IV. */ "jmp .Lleave_%=\n" ".Ldecrypt_%=:\n\t" "movdqa %%xmm1, %[iv]\n" /* [decrypt] Store IV. */ ".Lleave_%=:\n\t" "movdqu %%xmm0, %[dst]\n" /* Store output. */ : [iv] "+m" (*iv), [dst] "=m" (*b) : [src] "m" (*a), [key] "g" (ctx->keyschenc), [rounds] "g" (ctx->rounds), [decrypt] "m" (decrypt_flag) : "%esi", "cc", "memory"); #undef aesenc_xmm1_xmm0 #undef aesenclast_xmm1_xmm0 } static void do_aesni (RIJNDAEL_context *ctx, int decrypt_flag, unsigned char *bx, const unsigned char *ax) { if (decrypt_flag) { if (!ctx->decryption_prepared ) { prepare_decryption ( ctx ); ctx->decryption_prepared = 1; } do_aesni_dec_aligned (ctx, bx, ax); } else do_aesni_enc_aligned (ctx, bx, ax); } #endif /*USE_AESNI*/ static void rijndael_encrypt (void *context, byte *b, const byte *a) { RIJNDAEL_context *ctx = context; if (0) ; #ifdef USE_PADLOCK else if (ctx->use_padlock) { do_padlock (ctx, 0, b, a); _gcry_burn_stack (48 + 15 /* possible padding for alignment */); } #endif /*USE_PADLOCK*/ #ifdef USE_AESNI else if (ctx->use_aesni) { aesni_prepare (); do_aesni (ctx, 0, b, a); aesni_cleanup (); } #endif /*USE_AESNI*/ else { do_encrypt (ctx, b, a); _gcry_burn_stack (56 + 2*sizeof(int)); } } /* Bulk encryption of complete blocks in CFB mode. Caller needs to make sure that IV is aligned on an unsigned long boundary. This function is only intended for the bulk encryption feature of cipher.c. */ void _gcry_aes_cfb_enc (void *context, unsigned char *iv, void *outbuf_arg, const void *inbuf_arg, unsigned int nblocks) { RIJNDAEL_context *ctx = context; unsigned char *outbuf = outbuf_arg; const unsigned char *inbuf = inbuf_arg; unsigned char *ivp; int i; if (0) ; #ifdef USE_PADLOCK else if (ctx->use_padlock) { /* Fixme: Let Padlock do the CFBing. */ for ( ;nblocks; nblocks-- ) { /* Encrypt the IV. */ do_padlock (ctx, 0, iv, iv); /* XOR the input with the IV and store input into IV. */ for (ivp=iv,i=0; i < BLOCKSIZE; i++ ) *outbuf++ = (*ivp++ ^= *inbuf++); } } #endif /*USE_PADLOCK*/ #ifdef USE_AESNI else if (ctx->use_aesni) { aesni_prepare (); for ( ;nblocks; nblocks-- ) { do_aesni_cfb (ctx, 0, iv, outbuf, inbuf); outbuf += BLOCKSIZE; inbuf += BLOCKSIZE; } aesni_cleanup (); } #endif /*USE_AESNI*/ else { for ( ;nblocks; nblocks-- ) { /* Encrypt the IV. */ do_encrypt_aligned (ctx, iv, iv); /* XOR the input with the IV and store input into IV. */ for (ivp=iv,i=0; i < BLOCKSIZE; i++ ) *outbuf++ = (*ivp++ ^= *inbuf++); } } _gcry_burn_stack (48 + 2*sizeof(int)); } /* Bulk encryption of complete blocks in CBC mode. Caller needs to make sure that IV is aligned on an unsigned long boundary. This function is only intended for the bulk encryption feature of cipher.c. */ void _gcry_aes_cbc_enc (void *context, unsigned char *iv, void *outbuf_arg, const void *inbuf_arg, unsigned int nblocks, int cbc_mac) { RIJNDAEL_context *ctx = context; unsigned char *outbuf = outbuf_arg; const unsigned char *inbuf = inbuf_arg; unsigned char *ivp; int i; aesni_prepare (); for ( ;nblocks; nblocks-- ) { for (ivp=iv, i=0; i < BLOCKSIZE; i++ ) outbuf[i] = inbuf[i] ^ *ivp++; if (0) ; #ifdef USE_PADLOCK else if (ctx->use_padlock) do_padlock (ctx, 0, outbuf, outbuf); #endif /*USE_PADLOCK*/ #ifdef USE_AESNI else if (ctx->use_aesni) do_aesni (ctx, 0, outbuf, outbuf); #endif /*USE_AESNI*/ else do_encrypt (ctx, outbuf, outbuf ); memcpy (iv, outbuf, BLOCKSIZE); inbuf += BLOCKSIZE; if (!cbc_mac) outbuf += BLOCKSIZE; } aesni_cleanup (); _gcry_burn_stack (48 + 2*sizeof(int)); } /* Decrypt one block. A and B need to be aligned on a 4 byte boundary and the decryption must have been prepared. A and B may be the same. */ static void do_decrypt_aligned (RIJNDAEL_context *ctx, unsigned char *b, const unsigned char *a) { #define rk (ctx->keyschdec) int rounds = ctx->rounds; int r; union { u32 tempu32[4]; /* Force correct alignment. */ byte temp[4][4]; } u; - *((u32*)u.temp[0]) = *((u32*)(a )) ^ *((u32*)rk[rounds][0]); - *((u32*)u.temp[1]) = *((u32*)(a+ 4)) ^ *((u32*)rk[rounds][1]); - *((u32*)u.temp[2]) = *((u32*)(a+ 8)) ^ *((u32*)rk[rounds][2]); - *((u32*)u.temp[3]) = *((u32*)(a+12)) ^ *((u32*)rk[rounds][3]); - - *((u32*)(b )) = (*((u32*)T5[u.temp[0][0]]) - ^ *((u32*)T6[u.temp[3][1]]) - ^ *((u32*)T7[u.temp[2][2]]) - ^ *((u32*)T8[u.temp[1][3]])); - *((u32*)(b+ 4)) = (*((u32*)T5[u.temp[1][0]]) - ^ *((u32*)T6[u.temp[0][1]]) - ^ *((u32*)T7[u.temp[3][2]]) - ^ *((u32*)T8[u.temp[2][3]])); - *((u32*)(b+ 8)) = (*((u32*)T5[u.temp[2][0]]) - ^ *((u32*)T6[u.temp[1][1]]) - ^ *((u32*)T7[u.temp[0][2]]) - ^ *((u32*)T8[u.temp[3][3]])); - *((u32*)(b+12)) = (*((u32*)T5[u.temp[3][0]]) - ^ *((u32*)T6[u.temp[2][1]]) - ^ *((u32*)T7[u.temp[1][2]]) - ^ *((u32*)T8[u.temp[0][3]])); + *((u32_a_t*)u.temp[0]) = *((u32_a_t*)(a )) ^ *((u32_a_t*)rk[rounds][0]); + *((u32_a_t*)u.temp[1]) = *((u32_a_t*)(a+ 4)) ^ *((u32_a_t*)rk[rounds][1]); + *((u32_a_t*)u.temp[2]) = *((u32_a_t*)(a+ 8)) ^ *((u32_a_t*)rk[rounds][2]); + *((u32_a_t*)u.temp[3]) = *((u32_a_t*)(a+12)) ^ *((u32_a_t*)rk[rounds][3]); + + *((u32_a_t*)(b )) = (*((u32_a_t*)T5[u.temp[0][0]]) + ^ *((u32_a_t*)T6[u.temp[3][1]]) + ^ *((u32_a_t*)T7[u.temp[2][2]]) + ^ *((u32_a_t*)T8[u.temp[1][3]])); + *((u32_a_t*)(b+ 4)) = (*((u32_a_t*)T5[u.temp[1][0]]) + ^ *((u32_a_t*)T6[u.temp[0][1]]) + ^ *((u32_a_t*)T7[u.temp[3][2]]) + ^ *((u32_a_t*)T8[u.temp[2][3]])); + *((u32_a_t*)(b+ 8)) = (*((u32_a_t*)T5[u.temp[2][0]]) + ^ *((u32_a_t*)T6[u.temp[1][1]]) + ^ *((u32_a_t*)T7[u.temp[0][2]]) + ^ *((u32_a_t*)T8[u.temp[3][3]])); + *((u32_a_t*)(b+12)) = (*((u32_a_t*)T5[u.temp[3][0]]) + ^ *((u32_a_t*)T6[u.temp[2][1]]) + ^ *((u32_a_t*)T7[u.temp[1][2]]) + ^ *((u32_a_t*)T8[u.temp[0][3]])); for (r = rounds-1; r > 1; r--) { - *((u32*)u.temp[0]) = *((u32*)(b )) ^ *((u32*)rk[r][0]); - *((u32*)u.temp[1]) = *((u32*)(b+ 4)) ^ *((u32*)rk[r][1]); - *((u32*)u.temp[2]) = *((u32*)(b+ 8)) ^ *((u32*)rk[r][2]); - *((u32*)u.temp[3]) = *((u32*)(b+12)) ^ *((u32*)rk[r][3]); - *((u32*)(b )) = (*((u32*)T5[u.temp[0][0]]) - ^ *((u32*)T6[u.temp[3][1]]) - ^ *((u32*)T7[u.temp[2][2]]) - ^ *((u32*)T8[u.temp[1][3]])); - *((u32*)(b+ 4)) = (*((u32*)T5[u.temp[1][0]]) - ^ *((u32*)T6[u.temp[0][1]]) - ^ *((u32*)T7[u.temp[3][2]]) - ^ *((u32*)T8[u.temp[2][3]])); - *((u32*)(b+ 8)) = (*((u32*)T5[u.temp[2][0]]) - ^ *((u32*)T6[u.temp[1][1]]) - ^ *((u32*)T7[u.temp[0][2]]) - ^ *((u32*)T8[u.temp[3][3]])); - *((u32*)(b+12)) = (*((u32*)T5[u.temp[3][0]]) - ^ *((u32*)T6[u.temp[2][1]]) - ^ *((u32*)T7[u.temp[1][2]]) - ^ *((u32*)T8[u.temp[0][3]])); + *((u32_a_t*)u.temp[0]) = *((u32_a_t*)(b )) ^ *((u32_a_t*)rk[r][0]); + *((u32_a_t*)u.temp[1]) = *((u32_a_t*)(b+ 4)) ^ *((u32_a_t*)rk[r][1]); + *((u32_a_t*)u.temp[2]) = *((u32_a_t*)(b+ 8)) ^ *((u32_a_t*)rk[r][2]); + *((u32_a_t*)u.temp[3]) = *((u32_a_t*)(b+12)) ^ *((u32_a_t*)rk[r][3]); + *((u32_a_t*)(b )) = (*((u32_a_t*)T5[u.temp[0][0]]) + ^ *((u32_a_t*)T6[u.temp[3][1]]) + ^ *((u32_a_t*)T7[u.temp[2][2]]) + ^ *((u32_a_t*)T8[u.temp[1][3]])); + *((u32_a_t*)(b+ 4)) = (*((u32_a_t*)T5[u.temp[1][0]]) + ^ *((u32_a_t*)T6[u.temp[0][1]]) + ^ *((u32_a_t*)T7[u.temp[3][2]]) + ^ *((u32_a_t*)T8[u.temp[2][3]])); + *((u32_a_t*)(b+ 8)) = (*((u32_a_t*)T5[u.temp[2][0]]) + ^ *((u32_a_t*)T6[u.temp[1][1]]) + ^ *((u32_a_t*)T7[u.temp[0][2]]) + ^ *((u32_a_t*)T8[u.temp[3][3]])); + *((u32_a_t*)(b+12)) = (*((u32_a_t*)T5[u.temp[3][0]]) + ^ *((u32_a_t*)T6[u.temp[2][1]]) + ^ *((u32_a_t*)T7[u.temp[1][2]]) + ^ *((u32_a_t*)T8[u.temp[0][3]])); } /* Last round is special. */ - *((u32*)u.temp[0]) = *((u32*)(b )) ^ *((u32*)rk[1][0]); - *((u32*)u.temp[1]) = *((u32*)(b+ 4)) ^ *((u32*)rk[1][1]); - *((u32*)u.temp[2]) = *((u32*)(b+ 8)) ^ *((u32*)rk[1][2]); - *((u32*)u.temp[3]) = *((u32*)(b+12)) ^ *((u32*)rk[1][3]); + *((u32_a_t*)u.temp[0]) = *((u32_a_t*)(b )) ^ *((u32_a_t*)rk[1][0]); + *((u32_a_t*)u.temp[1]) = *((u32_a_t*)(b+ 4)) ^ *((u32_a_t*)rk[1][1]); + *((u32_a_t*)u.temp[2]) = *((u32_a_t*)(b+ 8)) ^ *((u32_a_t*)rk[1][2]); + *((u32_a_t*)u.temp[3]) = *((u32_a_t*)(b+12)) ^ *((u32_a_t*)rk[1][3]); b[ 0] = S5[u.temp[0][0]]; b[ 1] = S5[u.temp[3][1]]; b[ 2] = S5[u.temp[2][2]]; b[ 3] = S5[u.temp[1][3]]; b[ 4] = S5[u.temp[1][0]]; b[ 5] = S5[u.temp[0][1]]; b[ 6] = S5[u.temp[3][2]]; b[ 7] = S5[u.temp[2][3]]; b[ 8] = S5[u.temp[2][0]]; b[ 9] = S5[u.temp[1][1]]; b[10] = S5[u.temp[0][2]]; b[11] = S5[u.temp[3][3]]; b[12] = S5[u.temp[3][0]]; b[13] = S5[u.temp[2][1]]; b[14] = S5[u.temp[1][2]]; b[15] = S5[u.temp[0][3]]; - *((u32*)(b )) ^= *((u32*)rk[0][0]); - *((u32*)(b+ 4)) ^= *((u32*)rk[0][1]); - *((u32*)(b+ 8)) ^= *((u32*)rk[0][2]); - *((u32*)(b+12)) ^= *((u32*)rk[0][3]); + *((u32_a_t*)(b )) ^= *((u32_a_t*)rk[0][0]); + *((u32_a_t*)(b+ 4)) ^= *((u32_a_t*)rk[0][1]); + *((u32_a_t*)(b+ 8)) ^= *((u32_a_t*)rk[0][2]); + *((u32_a_t*)(b+12)) ^= *((u32_a_t*)rk[0][3]); #undef rk } /* Decrypt one block. AX and BX may be the same. */ static void do_decrypt (RIJNDAEL_context *ctx, byte *bx, const byte *ax) { if ( !ctx->decryption_prepared ) { prepare_decryption ( ctx ); _gcry_burn_stack (64); ctx->decryption_prepared = 1; } /* BX and AX are not necessary correctly aligned. Thus we might need to copy them here. We try to align to a 16 bytes. */ if (((size_t)ax & 0x0f) || ((size_t)bx & 0x0f)) { union { u32 dummy[4]; byte a[16] ATTR_ALIGNED_16; } a; union { u32 dummy[4]; byte b[16] ATTR_ALIGNED_16; } b; memcpy (a.a, ax, 16); do_decrypt_aligned (ctx, b.b, a.a); memcpy (bx, b.b, 16); } else { do_decrypt_aligned (ctx, bx, ax); } } static void rijndael_decrypt (void *context, byte *b, const byte *a) { RIJNDAEL_context *ctx = context; if (0) ; #ifdef USE_PADLOCK else if (ctx->use_padlock) { do_padlock (ctx, 1, b, a); _gcry_burn_stack (48 + 2*sizeof(int) /* FIXME */); } #endif /*USE_PADLOCK*/ #ifdef USE_AESNI else if (ctx->use_aesni) { aesni_prepare (); do_aesni (ctx, 1, b, a); aesni_cleanup (); } #endif /*USE_AESNI*/ else { do_decrypt (ctx, b, a); _gcry_burn_stack (56+2*sizeof(int)); } } /* Bulk decryption of complete blocks in CFB mode. Caller needs to make sure that IV is aligned on an unisgned lonhg boundary. This function is only intended for the bulk encryption feature of cipher.c. */ void _gcry_aes_cfb_dec (void *context, unsigned char *iv, void *outbuf_arg, const void *inbuf_arg, unsigned int nblocks) { RIJNDAEL_context *ctx = context; unsigned char *outbuf = outbuf_arg; const unsigned char *inbuf = inbuf_arg; unsigned char *ivp; unsigned char temp; int i; if (0) ; #ifdef USE_PADLOCK else if (ctx->use_padlock) { /* Fixme: Let Padlock do the CFBing. */ for ( ;nblocks; nblocks-- ) { do_padlock (ctx, 0, iv, iv); for (ivp=iv,i=0; i < BLOCKSIZE; i++ ) { temp = *inbuf++; *outbuf++ = *ivp ^ temp; *ivp++ = temp; } } } #endif /*USE_PADLOCK*/ #ifdef USE_AESNI else if (ctx->use_aesni) { aesni_prepare (); for ( ;nblocks; nblocks-- ) { do_aesni_cfb (ctx, 1, iv, outbuf, inbuf); outbuf += BLOCKSIZE; inbuf += BLOCKSIZE; } aesni_cleanup (); } #endif /*USE_AESNI*/ else { for ( ;nblocks; nblocks-- ) { do_encrypt_aligned (ctx, iv, iv); for (ivp=iv,i=0; i < BLOCKSIZE; i++ ) { temp = *inbuf++; *outbuf++ = *ivp ^ temp; *ivp++ = temp; } } } _gcry_burn_stack (48 + 2*sizeof(int)); } /* Bulk decryption of complete blocks in CBC mode. Caller needs to make sure that IV is aligned on an unsigned long boundary. This function is only intended for the bulk encryption feature of cipher.c. */ void _gcry_aes_cbc_dec (void *context, unsigned char *iv, void *outbuf_arg, const void *inbuf_arg, unsigned int nblocks) { RIJNDAEL_context *ctx = context; unsigned char *outbuf = outbuf_arg; const unsigned char *inbuf = inbuf_arg; unsigned char *ivp; int i; unsigned char savebuf[BLOCKSIZE]; aesni_prepare (); for ( ;nblocks; nblocks-- ) { /* We need to save INBUF away because it may be identical to OUTBUF. */ memcpy (savebuf, inbuf, BLOCKSIZE); if (0) ; #ifdef USE_PADLOCK else if (ctx->use_padlock) do_padlock (ctx, 1, outbuf, inbuf); #endif /*USE_PADLOCK*/ #ifdef USE_AESNI else if (ctx->use_aesni) do_aesni (ctx, 1, outbuf, inbuf); #endif /*USE_AESNI*/ else do_decrypt (ctx, outbuf, inbuf); for (ivp=iv, i=0; i < BLOCKSIZE; i++ ) outbuf[i] ^= *ivp++; memcpy (iv, savebuf, BLOCKSIZE); inbuf += BLOCKSIZE; outbuf += BLOCKSIZE; } aesni_cleanup (); _gcry_burn_stack (48 + 2*sizeof(int) + BLOCKSIZE + 4*sizeof (char*)); } /* Run the self-tests for AES 128. Returns NULL on success. */ static const char* selftest_basic_128 (void) { RIJNDAEL_context ctx; unsigned char scratch[16]; /* The test vectors are from the AES supplied ones; more or less randomly taken from ecb_tbl.txt (I=42,81,14) */ #if 1 static const unsigned char plaintext_128[16] = { 0x01,0x4B,0xAF,0x22,0x78,0xA6,0x9D,0x33, 0x1D,0x51,0x80,0x10,0x36,0x43,0xE9,0x9A }; static const unsigned char key_128[16] = { 0xE8,0xE9,0xEA,0xEB,0xED,0xEE,0xEF,0xF0, 0xF2,0xF3,0xF4,0xF5,0xF7,0xF8,0xF9,0xFA }; static const unsigned char ciphertext_128[16] = { 0x67,0x43,0xC3,0xD1,0x51,0x9A,0xB4,0xF2, 0xCD,0x9A,0x78,0xAB,0x09,0xA5,0x11,0xBD }; #else /* Test vectors from fips-197, appendix C. */ # warning debug test vectors in use static const unsigned char plaintext_128[16] = { 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77, 0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff }; static const unsigned char key_128[16] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f /* 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, */ /* 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c */ }; static const unsigned char ciphertext_128[16] = { 0x69,0xc4,0xe0,0xd8,0x6a,0x7b,0x04,0x30, 0xd8,0xcd,0xb7,0x80,0x70,0xb4,0xc5,0x5a }; #endif rijndael_setkey (&ctx, key_128, sizeof (key_128)); rijndael_encrypt (&ctx, scratch, plaintext_128); if (memcmp (scratch, ciphertext_128, sizeof (ciphertext_128))) return "AES-128 test encryption failed."; rijndael_decrypt (&ctx, scratch, scratch); if (memcmp (scratch, plaintext_128, sizeof (plaintext_128))) return "AES-128 test decryption failed."; return NULL; } /* Run the self-tests for AES 192. Returns NULL on success. */ static const char* selftest_basic_192 (void) { RIJNDAEL_context ctx; unsigned char scratch[16]; static unsigned char plaintext_192[16] = { 0x76,0x77,0x74,0x75,0xF1,0xF2,0xF3,0xF4, 0xF8,0xF9,0xE6,0xE7,0x77,0x70,0x71,0x72 }; static unsigned char key_192[24] = { 0x04,0x05,0x06,0x07,0x09,0x0A,0x0B,0x0C, 0x0E,0x0F,0x10,0x11,0x13,0x14,0x15,0x16, 0x18,0x19,0x1A,0x1B,0x1D,0x1E,0x1F,0x20 }; static const unsigned char ciphertext_192[16] = { 0x5D,0x1E,0xF2,0x0D,0xCE,0xD6,0xBC,0xBC, 0x12,0x13,0x1A,0xC7,0xC5,0x47,0x88,0xAA }; rijndael_setkey (&ctx, key_192, sizeof(key_192)); rijndael_encrypt (&ctx, scratch, plaintext_192); if (memcmp (scratch, ciphertext_192, sizeof (ciphertext_192))) return "AES-192 test encryption failed."; rijndael_decrypt (&ctx, scratch, scratch); if (memcmp (scratch, plaintext_192, sizeof (plaintext_192))) return "AES-192 test decryption failed."; return NULL; } /* Run the self-tests for AES 256. Returns NULL on success. */ static const char* selftest_basic_256 (void) { RIJNDAEL_context ctx; unsigned char scratch[16]; static unsigned char plaintext_256[16] = { 0x06,0x9A,0x00,0x7F,0xC7,0x6A,0x45,0x9F, 0x98,0xBA,0xF9,0x17,0xFE,0xDF,0x95,0x21 }; static unsigned char key_256[32] = { 0x08,0x09,0x0A,0x0B,0x0D,0x0E,0x0F,0x10, 0x12,0x13,0x14,0x15,0x17,0x18,0x19,0x1A, 0x1C,0x1D,0x1E,0x1F,0x21,0x22,0x23,0x24, 0x26,0x27,0x28,0x29,0x2B,0x2C,0x2D,0x2E }; static const unsigned char ciphertext_256[16] = { 0x08,0x0E,0x95,0x17,0xEB,0x16,0x77,0x71, 0x9A,0xCF,0x72,0x80,0x86,0x04,0x0A,0xE3 }; rijndael_setkey (&ctx, key_256, sizeof(key_256)); rijndael_encrypt (&ctx, scratch, plaintext_256); if (memcmp (scratch, ciphertext_256, sizeof (ciphertext_256))) return "AES-256 test encryption failed."; rijndael_decrypt (&ctx, scratch, scratch); if (memcmp (scratch, plaintext_256, sizeof (plaintext_256))) return "AES-256 test decryption failed."; return NULL; } /* Run all the self-tests and return NULL on success. This function is used for the on-the-fly self-tests. */ static const char * selftest (void) { const char *r; if ( (r = selftest_basic_128 ()) || (r = selftest_basic_192 ()) || (r = selftest_basic_256 ()) ) return r; return r; } /* SP800-38a.pdf for AES-128. */ static const char * selftest_fips_128_38a (int requested_mode) { struct tv { int mode; const unsigned char key[16]; const unsigned char iv[16]; struct { const unsigned char input[16]; const unsigned char output[16]; } data[4]; } tv[2] = { { GCRY_CIPHER_MODE_CFB, /* F.3.13, CFB128-AES128 */ { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }, { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, { { { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a }, { 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a } }, { { 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51 }, { 0xc8, 0xa6, 0x45, 0x37, 0xa0, 0xb3, 0xa9, 0x3f, 0xcd, 0xe3, 0xcd, 0xad, 0x9f, 0x1c, 0xe5, 0x8b } }, { { 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef }, { 0x26, 0x75, 0x1f, 0x67, 0xa3, 0xcb, 0xb1, 0x40, 0xb1, 0x80, 0x8c, 0xf1, 0x87, 0xa4, 0xf4, 0xdf } }, { { 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }, { 0xc0, 0x4b, 0x05, 0x35, 0x7c, 0x5d, 0x1c, 0x0e, 0xea, 0xc4, 0xc6, 0x6f, 0x9f, 0xf7, 0xf2, 0xe6 } } } }, { GCRY_CIPHER_MODE_OFB, { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }, { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, { { { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a }, { 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a } }, { { 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51 }, { 0x77, 0x89, 0x50, 0x8d, 0x16, 0x91, 0x8f, 0x03, 0xf5, 0x3c, 0x52, 0xda, 0xc5, 0x4e, 0xd8, 0x25 } }, { { 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef }, { 0x97, 0x40, 0x05, 0x1e, 0x9c, 0x5f, 0xec, 0xf6, 0x43, 0x44, 0xf7, 0xa8, 0x22, 0x60, 0xed, 0xcc } }, { { 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }, { 0x30, 0x4c, 0x65, 0x28, 0xf6, 0x59, 0xc7, 0x78, 0x66, 0xa5, 0x10, 0xd9, 0xc1, 0xd6, 0xae, 0x5e } }, } } }; unsigned char scratch[16]; gpg_error_t err; int tvi, idx; gcry_cipher_hd_t hdenc = NULL; gcry_cipher_hd_t hddec = NULL; #define Fail(a) do { \ _gcry_cipher_close (hdenc); \ _gcry_cipher_close (hddec); \ return a; \ } while (0) gcry_assert (sizeof tv[0].data[0].input == sizeof scratch); gcry_assert (sizeof tv[0].data[0].output == sizeof scratch); for (tvi=0; tvi < DIM (tv); tvi++) if (tv[tvi].mode == requested_mode) break; if (tvi == DIM (tv)) Fail ("no test data for this mode"); err = _gcry_cipher_open (&hdenc, GCRY_CIPHER_AES, tv[tvi].mode, 0); if (err) Fail ("open"); err = _gcry_cipher_open (&hddec, GCRY_CIPHER_AES, tv[tvi].mode, 0); if (err) Fail ("open"); err = _gcry_cipher_setkey (hdenc, tv[tvi].key, sizeof tv[tvi].key); if (!err) err = _gcry_cipher_setkey (hddec, tv[tvi].key, sizeof tv[tvi].key); if (err) Fail ("set key"); err = _gcry_cipher_setiv (hdenc, tv[tvi].iv, sizeof tv[tvi].iv); if (!err) err = _gcry_cipher_setiv (hddec, tv[tvi].iv, sizeof tv[tvi].iv); if (err) Fail ("set IV"); for (idx=0; idx < DIM (tv[tvi].data); idx++) { err = _gcry_cipher_encrypt (hdenc, scratch, sizeof scratch, tv[tvi].data[idx].input, sizeof tv[tvi].data[idx].input); if (err) Fail ("encrypt command"); if (memcmp (scratch, tv[tvi].data[idx].output, sizeof scratch)) Fail ("encrypt mismatch"); err = _gcry_cipher_decrypt (hddec, scratch, sizeof scratch, tv[tvi].data[idx].output, sizeof tv[tvi].data[idx].output); if (err) Fail ("decrypt command"); if (memcmp (scratch, tv[tvi].data[idx].input, sizeof scratch)) Fail ("decrypt mismatch"); } #undef Fail _gcry_cipher_close (hdenc); _gcry_cipher_close (hddec); return NULL; } /* Complete selftest for AES-128 with all modes and driver code. */ static gpg_err_code_t selftest_fips_128 (int extended, selftest_report_func_t report) { const char *what; const char *errtxt; what = "low-level"; errtxt = selftest_basic_128 (); if (errtxt) goto failed; if (extended) { what = "cfb"; errtxt = selftest_fips_128_38a (GCRY_CIPHER_MODE_CFB); if (errtxt) goto failed; what = "ofb"; errtxt = selftest_fips_128_38a (GCRY_CIPHER_MODE_OFB); if (errtxt) goto failed; } return 0; /* Succeeded. */ failed: if (report) report ("cipher", GCRY_CIPHER_AES128, what, errtxt); return GPG_ERR_SELFTEST_FAILED; } /* Complete selftest for AES-192. */ static gpg_err_code_t selftest_fips_192 (int extended, selftest_report_func_t report) { const char *what; const char *errtxt; (void)extended; /* No extended tests available. */ what = "low-level"; errtxt = selftest_basic_192 (); if (errtxt) goto failed; return 0; /* Succeeded. */ failed: if (report) report ("cipher", GCRY_CIPHER_AES192, what, errtxt); return GPG_ERR_SELFTEST_FAILED; } /* Complete selftest for AES-256. */ static gpg_err_code_t selftest_fips_256 (int extended, selftest_report_func_t report) { const char *what; const char *errtxt; (void)extended; /* No extended tests available. */ what = "low-level"; errtxt = selftest_basic_256 (); if (errtxt) goto failed; return 0; /* Succeeded. */ failed: if (report) report ("cipher", GCRY_CIPHER_AES256, what, errtxt); return GPG_ERR_SELFTEST_FAILED; } /* Run a full self-test for ALGO and return 0 on success. */ static gpg_err_code_t run_selftests (int algo, int extended, selftest_report_func_t report) { gpg_err_code_t ec; switch (algo) { case GCRY_CIPHER_AES128: ec = selftest_fips_128 (extended, report); break; case GCRY_CIPHER_AES192: ec = selftest_fips_192 (extended, report); break; case GCRY_CIPHER_AES256: ec = selftest_fips_256 (extended, report); break; default: ec = GPG_ERR_CIPHER_ALGO; break; } return ec; } static const char *rijndael_names[] = { "RIJNDAEL", "AES128", "AES-128", NULL }; static gcry_cipher_oid_spec_t rijndael_oids[] = { { "2.16.840.1.101.3.4.1.1", GCRY_CIPHER_MODE_ECB }, { "2.16.840.1.101.3.4.1.2", GCRY_CIPHER_MODE_CBC }, { "2.16.840.1.101.3.4.1.3", GCRY_CIPHER_MODE_OFB }, { "2.16.840.1.101.3.4.1.4", GCRY_CIPHER_MODE_CFB }, { NULL } }; gcry_cipher_spec_t _gcry_cipher_spec_aes = { "AES", rijndael_names, rijndael_oids, 16, 128, sizeof (RIJNDAEL_context), rijndael_setkey, rijndael_encrypt, rijndael_decrypt }; cipher_extra_spec_t _gcry_cipher_extraspec_aes = { run_selftests }; static const char *rijndael192_names[] = { "RIJNDAEL192", "AES-192", NULL }; static gcry_cipher_oid_spec_t rijndael192_oids[] = { { "2.16.840.1.101.3.4.1.21", GCRY_CIPHER_MODE_ECB }, { "2.16.840.1.101.3.4.1.22", GCRY_CIPHER_MODE_CBC }, { "2.16.840.1.101.3.4.1.23", GCRY_CIPHER_MODE_OFB }, { "2.16.840.1.101.3.4.1.24", GCRY_CIPHER_MODE_CFB }, { NULL } }; gcry_cipher_spec_t _gcry_cipher_spec_aes192 = { "AES192", rijndael192_names, rijndael192_oids, 16, 192, sizeof (RIJNDAEL_context), rijndael_setkey, rijndael_encrypt, rijndael_decrypt }; cipher_extra_spec_t _gcry_cipher_extraspec_aes192 = { run_selftests }; static const char *rijndael256_names[] = { "RIJNDAEL256", "AES-256", NULL }; static gcry_cipher_oid_spec_t rijndael256_oids[] = { { "2.16.840.1.101.3.4.1.41", GCRY_CIPHER_MODE_ECB }, { "2.16.840.1.101.3.4.1.42", GCRY_CIPHER_MODE_CBC }, { "2.16.840.1.101.3.4.1.43", GCRY_CIPHER_MODE_OFB }, { "2.16.840.1.101.3.4.1.44", GCRY_CIPHER_MODE_CFB }, { NULL } }; gcry_cipher_spec_t _gcry_cipher_spec_aes256 = { "AES256", rijndael256_names, rijndael256_oids, 16, 256, sizeof (RIJNDAEL_context), rijndael_setkey, rijndael_encrypt, rijndael_decrypt }; cipher_extra_spec_t _gcry_cipher_extraspec_aes256 = { run_selftests }; diff --git a/configure.ac b/configure.ac index 64692b6d..013ff3af 100644 --- a/configure.ac +++ b/configure.ac @@ -1,1258 +1,1249 @@ # Configure.ac script for Libgcrypt # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, # 2007, 2008, 2009 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 . # (Process this file with autoconf to produce a configure script.) AC_REVISION($Revision$) AC_PREREQ(2.60) min_automake_version="1.10" # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. m4_define([my_version], [1.5.0]) m4_define([my_issvn], [yes]) m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) m4_define([git_revision], m4_esyscmd([git branch -v 2>/dev/null \ | awk '/^\* / {printf "%s",$3}'])) AC_INIT([libgcrypt], [my_version[]m4_if(my_issvn,[yes], [m4_if(git_revision,[],[-svn[]svn_revision],[-git[]git_revision])])], [bug-libgcrypt@gnupg.org]) # LT Version numbers, remember to change them just *before* a release. # (Interfaces removed: CURRENT++, AGE=0, REVISION=0) # (Interfaces added: CURRENT++, AGE++, REVISION=0) # (No interfaces changed: REVISION++) # NOTE: As an exception during development of this branch the LT # versions are already set for 1.5.0! LIBGCRYPT_LT_CURRENT=18 LIBGCRYPT_LT_AGE=7 LIBGCRYPT_LT_REVISION=0 # If the API is changed in an incompatible way: increment the next counter. LIBGCRYPT_CONFIG_API_VERSION=1 NEED_GPG_ERROR_VERSION=1.8 is_development_version=my_issvn BUILD_REVISION=m4_if(git_revision,[],[svn_revision],[git_revision]) PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION AC_CONFIG_SRCDIR([src/libgcrypt.vers]) AM_INIT_AUTOMAKE([]) AM_CONFIG_HEADER(config.h) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_LIBOBJ_DIR([compat]) AC_CANONICAL_HOST AM_MAINTAINER_MODE AH_TOP([ #ifndef _GCRYPT_CONFIG_H_INCLUDED #define _GCRYPT_CONFIG_H_INCLUDED /* Enable gpg-error's strerror macro for W32CE. */ #define GPG_ERR_ENABLE_ERRNO_MACROS 1 ]) AH_BOTTOM([ #define _GCRYPT_IN_LIBGCRYPT 1 /* If the configure check for endianness has been disabled, get it from OS macros. This is intended for making fat binary builds on OS X. */ #ifdef DISABLED_ENDIAN_CHECK # if defined(__BIG_ENDIAN__) # define WORDS_BIGENDIAN 1 # elif defined(__LITTLE_ENDIAN__) # undef WORDS_BIGENDIAN # else # error "No endianness found" # endif #endif /*DISABLED_ENDIAN_CHECK*/ /* We basically use the original Camellia source. Make sure the symbols properly prefixed. */ #define CAMELLIA_EXT_SYM_PREFIX _gcry_ /* This error code is only available with gpg-error 1.7. Thus we define it here with the usual gcry prefix. */ #define GCRY_GPG_ERR_NOT_OPERATIONAL 176 #endif /*_GCRYPT_CONFIG_H_INCLUDED*/ ]) AH_VERBATIM([_REENTRANT], [/* To allow the use of Libgcrypt in multithreaded programs we have to use special features from the library. */ #ifndef _REENTRANT # define _REENTRANT 1 #endif ]) AC_SUBST(LIBGCRYPT_LT_CURRENT) AC_SUBST(LIBGCRYPT_LT_AGE) AC_SUBST(LIBGCRYPT_LT_REVISION) AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package]) ###################### ## Basic checks. ### (we need some results later on (e.g. $GCC) ###################### AC_PROG_MAKE_SET missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) # AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_PROG_CC AC_PROG_CPP AM_PROG_CC_C_O AM_PROG_AS AC_ISC_POSIX AC_PROG_INSTALL AC_PROG_AWK AC_GNU_SOURCE LT_PREREQ([2.2.6]) LT_INIT([win32-dll disable-static]) LT_LANG([Windows Resource]) ########################## ## General definitions. ## ########################## # Used by libgcrypt-config LIBGCRYPT_CONFIG_LIBS="-lgcrypt" LIBGCRYPT_CONFIG_CFLAGS="" # Definitions for symmetric ciphers. available_ciphers="arcfour blowfish cast5 des aes twofish serpent rfc2268 seed" available_ciphers="$available_ciphers camellia" enabled_ciphers="" # Definitions for public-key ciphers. available_pubkey_ciphers="dsa elgamal rsa ecc" enabled_pubkey_ciphers="" # Definitions for message digests. available_digests="crc md4 md5 rmd160 sha1 sha256" available_digests_64="sha512 tiger whirlpool" enabled_digests="" # Definitions for random modules. available_random_modules="linux egd unix" auto_random_modules="$available_random_modules" # Supported thread backends. LIBGCRYPT_THREAD_MODULES="" # Other definitions. print_egd_notice=no have_w32_system=no have_w32ce_system=no # Setup some stuff depending on host. case "${host}" in *-*-mingw32*) ac_cv_have_dev_random=no have_w32_system=yes case "${host}" in *-mingw32ce*) have_w32ce_system=yes available_random_modules="w32ce" ;; *) available_random_modules="w32" ;; esac AC_DEFINE(USE_ONLY_8DOT3,1, [set this to limit filenames to the 8.3 format]) AC_DEFINE(HAVE_DRIVE_LETTERS,1, [defined if we must run on a stupid file system]) AC_DEFINE(HAVE_DOSISH_SYSTEM,1, [defined if we run on some of the PCDOS like systems (DOS, Windoze. OS/2) with special properties like no file modes]) ;; i?86-emx-os2 | i?86-*-os2*emx) # OS/2 with the EMX environment ac_cv_have_dev_random=no AC_DEFINE(HAVE_DRIVE_LETTERS) AC_DEFINE(HAVE_DOSISH_SYSTEM) ;; i?86-*-msdosdjgpp*) # DOS with the DJGPP environment ac_cv_have_dev_random=no AC_DEFINE(HAVE_DRIVE_LETTERS) AC_DEFINE(HAVE_DOSISH_SYSTEM) ;; *-*-freebsd*) # FreeBSD CPPFLAGS="$CPPFLAGS -I/usr/local/include" LDFLAGS="$LDFLAGS -L/usr/local/lib" ;; *-*-hpux*) if test -z "$GCC" ; then CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE" fi ;; *-dec-osf4*) if test -z "$GCC" ; then # Suppress all warnings # to get rid of the unsigned/signed char mismatch warnings. CFLAGS="$CFLAGS -w" fi ;; m68k-atari-mint) ;; *) ;; esac 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="W32CE" ;; *-*-mingw32*) PRINTABLE_OS_NAME="W32" ;; i?86-emx-os2 | i?86-*-os2*emx ) PRINTABLE_OS_NAME="OS/2" ;; i?86-*-msdosdjgpp*) PRINTABLE_OS_NAME="MSDOS/DJGPP" ;; *-linux*) PRINTABLE_OS_NAME="GNU/Linux" ;; *) PRINTABLE_OS_NAME=`uname -s || echo "Unknown"` ;; esac # # Figure out the name of the random device # case "${host}" in *-openbsd*) NAME_OF_DEV_RANDOM="/dev/srandom" NAME_OF_DEV_URANDOM="/dev/urandom" ;; *) NAME_OF_DEV_RANDOM="/dev/random" NAME_OF_DEV_URANDOM="/dev/urandom" ;; esac AC_ARG_ENABLE(endian-check, AC_HELP_STRING([--disable-endian-check], [disable the endian check and trust the OS provided macros]), endiancheck=$enableval,endiancheck=yes) if test x"$endiancheck" = xyes ; then AC_C_BIGENDIAN else AC_DEFINE(DISABLED_ENDIAN_CHECK,1,[configure did not test for endianess]) fi AC_CHECK_SIZEOF(unsigned short, 2) AC_CHECK_SIZEOF(unsigned int, 4) AC_CHECK_SIZEOF(unsigned long, 4) AC_CHECK_SIZEOF(unsigned long long, 0) AC_TYPE_UINTPTR_T if test "$ac_cv_sizeof_unsigned_short" = "0" \ || test "$ac_cv_sizeof_unsigned_int" = "0" \ || test "$ac_cv_sizeof_unsigned_long" = "0"; then AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]); fi # Do we have any 64-bit data types? if test "$ac_cv_sizeof_unsigned_int" != "8" \ && test "$ac_cv_sizeof_unsigned_long" != "8" \ && test "$ac_cv_sizeof_unsigned_long_long" != "8" \ && test "$ac_cv_sizeof_uint64_t" != "8"; then AC_MSG_WARN([No 64-bit types. Disabling TIGER/192, SHA-384, and SHA-512]) else available_digests="$available_digests $available_digests_64" fi # If not specified otherwise, all available algorithms will be # included. default_ciphers="$available_ciphers" default_pubkey_ciphers="$available_pubkey_ciphers" default_digests="$available_digests" ############################ ## Command line switches. ## ############################ # Implementation of the --enable-ciphers switch. AC_ARG_ENABLE(ciphers, AC_HELP_STRING([--enable-ciphers=ciphers], [select the symmetric ciphers to include]), [enabled_ciphers=`echo $enableval | tr ',:' ' ' | tr '[A-Z]' '[a-z]'`], [enabled_ciphers=""]) if test "x$enabled_ciphers" = "x" \ -o "$enabled_ciphers" = "yes" \ -o "$enabled_ciphers" = "no"; then enabled_ciphers=$default_ciphers fi AC_MSG_CHECKING([which symmetric ciphers to include]) for cipher in $enabled_ciphers; do LIST_MEMBER($cipher, $available_ciphers) if test "$found" = "0"; then AC_MSG_ERROR([unsupported cipher "$cipher" specified]) fi done AC_MSG_RESULT([$enabled_ciphers]) # Implementation of the --enable-pubkey-ciphers switch. AC_ARG_ENABLE(pubkey-ciphers, AC_HELP_STRING([--enable-pubkey-ciphers=ciphers], [select the public-key ciphers to include]), [enabled_pubkey_ciphers=`echo $enableval | tr ',:' ' ' | tr '[A-Z]' '[a-z]'`], [enabled_pubkey_ciphers=""]) if test "x$enabled_pubkey_ciphers" = "x" \ -o "$enabled_pubkey_ciphers" = "yes" \ -o "$enabled_pubkey_ciphers" = "no"; then enabled_pubkey_ciphers=$default_pubkey_ciphers fi AC_MSG_CHECKING([which public-key ciphers to include]) for cipher in $enabled_pubkey_ciphers; do LIST_MEMBER($cipher, $available_pubkey_ciphers) if test "$found" = "0"; then AC_MSG_ERROR([unsupported public-key cipher specified]) fi done AC_MSG_RESULT([$enabled_pubkey_ciphers]) # Implementation of the --enable-digests switch. AC_ARG_ENABLE(digests, AC_HELP_STRING([--enable-digests=digests], [select the message digests to include]), [enabled_digests=`echo $enableval | tr ',:' ' ' | tr '[A-Z]' '[a-z]'`], [enabled_digests=""]) if test "x$enabled_digests" = "x" \ -o "$enabled_digests" = "yes" \ -o "$enabled_digests" = "no"; then enabled_digests=$default_digests fi AC_MSG_CHECKING([which message digests to include]) for digest in $enabled_digests; do LIST_MEMBER($digest, $available_digests) if test "$found" = "0"; then AC_MSG_ERROR([unsupported message digest specified]) fi done AC_MSG_RESULT([$enabled_digests]) # Implementation of the --enable-random switch. AC_ARG_ENABLE(random, AC_HELP_STRING([--enable-random=name], [select which random number generator to use]), [random=`echo $enableval | tr '[A-Z]' '[a-z]'`], []) if test "x$random" = "x" -o "$random" = "yes" -o "$random" = "no"; then random=default fi AC_MSG_CHECKING([which random module to use]) if test "$random" != "default" -a "$random" != "auto"; then LIST_MEMBER($random, $available_random_modules) if test "$found" = "0"; then AC_MSG_ERROR([unsupported random module specified]) fi fi AC_MSG_RESULT($random) # Implementation of the --disable-dev-random switch. AC_MSG_CHECKING([whether use of /dev/random is requested]) AC_ARG_ENABLE(dev-random, [ --disable-dev-random disable the use of dev random], try_dev_random=$enableval, try_dev_random=yes) AC_MSG_RESULT($try_dev_random) # Implementation of the --with-egd-socket switch. AC_ARG_WITH(egd-socket, [ --with-egd-socket=NAME Use NAME for the EGD socket)], egd_socket_name="$withval", egd_socket_name="" ) AC_DEFINE_UNQUOTED(EGD_SOCKET_NAME, "$egd_socket_name", [Define if you don't want the default EGD socket name. For details see cipher/rndegd.c]) # Implementation of the --enable-random-daemon AC_MSG_CHECKING([whether the experimental random daemon is requested]) AC_ARG_ENABLE([random-daemon], AC_HELP_STRING([--enable-random-daemon], [Build and support the experimental gcryptrnd]), [use_random_daemon=$enableval], [use_random_daemon=no]) AC_MSG_RESULT($use_random_daemon) if test x$use_random_daemon = xyes ; then AC_DEFINE(USE_RANDOM_DAEMON,1, [Define to support the experimental random daemon]) fi AM_CONDITIONAL(USE_RANDOM_DAEMON, test x$use_random_daemon = xyes) # Implementation of --disable-asm. AC_MSG_CHECKING([whether MPI assembler modules are requested]) AC_ARG_ENABLE([asm], AC_HELP_STRING([--disable-asm], [Disable MPI assembler modules]), [try_asm_modules=$enableval], [try_asm_modules=yes]) AC_MSG_RESULT($try_asm_modules) # Implementation of the --enable-m-guard switch. AC_MSG_CHECKING([whether memory guard is requested]) AC_ARG_ENABLE(m-guard, AC_HELP_STRING([--enable-m-guard], [Enable memory guard facility]), [use_m_guard=$enableval], [use_m_guard=no]) AC_MSG_RESULT($use_m_guard) if test "$use_m_guard" = yes ; then AC_DEFINE(M_GUARD,1,[Define to use the (obsolete) malloc guarding feature]) fi # Implementation of the --with-capabilities switch. # Check whether we want to use Linux capabilities AC_MSG_CHECKING([whether use of capabilities is requested]) AC_ARG_WITH(capabilities, AC_HELP_STRING([--with-capabilities], [Use linux capabilities [default=no]]), [use_capabilities="$withval"],[use_capabilities=no]) AC_MSG_RESULT($use_capabilities) # Implementation of the --enable-hmac-binary-check. AC_MSG_CHECKING([whether a HMAC binary check is requested]) AC_ARG_ENABLE(hmac-binary-check, AC_HELP_STRING([--enable-hmac-binary-check], [Enable library integrity check]), [use_hmac_binary_check=$enableval], [use_hmac_binary_check=no]) AC_MSG_RESULT($use_hmac_binary_check) if test "$use_hmac_binary_check" = yes ; then AC_DEFINE(ENABLE_HMAC_BINARY_CHECK,1, [Define to support an HMAC based integrity check]) fi # Implementation of the --disable-padlock-support switch. AC_MSG_CHECKING([whether padlock support is requested]) AC_ARG_ENABLE(padlock-support, AC_HELP_STRING([--disable-padlock-support], [Disable support for the PadLock Engine of VIA processors]), padlocksupport=$enableval,padlocksupport=yes) AC_MSG_RESULT($padlocksupport) if test x"$padlocksupport" = xyes ; then AC_DEFINE(ENABLE_PADLOCK_SUPPORT, 1, [Enable support for the PadLock engine.]) fi # Implementation of the --disable-aesni-support switch. AC_MSG_CHECKING([whether AESNI support is requested]) AC_ARG_ENABLE(aesni-support, AC_HELP_STRING([--disable-aesni-support], [Disable support for the Intel AES-NI instructions]), aesnisupport=$enableval,aesnisupport=yes) AC_MSG_RESULT($aesnisupport) if test x"$aesnisupport" = xyes ; then AC_DEFINE(ENABLE_AESNI_SUPPORT, 1, [Enable support for Intel AES-NI instructions.]) fi # Implementation of the --disable-O-flag-munging switch. AC_MSG_CHECKING([whether a -O flag munging is requested]) AC_ARG_ENABLE([O-flag-munging], AC_HELP_STRING([--disable-O-flag-munging], [Disable modification of the cc -O flag]), [enable_o_flag_munging=$enableval], [enable_o_flag_munging=yes]) AC_MSG_RESULT($enable_o_flag_munging) AM_CONDITIONAL(ENABLE_O_FLAG_MUNGING, test "$enable_o_flag_munging" = "yes") AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME", [A human readable text with the name of the OS]) # For some systems we know that we have ld_version scripts. # Use it then as default. have_ld_version_script=no case "${host}" in *-*-linux*) have_ld_version_script=yes ;; *-*-gnu*) have_ld_version_script=yes ;; esac AC_ARG_ENABLE([ld-version-script], AC_HELP_STRING([--enable-ld-version-script], [enable/disable use of linker version script. (default is system dependent)]), [have_ld_version_script=$enableval], [ : ] ) AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM", [defined to the name of the strong random device]) AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM", [defined to the name of the weaker random device]) ############################### #### Checks for libraries. #### ############################### # # gpg-error is required. # AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION") if test "x$GPG_ERROR_LIBS" = "x"; then AC_MSG_ERROR([libgpg-error is needed. See ftp://ftp.gnupg.org/gcrypt/libgpg-error/ .]) fi AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GCRYPT, [The default error source for libgcrypt.]) # # Check whether the GNU Pth library is available. We require this # to build the optional gcryptrnd program. # AC_ARG_WITH(pth-prefix, AC_HELP_STRING([--with-pth-prefix=PFX], [prefix where GNU Pth is installed (optional)]), pth_config_prefix="$withval", pth_config_prefix="") if test x$pth_config_prefix != x ; then PTH_CONFIG="$pth_config_prefix/bin/pth-config" fi if test "$use_random_daemon" = "yes"; then AC_PATH_PROG(PTH_CONFIG, pth-config, no) if test "$PTH_CONFIG" = "no"; then AC_MSG_WARN([[ *** *** To build the Libgcrypt's random number daemon *** we need the support of the GNU Portable Threads Library. *** Download it from ftp://ftp.gnu.org/gnu/pth/ *** On a Debian GNU/Linux system you might want to try *** apt-get install libpth-dev ***]]) else GNUPG_PTH_VERSION_CHECK([1.3.7]) if test $have_pth = yes; then PTH_CFLAGS=`$PTH_CONFIG --cflags` PTH_LIBS=`$PTH_CONFIG --ldflags` PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`" AC_DEFINE(USE_GNU_PTH, 1, [Defined if the GNU Portable Thread Library should be used]) AC_DEFINE(HAVE_PTH, 1, [Defined if the GNU Pth is available]) fi fi fi AC_SUBST(PTH_CFLAGS) AC_SUBST(PTH_LIBS) # Solaris needs -lsocket and -lnsl. Unisys system includes # gethostbyname in libsocket but needs libnsl for socket. AC_SEARCH_LIBS(setsockopt, [socket], , [AC_SEARCH_LIBS(setsockopt, [socket], , , [-lnsl])]) AC_SEARCH_LIBS(setsockopt, [nsl]) ################################## #### Checks for header files. #### ################################## AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h sys/select.h sys/msg.h) INSERT_SYS_SELECT_H= if test x"$ac_cv_header_sys_select_h" = xyes; then INSERT_SYS_SELECT_H=" include " fi AC_SUBST(INSERT_SYS_SELECT_H) ########################################## #### Checks for typedefs, structures, #### #### and compiler characteristics. #### ########################################## AC_C_CONST AC_C_INLINE 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) GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF) GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF) GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF) gl_TYPE_SOCKLEN_T case "${host}" in *-*-mingw32*) # socklen_t may or may not be defined depending on what headers # are included. To be safe we use int as this is the actual type. FALLBACK_SOCKLEN_T="typedef int gcry_socklen_t;" ;; *) if test ".$gl_cv_socklen_t_equiv" = "."; then FALLBACK_SOCKLEN_T="typedef socklen_t gcry_socklen_t;" else FALLBACK_SOCKLEN_T="typedef ${gl_cv_socklen_t_equiv} gcry_socklen_t;" fi esac AC_SUBST(FALLBACK_SOCKLEN_T) # # Check for ELF visibility support. # AC_CACHE_CHECK(whether the visibility attribute is supported, gcry_cv_visibility_attribute, [gcry_cv_visibility_attribute=no AC_LANG_CONFTEST([AC_LANG_SOURCE( [[int foo __attribute__ ((visibility ("hidden"))) = 1; int bar __attribute__ ((visibility ("protected"))) = 1; ]])]) if ${CC-cc} -Werror -S conftest.c -o conftest.s \ 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then if grep '\.hidden.*foo' conftest.s >/dev/null 2>&1 ; then if grep '\.protected.*bar' conftest.s >/dev/null 2>&1; then gcry_cv_visibility_attribute=yes fi fi fi ]) if test "$gcry_cv_visibility_attribute" = "yes"; then AC_CACHE_CHECK(for broken visibility attribute, gcry_cv_broken_visibility_attribute, [gcry_cv_broken_visibility_attribute=yes AC_LANG_CONFTEST([AC_LANG_SOURCE( [[int foo (int x); int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden"))); int bar (int x) { return x; } ]])]) if ${CC-cc} -Werror -S conftest.c -o conftest.s \ 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then if grep '\.hidden@<:@ _@:>@foo' conftest.s >/dev/null 2>&1; then gcry_cv_broken_visibility_attribute=no fi fi ]) fi if test "$gcry_cv_visibility_attribute" = "yes"; then AC_CACHE_CHECK(for broken alias attribute, gcry_cv_broken_alias_attribute, [gcry_cv_broken_alias_attribute=yes AC_LANG_CONFTEST([AC_LANG_SOURCE( [[extern int foo (int x) __asm ("xyzzy"); int bar (int x) { return x; } extern __typeof (bar) foo __attribute ((weak, alias ("bar"))); extern int dfoo; extern __typeof (dfoo) dfoo __asm ("abccb"); int dfoo = 1; ]])]) if ${CC-cc} -Werror -S conftest.c -o conftest.s \ 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then if grep 'xyzzy' conftest.s >/dev/null 2>&1 && \ grep 'abccb' conftest.s >/dev/null 2>&1; then gcry_cv_broken_alias_attribute=no fi fi ]) fi if test "$gcry_cv_visibility_attribute" = "yes"; then AC_CACHE_CHECK(if gcc supports -fvisibility=hidden, gcry_cv_gcc_has_f_visibility, [gcry_cv_gcc_has_f_visibility=no _gcc_cflags_save=$CFLAGS CFLAGS="-fvisibility=hidden" AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), gcry_cv_gcc_has_f_visibility=yes) CFLAGS=$_gcc_cflags_save; ]) fi if test "$gcry_cv_visibility_attribute" = "yes" \ && test "$gcry_cv_broken_visibility_attribute" != "yes" \ && test "$gcry_cv_broken_alias_attribute" != "yes" \ && test "$gcry_cv_gcc_has_f_visibility" = "yes" then AC_DEFINE(GCRY_USE_VISIBILITY, 1, [Define to use the GNU C visibility attribute.]) CFLAGS="$CFLAGS -fvisibility=hidden" fi ####################################### #### Checks for library functions. #### ####################################### AC_FUNC_VPRINTF # We have replacements for these in src/missing-string.c AC_CHECK_FUNCS(stpcpy strcasecmp) # We have replacements for these in src/g10lib.h AC_CHECK_FUNCS(strtoul memmove stricmp atexit raise) # Other checks AC_CHECK_FUNCS(strerror rand mmap getpagesize sysconf waitpid wait4) AC_CHECK_FUNCS(gettimeofday getrusage gethrtime clock_gettime syslog) AC_CHECK_FUNCS(fcntl ftruncate) GNUPG_CHECK_MLOCK # # Replacement functions. # AC_REPLACE_FUNCS([getpid clock]) # # Check wether it is necessary to link against libdl. # DL_LIBS="" if test "$use_hmac_binary_check" = yes ; then _gcry_save_libs="$LIBS" LIBS="" AC_SEARCH_LIBS(dlopen, c dl,,,) DL_LIBS=$LIBS LIBS="$_gcry_save_libs" LIBGCRYPT_CONFIG_LIBS="${LIBGCRYPT_CONFIG_LIBS} ${DL_LIBS}" fi AC_SUBST(DL_LIBS) # # Check whether we can use Linux capabilities as requested. # if test "$use_capabilities" = "yes" ; then use_capabilities=no AC_CHECK_HEADERS(sys/capability.h) if test "$ac_cv_header_sys_capability_h" = "yes" ; then AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1) if test "$ac_cv_lib_cap_cap_init" = "yes"; then AC_DEFINE(USE_CAPABILITIES,1, [define if capabilities should be used]) LIBS="$LIBS -lcap" use_capabilities=yes fi fi if test "$use_capabilities" = "no" ; then AC_MSG_WARN([[ *** *** The use of capabilities on this system is not possible. *** You need a recent Linux kernel and some patches: *** fcaps-2.2.9-990610.patch (kernel patch for 2.2.9) *** fcap-module-990613.tar.gz (kernel module) *** libcap-1.92.tar.gz (user mode library and utilities) *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN *** set (filesystems menu). Be warned: This code is *really* ALPHA. ***]]) fi fi # Check whether a random device is available. if test "$try_dev_random" = yes ; then AC_CACHE_CHECK(for random device, ac_cv_have_dev_random, [if test -r "$NAME_OF_DEV_RANDOM" && test -r "$NAME_OF_DEV_URANDOM" ; then ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi]) if test "$ac_cv_have_dev_random" = yes; then AC_DEFINE(HAVE_DEV_RANDOM,1, [defined if the system supports a random device] ) fi else AC_MSG_CHECKING(for random device) ac_cv_have_dev_random=no AC_MSG_RESULT(has been disabled) fi # Figure out the random modules for this configuration. if test "$random" = "default"; then # Select default value. if test "$ac_cv_have_dev_random" = yes; then # Try Linuxish random device. random_modules="linux" else case "${host}" in *-*-mingw32ce*) # WindowsCE random device. random_modules="w32ce" ;; *-*-mingw32*|*-*-cygwin*) # Windows random device. random_modules="w32" ;; *) # Build everything, allow to select at runtime. random_modules="$auto_random_modules" ;; esac fi else if test "$random" = "auto"; then # Build everything, allow to select at runtime. random_modules="$auto_random_modules" else random_modules="$random" fi fi # # Setup assembler stuff. # GNUPG_SYS_SYMBOL_UNDERSCORE() AC_ARG_ENABLE(mpi-path, AC_HELP_STRING([--enable-mpi-path=EXTRA_PATH], [prepend EXTRA_PATH to list of CPU specific optimizations]), mpi_extra_path="$enableval",mpi_extra_path="") AC_MSG_CHECKING(for mpi assembler functions) if test -f $srcdir/mpi/config.links ; then . $srcdir/mpi/config.links AC_CONFIG_LINKS("$mpi_ln_list") ac_cv_mpi_sflags="$mpi_sflags" AC_MSG_RESULT(done) else AC_MSG_RESULT(failed) AC_MSG_ERROR([mpi/config.links missing!]) fi MPI_SFLAGS="$ac_cv_mpi_sflags" AC_SUBST(MPI_SFLAGS) AM_CONDITIONAL(MPI_MOD_ASM_MPIH_ADD1, test "$mpi_mod_asm_mpih_add1" = yes) AM_CONDITIONAL(MPI_MOD_ASM_MPIH_SUB1, test "$mpi_mod_asm_mpih_sub1" = yes) AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL1, test "$mpi_mod_asm_mpih_mul1" = yes) AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL2, test "$mpi_mod_asm_mpih_mul2" = yes) AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL3, test "$mpi_mod_asm_mpih_mul3" = yes) AM_CONDITIONAL(MPI_MOD_ASM_MPIH_LSHIFT, test "$mpi_mod_asm_mpih_lshift" = yes) AM_CONDITIONAL(MPI_MOD_ASM_MPIH_RSHIFT, test "$mpi_mod_asm_mpih_rshift" = yes) AM_CONDITIONAL(MPI_MOD_ASM_UDIV, test "$mpi_mod_asm_udiv" = yes) AM_CONDITIONAL(MPI_MOD_ASM_UDIV_QRNND, test "$mpi_mod_asm_udiv_qrnnd" = yes) AM_CONDITIONAL(MPI_MOD_C_MPIH_ADD1, test "$mpi_mod_c_mpih_add1" = yes) AM_CONDITIONAL(MPI_MOD_C_MPIH_SUB1, test "$mpi_mod_c_mpih_sub1" = yes) AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL1, test "$mpi_mod_c_mpih_mul1" = yes) AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL2, test "$mpi_mod_c_mpih_mul2" = yes) AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL3, test "$mpi_mod_c_mpih_mul3" = yes) AM_CONDITIONAL(MPI_MOD_C_MPIH_LSHIFT, test "$mpi_mod_c_mpih_lshift" = yes) AM_CONDITIONAL(MPI_MOD_C_MPIH_RSHIFT, test "$mpi_mod_c_mpih_rshift" = yes) AM_CONDITIONAL(MPI_MOD_C_UDIV, test "$mpi_mod_c_udiv" = yes) AM_CONDITIONAL(MPI_MOD_C_UDIV_QRNND, test "$mpi_mod_c_udiv_qrnnd" = yes) if test "$is_development_version" = "yes"; then AC_DEFINE(IS_DEVELOPMENT_VERSION,1, [Defined if this is not a regular release]) fi AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes) # This is handy for debugging so the compiler doesn't rearrange # things and eliminate variables. AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], [disable compiler optimization]), [if test $enableval = no ; then CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'` fi]) # CFLAGS mangling when using gcc. if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wall" if test "$USE_MAINTAINER_MODE" = "yes"; then CFLAGS="$CFLAGS -Wcast-align -Wshadow -Wstrict-prototypes" CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security" # If -Wno-missing-field-initializers is supported we can enable a # a bunch of really useful warnings. AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers]) _gcc_cflags_save=$CFLAGS CFLAGS="-Wno-missing-field-initializers" AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no) AC_MSG_RESULT($_gcc_wopt) CFLAGS=$_gcc_cflags_save; if test x"$_gcc_wopt" = xyes ; then CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast" CFLAGS="$CFLAGS -Wwrite-strings" CFLAGS="$CFLAGS -Wdeclaration-after-statement" CFLAGS="$CFLAGS -Wno-missing-field-initializers" CFLAGS="$CFLAGS -Wno-sign-compare" fi AC_MSG_CHECKING([if gcc supports -Wpointer-arith]) _gcc_cflags_save=$CFLAGS CFLAGS="-Wpointer-arith" AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no) AC_MSG_RESULT($_gcc_wopt) CFLAGS=$_gcc_cflags_save; if test x"$_gcc_wopt" = xyes ; then CFLAGS="$CFLAGS -Wpointer-arith" fi - - AC_MSG_CHECKING([if gcc supports -fno-strict-aliasing]) - _gcc_cflags_save=$CFLAGS - CFLAGS="-fno-strict-aliasing" - AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no) - AC_MSG_RESULT($_gcc_wopt) - CFLAGS=$_gcc_cflags_save; - if test x"$_gcc_wopt" = xyes ; then - CFLAGS="$CFLAGS -fno-strict-aliasing" - fi - fi fi # Check whether as(1) supports a noeexecstack feature. This test # includes an override option. CL_AS_NOEXECSTACK AC_SUBST(LIBGCRYPT_CONFIG_API_VERSION) AC_SUBST(LIBGCRYPT_CONFIG_LIBS) AC_SUBST(LIBGCRYPT_CONFIG_CFLAGS) AC_SUBST(LIBGCRYPT_THREAD_MODULES) AC_CONFIG_COMMANDS([gcrypt-conf],[[ chmod +x src/libgcrypt-config ]],[[ prefix=$prefix exec_prefix=$exec_prefix libdir=$libdir datadir=$datadir DATADIRNAME=$DATADIRNAME ]]) ##################### #### Conclusion. #### ##################### # Define conditional sources and config.h symbols depending on the # selected ciphers, pubkey-ciphers, digests and random modules. LIST_MEMBER(arcfour, $enabled_ciphers) if test "$found" = "1"; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS arcfour.lo" AC_DEFINE(USE_ARCFOUR, 1, [Defined if this module should be included]) fi LIST_MEMBER(blowfish, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS blowfish.lo" AC_DEFINE(USE_BLOWFISH, 1, [Defined if this module should be included]) fi LIST_MEMBER(cast5, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS cast5.lo" AC_DEFINE(USE_CAST5, 1, [Defined if this module should be included]) fi LIST_MEMBER(des, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS des.lo" AC_DEFINE(USE_DES, 1, [Defined if this module should be included]) fi LIST_MEMBER(aes, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS rijndael.lo" AC_DEFINE(USE_AES, 1, [Defined if this module should be included]) fi LIST_MEMBER(twofish, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS twofish.lo" AC_DEFINE(USE_TWOFISH, 1, [Defined if this module should be included]) fi LIST_MEMBER(serpent, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS serpent.lo" AC_DEFINE(USE_SERPENT, 1, [Defined if this module should be included]) fi LIST_MEMBER(rfc2268, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS rfc2268.lo" AC_DEFINE(USE_RFC2268, 1, [Defined if this module should be included]) fi LIST_MEMBER(seed, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS seed.lo" AC_DEFINE(USE_SEED, 1, [Defined if this module should be included]) fi LIST_MEMBER(camellia, $enabled_ciphers) if test "$found" = "1" ; then GCRYPT_CIPHERS="$GCRYPT_CIPHERS camellia.lo camellia-glue.lo" AC_DEFINE(USE_CAMELLIA, 1, [Defined if this module should be included]) fi LIST_MEMBER(dsa, $enabled_pubkey_ciphers) if test "$found" = "1" ; then GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS dsa.lo" AC_DEFINE(USE_DSA, 1, [Defined if this module should be included]) fi LIST_MEMBER(rsa, $enabled_pubkey_ciphers) if test "$found" = "1" ; then GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS rsa.lo" AC_DEFINE(USE_RSA, 1, [Defined if this module should be included]) fi LIST_MEMBER(elgamal, $enabled_pubkey_ciphers) if test "$found" = "1" ; then GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS elgamal.lo" AC_DEFINE(USE_ELGAMAL, 1, [Defined if this module should be included]) fi LIST_MEMBER(ecc, $enabled_pubkey_ciphers) if test "$found" = "1" ; then GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS ecc.lo" AC_DEFINE(USE_ECC, 1, [Defined if this module should be included]) fi LIST_MEMBER(crc, $enabled_digests) if test "$found" = "1" ; then GCRYPT_DIGESTS="$GCRYPT_DIGESTS crc.lo" AC_DEFINE(USE_CRC, 1, [Defined if this module should be included]) fi LIST_MEMBER(md4, $enabled_digests) if test "$found" = "1" ; then GCRYPT_DIGESTS="$GCRYPT_DIGESTS md4.lo" AC_DEFINE(USE_MD4, 1, [Defined if this module should be included]) fi LIST_MEMBER(md5, $enabled_digests) if test "$found" = "1" ; then GCRYPT_DIGESTS="$GCRYPT_DIGESTS md5.lo" AC_DEFINE(USE_MD5, 1, [Defined if this module should be included]) fi LIST_MEMBER(sha256, $enabled_digests) if test "$found" = "1" ; then GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha256.lo" AC_DEFINE(USE_SHA256, 1, [Defined if this module should be included]) fi LIST_MEMBER(sha512, $enabled_digests) if test "$found" = "1" ; then GCRYPT_DIGESTS="$GCRYPT_DIGESTS sha512.lo" AC_DEFINE(USE_SHA512, 1, [Defined if this module should be included]) fi LIST_MEMBER(tiger, $enabled_digests) if test "$found" = "1" ; then GCRYPT_DIGESTS="$GCRYPT_DIGESTS tiger.lo" AC_DEFINE(USE_TIGER, 1, [Defined if this module should be included]) fi LIST_MEMBER(whirlpool, $enabled_digests) if test "$found" = "1" ; then GCRYPT_DIGESTS="$GCRYPT_DIGESTS whirlpool.lo" AC_DEFINE(USE_WHIRLPOOL, 1, [Defined if this module should be included]) fi # rmd160 and sha1 should be included always. GCRYPT_DIGESTS="$GCRYPT_DIGESTS rmd160.lo sha1.lo" AC_DEFINE(USE_RMD160, 1, [Defined if this module should be included]) AC_DEFINE(USE_SHA1, 1, [Defined if this module should be included]) LIST_MEMBER(linux, $random_modules) if test "$found" = "1" ; then GCRYPT_RANDOM="$GCRYPT_RANDOM rndlinux.lo" AC_DEFINE(USE_RNDLINUX, 1, [Defined if the /dev/random RNG should be used.]) fi LIST_MEMBER(unix, $random_modules) if test "$found" = "1" ; then GCRYPT_RANDOM="$GCRYPT_RANDOM rndunix.lo" AC_DEFINE(USE_RNDUNIX, 1, [Defined if the default Unix RNG should be used.]) print_egd_notice=yes fi LIST_MEMBER(egd, $random_modules) if test "$found" = "1" ; then GCRYPT_RANDOM="$GCRYPT_RANDOM rndegd.lo" AC_DEFINE(USE_RNDEGD, 1, [Defined if the EGD based RNG should be used.]) fi LIST_MEMBER(w32, $random_modules) if test "$found" = "1" ; then GCRYPT_RANDOM="$GCRYPT_RANDOM rndw32.lo" AC_DEFINE(USE_RNDW32, 1, [Defined if the Windows specific RNG should be used.]) fi LIST_MEMBER(w32ce, $random_modules) if test "$found" = "1" ; then GCRYPT_RANDOM="$GCRYPT_RANDOM rndw32ce.lo" AC_DEFINE(USE_RNDW32CE, 1, [Defined if the WindowsCE specific RNG should be used.]) fi AC_SUBST([GCRYPT_CIPHERS]) AC_SUBST([GCRYPT_PUBKEY_CIPHERS]) AC_SUBST([GCRYPT_DIGESTS]) AC_SUBST([GCRYPT_RANDOM]) AC_SUBST(LIBGCRYPT_CIPHERS, $enabled_ciphers) AC_SUBST(LIBGCRYPT_PUBKEY_CIPHERS, $enabled_pubkey_ciphers) AC_SUBST(LIBGCRYPT_DIGESTS, $enabled_digests) # For printing the configuration we need a colon separated list of # algorithm names. tmp=`echo "$enabled_ciphers" | tr ' ' : ` AC_DEFINE_UNQUOTED(LIBGCRYPT_CIPHERS, "$tmp", [List of available cipher algorithms]) tmp=`echo "$enabled_pubkey_ciphers" | tr ' ' : ` AC_DEFINE_UNQUOTED(LIBGCRYPT_PUBKEY_CIPHERS, "$tmp", [List of available public key cipher algorithms]) tmp=`echo "$enabled_digests" | tr ' ' : ` AC_DEFINE_UNQUOTED(LIBGCRYPT_DIGESTS, "$tmp", [List of available digest algorithms]) # Generate extended version information for W32. if test "$have_w32_system" = yes; then BUILD_TIMESTAMP=`date --iso-8601=minutes` changequote(,)dnl BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` changequote([,])dnl BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}" fi AC_SUBST(BUILD_REVISION) AC_SUBST(BUILD_TIMESTAMP) AC_SUBST(BUILD_FILEVERSION) AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION", [Subversion revision used to build this package]) # Substitutions to set generated files in a Emacs buffer to read-only. AC_SUBST(emacs_local_vars_begin, ['Local Variables:']) AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t']) AC_SUBST(emacs_local_vars_end, ['End:']) # And create the files. AC_CONFIG_FILES([ Makefile m4/Makefile compat/Makefile mpi/Makefile cipher/Makefile random/Makefile doc/Makefile src/Makefile src/gcrypt.h src/libgcrypt-config src/versioninfo.rc tests/Makefile ]) AC_OUTPUT # Give some feedback echo " Libgcrypt v${VERSION} has been configured as follows: Platform: $PRINTABLE_OS_NAME ($host) Enabled cipher algorithms: $enabled_ciphers Enabled digest algorithms: $enabled_digests Enabled pubkey algorithms: $enabled_pubkey_ciphers Random number generator: $random Using linux capabilities: $use_capabilities + Try using Padlock crypto: $padlocksupport + Try using AES-NI crypto: $aesnisupport " if test "$print_egd_notice" = "yes"; then cat <