pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/digest Update digest to version 20050323. Th...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4bbd610300e8
branches:  trunk
changeset: 491357:4bbd610300e8
user:      agc <agc%pkgsrc.org@localhost>
date:      Wed Mar 23 14:32:19 2005 +0000

description:
Update digest to version 20050323.  The whirlpool digest algorithm was
added in this version, taken from the reference code from the NESSIE
project. Passes regression test suite on NetBSD/{i386,sparc64} and
also on SunOS 5.9 sparc (thanks, Jonathan).

diffstat:

 pkgtools/digest/DESCR              |     1 +
 pkgtools/digest/Makefile           |     6 +-
 pkgtools/digest/files/Makefile.in  |     8 +-
 pkgtools/digest/files/configure    |     4 +-
 pkgtools/digest/files/configure.ac |     4 +-
 pkgtools/digest/files/digest.1     |     8 +-
 pkgtools/digest/files/digest.c     |    29 +-
 pkgtools/digest/files/whirlpool.c  |  1854 ++++++++++++++++++++++++++++++++++++
 pkgtools/digest/files/whirlpool.h  |   133 ++
 9 files changed, 2023 insertions(+), 24 deletions(-)

diffs (truncated from 2182 to 300 lines):

diff -r 67a130ca1bc2 -r 4bbd610300e8 pkgtools/digest/DESCR
--- a/pkgtools/digest/DESCR     Wed Mar 23 14:31:26 2005 +0000
+++ b/pkgtools/digest/DESCR     Wed Mar 23 14:32:19 2005 +0000
@@ -7,5 +7,6 @@
        + sha384
        + sha512
        + tiger
+       + whirlpool
 
 message digest routines.
diff -r 67a130ca1bc2 -r 4bbd610300e8 pkgtools/digest/Makefile
--- a/pkgtools/digest/Makefile  Wed Mar 23 14:31:26 2005 +0000
+++ b/pkgtools/digest/Makefile  Wed Mar 23 14:32:19 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.44 2005/01/06 05:32:29 tv Exp $
+# $NetBSD: Makefile,v 1.45 2005/03/23 14:32:19 agc Exp $
 #
 # When adding new digest algorithms, please use rmd160 as the template,
 # and bump the VERSION definition.
@@ -15,10 +15,10 @@
 PKG_INSTALLATION_TYPES=        overwrite pkgviews
 
 USE_BUILDLINK3=                yes
-GNU_CONFIGURE=         # defined
+GNU_CONFIGURE=         yes
 
 NO_PKGTOOLS_REQD_CHECK=        # defined
-NO_CHECKSUM=           # defined
+NO_CHECKSUM=           yes
 
 # XXX Remove the following two lines after pkgsrc/bootstrap is up and
 # XXX running.
diff -r 67a130ca1bc2 -r 4bbd610300e8 pkgtools/digest/files/Makefile.in
--- a/pkgtools/digest/files/Makefile.in Wed Mar 23 14:31:26 2005 +0000
+++ b/pkgtools/digest/files/Makefile.in Wed Mar 23 14:32:19 2005 +0000
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.3 2005/03/22 10:16:15 agc Exp $
+# $Id: Makefile.in,v 1.4 2005/03/23 14:32:19 agc Exp $
 
 @SET_MAKE@
 SHELL = @SHELL@
@@ -43,11 +43,12 @@
 COMPILE= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS)
 
 digest_OBJS = digest.o md5c.o rmd160.o rmd160hl.o sha2.o sha2hl.o \
-md5hl.o sha1.o sha1hl.o tiger.o
+md5hl.o sha1.o sha1hl.o tiger.o whirlpool.o
 bits_OBJS = bits.o
 
 SRCS= digest.c md5c.c rmd160.c rmd160hl.c sha2.c sha2hl.c md5hl.c sha1.c \
-sha1hl.c bits.c md5.h rmd160.h sha1.h sha2.h tiger.c tiger.h
+sha1hl.c bits.c md5.h rmd160.h sha1.h sha2.h tiger.c tiger.h whirlpool.c \
+whirlpool.h
 
 DISTFILES= $(SRCS) AUTHORS COPYING DESCR INSTALL Makefile.in NEWS aclocal.m4 \
 config.guess config.h.in config.sub configure configure.ac install-sh \
