summaryrefslogtreecommitdiff
path: root/beecrypt
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-05-02 16:18:50 +0000
committerjbj <devnull@localhost>2003-05-02 16:18:50 +0000
commitf3de276031932be5311f97694c581d312393330e (patch)
treeeb04649ebf0f853405de76965252d7794724cedc /beecrypt
parent366f697b6690d245319eb856985e84625c25236d (diff)
downloadrpm-f3de276031932be5311f97694c581d312393330e.tar.gz
rpm-f3de276031932be5311f97694c581d312393330e.tar.bz2
rpm-f3de276031932be5311f97694c581d312393330e.zip
Import changes from latest beecrypt-3.0.0.
CVS patchset: 6803 CVS date: 2003/05/02 16:18:50
Diffstat (limited to 'beecrypt')
-rw-r--r--beecrypt/Makefile.am1
-rw-r--r--beecrypt/acinclude.m43
-rw-r--r--beecrypt/beecrypt.h15
-rw-r--r--beecrypt/blowfish.c2
-rw-r--r--beecrypt/dsa.c3
-rw-r--r--beecrypt/dsa.h1
-rw-r--r--beecrypt/elgamal.c2
-rw-r--r--beecrypt/gas/ppc.m474
-rw-r--r--beecrypt/gas/x86.m415
-rw-r--r--beecrypt/hmac.c1
-rw-r--r--beecrypt/mpbarrett.h2
-rw-r--r--beecrypt/mtprng.h6
-rw-r--r--beecrypt/rsakp.c6
-rw-r--r--beecrypt/sha1opt.h8
-rw-r--r--beecrypt/sha256.c6
15 files changed, 88 insertions, 57 deletions
diff --git a/beecrypt/Makefile.am b/beecrypt/Makefile.am
index ac6378fe6..fe9d3cece 100644
--- a/beecrypt/Makefile.am
+++ b/beecrypt/Makefile.am
@@ -39,6 +39,7 @@ LINT = splint
SUBDIRS = docs gas masm mwerks tests
SUFFIXES = .s
+
.s.lo:
$(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
diff --git a/beecrypt/acinclude.m4 b/beecrypt/acinclude.m4
index 192515165..78da2712b 100644
--- a/beecrypt/acinclude.m4
+++ b/beecrypt/acinclude.m4
@@ -391,6 +391,7 @@ AC_DEFUN(BEECRYPT_INTEL_CC,[
])
if test "$bc_cv_prog_INTEL_CC" = yes; then
if test "$ac_enable_debug" != yes; then
+ BEECRYPT_CFLAGS_REM([-g])
CFLAGS="$CFLAGS -O3"
case $bc_target_cpu in
i586 | pentium | pentium-mmx)
@@ -511,7 +512,7 @@ AC_DEFUN(BEECRYPT_ASM_GSYM_PREFIX,[
*) bc_cv_asm_gsym_prefix="" ;;
esac
])
- AC_SUBST(ASM_GSYM_PREFIX,$bc_cv_asm_sym_prefix)
+ AC_SUBST(ASM_GSYM_PREFIX,$bc_cv_asm_gsym_prefix)
])
diff --git a/beecrypt/beecrypt.h b/beecrypt/beecrypt.h
index 86f881337..d1c46b29c 100644
--- a/beecrypt/beecrypt.h
+++ b/beecrypt/beecrypt.h
@@ -1,8 +1,4 @@
/*
- * beecrypt.h
- *
- * BeeCrypt library hooks & stubs, header
- *
* Copyright (c) 1999, 2000, 2001, 2002 Virtual Unlimited B.V.
*
* This library is free software; you can redistribute it and/or
@@ -21,6 +17,17 @@
*
*/
+/*!\file beecrypt.h
+ * \brief BeeCrypt API, headers.
+ *
+ * These API functions provide an abstract way for using most of
+ * the various algorithms implemented by the library.
+ *
+ * \author Bob Deblier <bob.deblier@pandora.be>
+ * \ingroup ES_m PRNG_m HASH_m HMAC_m BC_m
+ */
+
+
#ifndef _BEECRYPT_H
#define _BEECRYPT_H
diff --git a/beecrypt/blowfish.c b/beecrypt/blowfish.c
index 119a75a9d..04f7e0f5a 100644
--- a/beecrypt/blowfish.c
+++ b/beecrypt/blowfish.c
@@ -19,7 +19,7 @@
/*!\file blowfish.c
* \brief Blowfish block cipher.
- *
+ *
* For more information on this blockcipher, see:
* "Applied Cryptography", second edition
* Bruce Schneier
diff --git a/beecrypt/dsa.c b/beecrypt/dsa.c
index f591211d4..ecea2a1b1 100644
--- a/beecrypt/dsa.c
+++ b/beecrypt/dsa.c
@@ -15,9 +15,8 @@
* 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 dsa.c
* \brief Digital Signature Algorithm, as specified by NIST FIPS 186.
*
diff --git a/beecrypt/dsa.h b/beecrypt/dsa.h
index e03ffba6c..4a682dce8 100644
--- a/beecrypt/dsa.h
+++ b/beecrypt/dsa.h
@@ -22,6 +22,7 @@
* \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup DL_m DL_dsa_m
*/
+
#ifndef _DSA_H
#define _DSA_H
diff --git a/beecrypt/elgamal.c b/beecrypt/elgamal.c
index f9ebc38df..f525d419e 100644
--- a/beecrypt/elgamal.c
+++ b/beecrypt/elgamal.c
@@ -22,7 +22,7 @@
*
* For more information on this algorithm, see:
* "Handbook of Applied Cryptography"
- * 11.5.2 "The ElGamal signature scheme", p. 454-459
+ * 11.5.2: "The ElGamal signature scheme", p. 454-459
*
* Two of the signature variants in Note 11.70 are described.
*
diff --git a/beecrypt/gas/ppc.m4 b/beecrypt/gas/ppc.m4
index f8e9865db..e22be6f15 100644
--- a/beecrypt/gas/ppc.m4
+++ b/beecrypt/gas/ppc.m4
@@ -18,7 +18,12 @@ 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(substr(ASM_OS,0,5),linux,`
+define(USE_NUMERIC_REGISTERS)
+')
+
ifelse(substr(ASM_OS,0,3),aix,`
+define(USE_NUMERIC_REGISTERS)
undefine(`C_FUNCTION_BEGIN')
define(C_FUNCTION_BEGIN,`
.toc
@@ -41,41 +46,7 @@ define(EXTERNAL_VARIABLE,`
L$1:
.tc $1[TC],$1[RW]
')
-
.machine "ppc"
-
- .set r0,0
- .set r1,1
- .set r2,2
- .set r3,3
- .set r4,4
- .set r5,5
- .set r6,6
- .set r7,7
- .set r8,8
- .set r9,9
- .set r10,10
- .set r11,11
- .set r12,12
- .set r13,13
- .set r14,14
- .set r15,15
- .set r16,16
- .set r17,17
- .set r18,18
- .set r19,19
- .set r20,20
- .set r21,21
- .set r22,22
- .set r23,23
- .set r24,24
- .set r25,25
- .set r26,26
- .set r27,27
- .set r28,28
- .set r29,29
- .set r30,30
- .set r31,31
',`
define(LOAD_ADDRESS,`
lis $2,$1@ha
@@ -83,3 +54,38 @@ define(LOAD_ADDRESS,`
')
define(EXTERNAL_VARIABLE)
')
+
+ifdef(`USE_NUMERIC_REGISTERS',`
+define(r0,0)
+define(r1,1)
+define(r2,2)
+define(r3,3)
+define(r4,4)
+define(r5,5)
+define(r6,6)
+define(r7,7)
+define(r8,8)
+define(r9,9)
+define(r10,10)
+define(r11,11)
+define(r12,12)
+define(r13,13)
+define(r14,14)
+define(r15,15)
+define(r16,16)
+define(r17,17)
+define(r18,18)
+define(r19,19)
+define(r20,20)
+define(r21,21)
+define(r22,22)
+define(r23,23)
+define(r24,24)
+define(r25,25)
+define(r26,26)
+define(r27,27)
+define(r28,28)
+define(r29,29)
+define(r30,30)
+define(r31,31)
+')
diff --git a/beecrypt/gas/x86.m4 b/beecrypt/gas/x86.m4
index 131c94df2..8881dc750 100644
--- a/beecrypt/gas/x86.m4
+++ b/beecrypt/gas/x86.m4
@@ -18,6 +18,19 @@ 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(substr(ASM_ARCH,0,6),athlon,`
+define(USE_BSWAP)
+')
+ifelse(substr(ASM_ARCHi,0,7),pentium,`
+define(USE_BSWAP)
+')
+ifelse(ASM_ARCH,i586,`
+define(USE_BSWAP)
+')
+ifelse(ASM_ARCH,i686,`
+define(USE_BSWAP)
+')
ifelse(ASM_ARCH,pentium4,`
- define(`USE_SSE2')
+define(USE_BSWAP)
+define(USE_SSE2)
')
diff --git a/beecrypt/hmac.c b/beecrypt/hmac.c
index b374643a8..f1711bddf 100644
--- a/beecrypt/hmac.c
+++ b/beecrypt/hmac.c
@@ -96,6 +96,7 @@ int hmacReset(const byte* kxi, const hashFunction* hash, hashFunctionParam* para
return -1;
if (hash->update(param, kxi, hash->blocksize))
return -1;
+
return 0;
}
diff --git a/beecrypt/mpbarrett.h b/beecrypt/mpbarrett.h
index e1321a44b..ada85aa71 100644
--- a/beecrypt/mpbarrett.h
+++ b/beecrypt/mpbarrett.h
@@ -18,7 +18,7 @@
*/
/*!\file mpbarrett.h
- * \brief Multi-precision integer routines using Barrett modular reduction, headers.
+ * \brief Multi-precision integer routines using Barrett modular reduction, headers.
* \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup MP_m
*/
diff --git a/beecrypt/mtprng.h b/beecrypt/mtprng.h
index 673cf5dc9..c77895411 100644
--- a/beecrypt/mtprng.h
+++ b/beecrypt/mtprng.h
@@ -62,10 +62,10 @@ typedef struct
# endif
# endif
#endif
- uint32_t state[N+1];
- uint32_t left;
+ uint32_t state[N+1];
+ uint32_t left;
/*@kept@*/
- uint32_t* nextw;
+ uint32_t* nextw;
} mtprngParam;
#ifdef __cplusplus
diff --git a/beecrypt/rsakp.c b/beecrypt/rsakp.c
index e846b1e68..eeaaa9191 100644
--- a/beecrypt/rsakp.c
+++ b/beecrypt/rsakp.c
@@ -61,11 +61,9 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, size_t nsize)
/* if p <= q, perform a swap to make p larger than q */
if (mple(pqsize, kp->p.modl, kp->q.modl))
{
- /*@-sizeoftype@*/
memcpy(&r, &kp->q, sizeof(r));
memcpy(&kp->q, &kp->p, sizeof(kp->q));
memcpy(&kp->p, &r, sizeof(kp->p));
- /*@=sizeoftype@*/
}
mpbzero(&r);
@@ -90,19 +88,15 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, size_t nsize)
if (mple(pqsize, kp->p.modl, r.modl))
{
mpbfree(&kp->q);
- /*@-sizeoftype@*/
memcpy(&kp->q, &kp->p, sizeof(kp->q));
memcpy(&kp->p, &r, sizeof(kp->p));
- /*@=sizeoftype@*/
mpbzero(&r);
newn = 1;
}
else if (mple(pqsize, kp->q.modl, r.modl))
{
mpbfree(&kp->q);
- /*@-sizeoftype@*/
memcpy(&kp->q, &r, sizeof(kp->q));
- /*@=sizeoftype@*/
mpbzero(&r);
newn = 1;
}
diff --git a/beecrypt/sha1opt.h b/beecrypt/sha1opt.h
index de68f44d7..304dfb319 100644
--- a/beecrypt/sha1opt.h
+++ b/beecrypt/sha1opt.h
@@ -38,7 +38,13 @@ extern "C" {
# endif
#endif
-#ifdef __GNUC__
+#if defined(__GNUC__)
+# if defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)
+# define ASM_SHA1PROCESS
+# endif
+#endif
+
+#if defined(__INTEL_COMPILER)
# if defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)
# define ASM_SHA1PROCESS
# endif
diff --git a/beecrypt/sha256.c b/beecrypt/sha256.c
index 62b2f7813..bfdef2365 100644
--- a/beecrypt/sha256.c
+++ b/beecrypt/sha256.c
@@ -94,14 +94,16 @@ void sha256Process(register sha256Param* p)
#else
w = p->data;
t = 16;
- while (t--) {
+ while (t--)
+ {
temp = swapu32(*w);
*(w++) = temp;
}
#endif
t = 48;
- while (t--) {
+ while (t--)
+ {
temp = sig1(w[-2]) + w[-7] + sig0(w[-15]) + w[-16];
*(w++) = temp;
}