Remove broken asm mp32{even,odd} for now.
authorjbj <devnull@localhost>
Fri, 28 Sep 2001 00:35:50 +0000 (00:35 +0000)
committerjbj <devnull@localhost>
Fri, 28 Sep 2001 00:35:50 +0000 (00:35 +0000)
Add the RSA test(s) to beetest.

CVS patchset: 5086
CVS date: 2001/09/28 00:35:50

beecrypt/Makefile.am
beecrypt/Makefile.in
beecrypt/autogen.sh
beecrypt/configure
beecrypt/configure.in
beecrypt/dsa.c
beecrypt/gas/mp32opt.i386.S
beecrypt/mp32opt.h
beecrypt/tests/Makefile.am
beecrypt/tests/Makefile.in
beecrypt/tests/beetest.c

index 05eada2..c241d0d 100644 (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/%)
index e56bdf0..98f0766 100644 (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/%)
index 78c54ef..2807b71 100755 (executable)
@@ -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
index ead258d..845da73 100755 (executable)
@@ -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"
index 5460a3c..5d6a507 100644 (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"
index ce5d912..7887462 100644 (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);
index 2f3eef9..1154baf 100644 (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)
index d49aa79..c6e7b3d 100644 (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
index be569c2..56bd936 100644 (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
 
index c0f520f..6b1d117 100644 (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
index 3d69ea6..5d5675d 100644 (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;