@@ -80,6 +81,7 @@
 sha1.o: digest-types.h
 sha1hl.o: digest-types.h
 tiger.o: digest-types.h
+whirlpool.o: digest-types.h
 
 clean:
        rm -f *.o digest bits digest-types.h
diff -r 67a130ca1bc2 -r 4bbd610300e8 pkgtools/digest/files/configure
--- a/pkgtools/digest/files/configure   Wed Mar 23 14:31:26 2005 +0000
+++ b/pkgtools/digest/files/configure   Wed Mar 23 14:32:19 2005 +0000
@@ -268,8 +268,8 @@
 # Identity of this package.
 PACKAGE_NAME='nbsd-digest'
 PACKAGE_TARNAME='nbsd-digest'
-PACKAGE_VERSION='20050310'
-PACKAGE_STRING='nbsd-digest 20050310'
+PACKAGE_VERSION='20050323'
+PACKAGE_STRING='nbsd-digest 20050323'
 PACKAGE_BUGREPORT='agc%netbsd.org@localhost'
 
 ac_unique_file="digest.c"
diff -r 67a130ca1bc2 -r 4bbd610300e8 pkgtools/digest/files/configure.ac
--- a/pkgtools/digest/files/configure.ac        Wed Mar 23 14:31:26 2005 +0000
+++ b/pkgtools/digest/files/configure.ac        Wed Mar 23 14:32:19 2005 +0000
@@ -1,7 +1,7 @@
-dnl $Id: configure.ac,v 1.4 2005/03/22 10:16:15 agc Exp $
+dnl $Id: configure.ac,v 1.5 2005/03/23 14:32:19 agc Exp $
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.57)
-AC_INIT([nbsd-digest],[20050310],[agc%netbsd.org@localhost])
+AC_INIT([nbsd-digest],[20050323],[agc%netbsd.org@localhost])
 AC_CONFIG_SRCDIR([digest.c])
 AC_CONFIG_HEADER(config.h)
 AC_ARG_PROGRAM
diff -r 67a130ca1bc2 -r 4bbd610300e8 pkgtools/digest/files/digest.1
--- a/pkgtools/digest/files/digest.1    Wed Mar 23 14:31:26 2005 +0000
+++ b/pkgtools/digest/files/digest.1    Wed Mar 23 14:32:19 2005 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: digest.1,v 1.5 2005/03/22 12:42:02 wiz Exp $
+.\" $NetBSD: digest.1,v 1.6 2005/03/23 14:32:19 agc Exp $
 .\"
 .\"
 .\" Copyright (c) 2001 Alistair G. Crooks.  All rights reserved.
@@ -31,7 +31,7 @@
 .\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd March 22, 2005
+.Dd March 23, 2005
 .Dt DIGEST 1
 .Os
 .Sh NAME
@@ -76,6 +76,10 @@
 the
 tiger
 algorithm will be used.
+.It whirlpool
+the
+whirlpool
+algorithm will be used.
 .El
 .Pp
 The
