Spliddles and diddles.
authorjbj <devnull@localhost>
Wed, 28 May 2003 17:18:56 +0000 (17:18 +0000)
committerjbj <devnull@localhost>
Wed, 28 May 2003 17:18:56 +0000 (17:18 +0000)
CVS patchset: 6877
CVS date: 2003/05/28 17:18:56

23 files changed:
beecrypt/BUGS
beecrypt/Doxyheader
beecrypt/Makefile.am
beecrypt/autogen.sh
beecrypt/beecrypt.c
beecrypt/beecrypt.win.h
beecrypt/configure.ac
beecrypt/docs/Makefile.am
beecrypt/docs/api.html [deleted file]
beecrypt/docs/developing.html [deleted file]
beecrypt/docs/index.html [deleted file]
beecrypt/docs/installing.html [deleted file]
beecrypt/docs/manual.css [deleted file]
beecrypt/docs/using.html [deleted file]
beecrypt/entropy.c
beecrypt/memchunk.c
beecrypt/memchunk.h
beecrypt/mp.c
beecrypt/mpbarrett.c
beecrypt/python/Makefile.am
beecrypt/python/mpw-py.c
beecrypt/python/rng-py.c
beecrypt/tests/Makefile.am

index 367149a..dcdbe0d 100644 (file)
@@ -6,6 +6,9 @@ Legend:
        - Intel icc can't cope with gcj headers; there's also a problem in
       combination with aio.h. Solution should be to not test gcj when using
       this compiler. As a workaround, you can specify --without-javaglue.
+       - GCC 3.3 produces faster output for Blowfish than the included assembler
+         source; try coding two Blowfish rounds (without swap) in C and compile
+         to assembler to see how GCC accomplishes this.
 
 2.3.0pre:
        * bug in certain instances of computing modular inverse.
