Remove broken asm mp32{even,odd} for now.

Add the RSA test(s) to beetest.

CVS patchset: 5086
CVS date: 2001/09/28 00:35:50
This commit is contained in:
jbj 2001-09-28 00:35:50 +00:00
parent aeb0762342
commit 367788b45e
11 changed files with 105 additions and 8 deletions

View File

@ -54,6 +54,11 @@ pkginclude_HEADERS = base64.h beecrypt.h blockmode.h blockpad.h blowfish.h blowf
EXTRA_DIST = BENCHMARKS BUGS CONTRIBUTORS Doxyfile.in Doxyheader README.DLL README.WIN32 beecrypt.def beecrypt.mcp beecrypt.rc beecrypt.spec config.h config.gas.h config.win.h javaglue.h
.PHONY: beetest
beetest: all
make -C tests beetest
./tests/beetest
.PHONY: sources
sources:
@echo $(libbeecrypt_la_SOURCES:%=beecrypt/%)

View File

@ -554,6 +554,11 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
.PHONY: beetest
beetest: all
make -C tests beetest
./tests/beetest
.PHONY: sources
sources:
@echo $(libbeecrypt_la_SOURCES:%=beecrypt/%)

View File

@ -38,7 +38,7 @@ if [ X"$@" = X -a "X`uname -s`" = "XLinux" ]; then
mandir=/usr/man
infodir=/usr/info
fi
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=${infodir} --mandir=${mandir} "$@"
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=${infodir} --mandir=${mandir} --enable-static "$@"
else
./configure "$@"
fi

4
beecrypt/configure vendored
View File

@ -6908,7 +6908,7 @@ if test "$ac_enable_debug" = yes; then
fi
else
if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -O3"
CFLAGS="$CFLAGS -O3 -g"
if test "$ac_enable_optimized" = yes; then
case $target_cpu in
# This switch makes the mp32 routines slower by about 10%, so it's disabled
@ -6928,7 +6928,7 @@ else
CFLAGS="$CFLAGS -mpentium -march=pentium -fomit-frame-pointer"
;;
i686)
CFLAGS="$CFLAGS -mpentiumpro -march=pentiumpro -fomit-frame-pointer"
CFLAGS="$CFLAGS -mpentiumpro -march=pentiumpro -fomit-frame-pointer"
;;
sparcv8)
CFLAGS="$CFLAGS -mv8"

View File

@ -407,7 +407,7 @@ if test "$ac_enable_debug" = yes; then
fi
else
if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -O3"
CFLAGS="$CFLAGS -O3 -g"
if test "$ac_enable_optimized" = yes; then
case $target_cpu in
# This switch makes the mp32 routines slower by about 10%, so it's disabled
@ -427,7 +427,7 @@ else
CFLAGS="$CFLAGS -mpentium -march=pentium -fomit-frame-pointer"
;;
i686)
CFLAGS="$CFLAGS -mpentiumpro -march=pentiumpro -fomit-frame-pointer"
CFLAGS="$CFLAGS -mpentiumpro -march=pentiumpro -fomit-frame-pointer"
;;
sparcv8)
CFLAGS="$CFLAGS -mv8"

View File

