diff options
author | jbj <devnull@localhost> | 2001-09-28 00:35:50 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-09-28 00:35:50 +0000 |
commit | 367788b45e31e08cc493e5d1fa828c6d370f0427 (patch) | |
tree | 2cd6eb3419a03cbd6df84001663e32111d39cf93 | |
parent | aeb07623428910e8811818209cc4389cd4296d58 (diff) | |
download | librpm-tizen-367788b45e31e08cc493e5d1fa828c6d370f0427.tar.gz librpm-tizen-367788b45e31e08cc493e5d1fa828c6d370f0427.tar.bz2 librpm-tizen-367788b45e31e08cc493e5d1fa828c6d370f0427.zip |
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
-rw-r--r-- | beecrypt/Makefile.am | 5 | ||||
-rw-r--r-- | beecrypt/Makefile.in | 5 | ||||
-rwxr-xr-x | beecrypt/autogen.sh | 2 | ||||
-rwxr-xr-x | beecrypt/configure | 4 | ||||
-rw-r--r-- | beecrypt/configure.in | 4 | ||||
-rw-r--r-- | beecrypt/dsa.c | 5 | ||||
-rw-r--r-- | beecrypt/gas/mp32opt.i386.S | 2 | ||||
-rw-r--r-- | beecrypt/mp32opt.h | 2 | ||||
-rw-r--r-- | beecrypt/tests/Makefile.am | 1 | ||||
-rw-r--r-- | beecrypt/tests/Makefile.in | 2 | ||||
-rw-r--r-- | beecrypt/tests/beetest.c | 81 |
11 files changed, 105 insertions, 8 deletions
diff --git a/beecrypt/Makefile.am b/beecrypt/Makefile.am index 05eada217..c241d0d47 100644 --- a/beecrypt/Makefile.am +++ b/beecrypt/Makefile.am @@ -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/%) diff --git a/beecrypt/Makefile.in b/beecrypt/Makefile.in index e56bdf0fa..98f0766ea 100644 --- a/beecrypt/Makefile.in +++ b/beecrypt/Makefile.in @@ -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/%) diff --git a/beecrypt/autogen.sh b/beecrypt/autogen.sh index 78c54efcb..2807b7149 100755 --- a/beecrypt/autogen.sh +++ b/beecrypt/autogen.sh @@ -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 diff --git a/beecrypt/configure b/beecrypt/configure index ead258df8..845da73a8 100755 --- a/beecrypt/configure +++ b/beecrypt/configure @@ -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" diff --git a/beecrypt/configure.in b/beecrypt/configure.in index 5460a3c5e..5d6a50701 100644 --- a/beecrypt/configure.in +++ b/beecrypt/configure.in @@ -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" diff --git a/beecrypt/dsa.c b/beecrypt/dsa.c index ce5d91234..78874623d 100644 --- a/beecrypt/dsa.c +++ b/beecrypt/dsa.c @@ -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); diff --git a/beecrypt/gas/mp32opt.i386.S b/beecrypt/gas/mp32opt.i386.S index 2f3eef9e0..1154baf33 100644 --- a/beecrypt/gas/mp32opt.i386.S +++ b/beecrypt/gas/mp32opt.i386.S @@ -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) diff --git a/beecrypt/mp32opt.h b/beecrypt/mp32opt.h index d49aa79f1..c6e7b3d18 100644 --- a/beecrypt/mp32opt.h +++ b/beecrypt/mp32opt.h @@ -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 diff --git a/beecrypt/tests/Makefile.am b/beecrypt/tests/Makefile.am index be569c2e3..56bd93683 100644 --- a/beecrypt/tests/Makefile.am +++ b/beecrypt/tests/Makefile.am @@ -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 diff --git a/beecrypt/tests/Makefile.in b/beecrypt/tests/Makefile.in index c0f520fc7..6b1d1171a 100644 --- a/beecrypt/tests/Makefile.in +++ b/beecrypt/tests/Makefile.in @@ -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 diff --git a/beecrypt/tests/beetest.c b/beecrypt/tests/beetest.c index 3d69ea6ae..5d5675dac 100644 --- a/beecrypt/tests/beetest.c +++ b/beecrypt/tests/beetest.c @@ -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; |