index b72eae5..2f38355 100644 (file)
@@ -1,5 +1,30 @@
 /*! \mainpage BeeCrypt API Documentation.
 
+BeeCrypt started its life when the need for a portable and fast cryptography
+library arose at Virtual Unlimited in 1997. I'm still trying to make it
+faster, easier to use and more portable, in addition to providing better
+documentation.
+
+BeeCrypt is released under the following license:
+
+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
+
+Legal disclaimer: note that depending on where you are, the use of
+cryptography may be limited or forbidden by law. Before using this library,
+make sure you are legally entitled to do so.
+
 Included in the library are:
     - entropy sources for initializing pseudo-random generators
     - pseudo-random generators
@@ -17,20 +42,19 @@ Included in the library are:
         - HMAC-SHA-1
         - HMAC-SHA-256
     - multi-precision integer library, with assembler-optimized routines
-      for several processors
+      for a range of processors; optimized to perform well on both 32-bit
+      and 64-bit machines
     - probabilistic primality testing, with optimized small prime trial
       division
     - discrete logarithm parameter generation over a prime field
     - Diffie-Hellman key agreement
+    - DHAES encryption scheme
     - DSA signature scheme
     - ElGamal signature scheme (two variants)
     - RSA keypair generation with chinese remainder theorem variables
     - RSA public & private key operations
-    - DHAES encryption scheme
 
 Planned for the near future are:
-    - mp64 library for operation on 64-bit computers (and possibly also
-      on certain 32-bit platforms)
     - compliance with and compliance statements for IEEE P1363
     - more blockciphers (Twofish, ... )
     - more hash functions (RIPEMD-160, SHA-384, SHA-512, HAVAL, Tiger)
@@ -39,30 +63,20 @@ Planned for the near future are:
     - more blockcipher modes (OFB, ... )
 
 The library has been tested on the following platforms:
-    - FreeBSD 4.0 alpha
-    - FreeBSD 4.0, 4.2 x86
-        - includes assembler optimization (tuned for Pentium and higher)
-    - HP-UX 11a PA-RISC
     - Linux glibc 2.x alpha
     - Linux glibc 2.x arm
-        - includes assembler optimization
+    - Linux glibc 2.x ia64
+    - Linux glibc 2.x m68k
     - Linux glibc 2.x ppc
-        - includes assembler optimization for 32-bit PowerPC
-     - Linux glibc 2.x sparc
-        - includes assembler optimization for Sparc v8
+    - Linux glibc 2.x s390x
+    - Linux glibc 2.x sparc
     - Linux glibc 2.x x86
-        - includes assembler optimization (tuned for Pentium and higher)
-    - Solaris 2.[6789] sparc (with Forte or gnu compilers)
-        - includes assembler optimization for Sparc v8, v8plus and v9
-    - Solaris 2.[78] x86 (with Forte or gnu compilers)
-        - includes assembler optimization (tuned for Pentium and higher)
+    - Solaris 2.[6789] sparc (with Forte or GNU compilers)
+    - Solaris 2.[78] x86 (with Forte or GNU compilers)
     - Tru64 Unix alpha
-    - Win32 (Windows 95, 98, NT 4.0, 2000)
-        - includes assembler optimization (tuned for Pentium and higher)
-
-The library is currently in the process of being ported to:
-    - Darwin (apparently Apple has decided to change the PPC assembler format;
-      this will need a fix)
+    - Win32 (Windows 95, 98, NT 4.0, 2000, XP)
+    - AIX (shared libraries don't seem to work in 64-bit mode)
+    - Darwin (javaglue doesn't compile yet)
     - Cygwin (the DLL builds now, but needs to be tested)
 
 The structures in the library are geared towards exchange with Java
index 9b5eb9f..0e58fc3 100644 (file)
@@ -36,7 +36,7 @@ AUTOMAKE_OPTIONS = gnu check-news no-dependencies
 
 LINT = splint
 
-SUBDIRS = . docs gas masm python tests $(MAYBE_OPT)
+SUBDIRS = . docs gas masm tests $(MAYBE_OPT)
 
 SUFFIXES = .s
 
index 13965a1..71bf7a4 100755 (executable)
@@ -38,7 +38,7 @@ if [ X"$@" = X  -a "X`uname -s`" = "XLinux" ]; then
        mandir=/usr/man
        infodir=/usr/info
     fi
-    CPPFLAGS="-Wall -g" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=${infodir} --mandir=${mandir} --enable-static "$@"
+    CPPFLAGS="-Wall -g" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=${infodir} --mandir=${mandir} --enable-static --with-python "$@"
 else
     ./configure "$@"
 fi
index a10c565..68102d6 100644 (file)
@@ -48,8 +48,8 @@ static entropySource entropySourceList[] =
 {
 #if WIN32
        { "wincrypt", entropy_wincrypt },
-       { "wavein", entropy_wavein },
        { "console", entropy_console },
+       { "wavein", entropy_wavein },
 #else
 # if HAVE_DEV_URANDOM
        { "urandom", entropy_dev_urandom },
@@ -394,7 +394,6 @@ int hashFunctionContextUpdateMP(hashFunctionContext* ctxt, const mpnumber* n)
                if (tmp == (byte*) 0)
                        return -1;
 
-               /*@-nullpass -nullderef -nullptrarith @*/ /* FIX: temp may be NULL */
                if (mpmsbset(n->size, n->data))
                {
                        tmp[0] = 0;
@@ -407,7 +406,6 @@ int hashFunctionContextUpdateMP(hashFunctionContext* ctxt, const mpnumber* n)
                        rc = ctxt->algo->update(ctxt->param, tmp, MP_WORDS_TO_BYTES(n->size));
                }
                free(tmp);
-               /*@=nullpass =nullderef =nullptrarith @*/
 
                return rc;
        }
