From 448f8e53fe3e5d5ac54fe7151e512acbb6114ad5 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 30 Apr 1998 14:06:01 +0000 Subject: [PATCH] *** empty log message *** --- Makefile.in | 23 +- NEWS | 14 + README | 8 +- VERSION | 2 +- checks/defs.inc | 2 + cipher/ChangeLog | 8 + cipher/Makefile.am | 2 + cipher/Makefile.in | 28 +- cipher/cipher.c | 42 ++- cipher/md.c | 42 ++- cipher/md.h | 5 + cipher/misc.c | 4 + cipher/tiger.c | 848 +++++++++++++++++++++++++++++++++++++++++++++ cipher/tiger.h | 44 +++ doc/gpg.1pod | 7 +- g10/ChangeLog | 19 + g10/Makefile.in | 20 ++ g10/armor.c | 9 +- g10/build-packet.c | 2 - g10/g10.c | 24 +- g10/mainproc.c | 5 + g10/options.h | 2 +- g10/parse-packet.c | 10 +- g10/pkclist.c | 2 +- g10/pubkey-enc.c | 10 +- g10/seckey-cert.c | 2 + g10/seskey.c | 17 +- g10/sign.c | 8 + include/ChangeLog | 4 + include/cipher.h | 10 +- include/types.h | 14 + include/util.h | 3 + mpi/Makefile.in | 20 ++ tools/Makefile.in | 20 ++ util/ChangeLog | 4 + util/Makefile.in | 20 ++ util/strgutil.c | 12 + zlib/Makefile | 322 +++++++++++++++++ zlib/Makefile.am~ | 29 ++ zlib/Makefile.in | 322 +++++++++++++++++ zlib/zconf.h~ | 186 ++++++++++ zlib/zlib.h~ | 782 +++++++++++++++++++++++++++++++++++++++++ 42 files changed, 2892 insertions(+), 65 deletions(-) create mode 100644 cipher/tiger.c create mode 100644 cipher/tiger.h create mode 100644 zlib/Makefile create mode 100644 zlib/Makefile.am~ create mode 100644 zlib/Makefile.in create mode 100644 zlib/zconf.h~ create mode 100644 zlib/zlib.h~ diff --git a/Makefile.in b/Makefile.in index a889c863d..cd28655e3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -61,25 +61,46 @@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@ CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@ CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ G10_LOCALEDIR = @G10_LOCALEDIR@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MKINSTALLDIRS = @MKINSTALLDIRS@ MPI_EXTRA_ASM_OBJS = @MPI_EXTRA_ASM_OBJS@ +MSGFMT = @MSGFMT@ PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ ZLIBS = @ZLIBS@ +l = @l@ SUBDIRS = intl po zlib util mpi cipher tools g10 doc checks EXTRA_DIST = VERSION +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = DIST_COMMON = README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL \ Makefile.am Makefile.in NEWS THANKS TODO acconfig.h acinclude.m4 \ -config.h.in configure configure.in stamp-h.in +aclocal.m4 config.h.in configure configure.in stamp-h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) diff --git a/NEWS b/NEWS index 6d0200a11..3571b1997 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,17 @@ +Noteworthy changes in version 0.2.16 +------------------------------------ + + * Add experimental support for the TIGER/192 message diigest algorithm. + (But there is only a dummy ASN OID). + + * Standard cipher is now Blowfish with 128 bit key in OpenPGP's CFB + mode. I renamed the old cipher to Blowfish160. Because the OpenPGP + group refused to assign me a number for Blowfish160, I have to + drop support for this in the future. You should use + "--change-passphrase" to recode your current passphrase with 128 + bit Blowfish. + + Noteworthy changes in version 0.2.15 ------------------------------------ diff --git a/README b/README index 6a8dce21a..a13192c70 100644 --- a/README +++ b/README @@ -37,9 +37,9 @@ about unsupported algorithms. The default algorithms used by GNUPG are ElGamal for public-key - encryption and signing; Blowfish with a 160 bit key for protecting + encryption and signing; Blowfish with a 128 bit key for protecting the secret-key components, conventional and session encryption; - RIPE MD-160 to create message digest. DSA, SHA-1 and CAST are + RIPE MD-160 to create message digest. DSA, SHA-1, CAST and TIGER are also implemented, but not used by default. I decided not to use DSA as the default signing algorithm, because it allows only for 1024 bit keys and this may not be enough in a couple of years. @@ -126,7 +126,7 @@ whether you want to sign this key. You may remove a signature at any time using the option "--edit-sig", - which asks for the sigs to remove. Self-signatures are not removable. + which asks for the sigs to remove. Self-signatures are not removable. @@ -347,7 +347,7 @@ The primary WWW page is "http://www.d.shuttle.de/isil/crypt/gnupg.html" If you like, send your keys to ; use - "gnupg --export --armor | mail gnupg-keys@isil.d.shuttle.de" to do this. + "gpg --export --armor | mail gnupg-keys@isil.d.shuttle.de" to do this. Please direct bug reports to or better post them to the mailing list . diff --git a/VERSION b/VERSION index c54e27eaf..9097948ff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.15a +0.2.16 diff --git a/checks/defs.inc b/checks/defs.inc index aedd4b6f1..32711c916 100755 --- a/checks/defs.inc +++ b/checks/defs.inc @@ -9,6 +9,8 @@ usrname1="one" usrpass1="def" usrname2="two" usrpass2="" +usrname3="three" +usrpass3="abc" dsa_usrname1="pgp5" diff --git a/cipher/ChangeLog b/cipher/ChangeLog index bc9261b75..a44abae94 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,11 @@ +Mon Apr 27 14:41:58 1998 Werner Koch (wk@isil.d.shuttle.de) + + * cipher.c (cipher_get_keylen): New. + +Sun Apr 26 14:44:52 1998 Werner Koch (wk@isil.d.shuttle.de) + + * tiger.c, tiger.h: New. + Wed Apr 8 14:57:11 1998 Werner Koch (wk@isil.d.shuttle.de) * misc.c (check_pubkey_algo2): New. diff --git a/cipher/Makefile.am b/cipher/Makefile.am index 945ae3dbc..3e8885b6a 100644 --- a/cipher/Makefile.am +++ b/cipher/Makefile.am @@ -20,6 +20,8 @@ libcipher_a_SOURCES = cipher.c \ random.c \ rmd.h \ rmd160.c \ + tiger.h \ + tiger.c \ sha1.h \ sha1.c \ dsa.h \ diff --git a/cipher/Makefile.in b/cipher/Makefile.in index bc910abb8..52bfc4667 100644 --- a/cipher/Makefile.in +++ b/cipher/Makefile.in @@ -61,16 +61,36 @@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@ CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@ CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ G10_LOCALEDIR = @G10_LOCALEDIR@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MKINSTALLDIRS = @MKINSTALLDIRS@ MPI_EXTRA_ASM_OBJS = @MPI_EXTRA_ASM_OBJS@ +MSGFMT = @MSGFMT@ PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ ZLIBS = @ZLIBS@ +l = @l@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl EXTRA_DIST = @CIPHER_EXTRA_DIST@ @@ -91,6 +111,8 @@ libcipher_a_SOURCES = cipher.c \ random.c \ rmd.h \ rmd160.c \ + tiger.h \ + tiger.c \ sha1.h \ sha1.c \ dsa.h \ @@ -113,7 +135,8 @@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ libcipher_a_OBJECTS = cipher.o blowfish.o cast5.o elgamal.o md5.o \ -primegen.o random.o rmd160.o sha1.o dsa.o md.o misc.o smallprime.o +primegen.o random.o rmd160.o tiger.o sha1.o dsa.o md.o misc.o \ +smallprime.o AR = ar CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @@ -127,7 +150,8 @@ TAR = tar GZIP = --best DEP_FILES = .deps/blowfish.P .deps/cast5.P .deps/cipher.P .deps/dsa.P \ .deps/elgamal.P .deps/md.P .deps/md5.P .deps/misc.P .deps/primegen.P \ -.deps/random.P .deps/rmd160.P .deps/sha1.P .deps/smallprime.P +.deps/random.P .deps/rmd160.P .deps/sha1.P .deps/smallprime.P \ +.deps/tiger.P SOURCES = $(libcipher_a_SOURCES) OBJECTS = $(libcipher_a_OBJECTS) diff --git a/cipher/cipher.c b/cipher/cipher.c index 2729e5e1a..f449a99b5 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -41,15 +41,15 @@ #endif -static struct { const char *name; int algo;} cipher_names[] = { - { "IDEA", CIPHER_ALGO_IDEA }, - { "3DES", CIPHER_ALGO_3DES }, - { "CAST", CIPHER_ALGO_CAST }, - { "BLOWFISH128", CIPHER_ALGO_BLOWFISH128 }, - { "ROT_N", CIPHER_ALGO_ROT_N }, - { "SAFER_SK128", CIPHER_ALGO_SAFER_SK128 }, - { "DES_SK", CIPHER_ALGO_DES_SK }, - { "BLOWFISH", CIPHER_ALGO_BLOWFISH }, +static struct { const char *name; int algo; int keylen; } cipher_names[] = { + { "IDEA", CIPHER_ALGO_IDEA ,0 }, + { "3DES", CIPHER_ALGO_3DES ,0 }, + { "CAST", CIPHER_ALGO_CAST ,128 }, + { "BLOWFISH160", CIPHER_ALGO_BLOWFISH160 ,160 }, + { "ROT_N", CIPHER_ALGO_ROT_N ,0 }, + { "SAFER_SK128", CIPHER_ALGO_SAFER_SK128 ,0 }, + { "DES_SK", CIPHER_ALGO_DES_SK ,0 }, + { "BLOWFISH", CIPHER_ALGO_BLOWFISH ,128 }, {NULL} }; @@ -112,7 +112,7 @@ int check_cipher_algo( int algo ) { switch( algo ) { - case CIPHER_ALGO_BLOWFISH128: + case CIPHER_ALGO_BLOWFISH160: case CIPHER_ALGO_BLOWFISH: case CIPHER_ALGO_CAST: return 0; @@ -122,6 +122,23 @@ check_cipher_algo( int algo ) } +unsigned +cipher_get_keylen( int algo ) +{ + int i; + unsigned len = 0; + + for(i=0; cipher_names[i].name; i++ ) + if( cipher_names[i].algo == algo ) { + len = cipher_names[i].keylen; + break; + } + if( !len ) + log_bug("cipher %d w/o key length\n", algo ); + return len; +} + + /**************** * Open a cipher handle for use with algorithm ALGO, in mode MODE * and put it into secure memory if SECURE is true. @@ -138,7 +155,7 @@ cipher_open( int algo, int mode, int secure ) : m_alloc_clear( sizeof *hd ); hd->algo = algo; if( mode == CIPHER_MODE_AUTO_CFB ) { - if( algo == CIPHER_ALGO_CAST ) + if( algo != CIPHER_ALGO_BLOWFISH160 ) hd->mode = CIPHER_MODE_PHILS_CFB; else hd->mode = CIPHER_MODE_CFB; @@ -147,7 +164,7 @@ cipher_open( int algo, int mode, int secure ) hd->mode = mode; switch( algo ) { case CIPHER_ALGO_BLOWFISH: - case CIPHER_ALGO_BLOWFISH128: + case CIPHER_ALGO_BLOWFISH160: hd->setkey = FNCCAST_SETKEY(blowfish_setkey); hd->encrypt = FNCCAST_CRYPT(blowfish_encrypt_block); hd->decrypt = FNCCAST_CRYPT(blowfish_decrypt_block); @@ -180,6 +197,7 @@ cipher_setkey( CIPHER_HANDLE c, byte *key, unsigned keylen ) } + void cipher_setiv( CIPHER_HANDLE c, const byte *iv ) { diff --git a/cipher/md.c b/cipher/md.c index 0f49443b7..0536fc2fe 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -64,6 +64,13 @@ md_enable( MD_HANDLE h, int algo ) sha1_init( &h->sha1 ); h->use_sha1 = 1; } + #ifdef WITH_TIGER_HASH + else if( algo == DIGEST_ALGO_TIGER ) { + if( !h->use_tiger ) + tiger_init( &h->tiger ); + h->use_tiger = 1; + } + #endif else log_bug("md_enable(%d)", algo ); } @@ -107,6 +114,12 @@ md_write( MD_HANDLE a, byte *inbuf, size_t inlen) sha1_write( &a->sha1, a->buffer, a->bufcount ); sha1_write( &a->sha1, inbuf, inlen ); } + #ifdef WITH_TIGER_HASH + if( a->use_tiger ) { + tiger_write( &a->tiger, a->buffer, a->bufcount ); + tiger_write( &a->tiger, inbuf, inlen ); + } + #endif if( a->use_md5 ) { md5_write( &a->md5, a->buffer, a->bufcount ); md5_write( &a->md5, inbuf, inlen ); @@ -121,13 +134,14 @@ md_final(MD_HANDLE a) { if( a->bufcount ) md_write( a, NULL, 0 ); - if( a->use_rmd160 ) { - byte *p; + if( a->use_rmd160 ) rmd160_final( &a->rmd160 ); - p = rmd160_read( &a->rmd160 ); - } if( a->use_sha1 ) sha1_final( &a->sha1 ); + #ifdef WITH_TIGER_HASH + if( a->use_tiger ) + tiger_final( &a->tiger ); + #endif if( a->use_md5 ) md5_final( &a->md5 ); } @@ -144,6 +158,10 @@ md_read( MD_HANDLE a, int algo ) return rmd160_read( &a->rmd160 ); if( a->use_sha1 ) return sha1_read( &a->sha1 ); + #ifdef WITH_TIGER_HASH + if( a->use_tiger ) + return tiger_read( &a->tiger ); + #endif if( a->use_md5 ) return md5_read( &a->md5 ); } @@ -152,6 +170,10 @@ md_read( MD_HANDLE a, int algo ) return rmd160_read( &a->rmd160 ); if( algo == DIGEST_ALGO_SHA1 ) return sha1_read( &a->sha1 ); + #ifdef WITH_TIGER_HASH + if( algo == DIGEST_ALGO_TIGER ) + return tiger_read( &a->tiger ); + #endif if( algo == DIGEST_ALGO_MD5 ) return md5_read( &a->md5 ); } @@ -165,6 +187,10 @@ md_get_algo( MD_HANDLE a ) return DIGEST_ALGO_RMD160; if( a->use_sha1 ) return DIGEST_ALGO_SHA1; + #ifdef WITH_TIGER_HASH + if( a->use_tiger ) + return DIGEST_ALGO_TIGER; + #endif if( a->use_md5 ) return DIGEST_ALGO_MD5; return 0; @@ -177,6 +203,8 @@ int md_digest_length( int algo ) { switch( algo ) { + case DIGEST_ALGO_TIGER: + return 24; case DIGEST_ALGO_RMD160: case DIGEST_ALGO_SHA1: return 20; @@ -204,6 +232,12 @@ md_asn_oid( int algo, size_t *asnlen, size_t *mdlen ) 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 }; mlen = 20; alen = DIM(asn); p = asn; } + else if( algo == DIGEST_ALGO_TIGER ) { + static byte asn[15] = /* FIXME: Object ID is ???????????? */ + { 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42 }; + mlen = 24; alen = DIM(asn); p = asn; + } else if( algo == DIGEST_ALGO_SHA1 ) { static byte asn[15] = /* Objet ID is 1.3.14.3.2.26 */ { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, diff --git a/cipher/md.h b/cipher/md.h index 961f61710..3bad06182 100644 --- a/cipher/md.h +++ b/cipher/md.h @@ -25,6 +25,7 @@ #include "rmd.h" #include "sha1.h" #include "md5.h" +#include "tiger.h" #define MD_BUFFER_SIZE 512 @@ -33,6 +34,10 @@ typedef struct { RMD160_CONTEXT rmd160; int use_sha1; SHA1_CONTEXT sha1; + #ifdef WITH_TIGER_HASH + int use_tiger; + TIGER_CONTEXT tiger; + #endif int use_md5; MD5_CONTEXT md5; byte buffer[MD_BUFFER_SIZE]; /* primary buffer */ diff --git a/cipher/misc.c b/cipher/misc.c index 3016b8e56..77cd03c7a 100644 --- a/cipher/misc.c +++ b/cipher/misc.c @@ -43,6 +43,7 @@ static struct { const char *name; int algo;} digest_names[] = { { "RMD160", DIGEST_ALGO_RMD160 }, { "RMD-160", DIGEST_ALGO_RMD160 }, { "RIPE-MD-160", DIGEST_ALGO_RMD160 }, + { "TIGER", DIGEST_ALGO_TIGER }, {NULL} }; @@ -149,6 +150,9 @@ int check_digest_algo( int algo ) { switch( algo ) { + #ifdef WITH_TIGER_HASH + case DIGEST_ALGO_TIGER: + #endif case DIGEST_ALGO_MD5: case DIGEST_ALGO_RMD160: case DIGEST_ALGO_SHA1: diff --git a/cipher/tiger.c b/cipher/tiger.c new file mode 100644 index 000000000..3ceeb9fdd --- /dev/null +++ b/cipher/tiger.c @@ -0,0 +1,848 @@ +/* tiger.c - The TIGER hash function + * Copyright (C) 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include "util.h" +#include "memory.h" +#include "tiger.h" + +#ifdef WITH_TIGER_HASH + +/********************************* + * Okay, okay, this is not the fastest code - improvements are welcome. + * + */ + +/* Some test vectors: + * "" 24F0130C63AC9332 16166E76B1BB925F F373DE2D49584E7A + * "abc" F258C1E88414AB2A 527AB541FFC5B8BF 935F7B951C132951 + * "Tiger" 9F00F599072300DD 276ABB38C8EB6DEC 37790C116F9D2BDF + * "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" + * 87FB2A9083851CF7 470D2CF810E6DF9E B586445034A5A386 + * "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789" + * 467DB80863EBCE48 8DF1CD1261655DE9 57896565975F9197 + * "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham" + * 0C410A042968868A 1671DA5A3FD29A72 5EC1E457D3CDB303 + * "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proc" + * "eedings of Fast Software Encryption 3, Cambridge." + * EBF591D5AFA655CE 7F22894FF87F54AC 89C811B6B0DA3193 + * "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proc" + * "eedings of Fast Software Encryption 3, Cambridge, 1996." + * 3D9AEB03D1BD1A63 57B2774DFD6D5B24 DD68151D503974FC + * "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEF" + * "GHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" + * 00B83EB4E53440C5 76AC6AAEE0A74858 25FD15E70A59FFE4 + */ + + +static u64 sbox1[256] = { + 0x02aab17cf7e90c5eLL /* 0 */, 0xac424b03e243a8ecLL /* 1 */, + 0x72cd5be30dd5fcd3LL /* 2 */, 0x6d019b93f6f97f3aLL /* 3 */, + 0xcd9978ffd21f9193LL /* 4 */, 0x7573a1c9708029e2LL /* 5 */, + 0xb164326b922a83c3LL /* 6 */, 0x46883eee04915870LL /* 7 */, + 0xeaace3057103ece6LL /* 8 */, 0xc54169b808a3535cLL /* 9 */, + 0x4ce754918ddec47cLL /* 10 */, 0x0aa2f4dfdc0df40cLL /* 11 */, + 0x10b76f18a74dbefaLL /* 12 */, 0xc6ccb6235ad1ab6aLL /* 13 */, + 0x13726121572fe2ffLL /* 14 */, 0x1a488c6f199d921eLL /* 15 */, + 0x4bc9f9f4da0007caLL /* 16 */, 0x26f5e6f6e85241c7LL /* 17 */, + 0x859079dbea5947b6LL /* 18 */, 0x4f1885c5c99e8c92LL /* 19 */, + 0xd78e761ea96f864bLL /* 20 */, 0x8e36428c52b5c17dLL /* 21 */, + 0x69cf6827373063c1LL /* 22 */, 0xb607c93d9bb4c56eLL /* 23 */, + 0x7d820e760e76b5eaLL /* 24 */, 0x645c9cc6f07fdc42LL /* 25 */, + 0xbf38a078243342e0LL /* 26 */, 0x5f6b343c9d2e7d04LL /* 27 */, + 0xf2c28aeb600b0ec6LL /* 28 */, 0x6c0ed85f7254bcacLL /* 29 */, + 0x71592281a4db4fe5LL /* 30 */, 0x1967fa69ce0fed9fLL /* 31 */, + 0xfd5293f8b96545dbLL /* 32 */, 0xc879e9d7f2a7600bLL /* 33 */, + 0x860248920193194eLL /* 34 */, 0xa4f9533b2d9cc0b3LL /* 35 */, + 0x9053836c15957613LL /* 36 */, 0xdb6dcf8afc357bf1LL /* 37 */, + 0x18beea7a7a370f57LL /* 38 */, 0x037117ca50b99066LL /* 39 */, + 0x6ab30a9774424a35LL /* 40 */, 0xf4e92f02e325249bLL /* 41 */, + 0x7739db07061ccae1LL /* 42 */, 0xd8f3b49ceca42a05LL /* 43 */, + 0xbd56be3f51382f73LL /* 44 */, 0x45faed5843b0bb28LL /* 45 */, + 0x1c813d5c11bf1f83LL /* 46 */, 0x8af0e4b6d75fa169LL /* 47 */, + 0x33ee18a487ad9999LL /* 48 */, 0x3c26e8eab1c94410LL /* 49 */, + 0xb510102bc0a822f9LL /* 50 */, 0x141eef310ce6123bLL /* 51 */, + 0xfc65b90059ddb154LL /* 52 */, 0xe0158640c5e0e607LL /* 53 */, + 0x884e079826c3a3cfLL /* 54 */, 0x930d0d9523c535fdLL /* 55 */, + 0x35638d754e9a2b00LL /* 56 */, 0x4085fccf40469dd5LL /* 57 */, + 0xc4b17ad28be23a4cLL /* 58 */, 0xcab2f0fc6a3e6a2eLL /* 59 */, + 0x2860971a6b943fcdLL /* 60 */, 0x3dde6ee212e30446LL /* 61 */, + 0x6222f32ae01765aeLL /* 62 */, 0x5d550bb5478308feLL /* 63 */, + 0xa9efa98da0eda22aLL /* 64 */, 0xc351a71686c40da7LL /* 65 */, + 0x1105586d9c867c84LL /* 66 */, 0xdcffee85fda22853LL /* 67 */, + 0xccfbd0262c5eef76LL /* 68 */, 0xbaf294cb8990d201LL /* 69 */, + 0xe69464f52afad975LL /* 70 */, 0x94b013afdf133e14LL /* 71 */, + 0x06a7d1a32823c958LL /* 72 */, 0x6f95fe5130f61119LL /* 73 */, + 0xd92ab34e462c06c0LL /* 74 */, 0xed7bde33887c71d2LL /* 75 */, + 0x79746d6e6518393eLL /* 76 */, 0x5ba419385d713329LL /* 77 */, + 0x7c1ba6b948a97564LL /* 78 */, 0x31987c197bfdac67LL /* 79 */, + 0xde6c23c44b053d02LL /* 80 */, 0x581c49fed002d64dLL /* 81 */, + 0xdd474d6338261571LL /* 82 */, 0xaa4546c3e473d062LL /* 83 */, + 0x928fce349455f860LL /* 84 */, 0x48161bbacaab94d9LL /* 85 */, + 0x63912430770e6f68LL /* 86 */, 0x6ec8a5e602c6641cLL /* 87 */, + 0x87282515337ddd2bLL /* 88 */, 0x2cda6b42034b701bLL /* 89 */, + 0xb03d37c181cb096dLL /* 90 */, 0xe108438266c71c6fLL /* 91 */, + 0x2b3180c7eb51b255LL /* 92 */, 0xdf92b82f96c08bbcLL /* 93 */, + 0x5c68c8c0a632f3baLL /* 94 */, 0x5504cc861c3d0556LL /* 95 */, + 0xabbfa4e55fb26b8fLL /* 96 */, 0x41848b0ab3baceb4LL /* 97 */, + 0xb334a273aa445d32LL /* 98 */, 0xbca696f0a85ad881LL /* 99 */, + 0x24f6ec65b528d56cLL /* 100 */, 0x0ce1512e90f4524aLL /* 101 */, + 0x4e9dd79d5506d35aLL /* 102 */, 0x258905fac6ce9779LL /* 103 */, + 0x2019295b3e109b33LL /* 104 */, 0xf8a9478b73a054ccLL /* 105 */, + 0x2924f2f934417eb0LL /* 106 */, 0x3993357d536d1bc4LL /* 107 */, + 0x38a81ac21db6ff8bLL /* 108 */, 0x47c4fbf17d6016bfLL /* 109 */, + 0x1e0faadd7667e3f5LL /* 110 */, 0x7abcff62938beb96LL /* 111 */, + 0xa78dad948fc179c9LL /* 112 */, 0x8f1f98b72911e50dLL /* 113 */, + 0x61e48eae27121a91LL /* 114 */, 0x4d62f7ad31859808LL /* 115 */, + 0xeceba345ef5ceaebLL /* 116 */, 0xf5ceb25ebc9684ceLL /* 117 */, + 0xf633e20cb7f76221LL /* 118 */, 0xa32cdf06ab8293e4LL /* 119 */, + 0x985a202ca5ee2ca4LL /* 120 */, 0xcf0b8447cc8a8fb1LL /* 121 */, + 0x9f765244979859a3LL /* 122 */, 0xa8d516b1a1240017LL /* 123 */, + 0x0bd7ba3ebb5dc726LL /* 124 */, 0xe54bca55b86adb39LL /* 125 */, + 0x1d7a3afd6c478063LL /* 126 */, 0x519ec608e7669eddLL /* 127 */, + 0x0e5715a2d149aa23LL /* 128 */, 0x177d4571848ff194LL /* 129 */, + 0xeeb55f3241014c22LL /* 130 */, 0x0f5e5ca13a6e2ec2LL /* 131 */, + 0x8029927b75f5c361LL /* 132 */, 0xad139fabc3d6e436LL /* 133 */, + 0x0d5df1a94ccf402fLL /* 134 */, 0x3e8bd948bea5dfc8LL /* 135 */, + 0xa5a0d357bd3ff77eLL /* 136 */, 0xa2d12e251f74f645LL /* 137 */, + 0x66fd9e525e81a082LL /* 138 */, 0x2e0c90ce7f687a49LL /* 139 */, + 0xc2e8bcbeba973bc5LL /* 140 */, 0x000001bce509745fLL /* 141 */, + 0x423777bbe6dab3d6LL /* 142 */, 0xd1661c7eaef06eb5LL /* 143 */, + 0xa1781f354daacfd8LL /* 144 */, 0x2d11284a2b16affcLL /* 145 */, + 0xf1fc4f67fa891d1fLL /* 146 */, 0x73ecc25dcb920adaLL /* 147 */, + 0xae610c22c2a12651LL /* 148 */, 0x96e0a810d356b78aLL /* 149 */, + 0x5a9a381f2fe7870fLL /* 150 */, 0xd5ad62ede94e5530LL /* 151 */, + 0xd225e5e8368d1427LL /* 152 */, 0x65977b70c7af4631LL /* 153 */, + 0x99f889b2de39d74fLL /* 154 */, 0x233f30bf54e1d143LL /* 155 */, + 0x9a9675d3d9a63c97LL /* 156 */, 0x5470554ff334f9a8LL /* 157 */, + 0x166acb744a4f5688LL /* 158 */, 0x70c74caab2e4aeadLL /* 159 */, + 0xf0d091646f294d12LL /* 160 */, 0x57b82a89684031d1LL /* 161 */, + 0xefd95a5a61be0b6bLL /* 162 */, 0x2fbd12e969f2f29aLL /* 163 */, + 0x9bd37013feff9fe8LL /* 164 */, 0x3f9b0404d6085a06LL /* 165 */, + 0x4940c1f3166cfe15LL /* 166 */, 0x09542c4dcdf3defbLL /* 167 */, + 0xb4c5218385cd5ce3LL /* 168 */, 0xc935b7dc4462a641LL /* 169 */, + 0x3417f8a68ed3b63fLL /* 170 */, 0xb80959295b215b40LL /* 171 */, + 0xf99cdaef3b8c8572LL /* 172 */, 0x018c0614f8fcb95dLL /* 173 */, + 0x1b14accd1a3acdf3LL /* 174 */, 0x84d471f200bb732dLL /* 175 */, + 0xc1a3110e95e8da16LL /* 176 */, 0x430a7220bf1a82b8LL /* 177 */, + 0xb77e090d39df210eLL /* 178 */, 0x5ef4bd9f3cd05e9dLL /* 179 */, + 0x9d4ff6da7e57a444LL /* 180 */, 0xda1d60e183d4a5f8LL /* 181 */, + 0xb287c38417998e47LL /* 182 */, 0xfe3edc121bb31886LL /* 183 */, + 0xc7fe3ccc980ccbefLL /* 184 */, 0xe46fb590189bfd03LL /* 185 */, + 0x3732fd469a4c57dcLL /* 186 */, 0x7ef700a07cf1ad65LL /* 187 */, + 0x59c64468a31d8859LL /* 188 */, 0x762fb0b4d45b61f6LL /* 189 */, + 0x155baed099047718LL /* 190 */, 0x68755e4c3d50baa6LL /* 191 */, + 0xe9214e7f22d8b4dfLL /* 192 */, 0x2addbf532eac95f4LL /* 193 */, + 0x32ae3909b4bd0109LL /* 194 */, 0x834df537b08e3450LL /* 195 */, + 0xfa209da84220728dLL /* 196 */, 0x9e691d9b9efe23f7LL /* 197 */, + 0x0446d288c4ae8d7fLL /* 198 */, 0x7b4cc524e169785bLL /* 199 */, + 0x21d87f0135ca1385LL /* 200 */, 0xcebb400f137b8aa5LL /* 201 */, + 0x272e2b66580796beLL /* 202 */, 0x3612264125c2b0deLL /* 203 */, + 0x057702bdad1efbb2LL /* 204 */, 0xd4babb8eacf84be9LL /* 205 */, + 0x91583139641bc67bLL /* 206 */, 0x8bdc2de08036e024LL /* 207 */, + 0x603c8156f49f68edLL /* 208 */, 0xf7d236f7dbef5111LL /* 209 */, + 0x9727c4598ad21e80LL /* 210 */, 0xa08a0896670a5fd7LL /* 211 */, + 0xcb4a8f4309eba9cbLL /* 212 */, 0x81af564b0f7036a1LL /* 213 */, + 0xc0b99aa778199abdLL /* 214 */, 0x959f1ec83fc8e952LL /* 215 */, + 0x8c505077794a81b9LL /* 216 */, 0x3acaaf8f056338f0LL /* 217 */, + 0x07b43f50627a6778LL /* 218 */, 0x4a44ab49f5eccc77LL /* 219 */, + 0x3bc3d6e4b679ee98LL /* 220 */, 0x9cc0d4d1cf14108cLL /* 221 */, + 0x4406c00b206bc8a0LL /* 222 */, 0x82a18854c8d72d89LL /* 223 */, + 0x67e366b35c3c432cLL /* 224 */, 0xb923dd61102b37f2LL /* 225 */, + 0x56ab2779d884271dLL /* 226 */, 0xbe83e1b0ff1525afLL /* 227 */, + 0xfb7c65d4217e49a9LL /* 228 */, 0x6bdbe0e76d48e7d4LL /* 229 */, + 0x08df828745d9179eLL /* 230 */, 0x22ea6a9add53bd34LL /* 231 */, + 0xe36e141c5622200aLL /* 232 */, 0x7f805d1b8cb750eeLL /* 233 */, + 0xafe5c7a59f58e837LL /* 234 */, 0xe27f996a4fb1c23cLL /* 235 */, + 0xd3867dfb0775f0d0LL /* 236 */, 0xd0e673de6e88891aLL /* 237 */, + 0x123aeb9eafb86c25LL /* 238 */, 0x30f1d5d5c145b895LL /* 239 */, + 0xbb434a2dee7269e7LL /* 240 */, 0x78cb67ecf931fa38LL /* 241 */, + 0xf33b0372323bbf9cLL /* 242 */, 0x52d66336fb279c74LL /* 243 */, + 0x505f33ac0afb4eaaLL /* 244 */, 0xe8a5cd99a2cce187LL /* 245 */, + 0x534974801e2d30bbLL /* 246 */, 0x8d2d5711d5876d90LL /* 247 */, + 0x1f1a412891bc038eLL /* 248 */, 0xd6e2e71d82e56648LL /* 249 */, + 0x74036c3a497732b7LL /* 250 */, 0x89b67ed96361f5abLL /* 251 */, + 0xffed95d8f1ea02a2LL /* 252 */, 0xe72b3bd61464d43dLL /* 253 */, + 0xa6300f170bdc4820LL /* 254 */, 0xebc18760ed78a77aLL /* 255 */ +}; +static u64 sbox2[256] = { + 0xe6a6be5a05a12138LL /* 256 */, 0xb5a122a5b4f87c98LL /* 257 */, + 0x563c6089140b6990LL /* 258 */, 0x4c46cb2e391f5dd5LL /* 259 */, + 0xd932addbc9b79434LL /* 260 */, 0x08ea70e42015aff5LL /* 261 */, + 0xd765a6673e478cf1LL /* 262 */, 0xc4fb757eab278d99LL /* 263 */, + 0xdf11c6862d6e0692LL /* 264 */, 0xddeb84f10d7f3b16LL /* 265 */, + 0x6f2ef604a665ea04LL /* 266 */, 0x4a8e0f0ff0e0dfb3LL /* 267 */, + 0xa5edeef83dbcba51LL /* 268 */, 0xfc4f0a2a0ea4371eLL /* 269 */, + 0xe83e1da85cb38429LL /* 270 */, 0xdc8ff882ba1b1ce2LL /* 271 */, + 0xcd45505e8353e80dLL /* 272 */, 0x18d19a00d4db0717LL /* 273 */, + 0x34a0cfeda5f38101LL /* 274 */, 0x0be77e518887caf2LL /* 275 */, + 0x1e341438b3c45136LL /* 276 */, 0xe05797f49089ccf9LL /* 277 */, + 0xffd23f9df2591d14LL /* 278 */, 0x543dda228595c5cdLL /* 279 */, + 0x661f81fd99052a33LL /* 280 */, 0x8736e641db0f7b76LL /* 281 */, + 0x15227725418e5307LL /* 282 */, 0xe25f7f46162eb2faLL /* 283 */, + 0x48a8b2126c13d9feLL /* 284 */, 0xafdc541792e76eeaLL /* 285 */, + 0x03d912bfc6d1898fLL /* 286 */, 0x31b1aafa1b83f51bLL /* 287 */, + 0xf1ac2796e42ab7d9LL /* 288 */, 0x40a3a7d7fcd2ebacLL /* 289 */, + 0x1056136d0afbbcc5LL /* 290 */, 0x7889e1dd9a6d0c85LL /* 291 */, + 0xd33525782a7974aaLL /* 292 */, 0xa7e25d09078ac09bLL /* 293 */, + 0xbd4138b3eac6edd0LL /* 294 */, 0x920abfbe71eb9e70LL /* 295 */, + 0xa2a5d0f54fc2625cLL /* 296 */, 0xc054e36b0b1290a3LL /* 297 */, + 0xf6dd59ff62fe932bLL /* 298 */, 0x3537354511a8ac7dLL /* 299 */, + 0xca845e9172fadcd4LL /* 300 */, 0x84f82b60329d20dcLL /* 301 */, + 0x79c62ce1cd672f18LL /* 302 */, 0x8b09a2add124642cLL /* 303 */, + 0xd0c1e96a19d9e726LL /* 304 */, 0x5a786a9b4ba9500cLL /* 305 */, + 0x0e020336634c43f3LL /* 306 */, 0xc17b474aeb66d822LL /* 307 */, + 0x6a731ae3ec9baac2LL /* 308 */, 0x8226667ae0840258LL /* 309 */, + 0x67d4567691caeca5LL /* 310 */, 0x1d94155c4875adb5LL /* 311 */, + 0x6d00fd985b813fdfLL /* 312 */, 0x51286efcb774cd06LL /* 313 */, + 0x5e8834471fa744afLL /* 314 */, 0xf72ca0aee761ae2eLL /* 315 */, + 0xbe40e4cdaee8e09aLL /* 316 */, 0xe9970bbb5118f665LL /* 317 */, + 0x726e4beb33df1964LL /* 318 */, 0x703b000729199762LL /* 319 */, + 0x4631d816f5ef30a7LL /* 320 */, 0xb880b5b51504a6beLL /* 321 */, + 0x641793c37ed84b6cLL /* 322 */, 0x7b21ed77f6e97d96LL /* 323 */, + 0x776306312ef96b73LL /* 324 */, 0xae528948e86ff3f4LL /* 325 */, + 0x53dbd7f286a3f8f8LL /* 326 */, 0x16cadce74cfc1063LL /* 327 */, + 0x005c19bdfa52c6ddLL /* 328 */, 0x68868f5d64d46ad3LL /* 329 */, + 0x3a9d512ccf1e186aLL /* 330 */, 0x367e62c2385660aeLL /* 331 */, + 0xe359e7ea77dcb1d7LL /* 332 */, 0x526c0773749abe6eLL /* 333 */, + 0x735ae5f9d09f734bLL /* 334 */, 0x493fc7cc8a558ba8LL /* 335 */, + 0xb0b9c1533041ab45LL /* 336 */, 0x321958ba470a59bdLL /* 337 */, + 0x852db00b5f46c393LL /* 338 */, 0x91209b2bd336b0e5LL /* 339 */, + 0x6e604f7d659ef19fLL /* 340 */, 0xb99a8ae2782ccb24LL /* 341 */, + 0xccf52ab6c814c4c7LL /* 342 */, 0x4727d9afbe11727bLL /* 343 */, + 0x7e950d0c0121b34dLL /* 344 */, 0x756f435670ad471fLL /* 345 */, + 0xf5add442615a6849LL /* 346 */, 0x4e87e09980b9957aLL /* 347 */, + 0x2acfa1df50aee355LL /* 348 */, 0xd898263afd2fd556LL /* 349 */, + 0xc8f4924dd80c8fd6LL /* 350 */, 0xcf99ca3d754a173aLL /* 351 */, + 0xfe477bacaf91bf3cLL /* 352 */, 0xed5371f6d690c12dLL /* 353 */, + 0x831a5c285e687094LL /* 354 */, 0xc5d3c90a3708a0a4LL /* 355 */, + 0x0f7f903717d06580LL /* 356 */, 0x19f9bb13b8fdf27fLL /* 357 */, + 0xb1bd6f1b4d502843LL /* 358 */, 0x1c761ba38fff4012LL /* 359 */, + 0x0d1530c4e2e21f3bLL /* 360 */, 0x8943ce69a7372c8aLL /* 361 */, + 0xe5184e11feb5ce66LL /* 362 */, 0x618bdb80bd736621LL /* 363 */, + 0x7d29bad68b574d0bLL /* 364 */, 0x81bb613e25e6fe5bLL /* 365 */, + 0x071c9c10bc07913fLL /* 366 */, 0xc7beeb7909ac2d97LL /* 367 */, + 0xc3e58d353bc5d757LL /* 368 */, 0xeb017892f38f61e8LL /* 369 */, + 0xd4effb9c9b1cc21aLL /* 370 */, 0x99727d26f494f7abLL /* 371 */, + 0xa3e063a2956b3e03LL /* 372 */, 0x9d4a8b9a4aa09c30LL /* 373 */, + 0x3f6ab7d500090fb4LL /* 374 */, 0x9cc0f2a057268ac0LL /* 375 */, + 0x3dee9d2dedbf42d1LL /* 376 */, 0x330f49c87960a972LL /* 377 */, + 0xc6b2720287421b41LL /* 378 */, 0x0ac59ec07c00369cLL /* 379 */, + 0xef4eac49cb353425LL /* 380 */, 0xf450244eef0129d8LL /* 381 */, + 0x8acc46e5caf4deb6LL /* 382 */, 0x2ffeab63989263f7LL /* 383 */, + 0x8f7cb9fe5d7a4578LL /* 384 */, 0x5bd8f7644e634635LL /* 385 */, + 0x427a7315bf2dc900LL /* 386 */, 0x17d0c4aa2125261cLL /* 387 */, + 0x3992486c93518e50LL /* 388 */, 0xb4cbfee0a2d7d4c3LL /* 389 */, + 0x7c75d6202c5ddd8dLL /* 390 */, 0xdbc295d8e35b6c61LL /* 391 */, + 0x60b369d302032b19LL /* 392 */, 0xce42685fdce44132LL /* 393 */, + 0x06f3ddb9ddf65610LL /* 394 */, 0x8ea4d21db5e148f0LL /* 395 */, + 0x20b0fce62fcd496fLL /* 396 */, 0x2c1b912358b0ee31LL /* 397 */, + 0xb28317b818f5a308LL /* 398 */, 0xa89c1e189ca6d2cfLL /* 399 */, + 0x0c6b18576aaadbc8LL /* 400 */, 0xb65deaa91299fae3LL /* 401 */, + 0xfb2b794b7f1027e7LL /* 402 */, 0x04e4317f443b5bebLL /* 403 */, + 0x4b852d325939d0a6LL /* 404 */, 0xd5ae6beefb207ffcLL /* 405 */, + 0x309682b281c7d374LL /* 406 */, 0xbae309a194c3b475LL /* 407 */, + 0x8cc3f97b13b49f05LL /* 408 */, 0x98a9422ff8293967LL /* 409 */, + 0x244b16b01076ff7cLL /* 410 */, 0xf8bf571c663d67eeLL /* 411 */, + 0x1f0d6758eee30da1LL /* 412 */, 0xc9b611d97adeb9b7LL /* 413 */, + 0xb7afd5887b6c57a2LL /* 414 */, 0x6290ae846b984fe1LL /* 415 */, + 0x94df4cdeacc1a5fdLL /* 416 */, 0x058a5bd1c5483affLL /* 417 */, + 0x63166cc142ba3c37LL /* 418 */, 0x8db8526eb2f76f40LL /* 419 */, + 0xe10880036f0d6d4eLL /* 420 */, 0x9e0523c9971d311dLL /* 421 */, + 0x45ec2824cc7cd691LL /* 422 */, 0x575b8359e62382c9LL /* 423 */, + 0xfa9e400dc4889995LL /* 424 */, 0xd1823ecb45721568LL /* 425 */, + 0xdafd983b8206082fLL /* 426 */, 0xaa7d29082386a8cbLL /* 427 */, + 0x269fcd4403b87588LL /* 428 */, 0x1b91f5f728bdd1e0LL /* 429 */, + 0xe4669f39040201f6LL /* 430 */, 0x7a1d7c218cf04adeLL /* 431 */, + 0x65623c29d79ce5ceLL /* 432 */, 0x2368449096c00bb1LL /* 433 */, + 0xab9bf1879da503baLL /* 434 */, 0xbc23ecb1a458058eLL /* 435 */, + 0x9a58df01bb401eccLL /* 436 */, 0xa070e868a85f143dLL /* 437 */, + 0x4ff188307df2239eLL /* 438 */, 0x14d565b41a641183LL /* 439 */, + 0xee13337452701602LL /* 440 */, 0x950e3dcf3f285e09LL /* 441 */, + 0x59930254b9c80953LL /* 442 */, 0x3bf299408930da6dLL /* 443 */, + 0xa955943f53691387LL /* 444 */, 0xa15edecaa9cb8784LL /* 445 */, + 0x29142127352be9a0LL /* 446 */, 0x76f0371fff4e7afbLL /* 447 */, + 0x0239f450274f2228LL /* 448 */, 0xbb073af01d5e868bLL /* 449 */, + 0xbfc80571c10e96c1LL /* 450 */, 0xd267088568222e23LL /* 451 */, + 0x9671a3d48e80b5b0LL /* 452 */, 0x55b5d38ae193bb81LL /* 453 */, + 0x693ae2d0a18b04b8LL /* 454 */, 0x5c48b4ecadd5335fLL /* 455 */, + 0xfd743b194916a1caLL /* 456 */, 0x2577018134be98c4LL /* 457 */, + 0xe77987e83c54a4adLL /* 458 */, 0x28e11014da33e1b9LL /* 459 */, + 0x270cc59e226aa213LL /* 460 */, 0x71495f756d1a5f60LL /* 461 */, + 0x9be853fb60afef77LL /* 462 */, 0xadc786a7f7443dbfLL /* 463 */, + 0x0904456173b29a82LL /* 464 */, 0x58bc7a66c232bd5eLL /* 465 */, + 0xf306558c673ac8b2LL /* 466 */, 0x41f639c6b6c9772aLL /* 467 */, + 0x216defe99fda35daLL /* 468 */, 0x11640cc71c7be615LL /* 469 */, + 0x93c43694565c5527LL /* 470 */, 0xea038e6246777839LL /* 471 */, + 0xf9abf3ce5a3e2469LL /* 472 */, 0x741e768d0fd312d2LL /* 473 */, + 0x0144b883ced652c6LL /* 474 */, 0xc20b5a5ba33f8552LL /* 475 */, + 0x1ae69633c3435a9dLL /* 476 */, 0x97a28ca4088cfdecLL /* 477 */, + 0x8824a43c1e96f420LL /* 478 */, 0x37612fa66eeea746LL /* 479 */, + 0x6b4cb165f9cf0e5aLL /* 480 */, 0x43aa1c06a0abfb4aLL /* 481 */, + 0x7f4dc26ff162796bLL /* 482 */, 0x6cbacc8e54ed9b0fLL /* 483 */, + 0xa6b7ffefd2bb253eLL /* 484 */, 0x2e25bc95b0a29d4fLL /* 485 */, + 0x86d6a58bdef1388cLL /* 486 */, 0xded74ac576b6f054LL /* 487 */, + 0x8030bdbc2b45805dLL /* 488 */, 0x3c81af70e94d9289LL /* 489 */, + 0x3eff6dda9e3100dbLL /* 490 */, 0xb38dc39fdfcc8847LL /* 491 */, + 0x123885528d17b87eLL /* 492 */, 0xf2da0ed240b1b642LL /* 493 */, + 0x44cefadcd54bf9a9LL /* 494 */, 0x1312200e433c7ee6LL /* 495 */, + 0x9ffcc84f3a78c748LL /* 496 */, 0xf0cd1f72248576bbLL /* 497 */, + 0xec6974053638cfe4LL /* 498 */, 0x2ba7b67c0cec4e4cLL /* 499 */, + 0xac2f4df3e5ce32edLL /* 500 */, 0xcb33d14326ea4c11LL /* 501 */, + 0xa4e9044cc77e58bcLL /* 502 */, 0x5f513293d934fcefLL /* 503 */, + 0x5dc9645506e55444LL /* 504 */, 0x50de418f317de40aLL /* 505 */, + 0x388cb31a69dde259LL /* 506 */, 0x2db4a83455820a86LL /* 507 */, + 0x9010a91e84711ae9LL /* 508 */, 0x4df7f0b7b1498371LL /* 509 */, + 0xd62a2eabc0977179LL /* 510 */, 0x22fac097aa8d5c0eLL /* 511 */ +}; +static u64 sbox3[256] = { + 0xf49fcc2ff1daf39bLL /* 512 */, 0x487fd5c66ff29281LL /* 513 */, + 0xe8a30667fcdca83fLL /* 514 */, 0x2c9b4be3d2fcce63LL /* 515 */, + 0xda3ff74b93fbbbc2LL /* 516 */, 0x2fa165d2fe70ba66LL /* 517 */, + 0xa103e279970e93d4LL /* 518 */, 0xbecdec77b0e45e71LL /* 519 */, + 0xcfb41e723985e497LL /* 520 */, 0xb70aaa025ef75017LL /* 521 */, + 0xd42309f03840b8e0LL /* 522 */, 0x8efc1ad035898579LL /* 523 */, + 0x96c6920be2b2abc5LL /* 524 */, 0x66af4163375a9172LL /* 525 */, + 0x2174abdcca7127fbLL /* 526 */, 0xb33ccea64a72ff41LL /* 527 */, + 0xf04a4933083066a5LL /* 528 */, 0x8d970acdd7289af5LL /* 529 */, + 0x8f96e8e031c8c25eLL /* 530 */, 0xf3fec02276875d47LL /* 531 */, + 0xec7bf310056190ddLL /* 532 */, 0xf5adb0aebb0f1491LL /* 533 */, + 0x9b50f8850fd58892LL /* 534 */, 0x4975488358b74de8LL /* 535 */, + 0xa3354ff691531c61LL /* 536 */, 0x0702bbe481d2c6eeLL /* 537 */, + 0x89fb24057deded98LL /* 538 */, 0xac3075138596e902LL /* 539 */, + 0x1d2d3580172772edLL /* 540 */, 0xeb738fc28e6bc30dLL /* 541 */, + 0x5854ef8f63044326LL /* 542 */, 0x9e5c52325add3bbeLL /* 543 */, + 0x90aa53cf325c4623LL /* 544 */, 0xc1d24d51349dd067LL /* 545 */, + 0x2051cfeea69ea624LL /* 546 */, 0x13220f0a862e7e4fLL /* 547 */, + 0xce39399404e04864LL /* 548 */, 0xd9c42ca47086fcb7LL /* 549 */, + 0x685ad2238a03e7ccLL /* 550 */, 0x066484b2ab2ff1dbLL /* 551 */, + 0xfe9d5d70efbf79ecLL /* 552 */, 0x5b13b9dd9c481854LL /* 553 */, + 0x15f0d475ed1509adLL /* 554 */, 0x0bebcd060ec79851LL /* 555 */, + 0xd58c6791183ab7f8LL /* 556 */, 0xd1187c5052f3eee4LL /* 557 */, + 0xc95d1192e54e82ffLL /* 558 */, 0x86eea14cb9ac6ca2LL /* 559 */, + 0x3485beb153677d5dLL /* 560 */, 0xdd191d781f8c492aLL /* 561 */, + 0xf60866baa784ebf9LL /* 562 */, 0x518f643ba2d08c74LL /* 563 */, + 0x8852e956e1087c22LL /* 564 */, 0xa768cb8dc410ae8dLL /* 565 */, + 0x38047726bfec8e1aLL /* 566 */, 0xa67738b4cd3b45aaLL /* 567 */, + 0xad16691cec0dde19LL /* 568 */, 0xc6d4319380462e07LL /* 569 */, + 0xc5a5876d0ba61938LL /* 570 */, 0x16b9fa1fa58fd840LL /* 571 */, + 0x188ab1173ca74f18LL /* 572 */, 0xabda2f98c99c021fLL /* 573 */, + 0x3e0580ab134ae816LL /* 574 */, 0x5f3b05b773645abbLL /* 575 */, + 0x2501a2be5575f2f6LL /* 576 */, 0x1b2f74004e7e8ba9LL /* 577 */, + 0x1cd7580371e8d953LL /* 578 */, 0x7f6ed89562764e30LL /* 579 */, + 0xb15926ff596f003dLL /* 580 */, 0x9f65293da8c5d6b9LL /* 581 */, + 0x6ecef04dd690f84cLL /* 582 */, 0x4782275fff33af88LL /* 583 */, + 0xe41433083f820801LL /* 584 */, 0xfd0dfe409a1af9b5LL /* 585 */, + 0x4325a3342cdb396bLL /* 586 */, 0x8ae77e62b301b252LL /* 587 */, + 0xc36f9e9f6655615aLL /* 588 */, 0x85455a2d92d32c09LL /* 589 */, + 0xf2c7dea949477485LL /* 590 */, 0x63cfb4c133a39ebaLL /* 591 */, + 0x83b040cc6ebc5462LL /* 592 */, 0x3b9454c8fdb326b0LL /* 593 */, + 0x56f56a9e87ffd78cLL /* 594 */, 0x2dc2940d99f42bc6LL /* 595 */, + 0x98f7df096b096e2dLL /* 596 */, 0x19a6e01e3ad852bfLL /* 597 */, + 0x42a99ccbdbd4b40bLL /* 598 */, 0xa59998af45e9c559LL /* 599 */, + 0x366295e807d93186LL /* 600 */, 0x6b48181bfaa1f773LL /* 601 */, + 0x1fec57e2157a0a1dLL /* 602 */, 0x4667446af6201ad5LL /* 603 */, + 0xe615ebcacfb0f075LL /* 604 */, 0xb8f31f4f68290778LL /* 605 */, + 0x22713ed6ce22d11eLL /* 606 */, 0x3057c1a72ec3c93bLL /* 607 */, + 0xcb46acc37c3f1f2fLL /* 608 */, 0xdbb893fd02aaf50eLL /* 609 */, + 0x331fd92e600b9fcfLL /* 610 */, 0xa498f96148ea3ad6LL /* 611 */, + 0xa8d8426e8b6a83eaLL /* 612 */, 0xa089b274b7735cdcLL /* 613 */, + 0x87f6b3731e524a11LL /* 614 */, 0x118808e5cbc96749LL /* 615 */, + 0x9906e4c7b19bd394LL /* 616 */, 0xafed7f7e9b24a20cLL /* 617 */, + 0x6509eadeeb3644a7LL /* 618 */, 0x6c1ef1d3e8ef0edeLL /* 619 */, + 0xb9c97d43e9798fb4LL /* 620 */, 0xa2f2d784740c28a3LL /* 621 */, + 0x7b8496476197566fLL /* 622 */, 0x7a5be3e6b65f069dLL /* 623 */, + 0xf96330ed78be6f10LL /* 624 */, 0xeee60de77a076a15LL /* 625 */, + 0x2b4bee4aa08b9bd0LL /* 626 */, 0x6a56a63ec7b8894eLL /* 627 */, + 0x02121359ba34fef4LL /* 628 */, 0x4cbf99f8283703fcLL /* 629 */, + 0x398071350caf30c8LL /* 630 */, 0xd0a77a89f017687aLL /* 631 */, + 0xf1c1a9eb9e423569LL /* 632 */, 0x8c7976282dee8199LL /* 633 */, + 0x5d1737a5dd1f7abdLL /* 634 */, 0x4f53433c09a9fa80LL /* 635 */, + 0xfa8b0c53df7ca1d9LL /* 636 */, 0x3fd9dcbc886ccb77LL /* 637 */, + 0xc040917ca91b4720LL /* 638 */, 0x7dd00142f9d1dcdfLL /* 639 */, + 0x8476fc1d4f387b58LL /* 640 */, 0x23f8e7c5f3316503LL /* 641 */, + 0x032a2244e7e37339LL /* 642 */, 0x5c87a5d750f5a74bLL /* 643 */, + 0x082b4cc43698992eLL /* 644 */, 0xdf917becb858f63cLL /* 645 */, + 0x3270b8fc5bf86ddaLL /* 646 */, 0x10ae72bb29b5dd76LL /* 647 */, + 0x576ac94e7700362bLL /* 648 */, 0x1ad112dac61efb8fLL /* 649 */, + 0x691bc30ec5faa427LL /* 650 */, 0xff246311cc327143LL /* 651 */, + 0x3142368e30e53206LL /* 652 */, 0x71380e31e02ca396LL /* 653 */, + 0x958d5c960aad76f1LL /* 654 */, 0xf8d6f430c16da536LL /* 655 */, + 0xc8ffd13f1be7e1d2LL /* 656 */, 0x7578ae66004ddbe1LL /* 657 */, + 0x05833f01067be646LL /* 658 */, 0xbb34b5ad3bfe586dLL /* 659 */, + 0x095f34c9a12b97f0LL /* 660 */, 0x247ab64525d60ca8LL /* 661 */, + 0xdcdbc6f3017477d1LL /* 662 */, 0x4a2e14d4decad24dLL /* 663 */, + 0xbdb5e6d9be0a1eebLL /* 664 */, 0x2a7e70f7794301abLL /* 665 */, + 0xdef42d8a270540fdLL /* 666 */, 0x01078ec0a34c22c1LL /* 667 */, + 0xe5de511af4c16387LL /* 668 */, 0x7ebb3a52bd9a330aLL /* 669 */, + 0x77697857aa7d6435LL /* 670 */, 0x004e831603ae4c32LL /* 671 */, + 0xe7a21020ad78e312LL /* 672 */, 0x9d41a70c6ab420f2LL /* 673 */, + 0x28e06c18ea1141e6LL /* 674 */, 0xd2b28cbd984f6b28LL /* 675 */, + 0x26b75f6c446e9d83LL /* 676 */, 0xba47568c4d418d7fLL /* 677 */, + 0xd80badbfe6183d8eLL /* 678 */, 0x0e206d7f5f166044LL /* 679 */, + 0xe258a43911cbca3eLL /* 680 */, 0x723a1746b21dc0bcLL /* 681 */, + 0xc7caa854f5d7cdd3LL /* 682 */, 0x7cac32883d261d9cLL /* 683 */, + 0x7690c26423ba942cLL /* 684 */, 0x17e55524478042b8LL /* 685 */, + 0xe0be477656a2389fLL /* 686 */, 0x4d289b5e67ab2da0LL /* 687 */, + 0x44862b9c8fbbfd31LL /* 688 */, 0xb47cc8049d141365LL /* 689 */, + 0x822c1b362b91c793LL /* 690 */, 0x4eb14655fb13dfd8LL /* 691 */, + 0x1ecbba0714e2a97bLL /* 692 */, 0x6143459d5cde5f14LL /* 693 */, + 0x53a8fbf1d5f0ac89LL /* 694 */, 0x97ea04d81c5e5b00LL /* 695 */, + 0x622181a8d4fdb3f3LL /* 696 */, 0xe9bcd341572a1208LL /* 697 */, + 0x1411258643cce58aLL /* 698 */, 0x9144c5fea4c6e0a4LL /* 699 */, + 0x0d33d06565cf620fLL /* 700 */, 0x54a48d489f219ca1LL /* 701 */, + 0xc43e5eac6d63c821LL /* 702 */, 0xa9728b3a72770dafLL /* 703 */, + 0xd7934e7b20df87efLL /* 704 */, 0xe35503b61a3e86e5LL /* 705 */, + 0xcae321fbc819d504LL /* 706 */, 0x129a50b3ac60bfa6LL /* 707 */, + 0xcd5e68ea7e9fb6c3LL /* 708 */, 0xb01c90199483b1c7LL /* 709 */, + 0x3de93cd5c295376cLL /* 710 */, 0xaed52edf2ab9ad13LL /* 711 */, + 0x2e60f512c0a07884LL /* 712 */, 0xbc3d86a3e36210c9LL /* 713 */, + 0x35269d9b163951ceLL /* 714 */, 0x0c7d6e2ad0cdb5faLL /* 715 */, + 0x59e86297d87f5733LL /* 716 */, 0x298ef221898db0e7LL /* 717 */, + 0x55000029d1a5aa7eLL /* 718 */, 0x8bc08ae1b5061b45LL /* 719 */, + 0xc2c31c2b6c92703aLL /* 720 */, 0x94cc596baf25ef42LL /* 721 */, + 0x0a1d73db22540456LL /* 722 */, 0x04b6a0f9d9c4179aLL /* 723 */, + 0xeffdafa2ae3d3c60LL /* 724 */, 0xf7c8075bb49496c4LL /* 725 */, + 0x9cc5c7141d1cd4e3LL /* 726 */, 0x78bd1638218e5534LL /* 727 */, + 0xb2f11568f850246aLL /* 728 */, 0xedfabcfa9502bc29LL /* 729 */, + 0x796ce5f2da23051bLL /* 730 */, 0xaae128b0dc93537cLL /* 731 */, + 0x3a493da0ee4b29aeLL /* 732 */, 0xb5df6b2c416895d7LL /* 733 */, + 0xfcabbd25122d7f37LL /* 734 */, 0x70810b58105dc4b1LL /* 735 */, + 0xe10fdd37f7882a90LL /* 736 */, 0x524dcab5518a3f5cLL /* 737 */, + 0x3c9e85878451255bLL /* 738 */, 0x4029828119bd34e2LL /* 739 */, + 0x74a05b6f5d3ceccbLL /* 740 */, 0xb610021542e13ecaLL /* 741 */, + 0x0ff979d12f59e2acLL /* 742 */, 0x6037da27e4f9cc50LL /* 743 */, + 0x5e92975a0df1847dLL /* 744 */, 0xd66de190d3e623feLL /* 745 */, + 0x5032d6b87b568048LL /* 746 */, 0x9a36b7ce8235216eLL /* 747 */, + 0x80272a7a24f64b4aLL /* 748 */, 0x93efed8b8c6916f7LL /* 749 */, + 0x37ddbff44cce1555LL /* 750 */, 0x4b95db5d4b99bd25LL /* 751 */, + 0x92d3fda169812fc0LL /* 752 */, 0xfb1a4a9a90660bb6LL /* 753 */, + 0x730c196946a4b9b2LL /* 754 */, 0x81e289aa7f49da68LL /* 755 */, + 0x64669a0f83b1a05fLL /* 756 */, 0x27b3ff7d9644f48bLL /* 757 */, + 0xcc6b615c8db675b3LL /* 758 */, 0x674f20b9bcebbe95LL /* 759 */, + 0x6f31238275655982LL /* 760 */, 0x5ae488713e45cf05LL /* 761 */, + 0xbf619f9954c21157LL /* 762 */, 0xeabac46040a8eae9LL /* 763 */, + 0x454c6fe9f2c0c1cdLL /* 764 */, 0x419cf6496412691cLL /* 765 */, + 0xd3dc3bef265b0f70LL /* 766 */, 0x6d0e60f5c3578a9eLL /* 767 */ +}; +static u64 sbox4[256] = { + 0x5b0e608526323c55LL /* 768 */, 0x1a46c1a9fa1b59f5LL /* 769 */, + 0xa9e245a17c4c8ffaLL /* 770 */, 0x65ca5159db2955d7LL /* 771 */, + 0x05db0a76ce35afc2LL /* 772 */, 0x81eac77ea9113d45LL /* 773 */, + 0x528ef88ab6ac0a0dLL /* 774 */, 0xa09ea253597be3ffLL /* 775 */, + 0x430ddfb3ac48cd56LL /* 776 */, 0xc4b3a67af45ce46fLL /* 777 */, + 0x4ececfd8fbe2d05eLL /* 778 */, 0x3ef56f10b39935f0LL /* 779 */, + 0x0b22d6829cd619c6LL /* 780 */, 0x17fd460a74df2069LL /* 781 */, + 0x6cf8cc8e8510ed40LL /* 782 */, 0xd6c824bf3a6ecaa7LL /* 783 */, + 0x61243d581a817049LL /* 784 */, 0x048bacb6bbc163a2LL /* 785 */, + 0xd9a38ac27d44cc32LL /* 786 */, 0x7fddff5baaf410abLL /* 787 */, + 0xad6d495aa804824bLL /* 788 */, 0xe1a6a74f2d8c9f94LL /* 789 */, + 0xd4f7851235dee8e3LL /* 790 */, 0xfd4b7f886540d893LL /* 791 */, + 0x247c20042aa4bfdaLL /* 792 */, 0x096ea1c517d1327cLL /* 793 */, + 0xd56966b4361a6685LL /* 794 */, 0x277da5c31221057dLL /* 795 */, + 0x94d59893a43acff7LL /* 796 */, 0x64f0c51ccdc02281LL /* 797 */, + 0x3d33bcc4ff6189dbLL /* 798 */, 0xe005cb184ce66af1LL /* 799 */, + 0xff5ccd1d1db99beaLL /* 800 */, 0xb0b854a7fe42980fLL /* 801 */, + 0x7bd46a6a718d4b9fLL /* 802 */, 0xd10fa8cc22a5fd8cLL /* 803 */, + 0xd31484952be4bd31LL /* 804 */, 0xc7fa975fcb243847LL /* 805 */, + 0x4886ed1e5846c407LL /* 806 */, 0x28cddb791eb70b04LL /* 807 */, + 0xc2b00be2f573417fLL /* 808 */, 0x5c9590452180f877LL /* 809 */, + 0x7a6bddfff370eb00LL /* 810 */, 0xce509e38d6d9d6a4LL /* 811 */, + 0xebeb0f00647fa702LL /* 812 */, 0x1dcc06cf76606f06LL /* 813 */, + 0xe4d9f28ba286ff0aLL /* 814 */, 0xd85a305dc918c262LL /* 815 */, + 0x475b1d8732225f54LL /* 816 */, 0x2d4fb51668ccb5feLL /* 817 */, + 0xa679b9d9d72bba20LL /* 818 */, 0x53841c0d912d43a5LL /* 819 */, + 0x3b7eaa48bf12a4e8LL /* 820 */, 0x781e0e47f22f1ddfLL /* 821 */, + 0xeff20ce60ab50973LL /* 822 */, 0x20d261d19dffb742LL /* 823 */, + 0x16a12b03062a2e39LL /* 824 */, 0x1960eb2239650495LL /* 825 */, + 0x251c16fed50eb8b8LL /* 826 */, 0x9ac0c330f826016eLL /* 827 */, + 0xed152665953e7671LL /* 828 */, 0x02d63194a6369570LL /* 829 */, + 0x5074f08394b1c987LL /* 830 */, 0x70ba598c90b25ce1LL /* 831 */, + 0x794a15810b9742f6LL /* 832 */, 0x0d5925e9fcaf8c6cLL /* 833 */, + 0x3067716cd868744eLL /* 834 */, 0x910ab077e8d7731bLL /* 835 */, + 0x6a61bbdb5ac42f61LL /* 836 */, 0x93513efbf0851567LL /* 837 */, + 0xf494724b9e83e9d5LL /* 838 */, 0xe887e1985c09648dLL /* 839 */, + 0x34b1d3c675370cfdLL /* 840 */, 0xdc35e433bc0d255dLL /* 841 */, + 0xd0aab84234131be0LL /* 842 */, 0x08042a50b48b7eafLL /* 843 */, + 0x9997c4ee44a3ab35LL /* 844 */, 0x829a7b49201799d0LL /* 845 */, + 0x263b8307b7c54441LL /* 846 */, 0x752f95f4fd6a6ca6LL /* 847 */, + 0x927217402c08c6e5LL /* 848 */, 0x2a8ab754a795d9eeLL /* 849 */, + 0xa442f7552f72943dLL /* 850 */, 0x2c31334e19781208LL /* 851 */, + 0x4fa98d7ceaee6291LL /* 852 */, 0x55c3862f665db309LL /* 853 */, + 0xbd0610175d53b1f3LL /* 854 */, 0x46fe6cb840413f27LL /* 855 */, + 0x3fe03792df0cfa59LL /* 856 */, 0xcfe700372eb85e8fLL /* 857 */, + 0xa7be29e7adbce118LL /* 858 */, 0xe544ee5cde8431ddLL /* 859 */, + 0x8a781b1b41f1873eLL /* 860 */, 0xa5c94c78a0d2f0e7LL /* 861 */, + 0x39412e2877b60728LL /* 862 */, 0xa1265ef3afc9a62cLL /* 863 */, + 0xbcc2770c6a2506c5LL /* 864 */, 0x3ab66dd5dce1ce12LL /* 865 */, + 0xe65499d04a675b37LL /* 866 */, 0x7d8f523481bfd216LL /* 867 */, + 0x0f6f64fcec15f389LL /* 868 */, 0x74efbe618b5b13c8LL /* 869 */, + 0xacdc82b714273e1dLL /* 870 */, 0xdd40bfe003199d17LL /* 871 */, + 0x37e99257e7e061f8LL /* 872 */, 0xfa52626904775aaaLL /* 873 */, + 0x8bbbf63a463d56f9LL /* 874 */, 0xf0013f1543a26e64LL /* 875 */, + 0xa8307e9f879ec898LL /* 876 */, 0xcc4c27a4150177ccLL /* 877 */, + 0x1b432f2cca1d3348LL /* 878 */, 0xde1d1f8f9f6fa013LL /* 879 */, + 0x606602a047a7ddd6LL /* 880 */, 0xd237ab64cc1cb2c7LL /* 881 */, + 0x9b938e7225fcd1d3LL /* 882 */, 0xec4e03708e0ff476LL /* 883 */, + 0xfeb2fbda3d03c12dLL /* 884 */, 0xae0bced2ee43889aLL /* 885 */, + 0x22cb8923ebfb4f43LL /* 886 */, 0x69360d013cf7396dLL /* 887 */, + 0x855e3602d2d4e022LL /* 888 */, 0x073805bad01f784cLL /* 889 */, + 0x33e17a133852f546LL /* 890 */, 0xdf4874058ac7b638LL /* 891 */, + 0xba92b29c678aa14aLL /* 892 */, 0x0ce89fc76cfaadcdLL /* 893 */, + 0x5f9d4e0908339e34LL /* 894 */, 0xf1afe9291f5923b9LL /* 895 */, + 0x6e3480f60f4a265fLL /* 896 */, 0xeebf3a2ab29b841cLL /* 897 */, + 0xe21938a88f91b4adLL /* 898 */, 0x57dfeff845c6d3c3LL /* 899 */, + 0x2f006b0bf62caaf2LL /* 900 */, 0x62f479ef6f75ee78LL /* 901 */, + 0x11a55ad41c8916a9LL /* 902 */, 0xf229d29084fed453LL /* 903 */, + 0x42f1c27b16b000e6LL /* 904 */, 0x2b1f76749823c074LL /* 905 */, + 0x4b76eca3c2745360LL /* 906 */, 0x8c98f463b91691bdLL /* 907 */, + 0x14bcc93cf1ade66aLL /* 908 */, 0x8885213e6d458397LL /* 909 */, + 0x8e177df0274d4711LL /* 910 */, 0xb49b73b5503f2951LL /* 911 */, + 0x10168168c3f96b6bLL /* 912 */, 0x0e3d963b63cab0aeLL /* 913 */, + 0x8dfc4b5655a1db14LL /* 914 */, 0xf789f1356e14de5cLL /* 915 */, + 0x683e68af4e51dac1LL /* 916 */, 0xc9a84f9d8d4b0fd9LL /* 917 */, + 0x3691e03f52a0f9d1LL /* 918 */, 0x5ed86e46e1878e80LL /* 919 */, + 0x3c711a0e99d07150LL /* 920 */, 0x5a0865b20c4e9310LL /* 921 */, + 0x56fbfc1fe4f0682eLL /* 922 */, 0xea8d5de3105edf9bLL /* 923 */, + 0x71abfdb12379187aLL /* 924 */, 0x2eb99de1bee77b9cLL /* 925 */, + 0x21ecc0ea33cf4523LL /* 926 */, 0x59a4d7521805c7a1LL /* 927 */, + 0x3896f5eb56ae7c72LL /* 928 */, 0xaa638f3db18f75dcLL /* 929 */, + 0x9f39358dabe9808eLL /* 930 */, 0xb7defa91c00b72acLL /* 931 */, + 0x6b5541fd62492d92LL /* 932 */, 0x6dc6dee8f92e4d5bLL /* 933 */, + 0x353f57abc4beea7eLL /* 934 */, 0x735769d6da5690ceLL /* 935 */, + 0x0a234aa642391484LL /* 936 */, 0xf6f9508028f80d9dLL /* 937 */, + 0xb8e319a27ab3f215LL /* 938 */, 0x31ad9c1151341a4dLL /* 939 */, + 0x773c22a57bef5805LL /* 940 */, 0x45c7561a07968633LL /* 941 */, + 0xf913da9e249dbe36LL /* 942 */, 0xda652d9b78a64c68LL /* 943 */, + 0x4c27a97f3bc334efLL /* 944 */, 0x76621220e66b17f4LL /* 945 */, + 0x967743899acd7d0bLL /* 946 */, 0xf3ee5bcae0ed6782LL /* 947 */, + 0x409f753600c879fcLL /* 948 */, 0x06d09a39b5926db6LL /* 949 */, + 0x6f83aeb0317ac588LL /* 950 */, 0x01e6ca4a86381f21LL /* 951 */, + 0x66ff3462d19f3025LL /* 952 */, 0x72207c24ddfd3bfbLL /* 953 */, + 0x4af6b6d3e2ece2ebLL /* 954 */, 0x9c994dbec7ea08deLL /* 955 */, + 0x49ace597b09a8bc4LL /* 956 */, 0xb38c4766cf0797baLL /* 957 */, + 0x131b9373c57c2a75LL /* 958 */, 0xb1822cce61931e58LL /* 959 */, + 0x9d7555b909ba1c0cLL /* 960 */, 0x127fafdd937d11d2LL /* 961 */, + 0x29da3badc66d92e4LL /* 962 */, 0xa2c1d57154c2ecbcLL /* 963 */, + 0x58c5134d82f6fe24LL /* 964 */, 0x1c3ae3515b62274fLL /* 965 */, + 0xe907c82e01cb8126LL /* 966 */, 0xf8ed091913e37fcbLL /* 967 */, + 0x3249d8f9c80046c9LL /* 968 */, 0x80cf9bede388fb63LL /* 969 */, + 0x1881539a116cf19eLL /* 970 */, 0x5103f3f76bd52457LL /* 971 */, + 0x15b7e6f5ae47f7a8LL /* 972 */, 0xdbd7c6ded47e9ccfLL /* 973 */, + 0x44e55c410228bb1aLL /* 974 */, 0xb647d4255edb4e99LL /* 975 */, + 0x5d11882bb8aafc30LL /* 976 */, 0xf5098bbb29d3212aLL /* 977 */, + 0x8fb5ea14e90296b3LL /* 978 */, 0x677b942157dd025aLL /* 979 */, + 0xfb58e7c0a390acb5LL /* 980 */, 0x89d3674c83bd4a01LL /* 981 */, + 0x9e2da4df4bf3b93bLL /* 982 */, 0xfcc41e328cab4829LL /* 983 */, + 0x03f38c96ba582c52LL /* 984 */, 0xcad1bdbd7fd85db2LL /* 985 */, + 0xbbb442c16082ae83LL /* 986 */, 0xb95fe86ba5da9ab0LL /* 987 */, + 0xb22e04673771a93fLL /* 988 */, 0x845358c9493152d8LL /* 989 */, + 0xbe2a488697b4541eLL /* 990 */, 0x95a2dc2dd38e6966LL /* 991 */, + 0xc02c11ac923c852bLL /* 992 */, 0x2388b1990df2a87bLL /* 993 */, + 0x7c8008fa1b4f37beLL /* 994 */, 0x1f70d0c84d54e503LL /* 995 */, + 0x5490adec7ece57d4LL /* 996 */, 0x002b3c27d9063a3aLL /* 997 */, + 0x7eaea3848030a2bfLL /* 998 */, 0xc602326ded2003c0LL /* 999 */, + 0x83a7287d69a94086LL /* 1000 */, 0xc57a5fcb30f57a8aLL /* 1001 */, + 0xb56844e479ebe779LL /* 1002 */, 0xa373b40f05dcbce9LL /* 1003 */, + 0xd71a786e88570ee2LL /* 1004 */, 0x879cbacdbde8f6a0LL /* 1005 */, + 0x976ad1bcc164a32fLL /* 1006 */, 0xab21e25e9666d78bLL /* 1007 */, + 0x901063aae5e5c33cLL /* 1008 */, 0x9818b34448698d90LL /* 1009 */, + 0xe36487ae3e1e8abbLL /* 1010 */, 0xafbdf931893bdcb4LL /* 1011 */, + 0x6345a0dc5fbbd519LL /* 1012 */, 0x8628fe269b9465caLL /* 1013 */, + 0x1e5d01603f9c51ecLL /* 1014 */, 0x4de44006a15049b7LL /* 1015 */, + 0xbf6c70e5f776cbb1LL /* 1016 */, 0x411218f2ef552bedLL /* 1017 */, + 0xcb0c0708705a36a3LL /* 1018 */, 0xe74d14754f986044LL /* 1019 */, + 0xcd56d9430ea8280eLL /* 1020 */, 0xc12591d7535f5065LL /* 1021 */, + 0xc83223f1720aef96LL /* 1022 */, 0xc3a0396f7363a51fLL /* 1023 */ +}; + + +static void +print_abc( const char *text, u64 a, u64 b, u64 c ) +{ +/*printf("%s: %08X%08X %08X%08X %08X%08X\n", + text, + (u32)(a>>32), + (u32)(a), + (u32)(b>>32), + (u32)(b), + (u32)(c>>32), + (u32)(c) );*/ +} + +static void +print_data( const char *text, u64 a, u64 b, u64 c, + u64 d, u64 e, u64 f, + u64 g, u64 h ) +{ +/*printf("%s: %08X%08X %08X%08X %08X%08X %08X%08X\n" + "%s %08X%08X %08X%08X %08X%08X %08X%08X\n", + text, + (u32)(a>>32), + (u32)(a), + (u32)(b>>32), + (u32)(b), + (u32)(c>>32), + (u32)(c), + (u32)(d>>32), + (u32)(d), + text, + (u32)(e>>32), + (u32)(e), + (u32)(f>>32), + (u32)(f), + (u32)(g>>32), + (u32)(g), + (u32)(h>>32), + (u32)(h) );*/ +} + + +void +tiger_init( TIGER_CONTEXT *hd ) +{ + hd->a = 0x0123456789abcdefLL; + hd->b = 0xfedcba9876543210LL; + hd->c = 0xf096a5b4c3b2e187LL; + hd->nblocks = 0; + hd->count = 0; +} + +static void +round( u64 *ra, u64 *rb, u64 *rc, u64 x, int mul ) +{ + u64 a = *ra; + u64 b = *rb; + u64 c = *rc; + + c ^= x; + a -= sbox1[ c & 0xff ] ^ sbox2[ (c >> 16) & 0xff ] + ^ sbox3[ (c >> 32) & 0xff ] ^ sbox4[ (c >> 48) & 0xff ]; + b += sbox4[ (c >> 8) & 0xff ] ^ sbox3[ (c >> 24) & 0xff ] + ^ sbox2[ (c >> 40) & 0xff ] ^ sbox1[ (c >> 56) & 0xff ]; + b *= mul; + + *ra = a; + *rb = b; + *rc = c; +} + + +static void +pass( u64 *ra, u64 *rb, u64 *rc, u64 *x, int mul ) +{ + u64 a = *ra; + u64 b = *rb; + u64 c = *rc; + + round( &a, &b, &c, x[0], mul ); + round( &b, &c, &a, x[1], mul ); + round( &c, &a, &b, x[2], mul ); + round( &a, &b, &c, x[3], mul ); + round( &b, &c, &a, x[4], mul ); + round( &c, &a, &b, x[5], mul ); + round( &a, &b, &c, x[6], mul ); + round( &b, &c, &a, x[7], mul ); + + *ra = a; + *rb = b; + *rc = c; +} + + +static void +key_schedule( u64 *x ) +{ + x[0] -= x[7] ^ 0xa5a5a5a5a5a5a5a5LL; + x[1] ^= x[0]; + x[2] += x[1]; + x[3] -= x[2] ^ ((~x[1]) << 19 ); + x[4] ^= x[3]; + x[5] += x[4]; + x[6] -= x[5] ^ ((~x[4]) >> 23 ); + x[7] ^= x[6]; + x[0] += x[7]; + x[1] -= x[0] ^ ((~x[7]) << 19 ); + x[2] ^= x[1]; + x[3] += x[2]; + x[4] -= x[3] ^ ((~x[2]) >> 23 ); + x[5] ^= x[4]; + x[6] += x[5]; + x[7] -= x[6] ^ 0x0123456789abcdefLL; +} + + +/**************** + * Transform the message DATA which consists of 512 bytes (8 words) + */ +static void +transform( TIGER_CONTEXT *hd, byte *data ) +{ + u64 a,b,c,aa,bb,cc; + u64 x[8]; + #ifdef BIG_ENDIAN_HOST + #define MKWORD(d,n) ( (d)[8*(n)+0] << 56 | (d)[8*(n)+1] << 48 \ + | (d)[8*(n)+2] << 40 | (d)[8*(n)+3] << 32 \ + | (d)[8*(n)+4] << 24 | (d)[8*(n)+5] << 16 \ + | (d)[8*(n)+6] << 8 | (d)[8*(n)+7] ) + x[0] = MKWORD(data, 0); + x[1] = MKWORD(data, 1); + x[2] = MKWORD(data, 2); + x[3] = MKWORD(data, 3); + x[4] = MKWORD(data, 4); + x[5] = MKWORD(data, 5); + x[6] = MKWORD(data, 6); + x[7] = MKWORD(data, 7); + #undef MKWORD + #else + memcpy( &x[0], data, 64 ); + #endif + + /* save */ + a = aa = hd->a; + b = bb = hd->b; + c = cc = hd->c; + + print_data(" key0", x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7] ); + print_abc(" init", a, b, c ); + pass( &a, &b, &c, x, 5); + print_abc("pass1", a, b, c ); + key_schedule( x ); + pass( &c, &a, &b, x, 7); + print_abc("pass2", a, b, c ); + key_schedule( x ); + pass( &b, &c, &a, x, 9); + print_abc("pass3", a, b, c ); + + + /* feedforward */ + a ^= aa; + b -= bb; + c += cc; + /* store */ + hd->a = a; + hd->b = b; + hd->c = c; +} + + + +/* Update the message digest with the contents + * of INBUF with length INLEN. + */ +void +tiger_write( TIGER_CONTEXT *hd, byte *inbuf, size_t inlen) +{ + if( hd->count == 64 ) { /* flush the buffer */ + transform( hd, hd->buf ); + hd->count = 0; + hd->nblocks++; + } + if( !inbuf ) + return; + if( hd->count ) { + for( ; inlen && hd->count < 64; inlen-- ) + hd->buf[hd->count++] = *inbuf++; + tiger_write( hd, NULL, 0 ); + if( !inlen ) + return; + } + + while( inlen >= 64 ) { + transform( hd, inbuf ); + hd->count = 0; + hd->nblocks++; + inlen -= 64; + inbuf += 64; + } + for( ; inlen && hd->count < 64; inlen-- ) + hd->buf[hd->count++] = *inbuf++; +} + + + +/* The routine terminates the computation + */ + +void +tiger_final( TIGER_CONTEXT *hd ) +{ + u32 t, msb, lsb; + byte *p; + + tiger_write(hd, NULL, 0); /* flush */; + + msb = 0; + t = hd->nblocks; + if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */ + msb++; + msb += t >> 26; + t = lsb; + if( (lsb = t + hd->count) < t ) /* add the count */ + msb++; + t = lsb; + if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */ + msb++; + msb += t >> 29; + + if( hd->count < 56 ) { /* enough room */ + hd->buf[hd->count++] = 0x01; /* pad */ + while( hd->count < 56 ) + hd->buf[hd->count++] = 0; /* pad */ + } + else { /* need one extra block */ + hd->buf[hd->count++] = 0x01; /* pad character */ + while( hd->count < 64 ) + hd->buf[hd->count++] = 0; + tiger_write(hd, NULL, 0); /* flush */; + memset(hd->buf, 0, 56 ); /* fill next block with zeroes */ + } + /* append the 64 bit count */ + hd->buf[56] = lsb ; + hd->buf[57] = lsb >> 8; + hd->buf[58] = lsb >> 16; + hd->buf[59] = lsb >> 24; + hd->buf[60] = msb ; + hd->buf[61] = msb >> 8; + hd->buf[62] = msb >> 16; + hd->buf[63] = msb >> 24; + transform( hd, hd->buf ); + + p = hd->buf; + #ifdef BIG_ENDIAN_HOST + #define X(a) do { *(u64*)p = hd->##a ; p += 8; } while(0) + #else /* little endian */ + #define X(a) do { *p++ = hd->##a >> 56; *p++ = hd->##a >> 48; \ + *p++ = hd->##a >> 40; *p++ = hd->##a >> 32; \ + *p++ = hd->##a >> 24; *p++ = hd->##a >> 16; \ + *p++ = hd->##a >> 8; *p++ = hd->##a; } while(0) + #endif + X(a); + X(b); + X(c); + #undef X +} + +#endif /* WITH_TIGER_HASH */ + diff --git a/cipher/tiger.h b/cipher/tiger.h new file mode 100644 index 000000000..906909269 --- /dev/null +++ b/cipher/tiger.h @@ -0,0 +1,44 @@ +/* tiger.h - TIGER hash function + * Copyright (C) 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#ifndef G10_TIGER_H +#define G10_TIGER_H + +#include "types.h" + +#ifdef HAVE_U64_TYPEDEF + +#define WITH_TIGER_HASH 1 + +typedef struct { + u64 a, b, c; + u32 nblocks; + byte buf[64]; + int count; +} TIGER_CONTEXT; + + +void tiger_init( TIGER_CONTEXT *c ); +void tiger_write( TIGER_CONTEXT *hd, byte *inbuf, size_t inlen); +void tiger_final(TIGER_CONTEXT *hd); +#define tiger_read(h) ( (h)->buf ) + +#endif /* HAVE_TIGER_HASH */ + +#endif /*G10_TIGER_H*/ diff --git a/doc/gpg.1pod b/doc/gpg.1pod index 002aee1fd..60e2d7e4b 100644 --- a/doc/gpg.1pod +++ b/doc/gpg.1pod @@ -135,7 +135,7 @@ B<--import> Long options can be put in an options file (default F<~/.gnupg/options>); do not write the 2 dashes, but simply the name of the option and any -arguments if required. Lines with a hash as the first non-white-space +arguments if required. Lines with a hash as the first non-white-space character are ignored. Commands may be put in this file too, but that does not make sense. @@ -271,6 +271,11 @@ B<--no-default-keyring> Do not add the default key-rings to the list of key-rings. +B<--skip-verify> + Skip the signature verification step. This may be used to + make the encryption faster if the signature verification + is not needed. + B<--version> Print version information along with a list of supported algorithms. diff --git a/g10/ChangeLog b/g10/ChangeLog index e95394f96..a5a012c80 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,22 @@ +Tue Apr 28 14:27:42 1998 Werner Koch (wk@isil.d.shuttle.de) + + * parse-packet.c (parse_subpkt): Some new types. + +Mon Apr 27 12:53:59 1998 Werner Koch (wk@isil.d.shuttle.de) + + * g10.c (main): Add option --skip-verify. + * mainproc.c (check_sig_and_print): Ditto. + + * g10.c (print_mds): Add output for Tiger. + + * sign.c (sign_file): Now uses partial length headers if used + in canonical textmode (kludge to fix a bug). + + * parse-packet.c (parse_certificate): Changed BLOWFISH id. + * pubkey-enc.c (get_session_key): Ditto. + * seskey.c (make_session_key): Ditto. + * seckey-cert.c (protect_secret_key,do_check): Add BLOWFISH160. + Fri Apr 24 17:38:48 1998 Werner Koch,mobil,,, (wk@tobold) * sig-check.c (check_key_signature): Add sig-class 0x14..0x17 diff --git a/g10/Makefile.in b/g10/Makefile.in index 8574f6c07..d954b680c 100644 --- a/g10/Makefile.in +++ b/g10/Makefile.in @@ -61,16 +61,36 @@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@ CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@ CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ G10_LOCALEDIR = @G10_LOCALEDIR@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MKINSTALLDIRS = @MKINSTALLDIRS@ MPI_EXTRA_ASM_OBJS = @MPI_EXTRA_ASM_OBJS@ +MSGFMT = @MSGFMT@ PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ ZLIBS = @ZLIBS@ +l = @l@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl EXTRA_DIST = OPTIONS pubring.asc diff --git a/g10/armor.c b/g10/armor.c index 7617415cb..462dc17b3 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -976,7 +976,7 @@ armor_filter( void *opaque, int control, iobuf_put(a, c); c = bintoasc[radbuf[2]&077]; iobuf_put(a, c); - if( ++idx2 > (72/4) ) { + if( ++idx2 >= (72/4) ) { iobuf_put(a, '\n'); idx2=0; } @@ -1015,10 +1015,13 @@ armor_filter( void *opaque, int control, iobuf_put(a, c); iobuf_put(a, '='); } - ++idx2; + if( ++idx2 >= (72/4) ) { + iobuf_put(a, '\n'); + idx2=0; + } } /* may need a linefeed */ - if( idx2 <= (72/4) ) + if( idx2 ) iobuf_put(a, '\n'); /* write the CRC */ iobuf_put(a, '='); diff --git a/g10/build-packet.c b/g10/build-packet.c index 583752eb3..8d897ca88 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -289,8 +289,6 @@ do_secret_cert( IOBUF out, int ctb, PKT_secret_cert *skc ) mpi_write(a, skc->d.rsa.n ); mpi_write(a, skc->d.rsa.e ); if( skc->is_protected ) { - assert( skc->protect.algo == CIPHER_ALGO_BLOWFISH - || skc->protect.algo == CIPHER_ALGO_CAST ); iobuf_put(a, skc->protect.algo ); iobuf_write(a, skc->protect.iv, 8 ); } diff --git a/g10/g10.c b/g10/g10.c index 5fe88c852..c068b5b36 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -160,7 +160,7 @@ static ARGPARSE_OPTS opts[] = { { 551, "list-key", 0, "\r" }, /* alias */ { 552, "list-sig", 0, "\r" }, /* alias */ { 508, "check-sig",0, "\r" }, /* alias */ - + { 553, "skip-verify",0, "\r" }, {0} }; @@ -258,11 +258,11 @@ build_list( const char *text, const char * (*mapf)(int), int (*chkf)(int) ) size_t n=strlen(text)+2; char *list, *p; - for(i=1; i < 100; i++ ) + for(i=1; i < 110; i++ ) if( !chkf(i) && (s=mapf(i)) ) n += strlen(s) + 2; list = m_alloc( 21 + n ); *list = 0; - for(p=NULL, i=1; i < 100; i++ ) { + for(p=NULL, i=1; i < 110; i++ ) { if( !chkf(i) && (s=mapf(i)) ) { if( !p ) p = stpcpy( list, text ); @@ -573,6 +573,7 @@ main( int argc, char **argv ) case 549: opt.with_colons=':'; break; case 551: set_cmd( &cmd, aListKeys); break; case 552: set_cmd( &cmd, aListSigs); break; + case 553: opt.skip_verify=1; break; default : errors++; pargs.err = configfp? 1:2; break; } } @@ -994,6 +995,13 @@ print_hex( byte *p, size_t n ) printf(" %02X%02X", *p, p[1] ); } } + else if( n == 24 ) { + for(i=0; i < n ; i += 4, p += 4 ) { + if( i == 12 ) + putchar(' '); + printf(" %02X%02X%02X%02X", *p, p[1], p[2], p[3] ); + } + } else { for(i=0; i < n ; i++, p++ ) { if( i && !(i%8) ) @@ -1023,8 +1031,11 @@ print_mds( const char *fname ) } md = md_open( DIGEST_ALGO_MD5, 0 ); - md_enable( md, DIGEST_ALGO_RMD160 ); md_enable( md, DIGEST_ALGO_SHA1 ); + md_enable( md, DIGEST_ALGO_RMD160 ); + #ifdef WITH_TIGER_HASH + md_enable( md, DIGEST_ALGO_TIGER ); + #endif while( (n=fread( buf, 1, DIM(buf), fp )) ) md_write( md, buf, n ); @@ -1033,8 +1044,11 @@ print_mds( const char *fname ) else { md_final(md); printf( "%s: MD5 =", fname ); print_hex(md_read(md, DIGEST_ALGO_MD5), 16 ); - printf("\n%s: RMD160 =", fname ); print_hex(md_read(md, DIGEST_ALGO_RMD160), 20 ); printf("\n%s: SHA1 =", fname ); print_hex(md_read(md, DIGEST_ALGO_SHA1), 20 ); + printf("\n%s: RMD160 =", fname ); print_hex(md_read(md, DIGEST_ALGO_RMD160), 20 ); + #ifdef WITH_TIGER_HASH + printf("\n%s: TIGER =", fname ); print_hex(md_read(md, DIGEST_ALGO_TIGER), 24 ); + #endif putchar('\n'); } diff --git a/g10/mainproc.c b/g10/mainproc.c index d8da7a41b..22af3561d 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -696,6 +696,11 @@ check_sig_and_print( CTX c, KBNODE node ) PKT_signature *sig = node->pkt->pkt.signature; int rc; + if( opt.skip_verify ) { + log_info("signature verification suppressed\n"); + return 0; + } + rc = do_check_sig(c, node ); if( !rc || rc == G10ERR_BAD_SIGN ) { char *p, *buf; diff --git a/g10/options.h b/g10/options.h index 0f2a2789f..19c065733 100644 --- a/g10/options.h +++ b/g10/options.h @@ -43,7 +43,7 @@ struct { int marginals_needed; int completes_needed; const char *homedir; - int reserved13; + int skip_verify; int reserved14; int reserved15; } opt; diff --git a/g10/parse-packet.c b/g10/parse-packet.c index fb2d74c3a..eb56b09ae 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -490,7 +490,7 @@ parse_subpkt( const byte *buffer, int reqtype ) critical = 0; if( reqtype < 0 ) { /* list packets */ printf("\t%ssubpacket %d of length %u (%s)\n", - reqtype == -1 ? "hashed ":"", type, n, + reqtype == -1 ? "hashed ":"", type, (unsigned)n, type == 2 ? "signature creation time" : type == 3 ? "signature expiration time" : type == 4 ? "exportable" @@ -507,6 +507,10 @@ parse_subpkt( const byte *buffer, int reqtype ) : type ==22 ? "preferred compression algorithms" : type ==23 ? "key server preferences" : type ==24 ? "preferred key server" + : type ==25 ? "primary user id" + : type ==26 ? "policy URL" + : type ==27 ? "key flags" + : type ==28 ? "signer's user id" : "?"); } else if( type == reqtype ) @@ -904,7 +908,7 @@ parse_certificate( IOBUF inp, int pkttype, unsigned long pktlen, cert->protect.s2k = 0; /* We need this kludge to cope with old GNUPG versions */ cert->protect.hash = - cert->protect.algo == CIPHER_ALGO_BLOWFISH? + cert->protect.algo == CIPHER_ALGO_BLOWFISH160? DIGEST_ALGO_RMD160 : DIGEST_ALGO_MD5; } if( pktlen < 8 ) { @@ -1106,7 +1110,7 @@ parse_certificate( IOBUF inp, int pkttype, unsigned long pktlen, printf(" %02x", temp[i] ); putchar('\n'); } - if( cert->protect.algo == CIPHER_ALGO_BLOWFISH ) + if( cert->protect.algo == CIPHER_ALGO_BLOWFISH160 ) memcpy(cert->protect.iv, temp, 8 ); } else diff --git a/g10/pkclist.c b/g10/pkclist.c index 3e6e78d59..fa8351bf5 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -172,7 +172,7 @@ do_we_trust( PKT_public_cert *pkc, int trustlevel ) char *answer; int yes; - log_info("key has beed revoked!\n"); + log_info("key has been revoked!\n"); if( opt.batch ) return 0; diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c index 0525f336f..b0d82bf68 100644 --- a/g10/pubkey-enc.c +++ b/g10/pubkey-enc.c @@ -115,21 +115,15 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek ) case CIPHER_ALGO_IDEA: rc = G10ERR_NI_CIPHER; goto leave; - case CIPHER_ALGO_BLOWFISH: + case CIPHER_ALGO_BLOWFISH160: if( dek->keylen != 20 ) { rc = G10ERR_WRONG_SECKEY; goto leave; } break; - case CIPHER_ALGO_BLOWFISH128: + case CIPHER_ALGO_BLOWFISH: case CIPHER_ALGO_CAST: if( dek->keylen != 16 ) { rc = G10ERR_WRONG_SECKEY; goto leave; } break; - #if 0 - case CIPHER_ALGO_CAST: - if( dek->keylen < 5 || dek->keylen > 16 ) - { rc = G10ERR_WRONG_SECKEY; goto leave; } - break; - #endif default: dek->algo = 0; rc = G10ERR_CIPHER_ALGO; diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c index 7dc84140b..d95d12380 100644 --- a/g10/seckey-cert.c +++ b/g10/seckey-cert.c @@ -50,6 +50,7 @@ do_check( PKT_secret_cert *cert ) switch( cert->protect.algo ) { case CIPHER_ALGO_NONE: BUG(); break; + case CIPHER_ALGO_BLOWFISH160: case CIPHER_ALGO_BLOWFISH: case CIPHER_ALGO_CAST: keyid_from_skc( cert, keyid ); @@ -290,6 +291,7 @@ protect_secret_key( PKT_secret_cert *cert, DEK *dek ) switch( cert->protect.algo ) { case CIPHER_ALGO_NONE: BUG(); break; + case CIPHER_ALGO_BLOWFISH160: case CIPHER_ALGO_BLOWFISH: case CIPHER_ALGO_CAST: cipher_hd = cipher_open( cert->protect.algo, diff --git a/g10/seskey.c b/g10/seskey.c index 0dcec8d9d..500dc8457 100644 --- a/g10/seskey.c +++ b/g10/seskey.c @@ -35,19 +35,8 @@ void make_session_key( DEK *dek ) { - switch( dek->algo ) { - case CIPHER_ALGO_BLOWFISH: - dek->keylen = 20; - randomize_buffer( dek->key, dek->keylen, 1 ); - break; - case CIPHER_ALGO_BLOWFISH128: - case CIPHER_ALGO_CAST: - dek->keylen = 16; - randomize_buffer( dek->key, dek->keylen, 1 ); - break; - - default: log_bug("invalid algo %d in make_session_key()\n", dek->algo); - } + dek->keylen = cipher_get_keylen( dek->algo ) / 8; + randomize_buffer( dek->key, dek->keylen, 1 ); } @@ -84,7 +73,7 @@ encode_session_key( DEK *dek, unsigned nbits ) * RND are non-zero random bytes. * A is the cipher algorithm * DEK is the encryption key (session key) length k depends on the - * cipher algorithm (20 is used with blowfish). + * cipher algorithm (20 is used with blowfish160). * CSUM is the 16 bit checksum over the DEK */ csum = 0; diff --git a/g10/sign.c b/g10/sign.c index 8867916c7..d804f576b 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -231,6 +231,14 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr, memcpy(pt->name, fname, pt->namelen ); if( !(filesize = iobuf_get_filelength(inp)) ) log_info("warning: '%s' is an empty file\n", fname ); + + /* because the text_filter modifies the length of the + * data, it is not possible to know the used length + * without a double read of the file - to avoid that + * we simple use partial length packets. + */ + if( opt.textmode && !outfile ) + filesize = 0; } else { /* no filename */ pt = m_alloc( sizeof *pt - 1 ); diff --git a/include/ChangeLog b/include/ChangeLog index b0dd2b902..94d967df3 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +Sun Apr 26 14:35:24 1998 Werner Koch (wk@isil.d.shuttle.de) + + * types.h: New type u64 + Mon Mar 9 12:59:55 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.h: Included dsa.h. diff --git a/include/cipher.h b/include/cipher.h index 87440ef8d..c82d35140 100644 --- a/include/cipher.h +++ b/include/cipher.h @@ -41,22 +41,25 @@ #define CIPHER_ALGO_IDEA 1 #define CIPHER_ALGO_3DES 2 #define CIPHER_ALGO_CAST 3 -#define CIPHER_ALGO_BLOWFISH128 4 /* blowfish 128 bit key */ +#define CIPHER_ALGO_BLOWFISH 4 /* blowfish 128 bit key */ #define CIPHER_ALGO_ROT_N 5 #define CIPHER_ALGO_SAFER_SK128 6 #define CIPHER_ALGO_DES_SK 7 -#define CIPHER_ALGO_BLOWFISH 42 /* blowfish 160 bit key (not in OpenPGP)*/ +#define CIPHER_ALGO_BLOWFISH160 42 /* blowfish 160 bit key (not in OpenPGP)*/ #define PUBKEY_ALGO_RSA 1 #define PUBKEY_ALGO_RSA_E 2 /* RSA encrypt only */ #define PUBKEY_ALGO_RSA_S 3 /* RSA sign only */ #define PUBKEY_ALGO_ELGAMAL 16 #define PUBKEY_ALGO_DSA 17 +/*#define PUBKEY_ALGO_ELGAMAL 20 sign and encrypt elgamal */ #define DIGEST_ALGO_MD5 1 #define DIGEST_ALGO_SHA1 2 #define DIGEST_ALGO_RMD160 3 - +#ifdef WITH_TIGER_HASH +#define DIGEST_ALGO_TIGER 101 +#endif typedef struct { int algo; @@ -82,6 +85,7 @@ int cipher_debug_mode; int string_to_cipher_algo( const char *string ); const char * cipher_algo_to_string( int algo ); int check_cipher_algo( int algo ); +unsigned cipher_get_keylen( int algo ); CIPHER_HANDLE cipher_open( int algo, int mode, int secure ); void cipher_close( CIPHER_HANDLE c ); void cipher_setkey( CIPHER_HANDLE c, byte *key, unsigned keylen ); diff --git a/include/types.h b/include/types.h index e5804be66..41adbbbd8 100644 --- a/include/types.h +++ b/include/types.h @@ -66,6 +66,20 @@ #define HAVE_U32_TYPEDEF #endif +#ifndef HAVE_U64_TYPEDEF + #undef u64 /* maybe there is a macro with this name */ + #if SIZEOF_UNSIGNED_INT == 8 + typedef unsigned int u64; + #define HAVE_U64_TYPEDEF + #elif SIZEOF_UNSIGNED_LONG == 8 + typedef unsigned long u64; + #define HAVE_U64_TYPEDEF + #elif __GNUC__ >= 2 + typedef unsigned long long u64; + #define HAVE_U64_TYPEDEF + #endif +#endif + diff --git a/include/util.h b/include/util.h index 3f39656f3..c56cc1991 100644 --- a/include/util.h +++ b/include/util.h @@ -107,6 +107,8 @@ const char *print_fname_stdout( const char *s ); /*-- miscutil.c --*/ u32 make_timestamp(void); +u32 add_days_to_timestamp( u32 stamp, u16 days ); +const char *strtimestamp( u32 stamp ); void print_string( FILE *fp, byte *p, size_t n, int delim ); int answer_is_yes( const char *s ); @@ -116,6 +118,7 @@ void free_strlist( STRLIST sl ); void add_to_strlist( STRLIST *list, const char *string ); STRLIST strlist_prev( STRLIST head, STRLIST node ); STRLIST strlist_last( STRLIST node ); +int memicmp( const char *a, const char *b, size_t n ); const char *memistr( const char *buf, size_t buflen, const char *sub ); char *mem2str( char *, const void *, size_t); char *trim_spaces( char *string ); diff --git a/mpi/Makefile.in b/mpi/Makefile.in index a28977fc3..c0db398a7 100644 --- a/mpi/Makefile.in +++ b/mpi/Makefile.in @@ -61,16 +61,36 @@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@ CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@ CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ G10_LOCALEDIR = @G10_LOCALEDIR@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MKINSTALLDIRS = @MKINSTALLDIRS@ MPI_EXTRA_ASM_OBJS = @MPI_EXTRA_ASM_OBJS@ +MSGFMT = @MSGFMT@ PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ ZLIBS = @ZLIBS@ +l = @l@ INCLUDES = -I$(top_srcdir)/include diff --git a/tools/Makefile.in b/tools/Makefile.in index f42cb51fa..6920c4cbe 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -61,16 +61,36 @@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@ CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@ CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ G10_LOCALEDIR = @G10_LOCALEDIR@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MKINSTALLDIRS = @MKINSTALLDIRS@ MPI_EXTRA_ASM_OBJS = @MPI_EXTRA_ASM_OBJS@ +MSGFMT = @MSGFMT@ PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ ZLIBS = @ZLIBS@ +l = @l@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl needed_libs = ../cipher/libcipher.a ../util/libutil.a \ diff --git a/util/ChangeLog b/util/ChangeLog index 05214578f..89eedb0c1 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,7 @@ +Mon Apr 27 11:01:32 1998 Werner Koch (wk@isil.d.shuttle.de) + + * strgutil.c (memicmp): New. + Thu Mar 19 11:29:03 1998 Werner Koch (wk@isil.d.shuttle.de) * strgutil.c (memistr): Add const to return and first arg. diff --git a/util/Makefile.in b/util/Makefile.in index 5f72e6533..025ea3f8e 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -61,16 +61,36 @@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@ CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@ CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ G10_LOCALEDIR = @G10_LOCALEDIR@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MKINSTALLDIRS = @MKINSTALLDIRS@ MPI_EXTRA_ASM_OBJS = @MPI_EXTRA_ASM_OBJS@ +MSGFMT = @MSGFMT@ PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ ZLIBS = @ZLIBS@ +l = @l@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl diff --git a/util/strgutil.c b/util/strgutil.c index 3e5999d43..c6c8f5a65 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -72,6 +72,18 @@ strlist_last( STRLIST node ) } + + +int +memicmp( const char *a, const char *b, size_t n ) +{ + for( ; n; n--, a++, b++ ) + if( *a != *b && toupper(*(const byte*)a) != toupper(*(const byte*)b) ) + return *(const byte *)a - *(const byte*)b; + return 0; +} + + /**************** * look for the substring SUB in buffer and return a pointer to that * substring in BUF or NULL if not found. diff --git a/zlib/Makefile b/zlib/Makefile new file mode 100644 index 000000000..404a76d02 --- /dev/null +++ b/zlib/Makefile @@ -0,0 +1,322 @@ +# Generated automatically from Makefile.in by configure. +# Makefile.in generated automatically by automake 1.2f from Makefile.am + +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Process this file with automake to produce Makefile.in +# Copyright (C) 1995-1996 Jean-loup Gailly. +# For conditions of distribution and use, see copyright notice in zlib.h +# This is used if a systems lacks support of zlib + + +SHELL = /bin/sh + +srcdir = . +top_srcdir = .. +prefix = /usr/local +exec_prefix = ${prefix} + +bindir = ${exec_prefix}/bin +sbindir = ${exec_prefix}/sbin +libexecdir = ${exec_prefix}/libexec +datadir = ${prefix}/share +sysconfdir = ${prefix}/etc +sharedstatedir = ${prefix}/com +localstatedir = ${prefix}/var +libdir = ${exec_prefix}/lib +infodir = ${prefix}/info +mandir = ${prefix}/man +includedir = ${prefix}/include +oldincludedir = /usr/include + +pkgdatadir = $(datadir)/gnupg +pkglibdir = $(libdir)/gnupg +pkgincludedir = $(includedir)/gnupg + +top_builddir = .. + +ACLOCAL = aclocal +AUTOCONF = autoconf +AUTOMAKE = automake +AUTOHEADER = autoheader + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = s,x,x, + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = i586-pc-linux-gnu +build_triplet = i586-pc-linux-gnu +host_alias = i586-pc-linux-gnu +host_triplet = i586-pc-linux-gnu +target_alias = i586-pc-linux-gnu +target_triplet = i586-pc-linux-gnu +CATALOGS = de.gmo it.gmo +CATOBJEXT = .gmo +CC = gcc +CIPHER_EXTRA_DIST = +CIPHER_EXTRA_OBJS = +CPP = gcc -E +DATADIRNAME = share +G10_LOCALEDIR = /usr/local/share/locale +GENCAT = +GMOFILES = de.gmo it.gmo +GMSGFMT = /usr/local/bin/msgfmt +GT_NO = +GT_YES = #YES# +INCLUDE_LOCALE_H = #include +INSTOBJEXT = .mo +INTLDEPS = $(top_builddir)/intl/libintl.a +INTLLIBS = $(top_builddir)/intl/libintl.a +INTLOBJS = $(GETTOBJS) +MKINSTALLDIRS = scripts/mkinstalldirs +MPI_EXTRA_ASM_OBJS = +MSGFMT = /usr/local/bin/msgfmt +PACKAGE = gnupg +POFILES = de.po it.po +POSUB = po +RANLIB = ranlib +USE_INCLUDED_LIBINTL = yes +USE_NLS = yes +VERSION = 0.2.16 +ZLIBS = +l = + +CFLAGS = -O -Wall + +EXTRA_DIST = README algorithm.doc ChangeLog example.c + +# I found no other easy way to use this only if zlib is neede +# doing this with SUBDIR = @xxx@ in the top Makefile.am does not +# work because automake doesn't scan this Makefile.am here. +#noinst_LIBRARIES = libzlib.a + +libzlib_a_SOURCES = adler32.c compress.c crc32.c gzio.c \ + uncompr.c deflate.c trees.c zutil.c \ + inflate.c infblock.c inftrees.c \ + infcodes.c infutil.c inffast.c \ + zlib.h zconf.h deflate.h infblock.h \ + infcodes.h inffast.h inftrees.h infutil.h zutil.h + +CLEANFILES = example foo.gz +mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I.. +CPPFLAGS = +LDFLAGS = +LIBS = -lz +libzlib_a_LIBADD = +libzlib_a_OBJECTS = adler32.o compress.o crc32.o gzio.o uncompr.o \ +deflate.o trees.o zutil.o inflate.o infblock.o inftrees.o infcodes.o \ +infutil.o inffast.o +AR = ar +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = README ChangeLog Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +DEP_FILES = .deps/adler32.P .deps/compress.P .deps/crc32.P \ +.deps/deflate.P .deps/gzio.P .deps/infblock.P .deps/infcodes.P \ +.deps/inffast.P .deps/inflate.P .deps/inftrees.P .deps/infutil.P \ +.deps/trees.P .deps/uncompr.P .deps/zutil.P +SOURCES = $(libzlib_a_SOURCES) +OBJECTS = $(libzlib_a_OBJECTS) + +default: all + +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu zlib/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +libzlib.a: $(libzlib_a_OBJECTS) $(libzlib_a_DEPENDENCIES) + -rm -f libzlib.a + $(AR) cru libzlib.a $(libzlib_a_OBJECTS) $(libzlib_a_LIBADD) + $(RANLIB) libzlib.a + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = zlib + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu zlib/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + +maintainer-clean-depend: + -rm -rf .deps + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< + @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ + < .deps/$(*F).p > .deps/$(*F).P + @-rm -f .deps/$(*F).p +info: +dvi: +check: all + $(MAKE) +installcheck: +install-exec: + @$(NORMAL_INSTALL) + +install-data: + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: + +all: Makefile $(LIBRARIES) + +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + + +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +clean: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \ + clean-generic mostlyclean + +distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \ + distclean-depend distclean-generic clean + -rm -f config.status + +maintainer-clean: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info dvi \ +installcheck install-exec install-data install uninstall all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/zlib/Makefile.am~ b/zlib/Makefile.am~ new file mode 100644 index 000000000..71103692f --- /dev/null +++ b/zlib/Makefile.am~ @@ -0,0 +1,29 @@ +# Process this file with automake to produce Makefile.in +# Copyright (C) 1995-1996 Jean-loup Gailly. +# For conditions of distribution and use, see copyright notice in zlib.h +# This is used if a systems lacks support of zlib + +CFLAGS = -O -Wall + +EXTRA_DIST = README algorithm.doc ChangeLog gzio.c example.c + +# I found no other easy way to use this only if zlib is neede +# doing this with SUBDIR = @xxx@ in the top Makefile.am does not +# work because automake doesn't scan this Makefile.am here. +if ENABLE_LOCAL_ZLIB +noinst_LIBRARIES = libzlib.a +endif + + +libzlib_a_SOURCES = adler32.c compress.c crc32.c \ + uncompr.c deflate.c trees.c zutil.c \ + inflate.c infblock.c inftrees.c \ + infcodes.c infutil.c inffast.c \ + zlib.h zconf.h deflate.h infblock.h \ + infcodes.h inffast.h inftrees.h infutil.h zutil.h + + +CLEANFILES = example foo.gz + + + diff --git a/zlib/Makefile.in b/zlib/Makefile.in new file mode 100644 index 000000000..1e489370a --- /dev/null +++ b/zlib/Makefile.in @@ -0,0 +1,322 @@ +# Makefile.in generated automatically by automake 1.2f from Makefile.am + +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Process this file with automake to produce Makefile.in +# Copyright (C) 1995-1996 Jean-loup Gailly. +# For conditions of distribution and use, see copyright notice in zlib.h +# This is used if a systems lacks support of zlib + + +SHELL = /bin/sh + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@ +CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@ +CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ +G10_LOCALEDIR = @G10_LOCALEDIR@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MPI_EXTRA_ASM_OBJS = @MPI_EXTRA_ASM_OBJS@ +MSGFMT = @MSGFMT@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +ZLIBS = @ZLIBS@ +l = @l@ + +CFLAGS = -O -Wall + +EXTRA_DIST = README algorithm.doc ChangeLog example.c + +# I found no other easy way to use this only if zlib is neede +# doing this with SUBDIR = @xxx@ in the top Makefile.am does not +# work because automake doesn't scan this Makefile.am here. +@ENABLE_LOCAL_ZLIB_TRUE@noinst_LIBRARIES = libzlib.a + +libzlib_a_SOURCES = adler32.c compress.c crc32.c gzio.c \ + uncompr.c deflate.c trees.c zutil.c \ + inflate.c infblock.c inftrees.c \ + infcodes.c infutil.c inffast.c \ + zlib.h zconf.h deflate.h infblock.h \ + infcodes.h inffast.h inftrees.h infutil.h zutil.h + +CLEANFILES = example foo.gz +mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +libzlib_a_LIBADD = +libzlib_a_OBJECTS = adler32.o compress.o crc32.o gzio.o uncompr.o \ +deflate.o trees.o zutil.o inflate.o infblock.o inftrees.o infcodes.o \ +infutil.o inffast.o +AR = ar +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = README ChangeLog Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +DEP_FILES = .deps/adler32.P .deps/compress.P .deps/crc32.P \ +.deps/deflate.P .deps/gzio.P .deps/infblock.P .deps/infcodes.P \ +.deps/inffast.P .deps/inflate.P .deps/inftrees.P .deps/infutil.P \ +.deps/trees.P .deps/uncompr.P .deps/zutil.P +SOURCES = $(libzlib_a_SOURCES) +OBJECTS = $(libzlib_a_OBJECTS) + +default: all + +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu zlib/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +libzlib.a: $(libzlib_a_OBJECTS) $(libzlib_a_DEPENDENCIES) + -rm -f libzlib.a + $(AR) cru libzlib.a $(libzlib_a_OBJECTS) $(libzlib_a_LIBADD) + $(RANLIB) libzlib.a + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = zlib + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu zlib/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + +maintainer-clean-depend: + -rm -rf .deps + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< + @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ + < .deps/$(*F).p > .deps/$(*F).P + @-rm -f .deps/$(*F).p +info: +dvi: +check: all + $(MAKE) +installcheck: +install-exec: + @$(NORMAL_INSTALL) + +install-data: + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: + +all: Makefile $(LIBRARIES) + +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + + +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +clean: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \ + clean-generic mostlyclean + +distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \ + distclean-depend distclean-generic clean + -rm -f config.status + +maintainer-clean: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info dvi \ +installcheck install-exec install-data install uninstall all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/zlib/zconf.h~ b/zlib/zconf.h~ new file mode 100644 index 000000000..12e6a8487 --- /dev/null +++ b/zlib/zconf.h~ @@ -0,0 +1,186 @@ +#warning local zconf + +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-1996 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* $Id$ */ + +#ifndef _ZCONF_H +#define _ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateReset z_inflateReset +# define compress z_compress +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table + +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +# define WIN32 +#endif +#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) +# ifndef __32BIT__ +# define __32BIT__ +# endif +#endif +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#if defined(MSDOS) && !defined(__32BIT__) +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) +# define STDC +#endif +#if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC) +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2 */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + 1 << (windowBits+2) + 1 << (memLevel+9) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR __far +# else +# define FAR far +# endif +#endif +#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) +# ifndef __32BIT__ +# define SMALL_MEDIUM +# define FAR __far +# endif +#endif +#ifndef FAR +# define FAR +#endif + +typedef unsigned char Byte; /* 8 bits */ +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#if defined(__BORLANDC__) && defined(SMALL_MEDIUM) + /* Borland C/C++ ignores FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + + +/* Compile with -DZLIB_DLL for Windows DLL support */ +#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL) +# include +# define EXPORT WINAPI +#else +# define EXPORT +#endif + +#endif /* _ZCONF_H */ diff --git a/zlib/zlib.h~ b/zlib/zlib.h~ new file mode 100644 index 000000000..28b56d186 --- /dev/null +++ b/zlib/zlib.h~ @@ -0,0 +1,782 @@ + +#warning static zlib +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.0.4, Jul 24th, 1996. + + Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + gzip@prep.ai.mit.edu madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef _ZLIB_H +#define _ZLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "zconf.h" + +#define ZLIB_VERSION "1.0.4" + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms may be added later and will have the same + stream interface. + + For compression the application must provide the output buffer and + may optionally provide the input buffer for optimization. For decompression, + the application must provide the input buffer and may optionally provide + the output buffer for optimization. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The library does not install any signal handler. It is recommended to + add at least a handler for SIGSEGV when decompressing; the library checks + the consistency of the input data whenever possible but may go nuts + for some forms of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: ascii or binary */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +/* Allowed flush values; see deflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_ASCII 1 +#define Z_UNKNOWN 2 +/* Possible values of the data_type field */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +extern const char * EXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +extern int EXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +extern int EXPORT deflate OF((z_streamp strm, int flush)); +/* + Performs one or both of the following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression + block is terminated and flushed to the output buffer so that the + decompressor can get all input data available so far. For method 9, a future + variant on method 8, the current block will be flushed but not terminated. + Z_SYNC_FLUSH has the same effect as partial flush except that the compressed + output is byte aligned (the compressor can clear its internal bit buffer) + and the current block is always terminated; this can be useful if the + compressor has to be restarted from scratch after an interruption (in which + case the internal state of the compressor may be lost). + If flush is set to Z_FULL_FLUSH, the compression block is terminated, a + special marker is output and the compression dictionary is discarded; this + is useful to allow the decompressor to synchronize if one compressed block + has been damaged (see inflateSync below). Flushing degrades compression and + so should be used only when necessary. Using Z_FULL_FLUSH too often can + seriously degrade the compression. If deflate returns with avail_out == 0, + this function must be called again with the same value of the flush + parameter and more output space (updated avail_out), until the flush is + complete (deflate returns with non-zero avail_out). + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + 0.1% larger than avail_in plus 12 bytes. If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() may update data_type if it can make a good guess about + the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible. +*/ + + +extern int EXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +extern int EXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, inflateInit updates them to use default + allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_VERSION_ERROR if the zlib library version is incompatible + with the version assumed by the caller. msg is set to null if there is no + error message. inflateInit does not perform any decompression: this will be + done by inflate(). +*/ + + +extern int EXPORT inflate OF((z_streamp strm, int flush)); +/* + Performs one or both of the following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + If the parameter flush is set to Z_PARTIAL_FLUSH, inflate flushes as much + output as possible to the output buffer. The flushing behavior of inflate is + not specified for values of the flush parameter other than Z_PARTIAL_FLUSH + and Z_FINISH, but the current implementation actually flushes as much output + as possible anyway. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster routine + may be used for the single inflate() call. + + inflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if the end of the + compressed data has been reached and all uncompressed output has been + produced, Z_NEED_DICT if a preset dictionary is needed at this point (see + inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted, + Z_STREAM_ERROR if the stream structure was inconsistent (for example if + next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in + the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the + application may then call inflateSync to look for a good compression block. + In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the + dictionary chosen by the compressor. +*/ + + +extern int EXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +extern int EXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. (Method 9 will allow a 64K history buffer and + partial block flushes.) + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library (the value 16 will be allowed for method 9). Larger + values of this parameter result in better compression at the expense of + memory usage. The default value is 15 if deflateInit is used instead. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match). Filtered data consists mostly of small values with a + somewhat random distribution. In this case, the compression algorithm is + tuned to compress them better. The effect of Z_FILTERED is to force more + Huffman coding and less string matching; it is somewhat intermediate + between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects + the compression ratio but not the correctness of the compressed output even + if it is not set appropriately. + + If next_in is not null, the library will use this buffer to hold also + some history information; the buffer must either hold the entire input + data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in + is null, the library will allocate its own history buffer (and leave next_in + null). next_out need not be provided here but must be provided by the + application for the next call of deflate(). + + If the history buffer is provided by the application, next_in must + must never be changed by the application since the compressor maintains + information inside this buffer from call to call; the application + must provide more input only by increasing avail_in. next_in is always + reset by the library in this case. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was + not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as + an invalid method). msg is set to null if there is no error message. + deflateInit2 does not perform any compression: this will be done by + deflate(). +*/ + +extern int EXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary (history buffer) from the given + byte sequence without producing any compressed output. This function must + be called immediately after deflateInit or deflateInit2, before any call + of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and + can be predicted with good accuracy; the data can then be compressed better + than with the default empty dictionary. In this version of the library, + only the last 32K bytes of the dictionary are used. + Upon return of this function, strm->adler is set to the Adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state + is inconsistent (for example if deflate has already been called for this + stream). deflateSetDictionary does not perform any compression: this will + be done by deflate(). +*/ + +extern int EXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. If + the source stream is using an application-supplied history buffer, a new + buffer is allocated for the destination stream. The compressed output + buffer is always application-supplied. It's the responsibility of the + application to provide the correct values of next_out and avail_out for the + next call of deflate. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +extern int EXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy)); +/* + Dynamically update the compression level and compression strategy. + This can be used to switch between compression and straight copy of + the input data, or to switch to a different kind of input data requiring + a different strategy. If the compression level is changed, the input + available so far is compressed with the old level (and may be flushed); + the new level will take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +/* +extern int EXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with more compression options. The + fields next_out, zalloc, zfree and opaque must be initialized before by + the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library (the value 16 will be allowed soon). The + default value is 15 if inflateInit is used instead. If a compressed stream + with a larger window size is given as input, inflate() will return with + the error code Z_DATA_ERROR instead of trying to allocate a larger window. + + If next_out is not null, the library will use this buffer for the history + buffer; the buffer must either be large enough to hold the entire output + data, or have at least 1<