@ -85,7 +85,8 @@ int dsasign(const mp32barrett* p, const mp32barrett* q, const mp32number* g, ran
// get a random k, invertible modulo q
mp32brndinv_w(q, rgc, qtemp, qtemp+qsize, qwksp);
/* FIPS 186 test vectors
#if 0
/* FIPS 186 test vectors for k, http://www.itl.nist.gov/fipspubs/186chg-1.htm */
qtemp[0] = 0x358dad57;
qtemp[1] = 0x1462710f;
qtemp[2] = 0x50e254cf;
@ -93,7 +94,7 @@ int dsasign(const mp32barrett* p, const mp32barrett* q, const mp32number* g, ran
qtemp[4] = 0xdeaadfbf;
mp32binv_w(q, qsize, qtemp, qtemp+qsize, qwksp);
*/
#endif
// g^k mod p
mp32bpowmod_w(p, g->size, g->data, qsize, qtemp, ptemp, pwksp);

View File

@ -60,6 +60,7 @@ C_FUNCTION_BEGIN(mp32fill)
C_FUNCTION_END(mp32fill, .Lmp32fill_size)
#if 0 /* BROKEN! */
C_FUNCTION_BEGIN(mp32even)
mov 4(%esp),%ecx
mov 8(%esp),%eax
@ -77,6 +78,7 @@ C_FUNCTION_BEGIN(mp32odd)
and %eax,1
ret
C_FUNCTION_END(mp32odd, .Lmp32odd_size)
#endif
C_FUNCTION_BEGIN(mp32addw)

View File

@ -72,8 +72,10 @@ extern "C" {
# if defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)
# define ASM_MP32ZERO
# define ASM_MP32FILL
#if 0 /* XXX BROKEN! */
# define ASM_MP32EVEN
# define ASM_MP32ODD
#endif
# define ASM_MP32ADDW
# define ASM_MP32ADD
# define ASM_MP32SUBW

View File

@ -28,6 +28,7 @@ LDADD = $(top_builddir)/libbeecrypt.la
EXTRA_PROGRAMS = beetest openpgp base64bug
beetest_SOURCES = beetest.c
beetest_LDFLAGS = -all-static
openpgp_SOURCES = openpgp.c

View File

@ -113,6 +113,7 @@ LDADD = $(top_builddir)/libbeecrypt.la
EXTRA_PROGRAMS = beetest openpgp base64bug
beetest_SOURCES = beetest.c
beetest_LDFLAGS = -all-static
openpgp_SOURCES = openpgp.c
@ -128,7 +129,6 @@ LIBS = @LIBS@
beetest_OBJECTS = beetest.$(OBJEXT)
beetest_LDADD = $(LDADD)
beetest_DEPENDENCIES = $(top_builddir)/libbeecrypt.la
beetest_LDFLAGS =
openpgp_OBJECTS = openpgp.$(OBJEXT)
openpgp_LDADD = $(LDADD)
openpgp_DEPENDENCIES = $(top_builddir)/libbeecrypt.la

View File

@ -301,6 +301,19 @@ static int testVectorDHAES(const dlkp_p* keypair)
return -1;
}
#if 0
/*@unused@*/ static int testVectorDSA(void)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
{
int rc = 0;
randomGeneratorContext rngc;
return rc;
}
#endif
/*@unused@*/ static int testVectorDLDP(void)
/*@*/
{
@ -853,6 +866,8 @@ int main(/*@unused@*/int argc, /*@unused@*/char *argv[])
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/
{
dlkp_p keypair;
int i, j;
printf("the beecrypt library implements:\n");
@ -918,6 +933,72 @@ int main(/*@unused@*/int argc, /*@unused@*/char *argv[])
testDLParams();
/*@=modnomods@*/
if (testVectorMD5())
printf("MD5 works!\n");
else
exit(EXIT_FAILURE);
if (testVectorSHA1())
printf("SHA-1 works!\n");
else
exit(EXIT_FAILURE);
if (testVectorSHA256())
printf("SHA-256 works!\n");
else
exit(EXIT_FAILURE);
/*@-compdef@*/
(void) dlkp_pInit(&keypair);
mp32bsethex(&keypair.param.p, dsa_p);
mp32bsethex(&keypair.param.q, dsa_q);
mp32nsethex(&keypair.param.g, dsa_g);
mp32bsethex(&keypair.param.n, elg_n);
mp32nsethex(&keypair.y, dsa_y);
mp32nsethex(&keypair.x, dsa_x);
if (testVectorInvMod(&keypair))
printf("InvMod works!\n");
else
exit(EXIT_FAILURE);
if (testVectorExpMod(&keypair))
printf("ExpMod works!\n");
else
exit(EXIT_FAILURE);
if (testVectorElGamalV1(&keypair))
printf("ElGamal v1 works!\n");
else
exit(EXIT_FAILURE);
if (testVectorElGamalV3(&keypair))
printf("ElGamal v3 works!\n");
else
exit(EXIT_FAILURE);
#if 0
if (testVectorDHAES(&keypair))
printf("DHAES works!\n");
else
exit(EXIT_FAILURE);
#endif
(void) dlkp_pFree(&keypair);
/*@=compdef@*/
if (testVectorRSA())
printf("RSA works!\n");
else
exit(EXIT_FAILURE);
#if 1
if (testVectorDLDP())
printf("dldp with generator of order q works!\n");
else
exit(EXIT_FAILURE);
#endif
printf("done\n");
return 0;