Merge with latest beecrypt-3.0.0, dump types.h.
authorjbj <devnull@localhost>
Sat, 17 May 2003 17:47:23 +0000 (17:47 +0000)
committerjbj <devnull@localhost>
Sat, 17 May 2003 17:47:23 +0000 (17:47 +0000)
CVS patchset: 6854
CVS date: 2003/05/17 17:47:23

28 files changed:
beecrypt/.cvsignore
beecrypt/CONTRIBUTORS
beecrypt/Makefile.am
beecrypt/acinclude.m4
beecrypt/beecrypt.gnu.h.in
beecrypt/beecrypt.h
beecrypt/configure.ac
beecrypt/endianness.h
beecrypt/gas/m68k.m4
beecrypt/gas/mpopt.s390x.m4
beecrypt/md5.h
beecrypt/memchunk.c
beecrypt/memchunk.h
beecrypt/mp.h
beecrypt/mpnumber.h
beecrypt/mpopt.h
beecrypt/sha1.c
beecrypt/sha1.h
beecrypt/sha256.c
beecrypt/sha256.h
beecrypt/system.h
beecrypt/tests/testhmacmd5.c
beecrypt/tests/testhmacsha1.c
beecrypt/tests/testmd5.c
beecrypt/tests/testmp.c
beecrypt/tests/testsha1.c
beecrypt/tests/testsha256.c
beecrypt/types.h.in [deleted file]

index 9c1c678..8117d62 100644 (file)
@@ -10,6 +10,7 @@ missing
 mkinstalldirs
 apidocs
 autom4te*
+beecrypt.gnu.h
 beecrypt.spec
 beecrypt-*.tar.gz
 config.h
@@ -38,4 +39,3 @@ sha1opt.c
 stamp-h
 stamp-h1
 stamp-h.in
-types.h
index 250bd53..6a9cee9 100644 (file)
@@ -1,13 +1,18 @@
-I would like to thank the following contributors to BeeCrypt:
+I would like to thank the following people (in alphabetical order):
 
-- ARM Ltd, for donating a copy of the "ARM Architecture Reference Manual".
-- Compaq, for their testdrive program, which gave me the opportunity to test many new platforms.
-- SourceForge, for their excellent open source development platform, including their compile farm.
-- Luca Filipozzi, for packaging BeeCrypt for the Debian GNU/Linux distribution.
+- Jan-Rudolph Bührmann, for helping me get started on the 64-bit multi-
+  precision integer library.
+- Luca Filipozzi, maintainer/packager of BeeCrypt for Debian GNU/Linux.
+- Jeff Johnson, the guy behind RedHat's Package Manager, who has inspired
+  and contributed to many of the changes for version 3.0.0; 73 de Bob.
+- Jon Sturgeon, bug hunter extraordinaire.
 
-Active developers on SourceForge:
-- Jan-Rudolph Bührmann
+Further thanks go to:
+- AMD, for donating a copy of "AMD x86-64 Architecture Programmer's Manual".
+- ARM Ltd, for donating a copy of "ARM Architecture Reference Manual".
+- HP/Compaq, for their testdrive program, which gave me the opportunity to
+  test and BeeCrypt on many new platforms.
+- SourceForge, for their excellent open source development platform!
 
-And last but not least:
-- Jon Sturgeon, bug hunter extraordinaire.
-- Jeff Johnson, author of the RedHat Package Manager.
+Last but not least: thanks to everyone who provided bits of information,
+reported bugs and provided feedback.
index fe9d3ce..88f1a44 100644 (file)
@@ -58,12 +58,12 @@ libbeecrypt_la_LIBADD = aesopt.lo blowfishopt.lo mpopt.lo sha1opt.lo
 
 libbeecrypt_la_LDFLAGS = -version-info $(LIBBEECRYPT_LT_CURRENT):$(LIBBEECRYPT_LT_REVISION):$(LIBBEECRYPT_LT_AGE)
 
-pkginclude_HEADERS = aes.h base64.h beecrypt.h blockmode.h blockpad.h blowfish.h dhaes.h dldp.h dlkp.h dlpk.h dlsvdp-dh.h dsa.h elgamal.h endianness.h entropy.h fips186.h hmac.h hmacmd5.h hmacsha1.h hmacsha256.h md5.h memchunk.h mp.h mpbarrett.h mpnumber.h mpprime.h mtprng.h rsa.h rsakp.h rsapk.h sha1.h sha256.h timestamp.h
+pkginclude_HEADERS = aes.h base64.h beecrypt.h beecrypt.api.h beecrypt.gnu.h blockmode.h blockpad.h blowfish.h dhaes.h dldp.h dlkp.h dlpk.h dlsvdp-dh.h dsa.h elgamal.h endianness.h entropy.h fips186.h hmac.h hmacmd5.h hmacsha1.h hmacsha256.h md5.h memchunk.h mp.h mpbarrett.h mpnumber.h mpprime.h mtprng.h rsa.h rsakp.h rsapk.h sha1.h sha256.h timestamp.h
 
-noinst_HEADERS = aesopt.h beecrypt.api.h beecrypt.win.h \
+noinst_HEADERS = aesopt.h beecrypt.win.h \
        blowfishopt.h debug.h mpopt.h sha1opt.h system.h
 
-EXTRA_DIST = BENCHMARKS BUGS CONTRIBUTORS Doxyfile.in Doxyheader README README.DARWIN README.DLL README.WIN32 beecrypt.def beecrypt.rc beecrypt.spec types.h javaglue.h installgen.sh
+EXTRA_DIST = BENCHMARKS BUGS CONTRIBUTORS Doxyfile.in Doxyheader README README.DARWIN README.DLL README.WIN32 autogen.sh beecrypt.def beecrypt.gnu.h.in beecrypt.rc beecrypt.spec javaglue.h
 
 .PHONY: beetest
 beetest: all
