diff options
author | jbj <devnull@localhost> | 2003-05-27 21:34:03 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2003-05-27 21:34:03 +0000 |
commit | 0148a73a15ad36e9c6b17fa1cdfa345e9d648d47 (patch) | |
tree | c6b01252b64c4758c5fb54bceccc61761936c90a | |
parent | 9e1e00f00a8873c85f5583e4f68df86cfe3d6dc3 (diff) | |
download | librpm-tizen-0148a73a15ad36e9c6b17fa1cdfa345e9d648d47.tar.gz librpm-tizen-0148a73a15ad36e9c6b17fa1cdfa345e9d648d47.tar.bz2 librpm-tizen-0148a73a15ad36e9c6b17fa1cdfa345e9d648d47.zip |
Another beecrypt-3.0.0 merge.
CVS patchset: 6875
CVS date: 2003/05/27 21:34:03
-rw-r--r-- | beecrypt/BENCHMARKS | 5 | ||||
-rw-r--r-- | beecrypt/Makefile.am | 10 | ||||
-rw-r--r-- | beecrypt/Makefile.mak | 45 | ||||
-rw-r--r-- | beecrypt/acinclude.m4 | 4 | ||||
-rw-r--r-- | beecrypt/configure.ac | 27 | ||||
-rw-r--r-- | beecrypt/gas/ia64.m4 | 30 | ||||
-rw-r--r-- | beecrypt/gas/mpopt.ia64.m4 | 92 | ||||
-rw-r--r-- | beecrypt/java/Makefile.am | 37 | ||||
-rw-r--r-- | beecrypt/java/javaglue.c (renamed from beecrypt/javaglue.c) | 31 | ||||
-rw-r--r-- | beecrypt/java/javaglue.h (renamed from beecrypt/javaglue.h) | 4 | ||||
-rw-r--r-- | beecrypt/mp.c | 30 | ||||
-rw-r--r-- | beecrypt/mp.h | 6 | ||||
-rw-r--r-- | beecrypt/mpopt.h | 1 |
13 files changed, 225 insertions, 97 deletions
diff --git a/beecrypt/BENCHMARKS b/beecrypt/BENCHMARKS index 81d30f378..eee4b2a4b 100644 --- a/beecrypt/BENCHMARKS +++ b/beecrypt/BENCHMARKS @@ -1,4 +1,4 @@ -Note: timings are average values and may vary under different conditions, +BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 (--with-arch=pentium3) i.e. the amount of free memory, swapped memory, amount of cpu cache, etc. I've tried to make them as accurate as possible, within limits. @@ -10,13 +10,14 @@ Linux - I'm just a little cramped for space... BENCHmark Modular Exponentation (more is better): -BeeCrypt 3.0.0 | gcc-3.2.2 | Debian Linux 3.0 | Itanium 2 900 | 12 GB: 6992 () +BeeCrypt 3.0.0 | gcc-3.2.2 | Debian Linux 3.0 | Itanium 2 900 | 12 GB: 7317 () BeeCrypt 3.0.0 | gcc-3.3 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 6920 (--with-arch=pentium4) BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0 | Alpha EV6.7 666 | 2 GB: 5742 () BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 3280 (--with-arch=pentiumpro) BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 1782 (--with-arch=powerpc64) BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 (--with-arch=pentium3) BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 756 () +BeeCrypt 3.0.0 | Forte C 5.1 | Solaris 8 | UltraSparc II 400 | 4 GB: 425 (--with-arch=sparcv8plus) BeeCrypt 3.0.0 | | Debian Linux 3.0 | StrongARM 1110 128 | 32 MB: 341 () BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68030 25 | 36 MB: 8 () diff --git a/beecrypt/Makefile.am b/beecrypt/Makefile.am index eab18845a..9b5eb9fa4 100644 --- a/beecrypt/Makefile.am +++ b/beecrypt/Makefile.am @@ -36,7 +36,7 @@ AUTOMAKE_OPTIONS = gnu check-news no-dependencies LINT = splint -SUBDIRS = . docs gas masm python tests +SUBDIRS = . docs gas masm python tests $(MAYBE_OPT) SUFFIXES = .s @@ -45,14 +45,12 @@ SUFFIXES = .s BEECRYPT_OBJECTS = aes.lo aesopt.lo base64.lo beecrypt.lo blockmode.lo blockpad.lo blowfish.lo blowfishopt.lo dhaes.lo dldp.lo dlkp.lo dlpk.lo dlsvdp-dh.lo dsa.lo elgamal.lo endianness.lo entropy.lo fips186.lo hmac.lo hmacmd5.lo hmacsha1.lo hmacsha256.lo md5.lo memchunk.lo mp.lo mpbarrett.lo mpnumber.lo mpopt.lo mpprime.lo mtprng.lo rsa.lo rsakp.lo rsapk.lo sha1.lo sha1opt.lo sha256.lo timestamp.lo -BEECRYPT_JAVA_OBJECTS = javaglue.lo - usrlibdir = $(libdir)@MARK64@ usrlib_LTLIBRARIES = libbeecrypt.la -libbeecrypt_la_SOURCES = aes.c base64.c beecrypt.c blockmode.c blockpad.c blowfish.c dhaes.c dldp.c dlkp.c dlpk.c dlsvdp-dh.c dsa.c elgamal.c endianness.c entropy.c fips186.c hmac.c hmacmd5.c hmacsha1.c hmacsha256.c javaglue.c md5.c memchunk.c mp.c mpbarrett.c mpnumber.c mpprime.c mtprng.c rsa.c rsakp.c rsapk.c sha1.c sha256.c timestamp.c +libbeecrypt_la_SOURCES = aes.c base64.c beecrypt.c blockmode.c blockpad.c blowfish.c dhaes.c dldp.c dlkp.c dlpk.c dlsvdp-dh.c dsa.c elgamal.c endianness.c entropy.c fips186.c hmac.c hmacmd5.c hmacsha1.c hmacsha256.c md5.c memchunk.c mp.c mpbarrett.c mpnumber.c mpprime.c mtprng.c rsa.c rsakp.c rsapk.c sha1.c sha256.c timestamp.c -libbeecrypt_la_DEPENDENCIES = $(BEECRYPT_OBJECTS) $(BEECRYPT_JAVA_OBJECTS) +libbeecrypt_la_DEPENDENCIES = $(BEECRYPT_OBJECTS) libbeecrypt_la_LIBADD = aesopt.lo blowfishopt.lo mpopt.lo sha1opt.lo @@ -63,7 +61,7 @@ pkginclude_HEADERS = aes.h base64.h beecrypt.h beecrypt.api.h beecrypt.gnu.h blo noinst_HEADERS = aesopt.h beecrypt.win.h \ blowfishopt.h debug.h mpopt.h sha1opt.h system.h -EXTRA_DIST = BENCHMARKS BUGS CONTRIBUTORS Doxyfile.in Doxyheader README README.DLL README.WIN32 beecrypt.gnu.h.in beecrypt.rc beecrypt.spec javaglue.h autogen.sh Makefile.mak +EXTRA_DIST = BENCHMARKS BUGS CONTRIBUTORS Doxyfile.in Doxyheader README README.DLL README.WIN32 beecrypt.gnu.h.in beecrypt.rc beecrypt.spec autogen.sh Makefile.mak DISTCLEANFILES = mpopt.s aesopt.s blowfishopt.s sha1opt.s diff --git a/beecrypt/Makefile.mak b/beecrypt/Makefile.mak index 2dcb7530a..258910b47 100644 --- a/beecrypt/Makefile.mak +++ b/beecrypt/Makefile.mak @@ -1,12 +1,13 @@ + # # Makefile.mak for the beecrypt library # # To be used with Microsoft's nmake utility; # Will need the Visual C Processor Pack installed. # -# Copyright (c) 2000, 2001, 2002, 2003 Virtual Unlimited B.V. +# Copyright (c) 2000, 2001, 2002 Virtual Unlimited B.V. # -# Author: Bob Deblier <bob@virtualunlimited.com> +# Author: Bob Deblier <bob.deblier@pandora.be> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -39,17 +40,19 @@ LIBPATH="C:\Program Files\Microsoft Visual Studio\VC98\Lib" JAVAPATH="C:\j2sdk1.4.0\include" -# To enable SSE2 optimization, add switch /DOPTIMIZE_SSE2 to ASFLAGS -ASFLAGS=/nologo /c /coff /Gd +# To enable SSE2 optimization, add switch /DUSE_SSE2 to ASFLAGS +ASFLAGS=/nologo /c /coff /Gd # /DUSE_SSE2 CFLAGS=/nologo /TC /MT /GM /Ox /G6 /I. -LDFLAGS=/nologo /machine:IX86 /libpath:$(LIBPATH) $(LIBS) # /DEBUG +# CFLAGS=/nologo /TC /MT /GM /ZI /G6 /I. +LDFLAGS=/nologo /fixed:no /machine:IX86 /libpath:$(LIBPATH) $(LIBS) # /DEBUG RCFLAGS=/r /L 0x409 /FObeecrypt.res JAVAFLAGS=/DJAVAGLUE=1 /I$(JAVAPATH) /I$(JAVAPATH)\win32 +# To compile Java support, add file javaglue.obj to this list OBJECTS= \ - aes.obj \ - aesopt.obj \ - base64.obj \ + aes.obj \ + aesopt.obj \ + base64.obj \ beecrypt.obj \ blockmode.obj \ blockpad.obj \ @@ -69,14 +72,13 @@ OBJECTS= \ hmacmd5.obj \ hmacsha1.obj \ hmacsha256.obj \ - javaglue.obj \ md5.obj \ memchunk.obj \ - mp32.obj \ - mp32opt.obj \ - mp32barrett.obj \ - mp32number.obj \ - mp32prime.obj \ + mp.obj \ + mpopt.obj \ + mpbarrett.obj \ + mpnumber.obj \ + mpprime.obj \ mtprng.obj \ rsa.obj \ rsakp.obj \ @@ -87,17 +89,10 @@ OBJECTS= \ timestamp.obj \ beecrypt.res - -all: .\beecrypt.dll .\beetest.exe +all: .\beecrypt.dll beecrypt.dll: $(OBJECTS) - $(LD) $(LDFLAGS) $(OBJECTS) /dll /def:beecrypt.def /out:beecrypt.dll /implib:beecrypt.lib - -beetest.obj: tests\beetest.c - $(CC) $(CFLAGS) /Fobeetest.obj /c tests\beetest.c - -beetest.exe: beecrypt.lib beetest.obj - $(LD) $(LDFLAGS) beetest.obj beecrypt.lib + $(LD) $(LDFLAGS) $(OBJECTS) /dll /out:beecrypt.dll /implib:beecrypt.lib beecrypt.res: beecrypt.rc $(RC) $(RCFLAGS) beecrypt.rc @@ -114,8 +109,8 @@ blowfishopt.obj: masm\blowfishopt.i586.asm sha1opt.obj: masm\sha1opt.i586.asm $(AS) $(ASFLAGS) /Fosha1opt.obj /c masm\sha1opt.i586.asm -mp32opt.obj: masm\mp32opt.i386.asm - $(AS) $(ASFLAGS) /Fomp32opt.obj /c masm\mp32opt.i386.asm +mpopt.obj: masm\mpopt.x86.asm + $(AS) $(ASFLAGS) /Fompopt.obj /c masm\mpopt.x86.asm clean: del *.obj diff --git a/beecrypt/acinclude.m4 b/beecrypt/acinclude.m4 index 8ec4282f1..77fd92de2 100644 --- a/beecrypt/acinclude.m4 +++ b/beecrypt/acinclude.m4 @@ -297,9 +297,7 @@ AC_DEFUN(BEECRYPT_GNU_CC,[ CFLAGS="$CFLAGS -mcpu=pentiumpro" ;; ia64) - # -mcpu=... doesn't work on ia64, and -O3 can lead to invalid code - BEECRYPT_CFLAGS_REM([-O3]) - CFLAGS="$CFLAGS -O" + # no -mcpu=... option on ia64 ;; pentium*) CFLAGS="$CFLAGS -mcpu=$bc_target_arch" diff --git a/beecrypt/configure.ac b/beecrypt/configure.ac index ae7d44d8a..d26408cc7 100644 --- a/beecrypt/configure.ac +++ b/beecrypt/configure.ac @@ -163,13 +163,21 @@ AC_ARG_WITH(mtmalloc,[ --with-mtmalloc links against the mtmalloc libra fi ],[ac_with_mtmalloc=no]) -AC_ARG_WITH(javaglue,[ --with-javaglue creates the java glue code [default=yes]],[ +AC_ARG_WITH(javaglue,[ --with-javaglue creates the java glue code [default=no]],[ if test "$withval" = no; then ac_with_javaglue=no else ac_with_javaglue=yes fi - ],[ac_with_javaglue=yes]) + ],[ac_with_javaglue=no]) + +AC_ARG_WITH(python,[ --with-python creates the python bindings code [default=no]],[ + if test "$withval" = no; then + ac_with_python=no + else + ac_with_python=yes + fi + ],[ac_with_python=no]) # Check for Unix variants AC_AIX @@ -439,7 +447,7 @@ EOF if test X"$java_home" = X; then java_home=/usr fi - if test -d "$java_home" -a -d "$java_home/include" -a -f "$java_home/include/jni.h"; then + if test -d "$java_home" -a -d "$java_home/include"; then ac_cv_java_headers=yes ac_cv_java_include="-I$java_home/include" gcjpath="$java_home/lib/gcc-lib/`gcj -dumpmachine`/`gcj -dumpversion`" @@ -689,6 +697,18 @@ if test "$ac_with_javaglue" = yes ; then CFLAGS="$CFLAGS $ac_cv_java_include" fi +MAYBE_OPT= + +if test "$ac_with_javaglue" = yes; then + MAYBE_OPT="$MAYBE_OPT java" +fi + +if test "$ac_with_python" = yes; then + MAYBE_OPT="$MAYBE_OPT python" +fi + +AC_SUBST([MAYBE_OPT]) + # Generate output files. AC_CONFIG_FILES([Makefile Doxyfile @@ -696,6 +716,7 @@ AC_CONFIG_FILES([Makefile config.m4 docs/Makefile gas/Makefile + java/Makefile masm/Makefile mwerks/Makefile python/Makefile diff --git a/beecrypt/gas/ia64.m4 b/beecrypt/gas/ia64.m4 index 1ac0898d3..51d27a8bf 100644 --- a/beecrypt/gas/ia64.m4 +++ b/beecrypt/gas/ia64.m4 @@ -22,14 +22,34 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA define(`saved_pfs',`r14') define(`saved_lc',`r15') +ifelse(substr(ASM_OS,0,5),linux,` +undefine(`C_FUNCTION_BEGIN') +define(C_FUNCTION_BEGIN,` + TEXTSEG + ALIGN + GLOBL SYMNAME($1)# + .proc SYMNAME($1)# +SYMNAME($1): +') +undefine(`C_FUNCTION_END') +define(C_FUNCTION_END,` + .endp SYMNAME($1)# +') +') + ifelse(substr(ASM_OS,0,4),hpux,` undefine(`C_FUNCTION_BEGIN') define(C_FUNCTION_BEGIN,` - TEXTSEG - GLOBL SYMNAME($1)# - .proc SYMNAME($1)# + TEXTSEG + ALIGN + GLOBL SYMNAME($1) + .proc SYMNAME($1) SYMNAME($1): ') -',` - .explicit +undefine(`C_FUNCTION_END') +define(C_FUNCTION_END,` + .endp SYMNAME($1) +') ') + + .explicit diff --git a/beecrypt/gas/mpopt.ia64.m4 b/beecrypt/gas/mpopt.ia64.m4 index b15b8ad2d..6c9a18791 100644 --- a/beecrypt/gas/mpopt.ia64.m4 +++ b/beecrypt/gas/mpopt.ia64.m4 @@ -21,15 +21,72 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/ia64.m4) -define(`sze',`r16') -define(`dst',`r17') -define(`src',`r18') -define(`alt',`r19') +define(`sze',`r14') +define(`dst',`r15') +define(`src',`r16') +define(`alt',`r17') + + +C_FUNCTION_BEGIN(mpzero) + .prologue + alloc saved_pfs = ar.pfs,2,0,0,0 + mov saved_lc = ar.lc + sub sze = in0,r0,1;; + +dnl adjust address + shladd dst = sze,3,in1 + +dnl prepare loop + mov ar.lc = sze;; + + .body +LOCAL(mpzero_loop): + st8 [dst] = r0,-8 + br.ctop.dptk LOCAL(mpzero_loop);; + + mov ar.lc = saved_lc + mov ar.pfs = saved_pfs + br.ret.sptk b0 +C_FUNCTION_END(mpzero) + + +C_FUNCTION_BEGIN(mpcopy) + .prologue + alloc saved_pfs = ar.pfs,3,6,0,8 + mov saved_lc = ar.lc + mov saved_pr = pr + sub sze = in0,r0,1;; + +dnl adjust addresses + shladd dst = sze,3,in1 + shladd src = sze,3,in2 + +dnl prepare modulo-scheduled loop + mov ar.lc = sze + mov ar.ec = 1 + mov pr.rot = (1 << 16);; + +LOCAL(mpcopy_loop): + (p16) ld8 r32 = [src],-8 + (p17) st8 [dst] = r33,-8 + br.ctop.dptk LOCAL(mpcopy_loop);; + +dnl epilogue + (p17) st8 [dst] = r33,-8 + ;; + + mov pr = saved_pr, -1 + mov ar.lc = saved_lc + mov ar.pfs = saved_pfs + br.ret.sptk b0 +C_FUNCTION_END(mpcopy) C_FUNCTION_BEGIN(mpadd) + .prologue alloc saved_pfs = ar.pfs,3,5,0,8 mov saved_lc = ar.lc + mov saved_pr = pr sub sze = in0,r0,1;; dnl adjust addresses @@ -42,7 +99,9 @@ dnl prepare modulo-scheduled loop mov ar.ec = 2 mov pr.rot = ((1 << 16) | (1 << 19));; + .body LOCAL(mpadd_loop): + .pred.rel.mutex p20,p22 (p16) ld8 r32 = [alt],-8 (p16) ld8 r35 = [src],-8 (p20) add r36 = r33,r36 @@ -57,9 +116,11 @@ dnl loop epilogue: final store (p18) st8 [dst] = r37,-8 dnl return carry + .pred.rel.mutex p20,p22 (p20) add ret0 = r0,r0 (p22) add ret0 = r0,r0,1 ;; + mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 @@ -67,8 +128,10 @@ C_FUNCTION_END(mpadd) C_FUNCTION_BEGIN(mpsub) + .prologue alloc saved_pfs = ar.pfs,3,5,0,8 mov saved_lc = ar.lc + mov saved_pr = pr sub sze = in0,r0,1;; dnl adjust addresses @@ -81,7 +144,9 @@ dnl prepare modulo-scheduled loop mov ar.ec = 2 mov pr.rot = ((1 << 16) | (1 << 19));; + .body LOCAL(mpsub_loop): + .pred.rel.mutex p20,p22 (p16) ld8 r32 = [alt],-8 (p16) ld8 r35 = [src],-8 (p20) sub r36 = r33,r36 @@ -96,9 +161,11 @@ dnl loop epilogue: final store (p18) st8 [dst] = r37,-8 dnl return carry + .pred.rel.mutex p20,p22 (p20) add ret0 = r0,r0 (p22) add ret0 = r0,r0,1 ;; + mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 @@ -106,8 +173,10 @@ C_FUNCTION_END(mpsub) C_FUNCTION_BEGIN(mpsetmul) + .prologue alloc saved_pfs = ar.pfs,4,4,0,8 mov saved_lc = ar.lc + mov saved_pr = pr setf.sig f6 = in3 setf.sig f7 = r0 @@ -122,16 +191,18 @@ dnl prepare modulo-scheduled loop mov ar.ec = 3 mov pr.rot = (1 << 16);; + .body LOCAL(mpsetmul_loop): (p16) ldf8 f32 = [src],-8 (p18) stf8 [dst] = f35,-8 (p17) xma.lu f34 = f6,f33,f7 - (p17) xma.hu f7 = f6,f33,f7;; + (p17) xma.hu f7 = f6,f33,f7 br.ctop.dptk LOCAL(mpsetmul_loop);; dnl return carry getf.sig ret0 = f7;; + mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 @@ -139,8 +210,10 @@ C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) + .prologue alloc saved_pfs = ar.pfs,4,4,0,8 mov saved_lc = ar.lc + mov saved_pr = pr setf.sig f6 = in3 sub sze = in0,r0,1;; @@ -156,9 +229,11 @@ dnl prepare the rotate-in carry dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 4 - mov pr.rot = ((1 << 16) | (1 << 21)); + mov pr.rot = ((1 << 16) | (1 << 21));; + .body LOCAL(mpaddmul_loop): + .pred.rel.mutex p24,p26 (p18) getf.sig r37 = f35 (p24) add r35 = r38,r35 (p17) xma.lu f34 = f6,f33,f37 @@ -178,9 +253,11 @@ dnl loop epilogue: final store (p20) st8 [dst] = r36,-8 dnl return carry + .pred.rel.mutex p24,p26 (p24) add ret0 = r35,r0 (p26) add ret0 = r35,r0,1 + mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 @@ -190,6 +267,7 @@ C_FUNCTION_END(mpaddmul) divert(-1) C_FUNCTION_BEGIN(mpaddsqrtrc) alloc saved_pfs = ar.pfs,4,4,0,8 + mov saved_pr = pr mov saved_lc = ar.lc setf.sig f6 = in3 @@ -206,7 +284,7 @@ dnl prepare the rotate-in carry dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 5 - mov pr.rot = ((1 << 16) | (1 << 21)); + mov pr.rot = ((1 << 16) | (1 << 21));; LOCAL(mpaddsqrtrc_loop): (p16) ldf8 f32 = [src],-8 diff --git a/beecrypt/java/Makefile.am b/beecrypt/java/Makefile.am new file mode 100644 index 000000000..ebdea2264 --- /dev/null +++ b/beecrypt/java/Makefile.am @@ -0,0 +1,37 @@ +# +# Copyright (c) 2003 Bob Deblier +# +# Author: Bob Deblier <bob.deblier@pandora.be> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +LIBBEECRYPT_LT_CURRENT = 6 +LIBBEECRYPT_LT_AGE = 0 +LIBBEECRYPT_LT_REVISION = 0 + +AUTOMAKE_OPTIONS = gnu no-dependencies + +BEECRYPT_JAVA_OBJECTS = javaglue.lo + +lib_LTLIBRARIES = libbeecrypt_java.la + +noinst_HEADERS = javaglue.h + +libbeecrypt_java_la_SOURCES = javaglue.c + +libbeecrypt_java_la_DEPENDENCIES = $(BEECRYPT_JAVA_OBJECTS) + +libbeecrypt_java_la_LDFLAGS = -no-undefined -version-info $(LIBBEECRYPT_LT_CURRENT):$(LIBBEECRYPT_LT_REVISION):$(LIBBEECRYPT_LT_AGE) diff --git a/beecrypt/javaglue.c b/beecrypt/java/javaglue.c index 1387abaa6..f7ee9cbcd 100644 --- a/beecrypt/javaglue.c +++ b/beecrypt/java/javaglue.c @@ -1,13 +1,22 @@ #define BEECRYPT_DLL_EXPORT -#include "system.h" +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include "beecrypt.h" #include "blockmode.h" -#include "javaglue.h" -#include "debug.h" #if JAVAGLUE +#if HAVE_STDLIB_H +# include <stdlib.h> +#endif +#if HAVE_MALLOC_H +# include <malloc.h> +#endif + +#include "javaglue.h" #ifndef WORDS_BIGENDIAN # define WORDS_BIGENDIAN 0 @@ -402,12 +411,12 @@ void JNICALL Java_beecrypt_crypto_NativeBlockCipher_encryptECB(JNIEnv* env, jcla return; } memcpy(datain, input+inputOffset, blocks * sizeof(uint32_t)); - blockEncryptECB((const blockCipher*) ciph, (blockCipherParam*) param, blocks, dataout, datain); + blockEncryptECB((const blockCipher*) ciph, (blockCipherParam*) param, dataout, datain, blocks); memcpy(output+outputOffset, dataout, blocks * sizeof(uint32_t)); } else { /* aligned */ - blockEncryptECB((const blockCipher*) ciph, (blockCipherParam*) param, blocks, (uint32_t*)(output+outputOffset), (uint32_t*) (input+inputOffset)); + blockEncryptECB((const blockCipher*) ciph, (blockCipherParam*) param, (uint32_t*)(output+outputOffset), (uint32_t*) (input+inputOffset), blocks); } (*env)->ReleaseByteArrayElements(env, inputArray, input, JNI_ABORT); @@ -464,12 +473,12 @@ void JNICALL Java_beecrypt_crypto_NativeBlockCipher_decryptECB(JNIEnv* env, jcla return; } memcpy(datain, input+inputOffset, blocks * sizeof(uint32_t)); - blockDecryptECB((const blockCipher*) ciph, (blockCipherParam*) param, blocks, dataout, datain); + blockDecryptECB((const blockCipher*) ciph, (blockCipherParam*) param, dataout, datain, blocks); memcpy(output+outputOffset, dataout, blocks * sizeof(uint32_t)); } else { /* aligned */ - blockDecryptECB((const blockCipher*) ciph, (blockCipherParam*) param, blocks, (uint32_t*)(output+outputOffset), (uint32_t*) (input+inputOffset)); + blockDecryptECB((const blockCipher*) ciph, (blockCipherParam*) param, (uint32_t*)(output+outputOffset), (uint32_t*) (input+inputOffset), blocks); } (*env)->ReleaseByteArrayElements(env, inputArray, input, JNI_ABORT); @@ -526,12 +535,12 @@ void JNICALL Java_beecrypt_crypto_NativeBlockCipher_encryptCBC(JNIEnv* env, jcla return; } memcpy(datain, input+inputOffset, blocks * sizeof(uint32_t)); - blockEncryptCBC((const blockCipher*) ciph, (blockCipherParam*) param, blocks, dataout, datain); + blockEncryptCBC((const blockCipher*) ciph, (blockCipherParam*) param, dataout, datain, blocks); memcpy(output+outputOffset, dataout, blocks * sizeof(uint32_t)); } else { /* aligned */ - blockEncryptCBC((const blockCipher*) ciph, (blockCipherParam*) param, blocks, (uint32_t*)(output+outputOffset), (uint32_t*) (input+inputOffset)); + blockEncryptCBC((const blockCipher*) ciph, (blockCipherParam*) param, (uint32_t*)(output+outputOffset), (uint32_t*) (input+inputOffset), blocks); } (*env)->ReleaseByteArrayElements(env, inputArray, input, JNI_ABORT); @@ -588,12 +597,12 @@ void JNICALL Java_beecrypt_crypto_NativeBlockCipher_decryptCBC(JNIEnv* env, jcla return; } memcpy(datain, input+inputOffset, blocks * sizeof(uint32_t)); - blockDecryptCBC((const blockCipher*) ciph, (blockCipherParam*) param, blocks, dataout, datain); + blockDecryptCBC((const blockCipher*) ciph, (blockCipherParam*) param, dataout, datain, blocks); memcpy(output+outputOffset, dataout, blocks * sizeof(uint32_t)); } else { /* aligned */ - blockDecryptCBC((const blockCipher*) ciph, (blockCipherParam*) param, blocks, (uint32_t*)(output+outputOffset), (uint32_t*) (input+inputOffset)); + blockDecryptCBC((const blockCipher*) ciph, (blockCipherParam*) param, (uint32_t*)(output+outputOffset), (uint32_t*) (input+inputOffset), blocks); } (*env)->ReleaseByteArrayElements(env, inputArray, input, JNI_ABORT); diff --git a/beecrypt/javaglue.h b/beecrypt/java/javaglue.h index b7c43d328..d81edbd5b 100644 --- a/beecrypt/javaglue.h +++ b/beecrypt/java/javaglue.h @@ -1,7 +1,3 @@ -/** \ingroup JAVA_m - * \file javaglue.h - */ - /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class javax_crypto_Cipher */ diff --git a/beecrypt/mp.c b/beecrypt/mp.c index f95339aa3..4fd0571f8 100644 --- a/beecrypt/mp.c +++ b/beecrypt/mp.c @@ -923,28 +923,6 @@ size_t mpmszcnt(size_t size, const mpw* data) } #endif -#ifndef ASM_MPBITCNT -size_t mpbitcnt(size_t size, const mpw* data) -{ - register mpw xmask = (mpw)((*data & MP_MSBMASK) ? -1 : 0); - register size_t nbits = MP_WBITS * size; - register size_t i = 0; - - while (i < size) { - register mpw temp = (data[i++] ^ xmask); - if (temp) { - while (!(temp & MP_MSBMASK)) { - nbits--; - temp <<= 1; - } - break; - } else - nbits -= MP_WBITS; - } - return nbits; -} -#endif - #ifndef ASM_MPLSZCNT size_t mplszcnt(size_t size, const mpw* data) { @@ -1197,7 +1175,7 @@ int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ndata, mpw* result, mpw { mpdivtwo(sizep, udata); - if ((full && mpodd(sizep, adata)) || mpodd(sizep, bdata)) + if (mpodd(sizep, bdata) || (full && mpodd(sizep, adata))) { if (full) (void) mpaddx(sizep, adata, size, xdata); (void) mpsubx(sizep, bdata, size, ndata); @@ -1210,7 +1188,7 @@ int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ndata, mpw* result, mpw { mpdivtwo(sizep, vdata); - if ((full && mpodd(sizep, cdata)) || mpodd(sizep, ddata)) + if (mpodd(sizep, ddata) || (full && mpodd(sizep, cdata))) { if (full) (void) mpaddx(sizep, cdata, size, xdata); (void) mpsubx(sizep, ddata, size, ndata); @@ -1232,7 +1210,7 @@ int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ndata, mpw* result, mpw (void) mpsub(sizep, ddata, bdata); } if (mpz(sizep, udata)) - { + { if (mpisone(sizep, vdata)) { if (result) @@ -1362,8 +1340,10 @@ void mpndivmod(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const *result = (mpge(ysize, xdata, ydata) ? 1 : 0); mpcopy(xsize, result+1, xdata); + if (*result) (void) mpsub(ysize, result+1, ydata); + result++; while (qsize--) diff --git a/beecrypt/mp.h b/beecrypt/mp.h index 4eb7b371e..45ed7be76 100644 --- a/beecrypt/mp.h +++ b/beecrypt/mp.h @@ -536,12 +536,6 @@ size_t mpmszcnt(size_t size, const mpw* data) /** */ -BEECRYPTAPI /*@unused@*/ -size_t mpbitcnt(size_t size, const mpw* data) - /*@*/; - -/** - */ /*@-exportlocal@*/ BEECRYPTAPI /*@unused@*/ size_t mplszcnt(size_t size, const mpw* data) diff --git a/beecrypt/mpopt.h b/beecrypt/mpopt.h index 3e43b1841..075f637b1 100644 --- a/beecrypt/mpopt.h +++ b/beecrypt/mpopt.h @@ -81,6 +81,7 @@ # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_IA64) +# define ASM_MPZERO # define ASM_MPADD # define ASM_MPSUB # define ASM_MPSETMUL |