@@ -656,8 +654,9 @@ int keyedHashFunctionContextUpdateMP(keyedHashFunctionContext* ctxt, const mpnum
        {
                register int rc;
                register byte* temp = (byte*) malloc(MP_WORDS_TO_BYTES(n->size)+1);
+               if (temp == (byte*) 0)
+                       return -1;
 
-               /*@-nullpass -nullderef -nullptrarith @*/ /* FIX: temp may be NULL */
                if (mpmsbset(n->size, n->data))
                {
                        temp[0] = 0;
@@ -670,7 +669,6 @@ int keyedHashFunctionContextUpdateMP(keyedHashFunctionContext* ctxt, const mpnum
                        rc = ctxt->algo->update(ctxt->param, temp, MP_WORDS_TO_BYTES(n->size));
                }
                free(temp);
-               /*@=nullpass =nullderef =nullptrarith @*/
 
                return rc;
        }
index 98d23ef..82ca262 100644 (file)
@@ -132,9 +132,6 @@ typedef unsigned __int64    uint64_t;
 
 #endif
 
-#define MP_WBITS       32
-
-typedef float  float4;
-typedef double double8;
+#define MP_WBITS       32U
 
 #endif
index d26408c..dda6b30 100644 (file)
@@ -85,6 +85,9 @@ AC_ARG_WITH(arch,[  --with-arch             optimize for specific architecture (
     i[[3456]]86 | \
     pentium | pentium-mmx | pentiumpro | pentium[[234]] | \
     athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp)
+      if test "$ac_with_cpu" != yes; then
+        bc_target_cpu=$withval
+      fi
       ;;
     esac
     ;;
@@ -373,8 +376,8 @@ if test "$ac_enable_threads" = 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)
-      bc_include_synch_h="#include <sync.h>"
-      bc_typedef_bc_lock_t="typedef pthread_mutex_t bc_lock_t;"
+      bc_include_synch_h="#include <synch.h>"
+      bc_typedef_bc_lock_t="typedef mutex_t bc_lock_t;"
       ])
   elif test "$ac_cv_header_pthread_h" = yes; then
     AC_SEARCH_LIBS([pthread_mutex_lock],[pthread],[
@@ -489,7 +492,7 @@ EOF
           *)
            java_include="$java_home"/../include ;;
           esac
-         if test -d "$java_include" -a -f "$java_include/jni.h"; then
+         if test -d "$java_include"; then
             ac_cv_java_headers=yes
               ac_cv_java_include="-I$java_include"
               case $target_os in
@@ -718,7 +721,6 @@ AC_CONFIG_FILES([Makefile
                  gas/Makefile
                  java/Makefile
                  masm/Makefile
-                 mwerks/Makefile
                  python/Makefile
                  python/test/Makefile
                  tests/Makefile])
index 8a50295..797486c 100644 (file)
@@ -21,5 +21,3 @@
 #
 
 AUTOMAKE_OPTIONS = gnu no-dependencies
-
-EXTRA_DIST = index.html installing.html using.html developing.html api.html manual.css
diff --git a/beecrypt/docs/api.html b/beecrypt/docs/api.html
deleted file mode 100644 (file)
index 2a9f242..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<HTML>
-<HEAD>
-<LINK REL=StyleSheet HREF="manual.css" TYPE="text/css">
-<TITLE>The BeeCrypt API</TITLE>
-</HEAD>
-<BODY>
-<DL>
-<DT><B>Entropy Sources</B></DT>
-<DD>
-<BR>
-<HR>
-</DD>
-<DT><B>Random Generators</B></DT>
-<DD>
-<P>The following structure is used to hold information describing a
-specific random generator implementation:
-<BR><A NAME="randomGenerator"></A><PRE><CODE CLASS=c>
-typedef struct
-{
-  const char*                  name;
-  const unsigned int           paramsize;
-  const randomGeneratorSetup   setup;
-  const randomGeneratorSeed    seed;
-  const randomGeneratorNext    next;
-  const randomGeneratorCleanup cleanup;
-} randomGenerator;
-</CODE></PRE>
-<P>The following structure is used to work with a specific random
-generator implementation: 
-<BR><A NAME="randomGeneratorContext"></A><PRE><CODE CLASS=c>
-typedef struct
-{
-  const randomGenerator* rng;
-  randomGeneratorparam*  param;
-} randomGeneratorContext;
-</CODE></PRE>
-<P>The following functions will operate on this structure:
-<DL>
-<DT><A NAME="randomGeneratorContextInit"></A><CODE CLASS=c>
-void randomGeneratorContextInit(<A HREF="#randomGeneratorContext">randomGeneratorContext</A>* ctxt, const <A HREF="#randomGenerator">randomGenerator</A>* rng);
-</CODE></DT>
-<DD>This function initializes <CODE>ctxt</CODE> by allocating and
-initializing parameters appropriate for <CODE>rng</CODE>.
-</DD>
-<DT><A NAME="randomGeneratorContextFree"></A><CODE CLASS=c>
-void randomGeneratorContextFree(<A HREF="#randomGeneratorContext">randomGeneratorContext</A>* ctxt);
-</CODE></DT>
-<DD>This function cleans up <CODE>ctxt</CODE> and frees its
-allocated parameters.
-</DL>
-<BR>
-<HR>
-</DD>
-<DT><B>Hash Functions</B></DT>
-<DD>
-<BR>
-<HR>
-</DD>
-<DT><B>Keyed Hash Functions</B></DT>
-<DD>
-<BR>
-<HR>
-</DD>
-<DT><B>Block Ciphers</B></DT>
-<DD>
-<BR>
-<HR>
-</DD>
-<DT><B>Multi-Precision Integer routines</B></DT>
-<DD>
-<P>The following structure is used to hold a multi-precision integer:
-<BR><A NAME="mp32number"></A><PRE><CODE CLASS=c>
-typedef struct
-{
-  uint32  size;
-  uint32* data;
-} mp32number;
-</CODE></PRE>
-<P>The following structure is used for barrett modular reduction operations on multi-precision integers:
-<BR><A NAME="mp32barrett"></A><PRE><CODE CLASS=c>
-typedef struct
-{
-  uint32  size;
-  uint32* modl;
-  uint32* mu;
-} mp32barrett;
-</CODE></PRE>
-<BR>
-<HR>
-</DD>
-<DT><B>Discrete Logarithm Public Key Primitives</B></DT>
-<DD>
-<P>Discrete logarithm operations can be performed in a variety of fields. This API implements discrete logarithms over a prime field, conform with IEEE P1363.
-<P>You can find the exact mathematics in:
-<BLOCKQUOTE>
-<EM>"Handbook of Applied Cryptography"</EM><BR>
-Alfred J. Menezes, Paul C. van Oorschot, Scott A. Vanstone<BR>
-CRC Press
-</BLOCKQUOTE>
-<P>The domain parameters are defined by a prime P, a prime factor Q of (P-1), and a group generator G.
-<P>The following struct is used to hold the discrete logarithm domain parameters:
-<BR><A NAME="dldp_p"></A><PRE><CODE CLASS=c>
-typedef struct
-{
-  <A HREF="#mp32barrett">mp32barrett</A> p;
-  <A HREF="#mp32barrett">mp32barrett</A> q;
-  <A HREF="#mp32number">mp32number</A>  r;
-  <A HREF="#mp32number">mp32number</A>  g;
-  <A HREF="#mp32barrett">mp32barrett</A> n;
-} dldp_p;
-</CODE></PRE>
-<P>The struct holds more than the three domain parameters required by IEEE P1363. Some discrete logarithm operations call for a reduction modulo (P-1). Hence we've defined N as (P-1). R is the cofactor of (P-1), so that P-1=N=Q*R, where P and Q are (probable) primes.
-<P>If you save the domain parameters, you don't need to save N, and R, since they can be trivially recomputed.
-<P>The following functions will operate on this structure:
-<DL>
-<DT><A NAME="dldp_pInit"></A><CODE CLASS=c>
-void <A NAME="dldp_pInit">dldp_pInit</A>(<A HREF="#dldp_p">dldp_p</A>* domain);
-</CODE></DT>
-<DT><A NAME="dldp_pFree"></A><CODE>
-void <A NAME="dldp_pFree">dldp_pFree</A>(<A HREF="#dldp_p">dldp_p</A>* domain);
-</CODE></DT>
-<DT><A NAME="dldp_pCopy"></A><CODE>
-void <A NAME="dldp_pCopy">dldp_pCopy</A>(<A HREF="#dldp_p">dldp_p</A>* dest, const <A HREF="#dldp_p">dldp_p</A>* source);
-</CODE></DT>
-</DL>
-<BR>
-<HR>
-</DD>
-</DL>
-</BODY>
-</HTML>
diff --git a/beecrypt/docs/developing.html b/beecrypt/docs/developing.html
deleted file mode 100644 (file)
index 06edb4e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<HTML>
-<HEAD>
-<LINK REL=StyleSheet HREF="manual.css" TYPE="text/css">
-<TITLE>Developing Applications with BeeCrypt</TITLE>
-</HEAD>
-<BODY>
-To be completed.
-<P><A HREF="api.html">API</A>
-<P><A HREF="examples.html">Examples</A>
-</BODY>
-</HTML>
diff --git a/beecrypt/docs/index.html b/beecrypt/docs/index.html
deleted file mode 100644 (file)
index a2c4a0f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<HTML>
-<HEAD>
-<LINK REL=StyleSheet HREF="manual.css" TYPE="text/css">
-<TITLE>The BeeCrypt Cryptography Library</TITLE>
-</HEAD>
-<BODY>
-<H1>The BeeCrypt Cryptography Library</H1>
-<P>Copyright &copy; 1997, 1998, 1999, 2000, 2001 Virtual Unlimited, B.V.<BR>
-<P>Permission is  granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or any
-later version published by the Free Software Foundation;
-with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
-Texts.
-<P>For the specifics of this license, see file 'COPYING.DOC', included in this
-distribution.
-<H2>About BeeCrypt</H2>
-<P>BeeCrypt is an open source cryptography library that contains highly
-optimized C and assembler implementations of many well-known algorithms
-including Blowfish, MD5, SHA-1, SHA-256, Diffie-Hellman, and ElGamal.
-<P>The goal of the library is to offer a wide range of low-level cryptographic
-primitives.
-<P>BeeCrypt is licensed under the GNU Lesser Public General License (LGPL),
-which means it can be used for free in both open and closed source commercial
-products.
-<BR>
-<H2>About the documentation</H2>
-<P>This is the first attempt to write a manual for the BeeCrypt Cryptography
-Library. Eventually this will become a full-blown manual, with all the jingles
-and bells.
-<H2>Contents</H2>
-<OL>
-<LI><A HREF="installing.html">Installing BeeCrypt</A>
-<LI><A HREF="using.html">Using BeeCrypt</A>
-<LI><A HREF="developing.html">Developing with BeeCrypt</A>
-</OL>
-</BODY>
-</HTML>
diff --git a/beecrypt/docs/installing.html b/beecrypt/docs/installing.html
deleted file mode 100644 (file)
index 6cd21b2..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<HTML>
-<HEAD>
-<TITLE>Installing the BeeCrypt Cryptography Library</TITLE>
-</HEAD>
-<BODY>
-<H2>Installing the BeeCrypt Cryptography Library</H2>
-<P>When it comes to installing BeeCrypt you basically have the following
-alternatives:
-<OL TYPE="a">
-<LI><B>Installing from the source code - aka roll your own</B></LI>
-<UL TYPE="disc">
-<LI>Getting the source code</LI>
-<P>The primary download location for the source tarball is through
-<A HREF="http://www.virtualunlimited.com/download/index.html#beecrypt">
-Virtual Unlimited's download page</A>. Alternatively you can download from
-<A HREF="http://sourceforge.net/projects/beecrypt">SourceForge</A>.
-<LI>Unpacking</LI>
-<P>Once you have the source tarball, unpack it with <ACRONYM>GNU</ACRONYM>
-tar (if you have it); on Windows you can use
-<A HREF="http://www.rarsoft.com/">WinRAR</A>.
-<LI>Configuring, building and installing</LI>
-<P>The library can be built on a variety of platforms, and we will illustrate
-the two most common ways:
-<P><B>Using the <ACRONYM>GNU</ACRONYM> toolchain</B>
-<P>The source tarball contains a configure script produced with
-<ACRONYM>GNU</ACRONYM> autoconf;
-on most platforms you will want to use this.
-<P>As with most configure scripts, there are a few options you can use:
-<DL COMPACT>
-<DT><CODE>--prefix</CODE></DT>
-<DD>Use this option to indicate where you want the shared library and header
-files installed. By default this is set to <CODE>/usr/local</CODE>. Another
-suggested location is the <CODE>/usr</CODE> directory.</DD>
-<DT><CODE>--target</CODE></DT>
-<DD>Use this option to indicate that you want the library built for a
-processor other than the one which is normally detected. Some examples of
-useful combinations are:
-<DL COMPACT>
-<DT><CODE>--target=sparcv8plus-sun-solaris2.8</CODE></DT>
-<DT><CODE>--target=i686-pc-freebsd4.3</CODE></DT>
-</DL>
-<DT><CODE>--enable-debug</CODE></DT>
-<DD>will build the library with debug symbols, and without assembler
-optimization, and instead just use plain C code.
-<DT><CODE>--disable-optimized</CODE></DT>
-<DD>will build the library without any processor-specific assembler
-optimization, and instead just use plain C code.</DD>
-<DT><CODE>--without-javaglue</CODE></DT>
-<DD>will build the library without code which allows BeeCrypt for Java
-to employ the native code in the library (automatic if you don't
-have a JDK installed).</DD>
-<DT><CODE>--disable-threads</CODE></DT>
-<DD>will build the library without thread-safe code; useful on platforms
-such as NetBSD (automatic if configure can't find threads).</DD>
-<DT><CODE>--disable-aio</CODE></DT>
-<DD>will build the library without asynchronous I/O on entropy devices
-(automatic if configure can't find POSIX-compliant asynchronous I/O
-routines).</DD>
-<DT><CODE>--with-mtmalloc</CODE></DT>
-<DD>will build the library with multi-thread optimized malloc routines
-(available on Solaris 8). There is a tradeoff in speed versus the amount
-of memory allocated.</DD>
-</DL>
-<P>To build, run: <XMP>make</XMP>
-<P>To install, run: <XMP>make install</XMP>
-</DL>
-<P><B>Using Visual C++ for Win32</B>
-<P>Microsoft Visual C++ is currently the preferred platform for compiling
-the library, as it seems faster and more stable than other platforms.
-<P>The prerequisites for compiling are:
-<DL COMPACT>
-<DT>Visual C++ 6.0</DT>
-<DD>At the time of writing, it is recommended to install the latest service
-pack for Visual Studio. You can find it through Microsoft's
-<A HREF="http://www.microsoft.com/downloads">download page</A>.</DD>
-<DT>Visual C++ Processor Pack</DT>
-<DD>You will need this package to support compilation of the assembler source 
-code. You can download it
-<A HREF="http://msdn.microsoft.com/vstudio/downloads/ppack/default.asp">
-here</A>.</DD>
-</DT>
-<P>Before going on, make sure the following Visual C++ tools are found on
-your PATH: cl.exe, (the compiler), ml.exe (the assembler), link.exe (the
-linker) and nmake.exe (the make utility).
-<P>For the Win32 platform, there is a Makefile.mak for Visual C++ included;
-if you have a Pentium class processor, you won't have to configure the source
-tree.
-<P>This Makefile.mak is set up to compile Java support into the library. If
-you don't have JDK 1.2 or later installed, you'll need to edit this file.
-<P>To build, run: <XMP>nmake /f Makefile.mak</XMP>
-<P><B>Using Metrowerks CodeWarrior for Win32</B>
-<P>The prerequisites for compiling are:
-<DL COMPACT>
-<DT>CodeWarrior Pro</DT>
-<DD>Use version 5 or later.</DD>
-<DT>CodeWarrior Pro Assembler Plugin</DT>
-<DD>This tool isn't officially support by MetroWerks, but it functions fine
-in conjunction with the project file included in the library.</DD>
-</DL>
-<P>To build, start the CodeWarrior IDE, open project file 'beecrypt.mcp'
-and make the BeeCrypt DLL by pressing the <CODE>[F7]</CODE> key.
-<P><B>Installing the BeeCrypt DLL</B>
-<P>To install, either copy file 'beecrypt.dll' to your Windows System
-directory (on Windows 95/98/Millenium), or to your Windows System 32
-directory (on Windows NT/2000).
-<P>If you don't need the BeeCrypt DLL globallly available, copy it into the same
-directory as the application which is going to use it. If you intend to develop
-software with BeeCrypt, you'll need file 'beecrypt.lib'. Either copy it into
-project directory, or point your Makefile or project to it.
-</DL>
-</UL>
-<BR>
-<LI><B>Installing precompiled versions</B></LI>
-<P>Several different flavors of precompiled versions exist.
-<DL COMPACT>
-<DT>Win32 BeeCrypt DLLs</DT>
-<DD>Virtual Unlimited makes precompiled BeeCrypt DLL and LIB files, usable on
-Pentium class processors. If you want to develop your own software with these
-files, you will also need the header files from the source tarball. See
-'Getting the source code'.</DD>
-<DT>RedHat RPMS</DT>
-<DD>Virtual Unlimited makes BeeCrypt RPM packages for every release for at
-least the following platforms: i386, i586, i686, powerpc. As we get access to
-more platforms, we will try to make more RPMS available; until then it
-shouldn't be too hard to get the BeeCrypt SRPM file, install it and compile
-your own RPMS from it. Note that RPM packages originating at Virtual
-Unlimited will contain a signature, which you can verify with
-<A HREF="http://www.virtualunlimited.com/support/beecrypt/gnupg-sigkey.html">
-this key</A>.</DD>
-<DT>Debian Packages</DT>
-<DD>Thanks to Luca Filipozzi there are Debian packages available for BeeCrypt.
-You can find these packages on various Debian mirror sites.</DD>
-</DL>
-<P>
-</OL>
-</BODY>
-</HTML>
diff --git a/beecrypt/docs/manual.css b/beecrypt/docs/manual.css
deleted file mode 100644 (file)
index 63f1bb0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-BODY { background: #fff }
-
-A:link { color: #0D45AC }
-A:visited { color: #936 }
-
-H1 { font: bold 170% verdana,arial,sans-serif }
-
-H2 {
-font: bold 100% verdana,arial,sans-serif;
-margin-bottom: .5em
-}
-
-H3 {
-font: bold 90% verdana,arial,sans-serif;
-margin-bottom: .5em
-}
-
-A.index { font: normal 70% Verdana,Arial,Helvetica,sans-serif }
-A.index  { color: #0D45AC }
-A.index:visited { color: #936 }
-
-.crumbtrail { font: normal 70% Verdana,Arial,Helvetica,sans-serif }
-A.crumblink  { color: #0D45AC }
-A.crumblink:visited { color: #936 }
-
diff --git a/beecrypt/docs/using.html b/beecrypt/docs/using.html
deleted file mode 100644 (file)
index 9bc2db6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<HTML>
-<HEAD>
-<LINK REL=StyleSheet HREF="manual.css" TYPE="text/css">
-<TITLE>Using BeeCrypt</TITLE>
-</HEAD>
-<BODY>
-To be completed.
-</BODY>
-</HTML>
index a36fec1..5dc3f0b 100644 (file)
@@ -526,7 +526,7 @@ static int entropy_noise_gather(int fd, int samplesize, int channels, int swap,
                                                temp <<= 1;
                                                temp |= samples[i];
                                                randombits--;
-                                               if (!(randombits & 0x1f))
+                                               if (!(randombits & 0x7))
                                                        *(data++) = temp;
                                        }
                                }
index 3239ebc..a6dc139 100644 (file)
@@ -1,12 +1,8 @@
 /*
  * memchunk.c
  *
- * BeeCrypt memory block handling, code
- *
  * Copyright (c) 2001 Virtual Unlimited B.V.
  *
- * Author: Bob Deblier <bob@virtualunlimited.com>
- *
  * 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
  *
  */
 
+/*!\file memchunk.c
+ * \author Bob Deblier <bob.deblier@pandora.be>
+ */
+
 #include "system.h"
 #include "memchunk.h"
 #include "debug.h"
index 86f6683..75e4f8f 100644 (file)
@@ -1,8 +1,4 @@
 /*
- * memchunk.h
- *
- * Beecrypt memory block handling, header
- *
  * Copyright (c) 2001 Virtual Unlimited B.V.
  *
  * This library is free software; you can redistribute it and/or
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/*!\file memchunk.h
+ * \author Bob Deblier <bob.deblier@pandora.be>
+ */
+
 #ifndef _MEMCHUNK_H
 #define _MEMCHUNK_H
 
index 4fd0571..b4685f0 100644 (file)
@@ -395,19 +395,19 @@ void mpand(size_t size, mpw* xdata, const mpw* ydata)
 }
 #endif
 
-#ifndef ASM_MPXOR
-void mpxor(size_t size, mpw* xdata, const mpw* ydata)
+#ifndef ASM_MPOR
+void mpor(size_t size, mpw* xdata, const mpw* ydata)
 {
        while (size--)
-               xdata[size] ^= ydata[size];
+               xdata[size] |= ydata[size];
 }
 #endif
 
-#ifndef ASM_MPOR
-void mpor(size_t size, mpw* xdata, const mpw* ydata)
+#ifndef ASM_MPXOR
+void mpxor(size_t size, mpw* xdata, const mpw* ydata)
 {
        while (size--)
-               xdata[size] |= ydata[size];
+               xdata[size] ^= ydata[size];
 }
 #endif
 
@@ -1016,7 +1016,6 @@ void mprshift(size_t size, mpw* data, size_t count)
 #endif
 
 #ifndef ASM_MPRSHIFTLSZ
-/* x must be != 0 */
 size_t mprshiftlsz(size_t size, mpw* data)
 {
        register mpw* slide = data+size-1;
index 3c18c05..c83bca2 100644 (file)
@@ -134,14 +134,13 @@ void mpbset(mpbarrett* b, size_t size, const mpw* data)
                {
                        mpw* temp = (mpw*) malloc((6*size+4) * sizeof(*temp));
 
+                       assert(temp != NULL);
                        b->size = size;
                        b->mu = b->modl+size;
                        mpcopy(size, b->modl, data);
-                       /*@-nullpass@*/         /* temp may be NULL */
                        mpbmu_w(b, temp);
 
                        free(temp);
-                       /*@=nullpass@*/
                }
                else
                {
@@ -340,6 +339,7 @@ void mpbmod_w(const mpbarrett* b, const mpw* data, mpw* result, mpw* wksp)
 
        while (mpgex(b->size+1, wksp, b->size, b->modl))
                (void) mpsubx(b->size+1, wksp, b->size, b->modl);
+
        mpcopy(b->size, result, wksp+1);
 }
 
index c72d247..50be843 100644 (file)
@@ -26,14 +26,14 @@ LDADD =
 pythondir = $(pylibdir)/site-packages
 python_PROGRAMS = _bc.so
 
-_bc_so_SOURCES = _bc-py.c
+_bc_so_SOURCES =
 _bc_so_LDFLAGS = $(mylibs) $(LIBS) -shared -Wl,-soname,_bc.so
 
 noinst_LTLIBRARIES = libbc.la
-libbc_la_SOURCES = mpw-py.c rng-py.c
+libbc_la_SOURCES = _bc-py.c mpw-py.c rng-py.c
 
-_bc.so$(EXEEXT): $(_bc_so_OBJECTS) $(libbc_la_OBJECTS)
-       $(CC) -o $@ $(_bc_so_OBJECTS) $(libbc_la_OBJECTS) $(_bc_so_LDFLAGS)
+_bc.so$(EXEEXT): $(libbc_la_OBJECTS)
+       $(CC) -o $@ $(libbc_la_OBJECTS) $(_bc_so_LDFLAGS)
 
 splint_srcs = _bc-py.c $(libbc_la_sources)
 
index bd910bf..651478d 100644 (file)
@@ -4,7 +4,7 @@
 
 #define        _REENTRANT      1       /* XXX config.h collides with pyconfig.h */
 #define        _GNU_SOURCE             /* XXX pick up stpcpy et al */
-#include "system.h"
+#include "config.h"
 
 #include "Python.h"
 #include "longintrepr.h"
@@ -19,8 +19,6 @@
 
 #include "debug-py.c"
 
-#include "debug.h"
-
 #define ABS(_x)                ((_x) < 0 ? -(_x) : (_x))
 #if !defined(MAX)
 #define MAX(x, y) ((x) < (y) ? (y) : (x))
index a5b2a86..1a9173d 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 #define        _REENTRANT      1       /* XXX config.h collides with pyconfig.h */
-#include "system.h"
+#include "config.h"
 
 #include "Python.h"
 #ifdef __LCLINT__
@@ -15,8 +15,6 @@
 
 #include "debug-py.c"
 
-#include "debug.h"
-
 /*@unchecked@*/
 static int _rng_debug = 0;
 
index 1a23de4..2920abe 100644 (file)
@@ -73,3 +73,4 @@ bench: benchme benchhf benchbc
        ./benchbc AES 128
        ./benchbc Blowfish 128
        ./benchbc Blowfish 128
+