index 2b8e732..48a5cf2 100644 (file)
@@ -10,93 +10,109 @@ dnl  LGPL
 
 dnl  BEECRYPT_INT_TYPES
 AC_DEFUN(BEECRYPT_INT_TYPES,[
+  AC_TYPE_SIZE_T
+  if test $ac_cv_header_inttypes_h = yes; then
+    AC_SUBST(INCLUDE_INTTYPES_H,["#include <inttypes.h>"])
+  else
+    AC_SUBST(INCLUDE_INTTYPES_H,[ ])
+  fi
+  if test $ac_cv_header_stdint_h = yes; then
+    AC_SUBST(INCLUDE_STDINT_H,["#include <stdint.h>"])
+  else
+    AC_SUBST(INCLUDE_STDINT_H,[ ])
+  fi
   AH_TEMPLATE([HAVE_INT64_T])
   AH_TEMPLATE([HAVE_UINT64_T])
+  bc_typedef_int8_t=
   AC_CHECK_TYPE([int8_t],,[
-    # Candidates are [char]
-    AC_CHECK_SIZEOF([char])
-    if test $ac_cv_sizeof_char -eq 1; then
-      AC_DEFINE_UNQUOTED([int8_t],[char],[If not already defined, define as a signed integer of 8 bits])
+    AC_CHECK_SIZEOF([signed char])
+    if test $ac_cv_sizeof_signed_char -eq 1; then
+      bc_typedef_int8_t="typedef signed char int8_t;"
     fi
     ])
+  AC_SUBST(TYPEDEF_INT8_T,$bc_typedef_int8_t)
+  bc_typedef_int16_t=
   AC_CHECK_TYPE([int16_t],,[
-    # Candidates are [short]
     AC_CHECK_SIZEOF([short])
     if test $ac_cv_sizeof_short -eq 2; then
-      AC_DEFINE_UNQUOTED([int16_t],[short],[If not already defined, define as a signed integer of exactly 16 bits])
+      bc_typedef_int16_t="typedef short int16_t;"
     fi
     ])
+  AC_SUBST(TYPEDEF_INT16_T,$bc_typedef_int16_t)
+  bc_typedef_int32_t=
   AC_CHECK_TYPE([int32_t],,[
-    # Candidates are [int]
     AC_CHECK_SIZEOF([int])
     if test $ac_cv_sizeof_int -eq 4; then
-      AC_DEFINE_UNQUOTED([int32_t],[int],[If not already defined, define as a signed integer of exactly 32 bits])
+      bc_typedef_int32_t="typedef int int32_t;"
     fi
     ])
+  AC_SUBST(TYPEDEF_INT32_T,$bc_typedef_int32_t)
+  bc_typedef_int64_t=
   AC_CHECK_TYPE([int64_t],[
     AC_DEFINE([HAVE_INT64_T],1)
     ],[
-    # Candidates are [long] and [long long]
     AC_CHECK_SIZEOF([long])
     if test $ac_cv_sizeof_long -eq 8; then
-      AC_DEFINE_UNQUOTED([int64_t],[long],[If not already defined, define as a signed integer of exactly 64 bits])
+      bc_typedef_int64_t="typedef long int64_t;"
     else
       AC_CHECK_SIZEOF([long long])
       if test $ac_cv_sizeof_long_long -eq 8; then
-        AC_DEFINE_UNQUOTED([int64_t],[long long],[If not already defined, define as a signed integer of exactly 64 bits])
         AC_DEFINE([HAVE_INT64_T],1)
+        bc_typedef_int64_t="typedef long long int64_t;"
       fi
     fi
     ])
+  AC_SUBST(TYPEDEF_INT64_T,$bc_typedef_int64_t)
+  bc_typedef_uint8_t=
   AC_CHECK_TYPE([uint8_t],,[
-    # Candidates are [unsigned char]
     AC_CHECK_SIZEOF([unsigned char])
     if test $ac_cv_sizeof_unsigned_char -eq 1; then
-      AC_DEFINE_UNQUOTED([uint8_t],[unsigned char],[If not already defined, define as an unsigned integer of 8 bits])
+      bc_typedef_uint8_t="typedef unsigned char uint8_t;"
     fi
     ])
+  AC_SUBST(TYPEDEF_UINT8_T,$bc_typedef_uint8_t)
+  bc_typedef_uint16_t=
   AC_CHECK_TYPE([uint16_t],,[
-    # Candidates are [unsigned short]
     AC_CHECK_SIZEOF([unsigned short])
     if test $ac_cv_sizeof_unsigned_short -eq 2; then
-      AC_DEFINE_UNQUOTED([uint16_t],[unsigned short],[If not already defined, define as an unsigned integer of exactly 16 bits])
+      bc_typedef_uint16_t="typedef unsigned short uint16_t;"
     fi
     ])
+  AC_SUBST(TYPEDEF_UINT16_T,$bc_typedef_uint16_t)
+  bc_typedef_uint32_t=
   AC_CHECK_TYPE([uint32_t],,[
-    # Candidates are [unsigned int]
     AC_CHECK_SIZEOF([unsigned int])
     if test $ac_cv_sizeof_unsigned_int -eq 4; then
-      AC_DEFINE_UNQUOTED([uint32_t],[unsigned int],[If not already defined, define as an unsigned integer of exactly 32 bits])
+      bc_typedef_uint32_t="typedef unsigned int uint32_t;"
     fi
     ])
+  AC_SUBST(TYPEDEF_UINT32_T,$bc_typedef_uint32_t)
+  bc_typedef_uint64_t=
   AC_CHECK_TYPE([uint64_t],[
     AC_DEFINE([HAVE_UINT64_T],1)
     ],[
-    # Candidates are [unsigned long] and [unsigned long long]
     AC_CHECK_SIZEOF([unsigned long])
     if test $ac_cv_sizeof_unsigned_long -eq 8; then
-      AC_DEFINE_UNQUOTED([uint64_t],[unsigned long],[If not already defined, define as an unsigned integer of exactly 64 bits])
+      bc_typedef_uint64_t="typedef unsigned long uint64_t;"
     else
       AC_CHECK_SIZEOF([unsigned long long])
       if test $ac_cv_sizeof_unsigned_long_long -eq 8; then
-        AC_DEFINE_UNQUOTED([uint64_t],[unsigned long long],[If not already defined, define as an unsigned integer of exactly 64 bits])
         AC_DEFINE([HAVE_UINT64_T],1)
+        bc_typedef_uint64_t="typedef unsigned long long uint64_t;"
       fi
     fi
     ])
+  AC_SUBST(TYPEDEF_UINT64_T,$bc_typedef_uint64_t)
   ])
 
 
 dnl  BEECRYPT_CPU_BITS
 AC_DEFUN(BEECRYPT_CPU_BITS,[
-  AH_TEMPLATE([MP_WBITS],[Define to the word size of your CPU, i.e. 32 or 64])
   AC_CHECK_SIZEOF([unsigned long])
   if test $ac_cv_sizeof_unsigned_long -eq 8; then
-    mp_wbits="64U"
-    AC_SUBST(MP_WBITS,$mp_wbits)
+    AC_SUBST(MP_WBITS,64U)
   elif test $ac_cv_sizeof_unsigned_long -eq 4; then
-    mp_wbits="32U"
-    AC_SUBST(MP_WBITS,$mp_wbits)
+    AC_SUBST(MP_WBITS,32U)
   else
     AC_MSG_ERROR([Illegal CPU word size])
   fi
@@ -587,6 +603,11 @@ AC_DEFUN(BEECRYPT_ASM_SOURCES,[
       m4 $srcdir/gas/mpopt.ppc64.m4 > mpopt.s
       ])
     ;;
+  s390x)
+    AC_CONFIG_COMMANDS([mpopt.s390x],[
+      m4 $srcdir/gas/mpopt.s390x.m4 > mpopt.s
+      ])
+    ;;
   sparcv8)
     AC_CONFIG_COMMANDS([mpopt.sparcv8],[
       m4 $srcdir/gas/mpopt.sparcv8.m4 > mpopt.s
index 4ef622f..b09a68a 100644 (file)
-/* beecrypt.gnu.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if you are using AIX */
-#undef AIX
-
-/* Define to 1 if you are using Cygwin */
-#undef CYGWIN
-
-/* Define to 1 if you are using Darwin/MacOS X */
-#undef DARWIN
-
-/* Define to 1 if you want to enable asynchronous I/O support */
-#undef ENABLE_AIO
-
-/* Define to 1 if you want to enable multithread support */
-#undef ENABLE_THREADS
-
-/* Define to 1 if you are using FreeBSD */
-#undef FREEBSD
-
-/* Define to 1 if you have the <aio.h> header file. */
-#undef HAVE_AIO_H
-
-/* Define to 1 if you have the <ctype.h> header file. */
-#undef HAVE_CTYPE_H
-
-/* Define to 1 if your system has device /dev/audio */
-#undef HAVE_DEV_AUDIO
-
-/* Define to 1 if your system has device /dev/dsp */
-#undef HAVE_DEV_DSP
-
-/* Define to 1 if your system has device /dev/random */
-#undef HAVE_DEV_RANDOM
-
-/* Define to 1 if your system has device /dev/tty */
-#undef HAVE_DEV_TTY
-
-/* Define to 1 if your system has device /dev/urandom */
-#undef HAVE_DEV_URANDOM
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <errno.h> header file. */
-#undef HAVE_ERRNO_H
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define to 1 if you have the `gethrtime' function. */
-#undef HAVE_GETHRTIME
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#undef HAVE_GETTIMEOFDAY
-
-/* */
-#undef HAVE_INT64_T
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `mtmalloc' library (-lmtmalloc). */
-#undef HAVE_LIBMTMALLOC
-
-/* Define to 1 if you have the `winmm' library (-lwinmm). */
-#undef HAVE_LIBWINMM
-
-/* Define to 1 if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
-
-/* Define to 1 if you have the `memcmp' function. */
-#undef HAVE_MEMCMP
-
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
-
-/* Define to 1 if you have the <mtmalloc.h> header file. */
-#undef HAVE_MTMALLOC_H
-
-/* Define to 1 if you have the <pthread.h> header file. */
-#undef HAVE_PTHREAD_H
-
-/* Define to 1 if you have the <semaphore.h> header file. */
-#undef HAVE_SEMAPHORE_H
-
-/* Define to 1 if `stat' has the bug that it succeeds when given the
-   zero-length file name argument. */
-#undef HAVE_STAT_EMPTY_STRING_BUG
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* . */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the `strcspn' function. */
-#undef HAVE_STRCSPN
-
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* . */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `strspn' function. */
-#undef HAVE_STRSPN
-
-/* Define to 1 if you have the <synch.h> header file. */
-#undef HAVE_SYNCH_H
-
-/* Define to 1 if you have the <sys/audioio.h> header file. */
-#undef HAVE_SYS_AUDIOIO_H
-
-/* Define to 1 if you have the <sys/ioctl> header file. */
-#undef HAVE_SYS_IOCTL
-
-/* . */
-#undef HAVE_SYS_IOCTL_H
-
-/* Define to 1 if you have the <sys/soundcard.h> header file. */
-#undef HAVE_SYS_SOUNDCARD_H
-
-/* . */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* . */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <termios.h> header file. */
-#undef HAVE_TERMIOS_H
-
-/* Define to 1 if you have the <termio.h> header file. */
-#undef HAVE_TERMIO_H
-
-/* Define to 1 if you have the <thread.h> header file. */
-#undef HAVE_THREAD_H
-
-/* Define to 1 if you have the <time.h> header file. */
-#undef HAVE_TIME_H
-
-/* */
-#undef HAVE_UINT64_T
-
-/* . */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if you are using HPUX */
-#undef HPUX
-
-/* Define to 1 if you want to include the Java code */
-#undef JAVAGLUE
-
-/* Define to 1 if you are using GNU/Linux */
-#undef LINUX
-
-/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
-   slash. */
-#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
-
-/* Define to the word size of your CPU */
-#undef MP_WBITS
-
-/* Define to 1 if you are using NetBSD */
-#undef NETBSD
-
-/* Define to 1 if you are using OpenBSD */
-#undef OPENBSD
-
-/* Define to 1 if you are using OSF */
-#undef OSF
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you are using QNX */
-#undef QNX
-
-/* Define to 1 if you are using SCO Unix */
-#undef SCO_UNIX
-
-/* The size of a `char', as computed by sizeof. */
-#undef SIZEOF_CHAR
-
-/* The size of a `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
-/* The size of a `long', as computed by sizeof. */
-#undef SIZEOF_LONG
-
-/* The size of a `long long', as computed by sizeof. */
-#undef SIZEOF_LONG_LONG
-
-/* The size of a `short', as computed by sizeof. */
-#undef SIZEOF_SHORT
-
-/* The size of a `unsigned char', as computed by sizeof. */
-#undef SIZEOF_UNSIGNED_CHAR
-
-/* The size of a `unsigned int', as computed by sizeof. */
-#undef SIZEOF_UNSIGNED_INT
-
-/* The size of a `unsigned long', as computed by sizeof. */
-#undef SIZEOF_UNSIGNED_LONG
-
-/* The size of a `unsigned long long', as computed by sizeof. */
-#undef SIZEOF_UNSIGNED_LONG_LONG
-
-/* The size of a `unsigned short', as computed by sizeof. */
-#undef SIZEOF_UNSIGNED_SHORT
-
-/* Define to 1 if you are using Solaris */
-#undef SOLARIS
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Version number of package */
-#undef VERSION
-
-
-#ifndef WIN32
-#undef WIN32
+/*
+ * Copyright (c) 2003 Bob Deblier
+ *
+ * This library 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.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef _BEECRYPT_GNU_H
+#define _BEECRYPT_GNU_H
+
+@INCLUDE_INTTYPES_H@
+@INCLUDE_STDINT_H@
+@INCLUDE_SYNCH_H@
+@INCLUDE_PTHREAD_H@
+
+@TYPEDEF_BC_LOCK_T@
+
+@TYPEDEF_INT8_T@
+@TYPEDEF_INT16_T@
+@TYPEDEF_INT32_T@
+@TYPEDEF_INT64_T@
+
+@TYPEDEF_UINT8_T@
+@TYPEDEF_UINT16_T@
+@TYPEDEF_UINT32_T@
+@TYPEDEF_UINT64_T@
+
+#if !defined(MP_WBITS) /* dangerous; some assembler routines make assumptions */
+# define MP_WBITS      @MP_WBITS@
 #endif
 
-
-/* Define to 1 if your processor stores words with the most significant byte
-   first (like Motorola and SPARC, unlike Intel and VAX). */
-#undef WORDS_BIGENDIAN
-
-/* Define to 1 if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
 #endif
-
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
-
-/* Define as `__inline' if that's what the C compiler calls it, or to nothing
-   if it is not supported. */
-#undef inline
-
-/* If not already defined, define as a signed integer of exactly 16 bits */
-#undef int16_t
-
-/* If not already defined, define as a signed integer of exactly 32 bits */
-#undef int32_t
-
-/* If not already defined, define as a signed integer of exactly 64 bits */
-#undef int64_t
-
-/* If not already defined, define as a signed integer of 8 bits */
-#undef int8_t
-
-/* Define to `unsigned' if <sys/types.h> does not define. */
-#undef size_t
-
-/* If not already defined, define as an unsigned integer of exactly 16 bits */
-#undef uint16_t
-
-/* If not already defined, define as an unsigned integer of exactly 32 bits */
-#undef uint32_t
-
-/* If not already defined, define as an unsigned integer of exactly 64 bits */
-#undef uint64_t
-
-/* If not already defined, define as an unsigned integer of 8 bits */
-#undef uint8_t
-
-
-#if ENABLE_THREADS
-# ifndef _REENTRANT
-#  define _REENTRANT
-# endif
-# if LINUX
-#  define _LIBC_REENTRANT
-# endif
-#else
-# ifdef _REENTRANT
-#  undef _REENTRANT
-# endif
-#endif
-
index 92f0f52..e7f0bae 100644 (file)
@@ -30,7 +30,7 @@
 #ifndef _BEECRYPT_H
 #define _BEECRYPT_H
 
-#include "types.h"
+#include "beecrypt.api.h"
 
 #include "memchunk.h"
 #include "mpnumber.h"
index 2ade73b..3f6f75a 100644 (file)
@@ -358,35 +358,29 @@ if test "$ac_with_mtmalloc" = yes; then
 fi
 
 # Checks for libraries.
-# XXX Insert "typedef foo bc_lock_t" into types.h.
-include_pthread_h=
-typedef_bc_lock_t=
+bc_include_synch_h=
+bc_include_pthread_h=
+bc_typedef_bc_lock_t=
 if test "$ac_enable_threads" = yes; then
-  if test "$ac_cv_header_thread_h" = yes; then
+  if test "$ac_cv_header_thread_h" = yes -a "$ac_cv_header_synch_h" = yes; then
     AC_SEARCH_LIBS([mutex_lock],[thread],[
       AC_DEFINE([ENABLE_THREADS],1)
-      if test "$ac_cv_header_sync_h" = yes; then
-       include_pthread_h='#include <sync.h>'
-       typedef_bc_lock_t='typedef mutex_t bc_lock_t;'
-      else
-       include_pthread_h='#include <pthread.h>'
-       typedef_bc_lock_t='typedef pthread_mutex_t bc_lock_t;'
-      fi
+      bc_include_synch_h="#include <sync.h>"
+      bc_typedef_bc_lock_t="typedef pthread_mutex_t bc_lock_t;"
       ])
   elif test "$ac_cv_header_pthread_h" = yes; then
     AC_SEARCH_LIBS([pthread_mutex_lock],[pthread],[
       AC_DEFINE([ENABLE_THREADS],1)
-      if test "$ac_cv_header_pthread_h" = yes; then
-       include_pthread_h='#include <pthread.h>'
-       typedef_bc_lock_t='typedef pthread_mutex_t bc_lock_t;'
-      fi
+      bc_include_pthread_h="#include <pthread.h>"
+      bc_typedef_bc_lock_t="typedef pthread_mutex_t bc_lock_t;"
       ])
   else
     AC_MSG_WARN([Don't know which thread library to check for])
   fi
 fi
-AC_SUBST(include_pthread_h)
-AC_SUBST(typedef_bc_lock_t)
+AC_SUBST(INCLUDE_SYNCH_H, $bc_include_synch_h)
+AC_SUBST(INCLUDE_PTHREAD_H, $bc_include_pthread_h)
+AC_SUBST(TYPEDEF_BC_LOCK_T, $bc_typedef_bc_lock_t)
 
 if test "$ac_enable_aio" = yes; then
   BEECRYPT_WORKING_AIO
@@ -637,30 +631,9 @@ else
 fi
 
 # Check for standard types and integers of specific sizes
-AC_TYPE_SIZE_T
 BEECRYPT_INT_TYPES
 BEECRYPT_CPU_BITS
 
-# XXX Insert correct stdint includes into types.h.
-include_stdint_h=
-if test "$ac_cv_header_stdint_h" = yes; then
-  include_stdint_h='#include <stdint.h>'
-elif test "$ac_cv_header_inttypes_h" = yes; then
-  include_stdint_h='#include <inttypes.h>'
-else
-  include_stdint_h='
-typedef signed char            int8_t;\
-typedef short int              int16_t;\
-typedef int                    int32_t;\
-typedef long long int          int64_t;\
-typedef unsigned char          uint8_t;\
-typedef unsigned short int     uint16_t;\
-typedef unsigned int           uint32_t;\
-typedef unsigned long long int uint64_t;\
-'
-fi
-AC_SUBST(include_stdint_h)
-
 if test "$ac_with_javaglue" = yes ; then
   CFLAGS="$CFLAGS -I$ac_cv_java_include"
   case $target_os in
@@ -690,8 +663,8 @@ fi
 # Generate output files.
 AC_CONFIG_FILES([Makefile
                  Doxyfile
+                 beecrypt.gnu.h
                  config.m4
-                 types.h
                  docs/Makefile
                  gas/Makefile
                  masm/Makefile
index d4289a6..1fa2418 100644 (file)
@@ -51,17 +51,10 @@ inline int32_t swap32(int32_t n)
 
 inline uint32_t swapu32(uint32_t n)
 {
-       #if (SIZEOF_UNSIGNED_LONG == 4)
        return (    ((n & 0xffU) << 24) |
                                ((n & 0xff00U) << 8) |
                                ((n & 0xff0000U) >> 8) |
                                ((n & 0xff000000U) >> 24) );
-       #else
-       return (    ((n & 0xffUL) << 24) |
-                               ((n & 0xff00UL) << 8) |
-                               ((n & 0xff0000UL) >> 8) |
-                               ((n & 0xff000000UL) >> 24) );
-       #endif
 }
 
 inline int64_t swap64(int64_t n)
index 1c6bb6e..ad92678 100644 (file)
@@ -1,3 +1,23 @@
+dnl  m68k.m4
+dnl
+dnl  Copyright (c) 2003 Bob Deblier
+dnl 
+dnl  Author: Bob Deblier <bob.deblier@pandora.be>
+dnl 
+dnl  This library is free software; you can redistribute it and/or
+dnl  modify it under the terms of the GNU Lesser General Public
+dnl  License as published by the Free Software Foundation; either
+dnl  version 2.1 of the License, or (at your option) any later version.
+dnl 
+dnl  This library is distributed in the hope that it will be useful,
+dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl  Lesser General Public License for more details.
+dnl 
+dnl  You should have received a copy of the GNU Lesser General Public
+dnl  License along with this library; if not, write to the Free Software
+dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ifelse(REGISTERS_NEED_PERCENT,yes,`
 define(d0,%d0)
 define(d1,%d1)
index bb1e934..c80380e 100644 (file)
@@ -21,19 +21,34 @@ dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 include(config.m4) 
 
 
-divert(-1)
-dnl r2 contains count -> move elsewhere; return register = carry
-dnl r3 contains result
-dnl r4 contains data
-dnl r5 contains multiplier
-dnl r6 index; start value = (count << 3) - 8
-dnl r7 zero register
-dnl r0,r1 free for computations
-C_FUNCTION_BEGIN(mpaddmul)
+C_FUNCTION_BEGIN(mpsetmul)
        stmg %r6,%r7,48(%r15)
        sllg %r6,%r2,3
+       aghi %r6,-8
+       xgr %r2,%r2
        xgr %r7,%r7
+
+LOCAL(mpsetmul_loop):
+       lgr %r1,%r5
+       mlg %r0,0(%r4,%r6)
+       algr %r1,%r2
+       alcgr %r0,%r7
+       stg %r1,0(%r3,%r6)
+       lgr %r2,%r0
+       aghi %r6,-8
+       jhe LOCAL(mpsetmul_loop)
+
+       lmg %r6,%r7,48(%r15)
+       br %r14
+C_FUNCTION_END(mpsetmul)
+
+
+C_FUNCTION_BEGIN(mpaddmul)
+       stmg %r6,%r7,48(%r15)
+       sllg %r6,%r2,3
+       aghi %r6,-8
        xgr %r2,%r2
+       xgr %r7,%r7
        
 LOCAL(mpaddmul_loop):
        lgr %r1,%r5
@@ -45,8 +60,40 @@ LOCAL(mpaddmul_loop):
        stg %r1,0(%r3,%r6)
        lgr %r2,%r0
        aghi %r6,-8
-       jle LOCAL(mpaddmul_loop)
+       jhe LOCAL(mpaddmul_loop)
+
        lmg %r6,%r7,48(%r15)
        br %r14
 C_FUNCTION_END(mpaddmul)
+
+
+divert(-1)
+dnl function fails; illegal instruction on mlgr
+dnl I've tried many alternative, but nothing seems to work so far
+C_FUNCTION_BEGIN(mpaddsqrtrc)
+       stmg %r6,%r7,48(%r15)
+       sllg %r5,%r2,3
+       sllg %r6,%r2,4
+       aghi %r5,-8
+       aghi %r6,-16
+       xgr %r2,%r2
+       xgr %r7,%r7
+
+LOCAL(mpaddsqrtrc_loop):
+       lg %r1,0(%r4,%r5)
+       mlgr %r1,%r1
+       algr %r1,%r2
+       alcgr %r0,%r7
+       xgr %r2,%r2
+       alg %r1,8(%r3,%r6)
+       alcg %r0,0(%r3,%r6)
+       alcgr %r2,%r7
+       stg %r1,8(%r3,%r6)
+       stg %r0,0(%r3,%r6)
+       aghi %r5,-8
+       jhe LOCAL(mpaddsqrtrc_loop)
+
+       lmg %r6,%r7,48(%r15)
+       br %r14
+C_FUNCTION_END(mpaddsqrtrc)
 divert(0)
index fd3d005..0baebd2 100644 (file)
@@ -67,7 +67,7 @@ void md5Process(md5Param* mp)
 /** \ingroup HASH_md5_m
  * This function resets the parameter block so that it's ready for a new hash.
  * @param mp           hash parameter block
- * @return             0 on success.
+ * @return             0 on success
  */
 /*@-exportlocal@*/
 BEECRYPTAPI
@@ -93,7 +93,7 @@ int md5Update  (md5Param* mp, const byte* data, size_t size)
  * value in \a digest.
  * @param sp           hash parameter block
  * @retval *digest     16 byte MD5 digest
- * @return             0 on success.
+ * @return             0 on success
  */
 /*@-exportlocal@*/
 BEECRYPTAPI
index 59fa2ee..3239ebc 100644 (file)
@@ -28,7 +28,7 @@
 #include "debug.h"
 
 /*@-compdef@*/ /* tmp->data is undefined */
-memchunk* memchunkAlloc(int size)
+memchunk* memchunkAlloc(size_t size)
 {
        memchunk* tmp = (memchunk*) calloc(1, sizeof(*tmp));
 
@@ -65,7 +65,7 @@ void memchunkFree(memchunk* m)
        }
 }
 
-memchunk* memchunkResize(memchunk* m, int size)
+memchunk* memchunkResize(memchunk* m, size_t size)
 {
        /*@-branchstate@*/
        if (m)
index 67fd56b..86f6683 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef _MEMCHUNK_H
 #define _MEMCHUNK_H
 
-#include "types.h"
+#include "beecrypt.api.h"
 
 typedef struct
 {
@@ -39,7 +39,7 @@ extern "C" {
 /**
  */
 BEECRYPTAPI /*@only@*/ /*@null@*/
-memchunk* memchunkAlloc(int size)
+memchunk* memchunkAlloc(size_t size)
        /*@*/;
 
 /**
@@ -51,7 +51,7 @@ BEECRYPTAPI
 /**
  */
 BEECRYPTAPI /*@only@*/ /*@null@*/
-memchunk* memchunkResize(/*@only@*/ /*@null@*/memchunk* m, int size)
+memchunk* memchunkResize(/*@only@*/ /*@null@*/memchunk* m, size_t size)
        /*@*/;
 
 /**
index 3136f23..7f878e4 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef _MP_H
 #define _MP_H
 
-#include "beecrypt.h"
+#include "beecrypt.api.h"
 #include "mpopt.h"
 
 #define MP_HWBITS      (MP_WBITS >> 1)
index 61f57fb..9fe41dd 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef _MPNUMBER_H
 #define _MPNUMBER_H
 
-#include "types.h"
+#include "mp.h"
 
 /**
  */
index 3fb64de..3e43b18 100644 (file)
 #  define ASM_MPADDMUL
 #  define ASM_MPADDSQRTRC
 # elif defined(OPTIMIZE_S390X)
+#  define ASM_MPSETMUL
+#  define ASM_MPADDMUL
 # elif defined(OPTIMIZE_SPARCV8)
 #  define ASM_MPSETMUL
 #  define ASM_MPADDMUL
index 4eaa8eb..69ccbf6 100644 (file)
@@ -291,34 +291,34 @@ static void sha1Finish(sha1Param* sp)
        sp->offset = 0;
 }
 
-int sha1Digest(sha1Param* sp, byte* data)
+int sha1Digest(sha1Param* sp, byte* digest)
 {
        sha1Finish(sp);
 
        #if WORDS_BIGENDIAN
-       memcpy(data, sp->h, sizeof(sp->h));
+       memcpy(digest, sp->h, sizeof(sp->h));
        #else
        /* encode 5 integers big-endian style */
-       data[ 0] = (byte)(sp->h[0] >> 24);
-       data[ 1] = (byte)(sp->h[0] >> 16);
-       data[ 2] = (byte)(sp->h[0] >>  8);
-       data[ 3] = (byte)(sp->h[0] >>  0);
-       data[ 4] = (byte)(sp->h[1] >> 24);
-       data[ 5] = (byte)(sp->h[1] >> 16);
-       data[ 6] = (byte)(sp->h[1] >>  8);
-       data[ 7] = (byte)(sp->h[1] >>  0);
-       data[ 8] = (byte)(sp->h[2] >> 24);
-       data[ 9] = (byte)(sp->h[2] >> 16);
-       data[10] = (byte)(sp->h[2] >>  8);
-       data[11] = (byte)(sp->h[2] >>  0);
-       data[12] = (byte)(sp->h[3] >> 24);
-       data[13] = (byte)(sp->h[3] >> 16);
-       data[14] = (byte)(sp->h[3] >>  8);
-       data[15] = (byte)(sp->h[3] >>  0);
-       data[16] = (byte)(sp->h[4] >> 24);
-       data[17] = (byte)(sp->h[4] >> 16);
-       data[18] = (byte)(sp->h[4] >>  8);
-       data[19] = (byte)(sp->h[4] >>  0);
+       digest[ 0] = (byte)(sp->h[0] >> 24);
+       digest[ 1] = (byte)(sp->h[0] >> 16);
+       digest[ 2] = (byte)(sp->h[0] >>  8);
+       digest[ 3] = (byte)(sp->h[0] >>  0);
+       digest[ 4] = (byte)(sp->h[1] >> 24);
+       digest[ 5] = (byte)(sp->h[1] >> 16);
+       digest[ 6] = (byte)(sp->h[1] >>  8);
+       digest[ 7] = (byte)(sp->h[1] >>  0);
+       digest[ 8] = (byte)(sp->h[2] >> 24);
+       digest[ 9] = (byte)(sp->h[2] >> 16);
+       digest[10] = (byte)(sp->h[2] >>  8);
+       digest[11] = (byte)(sp->h[2] >>  0);
+       digest[12] = (byte)(sp->h[3] >> 24);
+       digest[13] = (byte)(sp->h[3] >> 16);
+       digest[14] = (byte)(sp->h[3] >>  8);
+       digest[15] = (byte)(sp->h[3] >>  0);
+       digest[16] = (byte)(sp->h[4] >> 24);
+       digest[17] = (byte)(sp->h[4] >> 16);
+       digest[18] = (byte)(sp->h[4] >>  8);
+       digest[19] = (byte)(sp->h[4] >>  0);
        #endif
 
        (void) sha1Reset(sp);
index 8d170bd..38e9823 100644 (file)
@@ -49,33 +49,49 @@ extern "C" {
 #endif
 
 /** \ingroup HASH_sha1_m
+ * Holds the full API description of the SHA-1 algorithm.
  */
 /*@observer@*/ /*@unchecked@*/
 extern BEECRYPTAPI const hashFunction sha1;
 
 /** \ingroup HASH_sha1_m
+ * This function performs the SHA-1 hash algorithm on 64 byte blocks of data.
+ * @param mp           hash parameter block
  */
 BEECRYPTAPI
 void sha1Process(sha1Param* sp)
        /*@modifies sp @*/;
 
 /** \ingroup HASH_sha1_m
+ * This function resets the parameter block so that it's ready for a new hash.
+ * @param mp           hash parameter block
+ * @return             0 on success
  */
 BEECRYPTAPI /*@unused@*/
 int  sha1Reset  (sha1Param* sp)
        /*@modifies sp @*/;
 
 /** \ingroup HASH_sha1_m
+ * This function should be used to pass successive blocks of data to be hashed.
+ * @param mp           hash parameter block
+ * @param *data                bytes to hash
+ * @param size         no. of bytes to hash
+ * @return             0 on success
  */
 BEECRYPTAPI /*@unused@*/
 int  sha1Update (sha1Param* sp, const byte* data, size_t size)
        /*@modifies sp @*/;
 
 /** \ingroup HASH_sha1_m
+ * This function finishes the current hash computation, returning the digest
+ * value in \a digest.
+ * @param sp           hash parameter block
+ * @retval *digest     20 byte SHA-1 digest
+ * @return             0 on success
  */
 BEECRYPTAPI /*@unused@*/
-int  sha1Digest (sha1Param* sp, /*@out@*/ byte* data)
-       /*@modifies sp, data @*/;
+int  sha1Digest (sha1Param* sp, /*@out@*/ byte* digest)
+       /*@modifies sp, digest @*/;
 
 #ifdef __cplusplus
 }
index a109992..c96ca78 100644 (file)
@@ -277,43 +277,43 @@ static void sha256Finish(sha256Param* sp)
        sp->offset = 0;
 }
 
-int sha256Digest(sha256Param* sp, byte* data)
+int sha256Digest(sha256Param* sp, byte* digest)
 {
        sha256Finish(sp);
 
        /* encode 8 integers big-endian style */
-       data[ 0] = (byte)(sp->h[0] >> 24);
-       data[ 1] = (byte)(sp->h[0] >> 16);
-       data[ 2] = (byte)(sp->h[0] >>  8);
-       data[ 3] = (byte)(sp->h[0] >>  0);
-       data[ 4] = (byte)(sp->h[1] >> 24);
-       data[ 5] = (byte)(sp->h[1] >> 16);
-       data[ 6] = (byte)(sp->h[1] >>  8);
-       data[ 7] = (byte)(sp->h[1] >>  0);
-       data[ 8] = (byte)(sp->h[2] >> 24);
-       data[ 9] = (byte)(sp->h[2] >> 16);
-       data[10] = (byte)(sp->h[2] >>  8);
-       data[11] = (byte)(sp->h[2] >>  0);
-       data[12] = (byte)(sp->h[3] >> 24);
-       data[13] = (byte)(sp->h[3] >> 16);
-       data[14] = (byte)(sp->h[3] >>  8);
-       data[15] = (byte)(sp->h[3] >>  0);
-       data[16] = (byte)(sp->h[4] >> 24);
-       data[17] = (byte)(sp->h[4] >> 16);
-       data[18] = (byte)(sp->h[4] >>  8);
-       data[19] = (byte)(sp->h[4] >>  0);
-       data[20] = (byte)(sp->h[5] >> 24);
-       data[21] = (byte)(sp->h[5] >> 16);
-       data[22] = (byte)(sp->h[5] >>  8);
-       data[23] = (byte)(sp->h[5] >>  0);
-       data[24] = (byte)(sp->h[6] >> 24);
-       data[25] = (byte)(sp->h[6] >> 16);
-       data[26] = (byte)(sp->h[6] >>  8);
-       data[27] = (byte)(sp->h[6] >>  0);
-       data[28] = (byte)(sp->h[7] >> 24);
-       data[29] = (byte)(sp->h[7] >> 16);
-       data[30] = (byte)(sp->h[7] >>  8);
-       data[31] = (byte)(sp->h[7] >>  0);
+       digest[ 0] = (byte)(sp->h[0] >> 24);
+       digest[ 1] = (byte)(sp->h[0] >> 16);
+       digest[ 2] = (byte)(sp->h[0] >>  8);
+       digest[ 3] = (byte)(sp->h[0] >>  0);
+       digest[ 4] = (byte)(sp->h[1] >> 24);
+       digest[ 5] = (byte)(sp->h[1] >> 16);
+       digest[ 6] = (byte)(sp->h[1] >>  8);
+       digest[ 7] = (byte)(sp->h[1] >>  0);
+       digest[ 8] = (byte)(sp->h[2] >> 24);
+       digest[ 9] = (byte)(sp->h[2] >> 16);
+       digest[10] = (byte)(sp->h[2] >>  8);
+       digest[11] = (byte)(sp->h[2] >>  0);
+       digest[12] = (byte)(sp->h[3] >> 24);
+       digest[13] = (byte)(sp->h[3] >> 16);
+       digest[14] = (byte)(sp->h[3] >>  8);
+       digest[15] = (byte)(sp->h[3] >>  0);
+       digest[16] = (byte)(sp->h[4] >> 24);
+       digest[17] = (byte)(sp->h[4] >> 16);
+       digest[18] = (byte)(sp->h[4] >>  8);
+       digest[19] = (byte)(sp->h[4] >>  0);
+       digest[20] = (byte)(sp->h[5] >> 24);
+       digest[21] = (byte)(sp->h[5] >> 16);
+       digest[22] = (byte)(sp->h[5] >>  8);
+       digest[23] = (byte)(sp->h[5] >>  0);
+       digest[24] = (byte)(sp->h[6] >> 24);
+       digest[25] = (byte)(sp->h[6] >> 16);
+       digest[26] = (byte)(sp->h[6] >>  8);
+       digest[27] = (byte)(sp->h[6] >>  0);
+       digest[28] = (byte)(sp->h[7] >> 24);
+       digest[29] = (byte)(sp->h[7] >> 16);
+       digest[30] = (byte)(sp->h[7] >>  8);
+       digest[31] = (byte)(sp->h[7] >>  0);
 
        (void) sha256Reset(sp);
        return 0;
index f37783b..8102de1 100644 (file)
@@ -49,12 +49,15 @@ extern "C" {
 #endif
 
 /** \ingroup HASH_sha256_m
+ * Holds the full API description of the SHA-256 algorithm.
  */
 /*@observer@*/ /*@checked@*/
 extern BEECRYPTAPI const hashFunction sha256;
 
 /*@-exportlocal@*/
 /** \ingroup HASH_sha256_m
+ * This function performs the SHA-256 hash algorithm on 64 byte blocks of data.
+ * @param mp           hash parameter block
  */
 BEECRYPTAPI
 void sha256Process(sha256Param* sp)
@@ -62,12 +65,20 @@ void sha256Process(sha256Param* sp)
        /*@modifies sp, internalState @*/;
 
 /** \ingroup HASH_sha256_m
+ * This function resets the parameter block so that it's ready for a new hash.
+ * @param mp           hash parameter block
+ * @return             0 on success
  */
 BEECRYPTAPI
 int  sha256Reset  (sha256Param* sp)
        /*@modifies sp @*/;
 
 /** \ingroup HASH_sha256_m
+ * This function should be used to pass successive blocks of data to be hashed.
+ * @param mp           hash parameter block
+ * @param *data                bytes to hash
+ * @param size         no. of bytes to hash
+ * @return             0 on success
  */
 BEECRYPTAPI
 int  sha256Update (sha256Param* sp, const byte* data, size_t size)
@@ -75,11 +86,16 @@ int  sha256Update (sha256Param* sp, const byte* data, size_t size)
        /*@modifies sp, internalState @*/;
 
 /** \ingroup HASH_sha256_m
+ * This function finishes the current hash computation, returning the digest
+ * value in \a digest.
+ * @param sp           hash parameter block
+ * @retval *digest     32 byte SHA-256 digest
+ * @return             0 on success
  */
 BEECRYPTAPI
-int  sha256Digest (sha256Param* sp, /*@out@*/ byte* data)
+int  sha256Digest (sha256Param* sp, /*@out@*/ byte* digest)
        /*@globals internalState @*/
-       /*@modifies sp, data, internalState @*/;
+       /*@modifies sp, digest, internalState @*/;
 /*@=exportlocal@*/
 
 #ifdef __cplusplus
index 6ca004a..297397a 100644 (file)
@@ -30,7 +30,7 @@ typedef struct
 /*@=sizeoftype@*/
 #endif
 
-#include "types.h"
+#include "beecrypt.gnu.h"
 
 #if HAVE_SYS_STAT_H
 # include <sys/types.h>
index 7479ea4..8c17b16 100644 (file)
@@ -93,11 +93,9 @@ int main()
 
                if (memcmp(digest, table[i].expect, 16))
                {
-                       printf("failed\n");
+                       printf("failed test vector %d\n", i+1);
                        failures++;
                }
-               else
-                       printf("ok\n");
        }
 
        return failures;
index 1020c19..7ccc98e 100644 (file)
@@ -93,7 +93,7 @@ int main()
 
                if (memcmp(digest, table[i].expect, 20))
                {
-                       printf("failed\n");
+                       printf("failed test vector %d\n", i+1);
                        failures++;
                }
                else
index b7776ef..f5e1ef3 100644 (file)
@@ -72,8 +72,6 @@ int main()
                        printf("failed test vector %d\n", i+1);
                        failures++;
                }
-               else
-                       printf("ok\n");
        }
        return failures;
 }
index e8ecf31..161047e 100644 (file)
@@ -1,23 +1,25 @@
-#include <stdio.h>
-
+#include "system.h"
 #include "beecrypt.h"
 #include "mp.h"
+#include "debug.h"
 
 #define INIT   0xdeadbeefU;
 
-static const mpw z[4] = { 0U, 0U, 0U, 0U };
-static const mpw f[4] = { ~((mpw) 0U), ~((mpw) 0U), ~((mpw) 0U), ~((mpw) 0U)};
+static const mpw Z[4] = { 0U, 0U, 0U, 0U };
+static const mpw F[4] = { ~((mpw) 0U), ~((mpw) 0U), ~((mpw) 0U), ~((mpw) 0U)};
+static const mpw P[8] = { ~((mpw) 0U), ~((mpw) 0U), ~((mpw) 0U), ~((mpw) 0U) - 1U, 0U, 0U, 0U, 1U };
 
 int main()
 {
        int i;
        mpw x[4];
        mpw y[4];
+       mpw r[8];
 
        for (i = 0; i < 4; i++)
                x[i] = INIT;
 
-       mpcopy(4, x, z);
+       mpcopy(4, x, Z);
        for (i = 0; i < 4; i++)
        {
                if (x[i] != 0)
@@ -27,18 +29,18 @@ int main()
                }
        }
 
-       if (!mpeq(4, x, z))
+       if (!mpeq(4, x, Z))
        {
                printf("mpeq failed\n");
                return 1;
        }
-       if (mpne(4, x, z))
+       if (mpne(4, x, Z))
        {
                printf("mpne failed\n");
                return 1;
        }
 
-       mpcopy(4, x, f);
+       mpcopy(4, x, F);
        for (i = 0; i < 4; i++)
        {
                if (x[i] != ~((mpw) 0))
@@ -48,27 +50,45 @@ int main()
                }
        }
 
-       if (!mpz(4, z) || mpz(4, f))
+       if (!mpz(4, Z) || mpz(4, F))
        {
                printf("mpz failed\n");
                return 1;
        }
-       if (mpnz(4, z) || !mpnz(4, f))
+       if (mpnz(4, Z) || !mpnz(4, F))
        {
                printf("mpnz failed\n");
                return 1;
        }
 
-       if (!mpeq(4, x, f))
+       if (!mpeq(4, x, F))
        {
                printf("mpeq failed\n");
                return 1;
        }
-       if (mpne(4, x, f))
+       if (mpne(4, x, F))
        {
                printf("mpne failed\n");
                return 1;
        }
 
+       mpzero(8, r);
+       mpmul(r, 4, F, 4, F);
+       if (!mpeq(8, r, P))
+       {
+               printf("mpmul failed\n");
+               return 1;
+       }
+
+       mpzero(8, r);
+       mpsqr(r, 4, F);
+       if (!mpeq(8, r, P))
+       {
+               printf("mpsqr failed\n");
+               return 1;
+       }
+
+       printf("success\n");
+
        return 0;
 }
index 1f00faf..f2c3796 100644 (file)
@@ -63,8 +63,6 @@ int main()
                        printf("failed test vector %d\n", i+1);
                        failures++;
                }
-               else
-                       printf("ok\n");
        }
        return failures;
 }
index 871e0a7..9d67021 100644 (file)
@@ -60,8 +60,6 @@ int main()
                        printf("failed test vector %d\n", i+1);
                        failures++;
                }
-               else
-                       printf("ok\n");
        }
        return failures;
 }
diff --git a/beecrypt/types.h.in b/beecrypt/types.h.in
deleted file mode 100644 (file)
index 8489cd9..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2000, 2003 Virtual Unlimited B.V.
- *
- * This library 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.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-/*!\file types.h
- * \brief BeeCrypt API, portability headers.
- * \author Bob Deblier <bob.deblier@pandora.be>
- */
-
-#ifndef _BEECRYPT_TYPES_H
-#define _BEECRYPT_TYPES_H
-
-# define BEECRYPTAPI
-
-@include_stdint_h@
-
-/* Starting from GCC 3.2, the compiler seems smart enough to figure
- * out that we're trying to do a rotate without having to specify it.
- */
-#if defined(__GNUC__) && (__GNUC__ < 3 || __GNUC_MINOR__ < 2)
-# if defined(__i386__)
-static inline uint32_t _rotl32(uint32_t x, const unsigned char n)
-       /*@*/
-{
-       __asm__("roll %[n],%[x]"
-               :       [x] "=r" (x)
-               :       "0" (x), [n] "I" (n));
-
-       return x;
-}
-#define ROTL32(x, n) _rotl32(x, n)
-
-static inline uint32_t _rotr32(uint32_t x, const unsigned char n)
-       /*@*/
-{
-       __asm__("rorl %[n],%[x]"
-               :       [x] "=r" (x)
-               :       "0" (x), [n] "I" (n));
-
-       return x;
-}
-#define ROTR32(x, n) _rotr32(x, n)
-
-# endif
-#endif
-
-#ifndef ROTL32
-# define ROTL32(x, s) (((x) << (s)) | ((x) >> (32 - (s))))
-#endif
-#ifndef ROTR32
-# define ROTR32(x, s) (((x) >> (s)) | ((x) << (32 - (s))))
-#endif
-
-typedef uint8_t                byte;
-
-/*@-typeuse@*/
-typedef int8_t         javabyte;
-typedef int16_t                javashort;
-typedef uint16_t       javachar;
-typedef int32_t                javaint;
-/*@=typeuse@*/
-
-typedef int64_t                javalong;
-
-#if !defined(MP_WBITS)
-#define        MP_WBITS        @MP_WBITS@
-#endif
-
-#if (MP_WBITS == 64)
-typedef uint64_t mpw;
-typedef uint32_t mphw;
-#elif (MP_WBITS == 32)
-# if HAVE_UINT64_T
-#  define HAVE_MPDW 1
-typedef uint64_t mpdw;
-# endif
-typedef uint32_t mpw;
-/*@-typeuse@*/
-typedef uint16_t mphw;
-/*@=typeuse@*/
-#else
-# error
-#endif
-
-#if defined(_REENTRANT)
-@include_pthread_h@
-@typedef_bc_lock_t@
-#endif
-
-#endif /* _BEECRYPT_TYPES_H */