-BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 (--with-arch=pentium3)
+Note: timings are average values and may vary under different conditions,
i.e. the amount of free memory, swapped memory, amount of cpu cache, etc.
I've tried to make them as accurate as possible, within limits.
BENCHmark Modular Exponentation (more is better):
-BeeCrypt 3.0.0 | gcc-3.2.2 | Debian Linux 3.0 | Itanium 2 900 | 12 GB: 7317 ()
-BeeCrypt 3.0.0 | gcc-3.3 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 6920 (--with-arch=pentium4)
-BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0 | Alpha EV6.7 666 | 2 GB: 5742 ()
-BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 3280 (--with-arch=pentiumpro)
-BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 1782 (--with-arch=powerpc64)
-BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 (--with-arch=pentium3)
-BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 756 ()
-BeeCrypt 3.0.0 | Forte C 5.1 | Solaris 8 | UltraSparc II 400 | 4 GB: 425 (--with-arch=sparcv8plus)
-BeeCrypt 3.0.0 | | Debian Linux 3.0 | StrongARM 1110 128 | 32 MB: 341 ()
-BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68030 25 | 36 MB: 8 ()
+BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | Opteron MP 1600 | : 17230
+BeeCrypt 3.0.0 | gcc-3.2.2 | Debian Linux 3.0 | Itanium 2 900 | 12 GB: 7317
+BeeCrypt 3.0.0 | gcc-3.3 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 6920 [--with-arch=pentium4]
+BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0 | Alpha EV6.7 666 | 2 GB: 5742
+BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 3280 [--with-arch=pentiumpro]
+BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | POWER4+ 1200 | : 2592
+BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | P3 Xeon 900 | : 2169
+BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 1782 [--with-arch=powerpc64]
+BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | zSeries 900 | : 1687 (s390x)
+BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 [--with-arch=pentium3]
+BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 756
+BeeCrypt 3.0.0 | Forte C 5.1 | Solaris 8 | UltraSparc II 400 | 4 GB: 425 [--with-arch=sparcv8plus]
+BeeCrypt 3.0.0 | | Debian Linux 3.0 | StrongARM 1110 128 | 32 MB: 341
+BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68040 33 | 52 MB: 24
+BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68030 25 | 36 MB: 8
BENCHmark Hash Function (more is better):
MD5
-BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 137.0 MB/s (--with-arch=pentiumpro)
+BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 137.0 MB/s [--with-arch=pentiumpro]
SHA-1
-BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 77.0 MB/s (--with-arch=pentiumpro)
+BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 77.0 MB/s [--with-arch=pentiumpro]
SHA-256
-BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 37.8 MB/s (--with-arch=pentiumpro)
+BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 37.8 MB/s [--with-arch=pentiumpro]
BENCHmark Block Cipher (more is better):
AES, 128 bits
-BLowfish, 128 bits
+Blowfish, 128 bits
Welcome to the BeeCrypt crypto library!
-Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002 Virtual Unlimited B.V.
+Copyright (c) 1997, 1998, 1999, 2000, 2001 Virtual Unlimited B.V.
+Copyright (c) 2002, 2003, Bob Deblier (for certain parts)
Author: Bob Deblier <bob.deblier@pandora.be>
fi
if test "$ac_enable_debug" = yes; then
BEECRYPT_CFLAGS_REM([-O2])
- CFLAGS="$CFLAGS -Wall"
+ CFLAGS="$CFLAGS -Wall -pedantic"
else
# Generic optimizations, including cpu tuning
BEECRYPT_CFLAGS_REM([-g])
if (s == NULL) return NULL;
if (*s == '\0') return calloc(1, sizeof(*t));
- if (ns == 0) ns = strlen(s);
+ if (ns == 0) ns = strlen((const char*) s);
nt = ((ns + 2) / 3) * 4;
/* Add additional bytes necessary for eol string(s). */
}
/*@-mustfree -compdef @*/
- return t;
+ return (char *) t;
/*@=mustfree =compdef @*/
}
/*@=globs =internalglobs =modfilesys @*/
@INCLUDE_STDINT_H@
@INCLUDE_SYNCH_H@
@INCLUDE_PTHREAD_H@
+@INCLUDE_STDIO_H@
@INCLUDE_STDLIB_H@
@INCLUDE_MALLOC_H@
@INCLUDE_STRING_H@
+@INCLUDE_UNISTD_H@
@TYPEDEF_BC_LOCK_T@
{
/*@observer@*/
const char* name; /*!< random generator name */
- const unsigned int paramsize;
+ const size_t paramsize;
const randomGeneratorSetup setup;
const randomGeneratorSeed seed;
const randomGeneratorNext next;
{
/*@observer@*/
const char* name; /*!< hash function name */
- const unsigned int paramsize; /*!< in bytes */
- const unsigned int blocksize; /*!< in bytes */
- const unsigned int digestsize; /*!< in bytes */
+ const size_t paramsize; /*!< in bytes */
+ const size_t blocksize; /*!< in bytes */
+ const size_t digestsize; /*!< in bytes */
const hashFunctionReset reset;
const hashFunctionUpdate update;
const hashFunctionDigest digest;
{
/*@observer@*/
const char* name; /*!< keyed hash function name */
- const unsigned int paramsize; /*!< in bytes */
- const unsigned int blocksize; /*!< in bytes */
- const unsigned int digestsize; /*!< in bytes */
- const unsigned int keybitsmin; /*!< min keysize in bits */
- const unsigned int keybitsmax; /*!< max keysize in bits */
- const unsigned int keybitsinc; /*!< keysize increment in bits */
+ const size_t paramsize; /*!< in bytes */
+ const size_t blocksize; /*!< in bytes */
+ const size_t digestsize; /*!< in bytes */
+ const size_t keybitsmin; /*!< min keysize in bits */
+ const size_t keybitsmax; /*!< max keysize in bits */
+ const size_t keybitsinc; /*!< keysize increment in bits */
const keyedHashFunctionSetup setup;
const keyedHashFunctionReset reset;
const keyedHashFunctionUpdate update;
{
/*@observer@*/
const char* name; /*!< block cipher name */
- const unsigned int paramsize; /*!< in bytes */
- const unsigned int blocksize; /*!< in bytes */
- const unsigned int keybitsmin; /*!< min keysize in bits */
- const unsigned int keybitsmax; /*!< max keysize in bits */
- const unsigned int keybitsinc; /*!< keysize increment in bits */
+ const size_t paramsize; /*!< in bytes */
+ const size_t blocksize; /*!< in bytes */
+ const size_t keybitsmin; /*!< min keysize in bits */
+ const size_t keybitsmax; /*!< max keysize in bits */
+ const size_t keybitsinc; /*!< keysize increment in bits */
const blockCipherSetup setup;
const blockCipherSetIV setiv;
const blockCipherEncrypt encrypt;
const blockCipherDecrypt decrypt;
- const blockCipherFeedback getfb;
+ const blockCipherFeedback getfb;
} blockCipher;
#ifdef __cplusplus
#endif
#if defined(_MSC_VER) || __MWERKS__
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
if (tmp)
{
byte padvalue;
- int i;
+ unsigned int i;
/*@-usedef@*/ /* LCL: tmp->{data,size} not initialized? */
if (tmp->data == (byte*) 0)
{
memchunk* tmp;
byte padvalue;
- int i;
+ unsigned int i;
if (src == (memchunk*) 0)
return (memchunk*) 0;
{
register uint32_t* p = bp->p;
register uint32_t* s = bp->s;
- register int i, j, k;
+ register unsigned int i, j, k;
uint32_t tmp, work[2];
AH_TEMPLATE([HAVE_CTYPE_H],[.])
AH_TEMPLATE([HAVE_ERRNO_H],[.])
AH_TEMPLATE([HAVE_FCNTL_H],[.])
-AH_TEMPLATE([HAVE_MALLOC_H],[.])
-AH_TEMPLATE([HAVE_STDLIB_H],[.])
-AH_TEMPLATE([HAVE_STRING_H],[.])
AH_TEMPLATE([HAVE_TERMIO_H],[.])
AH_TEMPLATE([HAVE_TERMIOS_H],[.])
AH_TEMPLATE([HAVE_TIME_H],[.])
-AH_TEMPLATE([HAVE_UNISTD_H],[.])
AH_TEMPLATE([HAVE_SYS_AUDIOIO_H],[.])
AH_TEMPLATE([HAVE_SYS_IOCTL_H],[.])
AH_TEMPLATE([HAVE_SEMAPHORE_H],[.])
AH_TEMPLATE([HAVE_AIO_H],[.])
-AH_TEMPLATE([HAVE_MTMALLOC_H],[.])
AH_TEMPLATE([HAVE_DEV_AUDIO],[Define to 1 if your system has device /dev/audio])
AH_TEMPLATE([HAVE_DEV_DSP],[Define to 1 if your system has device /dev/dsp])
AC_HEADER_STDC
AC_CHECK_HEADERS([time.h sys/time.h])
AC_HEADER_TIME
-AC_CHECK_HEADERS([ctype.h errno.h fcntl.h malloc.h termio.h termios.h])
-AC_CHECK_HEADERS([sys/ioctl sys/audioio.h sys/soundcard.h])
+AC_CHECK_HEADERS([stdio.h ctype.h errno.h fcntl.h malloc.h termio.h termios.h])
+AC_CHECK_HEADERS([sys/ioctl.h sys/audioio.h sys/soundcard.h])
+bc_include_stdio_h=
bc_include_stdlib_h=
bc_include_malloc_h=
bc_include_string_h=
+bc_include_unistd_h=
+if test "$ac_cv_header_stdio_h" = yes; then
+ bc_include_stdio_h="#include <stdio.h>"
+fi
if test "$ac_cv_header_stdlib_h" = yes; then
bc_include_stdlib_h="#include <stdlib.h>"
elif test "$ac_cv_header_malloc_h" = yes; then
if test "$ac_cv_header_string_h" = yes; then
bc_include_string_h="#include <string.h>"
fi
+if test "$ac_cv_header_unistd_h" = yes; then
+ bc_include_unistd_h="#include <unistd.h>"
+fi
+AC_SUBST(INCLUDE_STDIO_H,$bc_include_stdio_h)
AC_SUBST(INCLUDE_STDLIB_H,$bc_include_stdlib_h)
AC_SUBST(INCLUDE_MALLOC_H,$bc_include_malloc_h)
AC_SUBST(INCLUDE_STRING_H,$bc_include_string_h)
+AC_SUBST(INCLUDE_UNISTD_H,$bc_include_unistd_h)
if test "$ac_enable_threads" = yes; then
AC_CHECK_HEADERS([thread.h pthread.h synch.h semaphore.h])
const hashFunction* hash;
const blockCipher* cipher;
const keyedHashFunction* mac;
- int cipherkeybits;
- int mackeybits;
+ size_t cipherkeybits;
+ size_t mackeybits;
} dhaes_pParameters;
/**
hashFunctionContext hash;
blockCipherContext cipher;
keyedHashFunctionContext mac;
- int cipherkeybits;
- int mackeybits;
+ size_t cipherkeybits;
+ size_t mackeybits;
} dhaes_pContext;
#ifdef __cplusplus
#include "beecrypt.h"
-#include <stdio.h>
-
#ifdef __cplusplus
inline int16_t swap16(int16_t n)
{
sha1Param param;
mpw state[FIPS186_STATE_SIZE];
byte digest[20];
- int digestremain;
+ unsigned char digestremain;
} fips186Param;
#ifdef __cplusplus
dnl aesopt.ppc.m4
dnl
-dnl NOTE: Only works for big-endian PowerPC!
+dnl NOTE: Only tested for big-endian PowerPC!
dnl
dnl Copyright (c) 2003 Bob Deblier
dnl
dnl blowfishopt.ppc.m4
dnl
+dnl Note: Only tested on big-endian PowerPC!
+dnl
dnl Copyright (c) 2003 Bob Deblier
dnl
dnl Author: Bob Deblier <bob.deblier@pandora.be>
li r0,0
lwbrx r7,r5,r0
li r0,4
- lwbrx r7,r5,r0
+ lwbrx r8,r5,r0
')
eblock
li r0,4
stwbrx r7,r4,r0
li r0,0
- stwbrx r7,r4,r0
+ stwbrx r8,r4,r0
')
li r3,0
int hmacSetup(byte* kxi, byte* kxo, const hashFunction* hash, hashFunctionParam* param, const byte* key, size_t keybits)
{
- register unsigned i;
+ register unsigned int i;
size_t keybytes = keybits >> 3;
/* if the key is too large, hash it first */
int md5Update(md5Param* mp, const byte* data, size_t size)
{
- register int proclength;
+ register unsigned short proclength;
#if (MP_WBITS == 64)
mpw add[1];
/*@-type@*/
while (size > 0)
{
- proclength = ((mp->offset + size) > 64) ? (64 - mp->offset) : size;
+ proclength = ((mp->offset + size) > 64U) ? (64U - mp->offset) : size;
memmove(((byte *) mp->data) + mp->offset, data, proclength);
size -= proclength;
data += proclength;
mp->offset += proclength;
- if (mp->offset == 64)
+ if (mp->offset == 64U)
{
md5Process(mp);
mp->offset = 0;
#else
# error
#endif
- short offset;
+ unsigned short offset;
} md5Param;
#ifdef __cplusplus
/* count 'all zero' words and move src pointer */
while (size--)
{
- /* test if we a non-zero word */
+ /* test if we have a non-zero word */
if ((carry = *(slide--)))
{
/* count 'least signification zero bits and set zbits counter */
zwords++;
}
+ if ((rbits == 0) && (zwords == 0))
+ return 0;
+
/* shouldn't happen, but let's test anyway */
if (size == 0)
return 0;
/* get the smallest returned values, and set shift to that */
shift = mprshiftlsz(size, wksp);
-
temp = mprshiftlsz(size, result);
if (shift > temp)
int sha1Update(sha1Param* sp, const byte* data, size_t size)
{
- register int proclength;
+ register unsigned short proclength;
#if (MP_WBITS == 64)
mpw add[1];
/*@-type@*/
while (size > 0)
{
- proclength = ((sp->offset + size) > 64) ? (64 - sp->offset) : size;
+ proclength = ((sp->offset + size) > 64U) ? (64U - sp->offset) : size;
memmove(((byte *) sp->data) + sp->offset, data, proclength);
size -= proclength;
data += proclength;
sp->offset += proclength;
- if (sp->offset == 64)
+ if (sp->offset == 64U)
{
sha1Process(sp);
sp->offset = 0;
#else
# error
#endif
- short offset;
+ unsigned short offset;
} sha1Param;
#ifdef __cplusplus
int sha256Update(sha256Param* sp, const byte* data, size_t size)
{
- register int proclength;
+ register unsigned short proclength;
#if (MP_WBITS == 64)
mpw add[1];
/*@-type@*/
while (size > 0)
{
- proclength = ((sp->offset + size) > 64) ? (64 - sp->offset) : size;
+ proclength = ((sp->offset + size) > 64U) ? (64U - sp->offset) : size;
memmove(((byte *) sp->data) + sp->offset, data, proclength);
size -= proclength;
data += proclength;
sp->offset += proclength;
- if (sp->offset == 64)
+ if (sp->offset == 64U)
{
sha256Process(sp);
sp->offset = 0;
#else
# error
#endif
- short offset;
+ unsigned short offset;
} sha256Param;
#ifdef __cplusplus