Add the RSA test(s) to beetest.
CVS patchset: 5086
CVS date: 2001/09/28 00:35:50
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/%)
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/%)
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
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
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"
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
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"
// 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;
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);
C_FUNCTION_END(mp32fill, .Lmp32fill_size)
+#if 0 /* BROKEN! */
C_FUNCTION_BEGIN(mp32even)
mov 4(%esp),%ecx
mov 8(%esp),%eax
and %eax,1
ret
C_FUNCTION_END(mp32odd, .Lmp32odd_size)
+#endif
C_FUNCTION_BEGIN(mp32addw)
# 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
EXTRA_PROGRAMS = beetest openpgp base64bug
beetest_SOURCES = beetest.c
+beetest_LDFLAGS = -all-static
openpgp_SOURCES = openpgp.c
EXTRA_PROGRAMS = beetest openpgp base64bug
beetest_SOURCES = beetest.c
+beetest_LDFLAGS = -all-static
openpgp_SOURCES = openpgp.c
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
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)
/*@*/
{
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/
{
+ dlkp_p keypair;
+
int i, j;
printf("the beecrypt library implements:\n");
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;