diff -r 67a130ca1bc2 -r 4bbd610300e8 pkgtools/digest/files/digest.c
--- a/pkgtools/digest/files/digest.c    Wed Mar 23 14:31:26 2005 +0000
+++ b/pkgtools/digest/files/digest.c    Wed Mar 23 14:32:19 2005 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: digest.c,v 1.9 2005/03/22 10:16:15 agc Exp $ */
+/*     $NetBSD: digest.c,v 1.10 2005/03/23 14:32:19 agc Exp $ */
 
 /*
- * Copyright (c) 2001 Alistair G. Crooks.  All rights reserved.
+ * Copyright (c) 2001-2005 Alistair G. Crooks.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
 #include <digest-types.h>
 
 #ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 2001 \
+__COPYRIGHT("@(#) Copyright (c) 2001-2005 \
                The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: digest.c,v 1.9 2005/03/22 10:16:15 agc Exp $");
+__RCSID("$NetBSD: digest.c,v 1.10 2005/03/23 14:32:19 agc Exp $");
 #endif
 
 
@@ -57,6 +57,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <tiger.h>
+#include <whirlpool.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -75,13 +76,14 @@
        HASH_end        hash_end;
        HASH_file       hash_file;
        union {
-               MD5_CTX         m;
-               SHA1_CTX        sha;
-               RMD160_CTX      rmd;
-               SHA256_CTX      sha256;
-               SHA384_CTX      sha384;
-               SHA512_CTX      sha512;
-               tiger_context_t tiger;
+               MD5_CTX                 m;
+               SHA1_CTX                sha;
+               RMD160_CTX              rmd;
+               SHA256_CTX              sha256;
+               SHA384_CTX              sha384;
+               SHA512_CTX              sha512;
+               tiger_context_t         tiger;
+               whirlpool_context_t     whirlpool;
        } hash_ctx, hash_ctx2;
 } alg_t;
 
@@ -107,7 +109,10 @@
          (HASH_end) SHA512_End,        (HASH_file) SHA512_File },
        { "TIGER",      20,
          (HASH_init) TIGERInit,        (HASH_update) TIGERUpdate,
-         (HASH_end) TIGEREnd,  (HASH_file) TIGERFile },
+         (HASH_end) TIGEREnd,          (HASH_file) TIGERFile },
+       { "WHIRLPOOL",  WHIRLPOOL_DIGEST_BYTES,
+         (HASH_init) whirlpool_init,   (HASH_update) whirlpool_update,
+         (HASH_end) whirlpool_end,     (HASH_file) whirlpool_file },
        { NULL }
 };
 
diff -r 67a130ca1bc2 -r 4bbd610300e8 pkgtools/digest/files/whirlpool.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/digest/files/whirlpool.c Wed Mar 23 14:32:19 2005 +0000
@@ -0,0 +1,1854 @@
+/**
+ * The Whirlpool hashing function.
+ *
+ * <P>
+ * <b>References</b>
+ *
+ * <P>
+ * The Whirlpool algorithm was developed by
+ * <a href="mailto:pbarreto%scopus.com.br@localhost";>Paulo S. L. M. Barreto</a> and
+ * <a href="mailto:vincent.rijmen%cryptomathic.com@localhost";>Vincent Rijmen</a>.
+ *
+ * See
+ *      P.S.L.M. Barreto, V. Rijmen,
+ *      ``The Whirlpool hashing function,''
+ *      NESSIE submission, 2000 (tweaked version, 2001),
+ *      <https://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/whirlpool.zip>
+ * 
+ * @author  Paulo S.L.M. Barreto
+ * @author  Vincent Rijmen.
+ *
+ * @version 3.0 (2003.03.12)
+ *
+ * =============================================================================
+ *
+ * Differences from version 2.1:
+ *
+ * - Suboptimal diffusion matrix replaced by cir(1, 1, 4, 1, 8, 5, 2, 9).
+ *
+ * =============================================================================
+ *
+ * Differences from version 2.0:
+ *
+ * - Generation of ISO/IEC 10118-3 test vectors.
+ * - Bug fix: nonzero carry was ignored when tallying the data length
+ *      (this bug apparently only manifested itself when feeding data
+ *      in pieces rather than in a single chunk at once).
+ * - Support for MS Visual C++ 64-bit integer arithmetic.
+ *
+ * Differences from version 1.0:
+ *
+ * - Original S-box replaced by the tweaked, hardware-efficient version.
+ *
+ * =============================================================================
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+
+#include "whirlpool.h"
+
+/*
+ * The number of rounds of the internal dedicated block cipher.
+ */
+#define R 10
+
+/*
+ * Though Whirlpool is endianness-neutral, the encryption tables are listed
+ * in BIG-ENDIAN format, which is adopted throughout this implementation
+ * (but little-endian notation would be equally suitable if consistently
+ * employed).
+ */
+
+static const u64 C0[256] = {
+    LL(0x18186018c07830d8), LL(0x23238c2305af4626), LL(0xc6c63fc67ef991b8), LL(0xe8e887e8136fcdfb),
+    LL(0x878726874ca113cb), LL(0xb8b8dab8a9626d11), LL(0x0101040108050209), LL(0x4f4f214f426e9e0d),
+    LL(0x3636d836adee6c9b), LL(0xa6a6a2a6590451ff), LL(0xd2d26fd2debdb90c), LL(0xf5f5f3f5fb06f70e),
+    LL(0x7979f979ef80f296), LL(0x6f6fa16f5fcede30), LL(0x91917e91fcef3f6d), LL(0x52525552aa07a4f8),
+    LL(0x60609d6027fdc047), LL(0xbcbccabc89766535), LL(0x9b9b569baccd2b37), LL(0x8e8e028e048c018a),
+    LL(0xa3a3b6a371155bd2), LL(0x0c0c300c603c186c), LL(0x7b7bf17bff8af684), LL(0x3535d435b5e16a80),
+    LL(0x1d1d741de8693af5), LL(0xe0e0a7e05347ddb3), LL(0xd7d77bd7f6acb321), LL(0xc2c22fc25eed999c),
+    LL(0x2e2eb82e6d965c43), LL(0x4b4b314b627a9629), LL(0xfefedffea321e15d), LL(0x575741578216aed5),
+    LL(0x15155415a8412abd), LL(0x7777c1779fb6eee8), LL(0x3737dc37a5eb6e92), LL(0xe5e5b3e57b56d79e),
+    LL(0x9f9f469f8cd92313), LL(0xf0f0e7f0d317fd23), LL(0x4a4a354a6a7f9420), LL(0xdada4fda9e95a944),
+    LL(0x58587d58fa25b0a2), LL(0xc9c903c906ca8fcf), LL(0x2929a429558d527c), LL(0x0a0a280a5022145a),
+    LL(0xb1b1feb1e14f7f50), LL(0xa0a0baa0691a5dc9), LL(0x6b6bb16b7fdad614), LL(0x85852e855cab17d9),
+    LL(0xbdbdcebd8173673c), LL(0x5d5d695dd234ba8f), LL(0x1010401080502090), LL(0xf4f4f7f4f303f507),
+    LL(0xcbcb0bcb16c08bdd), LL(0x3e3ef83eedc67cd3), LL(0x0505140528110a2d), LL(0x676781671fe6ce78),
+    LL(0xe4e4b7e47353d597), LL(0x27279c2725bb4e02), LL(0x4141194132588273), LL(0x8b8b168b2c9d0ba7),
+    LL(0xa7a7a6a7510153f6), LL(0x7d7de97dcf94fab2), LL(0x95956e95dcfb3749), LL(0xd8d847d88e9fad56),
+    LL(0xfbfbcbfb8b30eb70), LL(0xeeee9fee2371c1cd), LL(0x7c7ced7cc791f8bb), LL(0x6666856617e3cc71),
+    LL(0xdddd53dda68ea77b), LL(0x17175c17b84b2eaf), LL(0x4747014702468e45), LL(0x9e9e429e84dc211a),
+    LL(0xcaca0fca1ec589d4), LL(0x2d2db42d75995a58), LL(0xbfbfc6bf9179632e), LL(0x07071c07381b0e3f),
+    LL(0xadad8ead012347ac), LL(0x5a5a755aea2fb4b0), LL(0x838336836cb51bef), LL(0x3333cc3385ff66b6),
+    LL(0x636391633ff2c65c), LL(0x02020802100a0412), LL(0xaaaa92aa39384993), LL(0x7171d971afa8e2de),
+    LL(0xc8c807c80ecf8dc6), LL(0x19196419c87d32d1), LL(0x494939497270923b), LL(0xd9d943d9869aaf5f),
+    LL(0xf2f2eff2c31df931), LL(0xe3e3abe34b48dba8), LL(0x5b5b715be22ab6b9), LL(0x88881a8834920dbc),
+    LL(0x9a9a529aa4c8293e), LL(0x262698262dbe4c0b), LL(0x3232c8328dfa64bf), LL(0xb0b0fab0e94a7d59),
+    LL(0xe9e983e91b6acff2), LL(0x0f0f3c0f78331e77), LL(0xd5d573d5e6a6b733), LL(0x80803a8074ba1df4),
+    LL(0xbebec2be997c6127), LL(0xcdcd13cd26de87eb), LL(0x3434d034bde46889), LL(0x48483d487a759032),
+    LL(0xffffdbffab24e354), LL(0x7a7af57af78ff48d), LL(0x90907a90f4ea3d64), LL(0x5f5f615fc23ebe9d),
+    LL(0x202080201da0403d), LL(0x6868bd6867d5d00f), LL(0x1a1a681ad07234ca), LL(0xaeae82ae192c41b7),



Home | Main Index | Thread Index | Old Index