diff options
author | Mikhail Teterin <mi@FreeBSD.org> | 2009-07-13 05:30:15 +0000 |
---|---|---|
committer | Mikhail Teterin <mi@FreeBSD.org> | 2009-07-13 05:30:15 +0000 |
commit | 52b76e132728a3a0e13436f09f10391aec3e259b (patch) | |
tree | 8034266eeceaa3f8301733562c746f4e853afb28 /devel/tcl-trf | |
parent | 562f574aa03214a910861f8b8b480f662a0d28bb (diff) | |
download | ports-52b76e132728a3a0e13436f09f10391aec3e259b.tar.gz ports-52b76e132728a3a0e13436f09f10391aec3e259b.zip |
Notes
Diffstat (limited to 'devel/tcl-trf')
-rw-r--r-- | devel/tcl-trf/Makefile | 85 | ||||
-rw-r--r-- | devel/tcl-trf/distinfo | 3 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-Makefile | 16 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-bz2 | 166 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-configure | 23 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-crc | 25 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-crypt | 36 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-digest | 108 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-haval | 25 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-md2 | 185 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-md5dig | 257 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-rmd128 | 23 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-rmd160 | 284 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-sha | 244 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-sha1 | 193 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-transform | 30 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-warnings | 29 | ||||
-rw-r--r-- | devel/tcl-trf/files/patch-zlib | 300 | ||||
-rw-r--r-- | devel/tcl-trf/pkg-descr | 12 |
19 files changed, 2044 insertions, 0 deletions
diff --git a/devel/tcl-trf/Makefile b/devel/tcl-trf/Makefile new file mode 100644 index 000000000000..3af2bba4a579 --- /dev/null +++ b/devel/tcl-trf/Makefile @@ -0,0 +1,85 @@ +# New ports collection makefile for: tcl-Trf +# Date created: May 22, 2000 +# Whom: Mikhail Teterin <mi@aldan.algebra.com> +# +# $FreeBSD$ +# + +PORTNAME= Trf +PORTVERSION= 2.1.4 +CATEGORIES= devel tcl +MASTER_SITES= ftp://ftp.tcl.tk/pub/incoming/ +PKGNAMEPREFIX= tcl- +DISTNAME= trf${PORTVERSION} +MASTER_SITE_SUBDIR=tcltrf + +MAINTAINER= mi@aldan.algebra.com +COMMENT= Data conversion, digests, compression, error-correction for Tcl + +BUILD_DEPENDS= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${TCL_VER:S/.//} \ + ${LOCALBASE}/lib/tcl${TCL_VER}/Memchan/pkgIndex.tcl:${PORTSDIR}/devel/tcl-memchan + +USE_BZIP2= yes + +ALL_TARGET= all + +USE_TCL= 84+ +DDIR= ${PREFIX}/lib/tcl${TCL_VER}/Trf +CFLAGS+= -Wall -Werror + +MAKE_ENV+= TCL_VER=${TCL_VER} MKDIR="${MKDIR}" \ + INSTALL_DATA="${INSTALL_DATA}" + +REINPLACE_ARGS= -i "" +HAS_CONFIGURE= yes +CONFIGURE_ARGS= --with-tcl=${LOCALBASE}/lib/tcl${TCL_VER} \ + --with-tclinclude=${LOCALBASE}/include/tcl${TCL_VER} \ + --enable-static-zlib --enable-static-bzlib \ + --enable-static-md5 + +post-patch: +.ifdef TRF_USE_MD + # + # Using FreeBSD's own -lmd instead of OpenSSL's -lcrypto + # + ${REINPLACE_CMD} -E -e 's,openssl/,,' \ + -e 's,(MD[25])_([A-Z][a-z]),\1\2,g' \ + ${WRKSRC}/generic/*.[ch] + ${REINPLACE_CMD} 's,-lcrypto,-lmd,' ${WRKSRC}/Makefile.in +.else + # + # Using OpenSSL's implementations of message digests (-lcrypto) + # To use FreeBSD's own -lmd, stop now and restart make with: + # + # -DTRF_USE_MD + # +USE_OPENSSL= yes +.endif + +do-install: + ${MKDIR} ${PREFIX}/lib/Trf + ${INSTALL_DATA} ${WRKSRC}/libTrf${PORTVERSION}.so \ + ${WRKSRC}/pkgIndex.tcl ${PREFIX}/lib/Trf/ + for m in ${WRKSRC}/doc/man/*.n ; \ + do \ + ${INSTALL_MAN} $$m ${MANNPREFIX}/man/mann/ ;\ + done + +post-build test: + cd ${WRKSRC}/tests && ${SETENV} TCLLIBPATH="${WRKSRC}" ${TCLSH} all + +MANN= adler.n ascii85.n base64.n bin.n bz2.n crc-zlib.n crc.n \ + crypt.n haval.n hex.n md2.n md5.n md5_otp.n md5crypt.n \ + oct.n otp_words.n quoted-printable.n ripemd128.n ripemd160.n \ + rs_ecc.n sha.n sha1.n sha1_otp.n transform.n trf.n unstack.n \ + uuencode.n zip.n + +.include <bsd.port.pre.mk> + +PLIST_SUB+= TCL_DVER=${TCL_VER:C/\.//} VER=${PORTVERSION} + +.if defined(OPENSSLBASE) && ${OPENSSLBASE} != "/usr" +MAKE_ENV+= SSLINC=-I${OPENSSLINC} SSLLIB=-L${OPENSSLLIB} +.endif + +.include <bsd.port.post.mk> diff --git a/devel/tcl-trf/distinfo b/devel/tcl-trf/distinfo new file mode 100644 index 000000000000..6abf6091e34a --- /dev/null +++ b/devel/tcl-trf/distinfo @@ -0,0 +1,3 @@ +MD5 (trf2.1.4.tar.bz2) = 624dc7b112886fd006664ac377da2391 +SHA256 (trf2.1.4.tar.bz2) = 179ce88b272bdfa44e551b858f6ee5783a8c72cc11a5ef29975b29d12998b3de +SIZE (trf2.1.4.tar.bz2) = 1236871 diff --git a/devel/tcl-trf/files/patch-Makefile b/devel/tcl-trf/files/patch-Makefile new file mode 100644 index 000000000000..440259331a2d --- /dev/null +++ b/devel/tcl-trf/files/patch-Makefile @@ -0,0 +1,16 @@ +--- Makefile.in 2009-06-18 00:45:22.000000000 -0400 ++++ Makefile.in 2009-07-13 01:07:48.000000000 -0400 +@@ -84,5 +84,5 @@ + DESTDIR = + +-PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) ++PKG_DIR = $(PACKAGE_NAME) + pkgdatadir = $(datadir)/$(PKG_DIR) + pkglibdir = $(libdir)/$(PKG_DIR) +@@ -154,5 +154,5 @@ + + CPPFLAGS = @CPPFLAGS@ +-LIBS = @PKG_LIBS@ @LIBS@ ++LIBS = @PKG_LIBS@ @LIBS@ -lz -lbz2 -lcrypt ${SSLLIB} -lcrypto + AR = @AR@ + CFLAGS = @CFLAGS@ diff --git a/devel/tcl-trf/files/patch-bz2 b/devel/tcl-trf/files/patch-bz2 new file mode 100644 index 000000000000..a86179b7479f --- /dev/null +++ b/devel/tcl-trf/files/patch-bz2 @@ -0,0 +1,166 @@ +--- generic/bz2.c 2008-12-05 16:00:23.000000000 -0500 ++++ generic/bz2.c 2008-12-23 15:31:04.000000000 -0500 +@@ -28,4 +28,5 @@ + */ + ++#include <bzlib.h> + #include "transformInt.h" + +@@ -223,5 +224,5 @@ + } + +- res = bz.bcompressInit (&c->state, o->level, 0, 0); ++ res = BZ2_bzCompressInit (&c->state, o->level, 0, 0); + + if (res != BZ_OK) { +@@ -265,5 +266,5 @@ + /* release conversion specific items here (BZ2) */ + +- bz.bcompressEnd (&c->state); ++ BZ2_bzCompressEnd (&c->state); + Tcl_Free ((char*) c->output_buffer); + Tcl_Free ((char*) c); +@@ -305,12 +306,12 @@ + in = character; + +- c->state.next_in = (unsigned char*) (Bytef*) ∈ ++ c->state.next_in = ∈ + c->state.avail_in = 1; + + for (;;) { +- c->state.next_out = (unsigned char*) (Bytef*) c->output_buffer; ++ c->state.next_out = c->output_buffer; + c->state.avail_out = OUT_SIZE; + +- res = bz.bcompress (&c->state, BZ_RUN); ++ res = BZ2_bzCompress (&c->state, BZ_RUN); + + if (res < BZ_OK) { +@@ -373,12 +374,12 @@ + int res; + +- c->state.next_in = (unsigned char*) (Bytef*) buffer; ++ c->state.next_in = (char *)buffer; + c->state.avail_in = bufLen; + + for (;;) { +- c->state.next_out = (unsigned char*) (Bytef*) c->output_buffer; ++ c->state.next_out = c->output_buffer; + c->state.avail_out = OUT_SIZE; + +- res = bz.bcompress (&c->state, BZ_RUN); ++ res = BZ2_bzCompress (&c->state, BZ_RUN); + + if (res < BZ_OK) { +@@ -439,12 +440,12 @@ + int res; + +- c->state.next_in = (unsigned char*) (Bytef*) NULL; ++ c->state.next_in = NULL; + c->state.avail_in = 0; + + for (;;) { +- c->state.next_out = (unsigned char*) (Bytef*) c->output_buffer; ++ c->state.next_out = c->output_buffer; + c->state.avail_out = OUT_SIZE; + +- res = bz.bcompress (&c->state, BZ_FINISH); ++ res = BZ2_bzCompress (&c->state, BZ_FINISH); + + if (res < BZ_OK) { +@@ -499,5 +500,5 @@ + /* execute conversion specific code here (BZ2) */ + +- /* bz.bcompressReset (&c->state); */ ++ /* BZ2_bzCompressReset (&c->state); */ + } + +@@ -549,5 +550,5 @@ + } + +- res = bz.bdecompressInit (&c->state, 0, 0); ++ res = BZ2_bzDecompressInit (&c->state, 0, 0); + + if (res != BZ_OK) { +@@ -593,5 +594,5 @@ + /* release conversion specific items here (BZ2) */ + +- bz.bdecompressEnd (&c->state); ++ BZ2_bzDecompressEnd (&c->state); + + Tcl_Free ((char*) c->output_buffer); +@@ -633,12 +634,12 @@ + in = character; + +- c->state.next_in = (unsigned char*) (Bytef*) ∈ ++ c->state.next_in = ∈ + c->state.avail_in = 1; + + for (;;) { +- c->state.next_out = (unsigned char*) (Bytef*) c->output_buffer; ++ c->state.next_out = c->output_buffer; + c->state.avail_out = OUT_SIZE; + +- res = bz.bdecompress (&c->state); ++ res = BZ2_bzDecompress (&c->state); + c->lastRes = res; + +@@ -702,12 +703,12 @@ + int res; + +- c->state.next_in = (unsigned char*) (Bytef*) buffer; ++ c->state.next_in = (char *)buffer; + c->state.avail_in = bufLen; + + for (;;) { +- c->state.next_out = (unsigned char*) (Bytef*) c->output_buffer; ++ c->state.next_out = c->output_buffer; + c->state.avail_out = OUT_SIZE; + +- res = bz.bdecompress (&c->state); ++ res = BZ2_bzDecompress (&c->state); + c->lastRes = res; + +@@ -774,14 +775,14 @@ + } + +- c->state.next_in = (unsigned char*) (Bytef*) c->output_buffer; /* fake out +- * 'inflate' +- */ ++ c->state.next_in = c->output_buffer; /* fake out ++ * 'inflate' ++ */ + c->state.avail_in = 0; + + for (;;) { +- c->state.next_out = (unsigned char*) (Bytef*) c->output_buffer; ++ c->state.next_out = c->output_buffer; + c->state.avail_out = OUT_SIZE; + +- res = bz.bdecompress (&c->state); ++ res = BZ2_bzDecompress (&c->state); + + if ((res < BZ_OK) && (res != BZ_STREAM_END)) { +@@ -836,5 +837,5 @@ + /* execute conversion specific code here (BZ2) */ + +- /* bz.bdecompressReset (&c->state); */ ++ /* BZ2_bzDecompressReset (&c->state); */ + } + +--- generic/bz2_opt.c 2008-12-05 16:00:23.000000000 -0500 ++++ generic/bz2_opt.c 2008-12-23 15:45:52.000000000 -0500 +@@ -182,13 +182,4 @@ + + /* +- * 'bz2' is used, therefore load the required library. +- * And bail out if it is not available. +- */ +- +- if (TCL_OK != TrfLoadBZ2lib (interp)) { +- return TCL_ERROR; +- } +- +- /* + * Now perform the real option check. + */ diff --git a/devel/tcl-trf/files/patch-configure b/devel/tcl-trf/files/patch-configure new file mode 100644 index 000000000000..274baf234a86 --- /dev/null +++ b/devel/tcl-trf/files/patch-configure @@ -0,0 +1,23 @@ +--- configure 2009-06-18 00:45:24.000000000 -0400 ++++ configure 2009-07-12 20:45:07.000000000 -0400 +@@ -6752,5 +6752,5 @@ + + +- vars="zlib.c bz2lib.c loadman.c init.c registry.c unstack.c load.c crypt.c" ++ vars="init.c registry.c unstack.c load.c crypt.c" + for i in $vars; do + case $i in +@@ -13653,5 +13653,5 @@ + + +- vars="md5-crypt/crypt-entry.c md5-crypt/md5-crypt.c md5-crypt/md5.c compat/stpncpy.c" ++ vars="compat/stpncpy.c" + for i in $vars; do + case $i in +@@ -13713,5 +13713,5 @@ + + +- vars="md5-crypt/crypt-entry.c md5-crypt/md5-crypt.c md5-crypt/md5.c compat/stpncpy.c" ++ vars="compat/stpncpy.c" + for i in $vars; do + case $i in diff --git a/devel/tcl-trf/files/patch-crc b/devel/tcl-trf/files/patch-crc new file mode 100644 index 000000000000..bd6d8112d226 --- /dev/null +++ b/devel/tcl-trf/files/patch-crc @@ -0,0 +1,25 @@ +--- generic/crc.c 2009-06-18 00:54:43.000000000 -0400 ++++ generic/crc.c 2009-07-12 23:44:21.000000000 -0400 +@@ -48,6 +48,6 @@ + static void MDcrc_Start _ANSI_ARGS_ ((VOID* context)); + static void MDcrc_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDcrc_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); +-static void MDcrc_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); ++static void MDcrc_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, size_t bufLen)); ++static void MDcrc_Final _ANSI_ARGS_ ((VOID* digest, VOID* context)); + + /* +@@ -193,5 +193,5 @@ + VOID* context; + unsigned char* buffer; +-int bufLen; ++size_t bufLen; + { + /* call md specific update here */ +@@ -234,5 +234,5 @@ + + static void +-MDcrc_Final (context, digest) ++MDcrc_Final (digest, context) + VOID* context; + VOID* digest; diff --git a/devel/tcl-trf/files/patch-crypt b/devel/tcl-trf/files/patch-crypt new file mode 100644 index 000000000000..fb3e00ede5b2 --- /dev/null +++ b/devel/tcl-trf/files/patch-crypt @@ -0,0 +1,36 @@ +--- generic/crypt.c 2009-06-18 00:54:43.000000000 -0400 ++++ generic/crypt.c 2009-07-12 21:34:19.000000000 -0400 +@@ -28,5 +28,9 @@ + */ + +-#include "loadman.h" ++#ifndef __WIN32__ ++# include <sys/types.h> ++# include <unistd.h> ++#endif ++#include "transformInt.h" + + static int +@@ -112,4 +116,6 @@ + */ + ++char *crypt_md5(const char *pw, const char *salt); /* Lives in -lcrypt */ ++ + static int + TrfMd5CryptObjCmd (notUsed, interp, objc, objv) +@@ -128,8 +134,4 @@ + Tcl_Obj* res; + +- if (TrfLoadMD5 (interp) != TCL_OK) { +- return TCL_ERROR; +- } +- + if (objc != 3) { + Tcl_AppendResult (interp, +@@ -159,5 +161,5 @@ + + TrfLock; +- res = Tcl_NewStringObj ((char*) md5f.crypt (passwd, salt_b) + 3, -1); ++ res = Tcl_NewStringObj (crypt_md5(passwd, salt_b) + 3, -1); + TrfUnlock; + diff --git a/devel/tcl-trf/files/patch-digest b/devel/tcl-trf/files/patch-digest new file mode 100644 index 000000000000..c86cd6a65a6b --- /dev/null +++ b/devel/tcl-trf/files/patch-digest @@ -0,0 +1,108 @@ +--- generic/digest.c 2009-06-18 00:54:43.000000000 -0400 ++++ generic/digest.c 2009-07-12 23:59:49.000000000 -0400 +@@ -34,4 +34,7 @@ + * Declarations of internal procedures. + */ ++static void Update _ANSI_ARGS_ ((Trf_MessageDigestDescription *md, ++ VOID* context, ++ unsigned int character)); + + static Trf_ControlBlock CreateEncoder _ANSI_ARGS_ ((ClientData writeClientData, +@@ -236,4 +239,29 @@ + + /* ++ * ++ * Update ++ * ++ * ------------------------------------------------* ++ * If a back-end defines its own single-byte update ++ * function -- call it. Otherwise, call the back-end's ++ * updateBuf function with our single byte being the ++ * buffer. ++ * ------------------------------------------------* ++ * ++ */ ++static void ++Update(Trf_MessageDigestDescription *md, VOID* context, ++ unsigned int character) ++{ ++ if (md->updateProc != NULL) ++ md->updateProc(context, character); ++ else { ++ unsigned char buf = character; ++ ++ md->updateBufProc(context, &buf, 1); ++ } ++} ++ ++/* + *------------------------------------------------------* + * +@@ -378,5 +406,5 @@ + + buf = character; +- (*md->updateProc) (c->context, character); ++ Update(md, c->context, character); + + if ((c->operation_mode == ATTACH_ABSORB) || +@@ -430,5 +458,5 @@ + for (i=0; i < ((unsigned int) bufLen); i++) { + character = buffer [i]; +- (*md->updateProc) (c->context, character); ++ Update(md, c->context, character); + } + } +@@ -481,5 +509,5 @@ + */ + digest = (char*) ckalloc (2 + md->digest_size); +- (*md->finalProc) (c->context, digest); ++ (*md->finalProc) (digest, c->context); + + if ((c->operation_mode == ATTACH_WRITE) || +@@ -671,9 +699,9 @@ + if (c->operation_mode == ATTACH_WRITE) { + buf = character; +- (*md->updateProc) (c->context, character); ++ Update(md, c->context, character); + + } else if (c->operation_mode == ATTACH_TRANS) { + buf = character; +- (*md->updateProc) (c->context, character); ++ Update(md, c->context, character); + + return c->write (c->writeClientData, (unsigned char*) &buf, 1, interp); +@@ -692,5 +720,5 @@ + + character = buf; +- (*md->updateProc) (c->context, character); ++ Update(md, c->context, character); + + return c->write (c->writeClientData, (unsigned char*) &buf, 1, interp); +@@ -748,5 +776,5 @@ + for (i=0; i < bufLen; i++) { + character = buffer [i]; +- (*md->updateProc) (c->context, character); ++ Update(md, c->context, character); + } + } +@@ -760,5 +788,5 @@ + for (i=0; i < bufLen; i++) { + character = buffer [i]; +- (*md->updateProc) (c->context, character); ++ Update(md, c->context, character); + } + } +@@ -924,5 +952,5 @@ + */ + digest = (char*) ckalloc (2 + md->digest_size); +- (*md->finalProc) (c->context, digest); ++ (*md->finalProc) (digest, c->context); + + if ((c->operation_mode == ATTACH_WRITE) || +@@ -1040,5 +1068,5 @@ + + #if GT81 +- Tcl_Obj* digestObj = Tcl_NewByteArrayObj (digest, md->digest_size); ++ Tcl_Obj* digestObj = Tcl_NewByteArrayObj ((void *)digest, md->digest_size); + #else + Tcl_Obj* digestObj = Tcl_NewStringObj (digest, md->digest_size); diff --git a/devel/tcl-trf/files/patch-haval b/devel/tcl-trf/files/patch-haval new file mode 100644 index 000000000000..a7647c497918 --- /dev/null +++ b/devel/tcl-trf/files/patch-haval @@ -0,0 +1,25 @@ +--- generic/haval.c 2009-06-18 00:54:43.000000000 -0400 ++++ generic/haval.c 2009-07-13 00:03:06.000000000 -0400 +@@ -48,6 +48,6 @@ + static void MDHaval_Start _ANSI_ARGS_ ((VOID* context)); + static void MDHaval_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDHaval_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); +-static void MDHaval_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); ++static void MDHaval_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, size_t bufLen)); ++static void MDHaval_Final _ANSI_ARGS_ ((VOID* digest, VOID* context)); + + /* +@@ -169,5 +169,5 @@ + VOID* context; + unsigned char* buffer; +-int bufLen; ++size_t bufLen; + { + haval_hash ((CTX_TYPE*) context, (unsigned char*) buffer, bufLen); +@@ -194,5 +194,5 @@ + + static void +-MDHaval_Final (context, digest) ++MDHaval_Final (digest, context) + VOID* context; + VOID* digest; diff --git a/devel/tcl-trf/files/patch-md2 b/devel/tcl-trf/files/patch-md2 new file mode 100644 index 000000000000..73d9e6655329 --- /dev/null +++ b/devel/tcl-trf/files/patch-md2 @@ -0,0 +1,185 @@ +--- generic/md2.c 2009-06-18 00:54:43.000000000 -0400 ++++ generic/md2.c 2009-07-13 00:28:17.000000000 -0400 +@@ -28,5 +28,6 @@ + */ + +-#include "loadman.h" ++#include "transformInt.h" ++#include <openssl/md2.h> + + /* +@@ -38,18 +39,8 @@ + */ + +-#define DIGEST_SIZE (MD2_DIGEST_LENGTH) ++#define DIGEST_SIZE (20) + #define CTX_TYPE MD2_CTX + + /* +- * Declarations of internal procedures. +- */ +- +-static void MDmd2_Start _ANSI_ARGS_ ((VOID* context)); +-static void MDmd2_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDmd2_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); +-static void MDmd2_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); +-static int MDmd2_Check _ANSI_ARGS_ ((Tcl_Interp* interp)); +- +-/* + * Generator definition. + */ +@@ -59,9 +50,9 @@ + sizeof (CTX_TYPE), + DIGEST_SIZE, +- MDmd2_Start, +- MDmd2_Update, +- MDmd2_UpdateBuf, +- MDmd2_Final, +- MDmd2_Check ++ (Trf_MDStart *)MD2_Init, ++ NULL, ++ (Trf_MDUpdateBuf *)MD2_Update, ++ (Trf_MDFinal *)MD2_Final, ++ NULL + }; + +@@ -90,139 +81,2 @@ + return Trf_RegisterMessageDigest (interp, &mdDescription); + } +- +-/* +- *------------------------------------------------------* +- * +- * MDmd2_Start -- +- * +- * ------------------------------------------------* +- * Initialize the internal state of the message +- * digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDmd2_Start (context) +-VOID* context; +-{ +- md2f.init ((MD2_CTX*) context); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDmd2_Update -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a single character. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDmd2_Update (context, character) +-VOID* context; +-unsigned int character; +-{ +- unsigned char buf = character; +- +- md2f.update ((MD2_CTX*) context, &buf, 1); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDmd2_UpdateBuf -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a character buffer. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDmd2_UpdateBuf (context, buffer, bufLen) +-VOID* context; +-unsigned char* buffer; +-int bufLen; +-{ +- md2f.update ((MD2_CTX*) context, (unsigned char*) buffer, bufLen); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDmd2_Final -- +- * +- * ------------------------------------------------* +- * Generate the digest from the internal state of +- * the message digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDmd2_Final (context, digest) +-VOID* context; +-VOID* digest; +-{ +- md2f.final ((unsigned char*) digest, (MD2_CTX*) context); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDmd2_Check -- +- * +- * ------------------------------------------------* +- * Do global one-time initializations of the message +- * digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * Loads the shared library containing the +- * MD2 functionality +- * +- * Result: +- * A standard Tcl error code. +- * +- *------------------------------------------------------* +- */ +- +-static int +-MDmd2_Check (interp) +-Tcl_Interp* interp; +-{ +- return TrfLoadMD2 (interp); +-} diff --git a/devel/tcl-trf/files/patch-md5dig b/devel/tcl-trf/files/patch-md5dig new file mode 100644 index 000000000000..074ebc58320a --- /dev/null +++ b/devel/tcl-trf/files/patch-md5dig @@ -0,0 +1,257 @@ +--- generic/md5dig.c 2009-06-18 00:54:43.000000000 -0400 ++++ generic/md5dig.c 2009-07-12 23:12:51.000000000 -0400 +@@ -28,6 +28,8 @@ + */ + +-#include "loadman.h" ++#include "transformInt.h" + ++#include <sys/types.h> ++#include <openssl/md5.h> + /* + * Generator description +@@ -38,6 +40,4 @@ + */ + +-#define MD5_CTXP (MD5_CTX*) +- + #ifndef OTP + #define DIGEST_SIZE (16) +@@ -51,10 +51,7 @@ + */ + +-static void MDmd5_Start _ANSI_ARGS_ ((VOID* context)); +-static void MDmd5_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDmd5_UpdateBuf _ANSI_ARGS_ ((VOID* context, +- unsigned char* buffer, int bufLen)); +-static void MDmd5_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); +-static int MDmd5_Check _ANSI_ARGS_ ((Tcl_Interp* interp)); ++#ifdef OTP ++static void MDmd5_OTP_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); ++#endif + + /* +@@ -71,9 +68,13 @@ + sizeof (CTX_TYPE), + DIGEST_SIZE, +- MDmd5_Start, +- MDmd5_Update, +- MDmd5_UpdateBuf, +- MDmd5_Final, +- MDmd5_Check ++ (Trf_MDStart *)MD5_Init, ++ NULL, ++ (Trf_MDUpdateBuf *)MD5_Update, ++#ifdef OTP ++ MDmd5_OTP_Final, ++#else ++ (Trf_MDFinal *)MD5_Final, ++#endif ++ NULL, + }; + +@@ -107,118 +108,9 @@ + } + ++#ifdef OTP + /* + *------------------------------------------------------* + * +- * MDmd5_Start -- +- * +- * ------------------------------------------------* +- * Initialize the internal state of the message +- * digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDmd5_Start (context) +-VOID* context; +-{ +- /* MD5Init ((MD5_CTX*) context);*/ +- md5f.init (MD5_CTXP context); +- +-#ifdef TRF_DEBUG +- { +- MD5_CTX* c = MD5_CTXP context; +- PRINT ("Init ABCD = %d %d %d %d\n", c->A, c->B, c->C, c->D); FL; +- } +-#endif +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDmd5_Update -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a single character. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDmd5_Update (context, character) +-VOID* context; +-unsigned int character; +-{ +- unsigned char buf = character; +- +- /* MD5Update ((MD5_CTX*) context, &buf, 1); */ +- +- md5f.update (MD5_CTXP context, &buf, 1); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDmd5_UpdateBuf -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a character buffer. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDmd5_UpdateBuf (context, buffer, bufLen) +-VOID* context; +-unsigned char* buffer; +-int bufLen; +-{ +- /* MD5Update ((MD5_CTX*) context, (unsigned char*) buffer, bufLen);*/ +- +- PRTSTR ("update by %d (%s)\n", bufLen, buffer); +-#ifdef TRF_DEBUG +- { +- MD5_CTX* c = MD5_CTXP context; +- PRINT ("Upd1 ABCD = %d %d %d %d\n", c->A, c->B, c->C, c->D); FL; +- } +-#endif +- +- md5f.update (MD5_CTXP context, (unsigned char*) buffer, bufLen); +- +-#ifdef TRF_DEBUG +- { +- MD5_CTX* c = MD5_CTXP context; +- PRINT ("Upd2 ABCD = %d %d %d %d\n", c->A, c->B, c->C, c->D); FL; +- } +-#endif +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDmd5_Final -- ++ * MDmd5_OTP_Final -- + * + * ------------------------------------------------* +@@ -237,17 +129,12 @@ + + static void +-MDmd5_Final (context, digest) +-VOID* context; ++MDmd5_OTP_Final (digest, context) + VOID* digest; ++VOID* context; + { +-#ifndef OTP +- /* MD5Final ((unsigned char*) digest, (MD5_CTX*) context); */ +- md5f.final ((unsigned char*) digest, MD5_CTXP context); +-#else + int i; + unsigned char result[16]; + +- /* MD5Final ((unsigned char*) result, (MD5_CTX*) context);*/ +- md5f.final ((unsigned char*) result, MD5_CTXP context); ++ MD5_Final (result, (MD5_CTX*) context); + + for (i = 0; i < 8; i++) +@@ -255,5 +142,4 @@ + + memcpy ((VOID *) digest, (VOID *) result, DIGEST_SIZE); +-#endif + + #ifdef TRF_DEBUG +@@ -264,56 +150,3 @@ + #endif + } +- +-/* +- *------------------------------------------------------* +- * +- * MDmd5_Check -- +- * +- * ------------------------------------------------* +- * Do global one-time initializations of the message +- * digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * Loads the shared library containing the +- * SHA1 functionality +- * +- * Result: +- * A standard Tcl error code. +- * +- *------------------------------------------------------* +- */ +- +-static int +-MDmd5_Check (interp) +-Tcl_Interp* interp; +-{ +- return TrfLoadMD5 (interp); +-#ifdef MD5_STATIC_BUILD +- /*return TCL_OK;*/ +-#else +-#endif +-} +- +-#if 0 +-/* Import the MD5 code in case of static linkage. +- */ +-#ifdef MD5_STATIC_BUILD +-/* +- * External code from here on. +- */ +- +-#ifndef OTP +-#include "../md5-crypt/md5.c" /* THREADING: import of one constant var, read-only => safe */ +-#endif +- +-md5Functions md5f = { +- 0, +- md5_init_ctx, +- md5_process_bytes, +- md5_finish_ctx, +- 0, /* no crypt code! */ +-}; +- +-#endif + #endif diff --git a/devel/tcl-trf/files/patch-rmd128 b/devel/tcl-trf/files/patch-rmd128 new file mode 100644 index 000000000000..6893203d6fd8 --- /dev/null +++ b/devel/tcl-trf/files/patch-rmd128 @@ -0,0 +1,23 @@ +--- generic/rmd128.c 2009-07-12 21:34:41.000000000 -0400 ++++ generic/rmd128.c 2009-07-12 23:39:04.000000000 -0400 +@@ -59,5 +59,5 @@ + static void MDrmd128_Start _ANSI_ARGS_ ((VOID* context)); + static void MDrmd128_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDrmd128_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); ++static void MDrmd128_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, size_t bufLen)); + static void MDrmd128_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); + static void CountLength _ANSI_ARGS_ ((ripemd_context* ctx, +@@ -200,5 +200,5 @@ + VOID* context; + unsigned char* buffer; +-int bufLen; ++size_t bufLen; + { + ripemd_context* ctx = (ripemd_context*) context; +@@ -277,5 +277,5 @@ + + static void +-MDrmd128_Final (context, digest) ++MDrmd128_Final (digest, context) + VOID* context; + VOID* digest; diff --git a/devel/tcl-trf/files/patch-rmd160 b/devel/tcl-trf/files/patch-rmd160 new file mode 100644 index 000000000000..d29a996f819e --- /dev/null +++ b/devel/tcl-trf/files/patch-rmd160 @@ -0,0 +1,284 @@ +--- generic/rmd160.c 2009-06-18 00:54:44.000000000 -0400 ++++ generic/rmd160.c 2009-07-13 00:25:20.000000000 -0400 +@@ -29,5 +29,5 @@ + + #include "transformInt.h" +-#include "ripemd/rmd160.h" ++#include <openssl/ripemd.h> + + /* +@@ -40,27 +40,4 @@ + + #define DIGEST_SIZE (20) +-/*#define CTX_TYPE */ +-#define CONTEXT_SIZE (20) +-#define CHUNK_SIZE (64) +- +-typedef struct ripemd_context { +- dword state [5]; /* state variables of ripemd-160 */ +- byte buf [CHUNK_SIZE]; /* buffer of 16-dword's */ +- byte byteCount; /* number of bytes in buffer */ +- dword lowc; /* lower half of a 64bit counter */ +- dword highc; /* upper half of a 64bit counter */ +-} ripemd_context; +- +- +-/* +- * Declarations of internal procedures. +- */ +- +-static void MDrmd160_Start _ANSI_ARGS_ ((VOID* context)); +-static void MDrmd160_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDrmd160_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); +-static void MDrmd160_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); +-static void CountLength _ANSI_ARGS_ ((ripemd_context* ctx, +- unsigned int nbytes)); + + /* +@@ -70,10 +47,10 @@ + static Trf_MessageDigestDescription mdDescription = { /* THREADING: constant, read-only => safe */ + "ripemd160", +- sizeof (ripemd_context), ++ sizeof (RIPEMD160_CTX), + DIGEST_SIZE, +- MDrmd160_Start, +- MDrmd160_Update, +- MDrmd160_UpdateBuf, +- MDrmd160_Final, ++ (Trf_MDStart *)RIPEMD160_Init, ++ NULL, ++ (Trf_MDUpdateBuf *)RIPEMD160_Update, ++ (Trf_MDFinal *)RIPEMD160_Final, + NULL + }; +@@ -103,230 +80,2 @@ + return Trf_RegisterMessageDigest (interp, &mdDescription); + } +- +-/* +- *------------------------------------------------------* +- * +- * MDrmd160_Start -- +- * +- * ------------------------------------------------* +- * Initialize the internal state of the message +- * digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDrmd160_Start (context) +-VOID* context; +-{ +- ripemd_context* ctx = (ripemd_context*) context; +- +- ripemd160_MDinit (ctx->state); +- memset (ctx->buf, '\0', CHUNK_SIZE); +- +- ctx->byteCount = 0; +- ctx->lowc = 0; +- ctx->highc = 0; +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDrmd160_Update -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a single character. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDrmd160_Update (context, character) +-VOID* context; +-unsigned int character; +-{ +- ripemd_context* ctx = (ripemd_context*) context; +- +- ctx->buf [ctx->byteCount] = character; +- ctx->byteCount ++; +- +- if (ctx->byteCount == CHUNK_SIZE) { +- CountLength (ctx, CHUNK_SIZE); +- +-#ifdef WORDS_BIGENDIAN +- Trf_FlipRegisterLong (ctx->buf, CHUNK_SIZE); +-#endif +- ripemd160_compress (ctx->state, (dword*) ctx->buf); +- ctx->byteCount = 0; +- } +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDrmd160_UpdateBuf -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a character buffer. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDrmd160_UpdateBuf (context, buffer, bufLen) +-VOID* context; +-unsigned char* buffer; +-int bufLen; +-{ +- ripemd_context* ctx = (ripemd_context*) context; +- +- if ((ctx->byteCount + bufLen) < CHUNK_SIZE) { +- /* +- * Not enough for full chunk. Remember incoming +- * data and wait for another call containing more data. +- */ +- +- memcpy ((VOID*) (ctx->buf + ctx->byteCount), (VOID*) buffer, bufLen); +- ctx->byteCount += bufLen; +- } else { +- /* +- * Complete chunk with incoming data, update digest, +- * then use all chunks contained in the buffer. Remember +- * an incomplete chunk and wait for further calls. +- */ +- +- int k = CHUNK_SIZE - ctx->byteCount; +- +- if (k < CHUNK_SIZE) { +- memcpy ((VOID*) (ctx->buf + ctx->byteCount), (VOID*) buffer, k); +- +- CountLength (ctx, CHUNK_SIZE); +- +-#ifdef WORDS_BIGENDIAN +- Trf_FlipRegisterLong (ctx->buf, CHUNK_SIZE); +-#endif +- ripemd160_compress (ctx->state, (dword*) ctx->buf); +- +- buffer += k; +- bufLen -= k; +- } /* k == CHUNK_SIZE => internal buffer was empty, so skip it entirely */ +- +- while (bufLen >= CHUNK_SIZE) { +- CountLength (ctx, CHUNK_SIZE); +- +-#ifdef WORDS_BIGENDIAN +- Trf_FlipRegisterLong (buffer, CHUNK_SIZE); +-#endif +- ripemd160_compress (ctx->state, (dword*) buffer); +-#ifdef WORDS_BIGENDIAN +- Trf_FlipRegisterLong (buffer, CHUNK_SIZE); +-#endif +- +- buffer += CHUNK_SIZE; +- bufLen -= CHUNK_SIZE; +- } +- +- ctx->byteCount = bufLen; +- if (bufLen > 0) { +- memcpy ((VOID*) ctx->buf, (VOID*) buffer, bufLen); +- } +- } +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDrmd160_Final -- +- * +- * ------------------------------------------------* +- * Generate the digest from the internal state of +- * the message digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDrmd160_Final (context, digest) +-VOID* context; +-VOID* digest; +-{ +- ripemd_context* ctx = (ripemd_context*) context; +- +- CountLength (ctx, ctx->byteCount); +- +- ripemd160_MDfinish (ctx->state, ctx->buf, ctx->lowc, ctx->highc); +- +- memcpy (digest, ctx->state, DIGEST_SIZE); +-#ifdef WORDS_BIGENDIAN +- Trf_FlipRegisterLong (digest, DIGEST_SIZE); +-#endif +-} +- +-/* +- *------------------------------------------------------* +- * +- * CountLength -- +- * +- * ------------------------------------------------* +- * Update the 64bit counter in the context structure +- * ------------------------------------------------* +- * +- * Sideeffects: +- * See above. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-CountLength (ctx, nbytes) +- ripemd_context* ctx; +- unsigned int nbytes; +-{ +- /* update length counter */ +- +- if ((ctx->lowc + nbytes) < ctx->lowc) { +- /* overflow to msb of length */ +- ctx->highc ++; +- } +- +- ctx->lowc += nbytes; +-} +- +-/* +- * External code from here on. +- */ +- +-#include "ripemd/rmd160.c" diff --git a/devel/tcl-trf/files/patch-sha b/devel/tcl-trf/files/patch-sha new file mode 100644 index 000000000000..ecf491b8df47 --- /dev/null +++ b/devel/tcl-trf/files/patch-sha @@ -0,0 +1,244 @@ +--- generic/sha.c 2009-07-12 21:34:41.000000000 -0400 ++++ generic/sha.c 2009-07-12 23:11:26.000000000 -0400 +@@ -29,12 +29,5 @@ + + #include "transformInt.h" +-#include "sha/sha.h" +- +-#ifdef WORDS_BIGENDIAN +-#undef LITTLE_ENDIAN +-#else +-#undef LITTLE_ENDIAN +-#define LITTLE_ENDIAN +-#endif ++#include <openssl/sha.h> + + /* +@@ -46,30 +39,8 @@ + */ + +-#define DIGEST_SIZE (SHA_DIGESTSIZE) +-#define CTX_TYPE sha_trf_info ++#define DIGEST_SIZE (20) ++#define CTX_TYPE SHA_CTX + #define CHUNK_SIZE 256 + +-/* We cannot use SHA_INFO directly as context cause 'sha_update' handles +- * a chunk smaller then CHUNK_SIZE bytes correct if and only if it is +- * the last chunk. This forces us to buffer the incoming bytes till a chunk +- * is complete before doing an update. +- */ +- +-typedef struct _sha_trf_info { +- SHA_INFO s; +- unsigned short count; +- unsigned char buf [CHUNK_SIZE]; /* SHA block */ +-} sha_trf_info; +- +- +-/* +- * Declarations of internal procedures. +- */ +- +-static void MDsha_Start _ANSI_ARGS_ ((VOID* context)); +-static void MDsha_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDsha_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); +-static void MDsha_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); +- + /* + * Generator definition. +@@ -80,8 +51,8 @@ + sizeof (CTX_TYPE), + DIGEST_SIZE, +- MDsha_Start, +- MDsha_Update, +- MDsha_UpdateBuf, +- MDsha_Final, ++ (Trf_MDStart *)SHA_Init, ++ NULL, ++ (Trf_MDUpdateBuf *)SHA_Update, ++ (Trf_MDFinal *)SHA_Final, + NULL + }; +@@ -111,181 +82,2 @@ + return Trf_RegisterMessageDigest (interp, &mdDescription); + } +- +-/* +- *------------------------------------------------------* +- * +- * MDsha_Start -- +- * +- * ------------------------------------------------* +- * Initialize the internal state of the message +- * digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDsha_Start (context) +-VOID* context; +-{ +- sha_trf_info* s = (sha_trf_info*) context; +- +- memset (s, '\0', sizeof (sha_trf_info)); +- sha_init (&s->s); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDsha_Update -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a single character. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDsha_Update (context, character) +-VOID* context; +-unsigned int character; +-{ +- sha_trf_info* s = (sha_trf_info*) context; +- +- s->buf [s->count] = character; +- s->count ++; +- +- if (s->count == CHUNK_SIZE) { +- sha_update (&s->s, s->buf, s->count); +- s->count = 0; +- } +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDsha_UpdateBuf -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a character buffer. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDsha_UpdateBuf (context, buffer, bufLen) +-VOID* context; +-unsigned char* buffer; +-int bufLen; +-{ +- sha_trf_info* s = (sha_trf_info*) context; +- +- if ((s->count + bufLen) < CHUNK_SIZE) { +- /* +- * Not enough for full chunk. Remember incoming +- * data and wait for another call containing more data. +- */ +- +- memcpy ((VOID*) (s->buf + s->count), (VOID*) buffer, bufLen); +- s->count += bufLen; +- } else { +- /* +- * Complete chunk with incoming data, update digest, +- * then use all chunks contained in the buffer. Remember +- * an incomplete chunk and wait for further calls. +- */ +- +- int k = CHUNK_SIZE - s->count; +- +- if (k < CHUNK_SIZE) { +- memcpy ((VOID*) (s->buf + s->count), (VOID*) buffer, k); +- +- sha_update (&s->s, s->buf, CHUNK_SIZE); +- +- buffer += k; +- bufLen -= k; +- } /* k == CHUNK_SIZE => internal buffer was empty, so skip it entirely */ +- +- while (bufLen > CHUNK_SIZE) { +- sha_update (&s->s, buffer, CHUNK_SIZE); +- +- buffer += CHUNK_SIZE; +- bufLen -= CHUNK_SIZE; +- } +- +- s->count = bufLen; +- if (bufLen > 0) +- memcpy ((VOID*) s->buf, (VOID*) buffer, bufLen); +- } +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDsha_Final -- +- * +- * ------------------------------------------------* +- * Generate the digest from the internal state of +- * the message digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDsha_Final (context, digest) +-VOID* context; +-VOID* digest; +-{ +- sha_trf_info* s = (sha_trf_info*) context; +- +- if (s->count > 0) { +- sha_update (&s->s, s->buf, s->count); +- } +- +- sha_final (&s->s); +- +-#ifndef WORDS_BIGENDIAN +- Trf_FlipRegisterLong (s->s.digest, SHA_DIGESTSIZE); +-#endif +- +- memcpy (digest, s->s.digest, SHA_DIGESTSIZE); +-} +- +-/* +- * External code from here on. +- * +- * To make smaller object code, but run a little slower, don't use UNROLL_LOOPS. +- * To use NIST's modified SHA of 7/11/94, define USE_MODIFIED_SHA +- */ +- +-#define UNROLL_LOOPS +-#include "sha/sha.c" diff --git a/devel/tcl-trf/files/patch-sha1 b/devel/tcl-trf/files/patch-sha1 new file mode 100644 index 000000000000..1bead8e8a8ba --- /dev/null +++ b/devel/tcl-trf/files/patch-sha1 @@ -0,0 +1,193 @@ +--- generic/sha1.c 2009-06-18 00:54:44.000000000 -0400 ++++ generic/sha1.c 2009-07-12 23:39:47.000000000 -0400 +@@ -28,5 +28,6 @@ + */ + +-#include "loadman.h" ++#include "transformInt.h" ++#include <openssl/sha.h> + + /* +@@ -39,5 +40,5 @@ + + #ifndef OTP +-#define DIGEST_SIZE (SHA_DIGEST_LENGTH) ++#define DIGEST_SIZE (20) + #else + #define DIGEST_SIZE (8) +@@ -49,9 +50,7 @@ + */ + +-static void MDsha1_Start _ANSI_ARGS_ ((VOID* context)); +-static void MDsha1_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDsha1_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); +-static void MDsha1_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); +-static int MDsha1_Check _ANSI_ARGS_ ((Tcl_Interp* interp)); ++#ifdef OTP ++static void MDsha1_OTP_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); ++#endif + + /* +@@ -67,9 +66,13 @@ + sizeof (CTX_TYPE), + DIGEST_SIZE, +- MDsha1_Start, +- MDsha1_Update, +- MDsha1_UpdateBuf, +- MDsha1_Final, +- MDsha1_Check ++ (Trf_MDStart *)SHA1_Init, ++ NULL, ++ (Trf_MDUpdateBuf *)SHA1_Update, ++#ifdef OTP ++ MDsha1_OTP_Final, ++#else ++ (Trf_MDFinal *)SHA1_Final, ++#endif ++ NULL, + }; + +@@ -103,91 +106,9 @@ + } + ++#ifdef OTP + /* + *------------------------------------------------------* + * +- * MDsha1_Start -- +- * +- * ------------------------------------------------* +- * Initialize the internal state of the message +- * digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDsha1_Start (context) +-VOID* context; +-{ +- sha1f.init ((SHA_CTX*) context); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDsha1_Update -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a single character. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDsha1_Update (context, character) +-VOID* context; +-unsigned int character; +-{ +- unsigned char buf = character; +- +- sha1f.update ((SHA_CTX*) context, &buf, 1); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDsha1_UpdateBuf -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a character buffer. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDsha1_UpdateBuf (context, buffer, bufLen) +-VOID* context; +-unsigned char* buffer; +-int bufLen; +-{ +- sha1f.update ((SHA_CTX*) context, (unsigned char*) buffer, bufLen); +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDsha1_Final -- ++ * MDsha1_OTP_Final -- + * + * ------------------------------------------------* +@@ -206,14 +127,11 @@ + + static void +-MDsha1_Final (context, digest) ++MDsha1_OTP_Final (digest, context) + VOID* context; + VOID* digest; + { +-#ifndef OTP +- sha1f.final ((unsigned char*) digest, (SHA_CTX*) context); +-#else + unsigned int result[SHA_DIGEST_LENGTH / sizeof (char)]; + +- sha1f.final ((unsigned char*) result, (SHA_CTX*) context); ++ SHA1_Final ((unsigned char*) result, (SHA_CTX*) context); + + result[0] ^= result[2]; +@@ -223,31 +141,4 @@ + Trf_FlipRegisterLong ((VOID*) result, DIGEST_SIZE); + memcpy ((VOID *) digest, (VOID *) result, DIGEST_SIZE); +-#endif +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDsha1_Check -- +- * +- * ------------------------------------------------* +- * Do global one-time initializations of the message +- * digest generator. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * Loads the shared library containing the +- * SHA1 functionality +- * +- * Result: +- * A standard Tcl error code. +- * +- *------------------------------------------------------* +- */ +- +-static int +-MDsha1_Check (interp) +-Tcl_Interp* interp; +-{ +- return TrfLoadSHA1 (interp); + } ++#endif diff --git a/devel/tcl-trf/files/patch-transform b/devel/tcl-trf/files/patch-transform new file mode 100644 index 000000000000..c14d7d07515e --- /dev/null +++ b/devel/tcl-trf/files/patch-transform @@ -0,0 +1,30 @@ +--- generic/transform.h 2009-06-18 00:55:33.000000000 -0400 ++++ generic/transform.h 2009-07-12 22:14:08.000000000 -0400 +@@ -739,9 +739,9 @@ + typedef void Trf_MDUpdateBuf (VOID* context /* state to update */, + unsigned char* buf /* buffer to hash into the state */, +- int bufLen /* number of characters in the buffer */); ++ size_t bufLen /* number of characters in the buffer */); + #else + typedef void Trf_MDUpdateBuf _ANSI_ARGS_ ((VOID* context, + unsigned char* buffer, +- int bufLen)); ++ size_t bufLen)); + #endif + +@@ -754,6 +754,6 @@ + + #ifdef __C2MAN__ +-typedef void Trf_MDFinal (VOID* context /* state to finalize */, +- VOID* digest /* result area to fill */); ++typedef void Trf_MDFinal (VOID* digest /* result area to fill */, ++ VOID* context /* state to finalize */); + #else + typedef void Trf_MDFinal _ANSI_ARGS_ ((VOID* context, VOID* digest)); +@@ -916,5 +916,5 @@ + #define TCL_STORAGE_CLASS + +-EXTERN char *Trf_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, CONST char *version, int exact)); ++EXTERN CONST char *Trf_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, CONST char *version, int exact)); + + #ifndef USE_TRF_STUBS diff --git a/devel/tcl-trf/files/patch-warnings b/devel/tcl-trf/files/patch-warnings new file mode 100644 index 000000000000..327e633999e3 --- /dev/null +++ b/devel/tcl-trf/files/patch-warnings @@ -0,0 +1,29 @@ +--- generic/transformInt.h Tue Aug 21 01:51:33 2001 ++++ generic/transformInt.h Tue Apr 6 12:27:33 2004 +@@ -678,4 +678,8 @@ + #define TCL_STORAGE_CLASS DLLIMPORT + ++#ifndef CONST84 ++# define CONST84 ++#endif ++ + #ifdef __cplusplus + } +--- generic/trfStubLib.c Mon Sep 20 17:07:24 1999 ++++ generic/trfStubLib.c Tue Apr 6 13:13:38 2004 +@@ -61,5 +61,5 @@ + #endif + +-char * ++CONST char * + Trf_InitStubs(interp, version, exact) + Tcl_Interp *interp; +--- generic/registry.c 2009-06-18 00:54:44.000000000 -0400 ++++ generic/registry.c 2009-07-12 21:05:24.000000000 -0400 +@@ -1405,5 +1405,5 @@ + * [Bug 2788106]. + */ +- ckfree(trans); ++ ckfree((void *)trans); + + DONE (TrfClose); diff --git a/devel/tcl-trf/files/patch-zlib b/devel/tcl-trf/files/patch-zlib new file mode 100644 index 000000000000..683f10d3ead4 --- /dev/null +++ b/devel/tcl-trf/files/patch-zlib @@ -0,0 +1,300 @@ +--- generic/adler.c 2009-06-18 00:54:43.000000000 -0400 ++++ generic/adler.c 2009-07-12 23:55:20.000000000 -0400 +@@ -29,4 +29,5 @@ + + #include "transformInt.h" ++#include <zlib.h> + + /* +@@ -47,7 +48,6 @@ + static void MDAdler_Start _ANSI_ARGS_ ((VOID* context)); + static void MDAdler_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDAdler_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); +-static void MDAdler_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); +-static int MDAdler_Check _ANSI_ARGS_ ((Tcl_Interp* interp)); ++static void MDAdler_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, size_t bufLen)); ++static void MDAdler_Final _ANSI_ARGS_ ((VOID* digest, VOID* context)); + + /* +@@ -63,5 +63,5 @@ + MDAdler_UpdateBuf, + MDAdler_Final, +- MDAdler_Check ++ NULL + }; + +@@ -121,5 +121,5 @@ + /* call md specific initialization here */ + +- ADLER = zf.zadler32 (0L, Z_NULL, 0); ++ ADLER = adler32 (0L, Z_NULL, 0); + + DONE (MDAdler_Start); +@@ -154,5 +154,5 @@ + unsigned char buf = character; + +- ADLER = zf.zadler32 (ADLER, &buf, 1); ++ ADLER = adler32 (ADLER, &buf, 1); + } + +@@ -180,9 +180,9 @@ + VOID* context; + unsigned char* buffer; +-int bufLen; ++size_t bufLen; + { + /* call md specific update here */ + +- ADLER = zf.zadler32 (ADLER, buffer, bufLen); ++ ADLER = adler32 (ADLER, buffer, bufLen); + } + +@@ -207,5 +207,5 @@ + + static void +-MDAdler_Final (context, digest) ++MDAdler_Final (digest, context) + VOID* context; + VOID* digest; +@@ -222,36 +222,2 @@ + out [3] = (char) ((adler >> 0) & 0xff); + } +- +-/* +- *------------------------------------------------------* +- * +- * MDAdler_Check -- +- * +- * ------------------------------------------------* +- * Check for existence of libz, load it. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static int +-MDAdler_Check (interp) +-Tcl_Interp* interp; +-{ +- int res; +- +- START (MDAdler_Check); +- +- res = TrfLoadZlib (interp); +- +- PRINT ("res = %d\n", res); +- DONE (MDAdler_Check); +- return res; +-} +- +--- generic/crc_zlib.c 2009-06-18 00:54:43.000000000 -0400 ++++ generic/crc_zlib.c 2009-07-12 23:51:04.000000000 -0400 +@@ -29,4 +29,5 @@ + + #include "transformInt.h" ++#include <zlib.h> + + /* +@@ -47,7 +48,6 @@ + static void MDcrcz_Start _ANSI_ARGS_ ((VOID* context)); + static void MDcrcz_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-static void MDcrcz_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen)); +-static void MDcrcz_Final _ANSI_ARGS_ ((VOID* context, VOID* digest)); +-static int MDcrcz_Check _ANSI_ARGS_ ((Tcl_Interp* interp)); ++static void MDcrcz_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, size_t bufLen)); ++static void MDcrcz_Final _ANSI_ARGS_ ((VOID* digest, VOID* context)); + + /* +@@ -63,5 +63,5 @@ + MDcrcz_UpdateBuf, + MDcrcz_Final, +- MDcrcz_Check ++ NULL + }; + +@@ -118,5 +118,5 @@ + /* call md specific initialization here */ + +- CRC = zf.zcrc32 (0L, Z_NULL, 0); ++ CRC = crc32(0L, Z_NULL, 0); + } + +@@ -149,5 +149,5 @@ + unsigned char buf = character; + +- CRC = zf.zcrc32 (CRC, &buf, 1); ++ CRC = crc32(CRC, &buf, 1); + } + +@@ -175,9 +175,9 @@ + VOID* context; + unsigned char* buffer; +-int bufLen; ++size_t bufLen; + { + /* call md specific update here */ + +- CRC = zf.zcrc32 (CRC, buffer, bufLen); ++ CRC = crc32(CRC, buffer, bufLen); + } + +@@ -202,5 +202,5 @@ + + static void +-MDcrcz_Final (context, digest) ++MDcrcz_Final (digest, context) + VOID* context; + VOID* digest; +@@ -217,28 +217,2 @@ + out [0] = (char) ((crc >> 0) & 0xff); + } +- +-/* +- *------------------------------------------------------* +- * +- * MDcrcz_Check -- +- * +- * ------------------------------------------------* +- * Check for existence of libz, load it. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static int +-MDcrcz_Check (interp) +-Tcl_Interp* interp; +-{ +- return TrfLoadZlib (interp); +-} +- +--- generic/zip_opt.c Sat Nov 18 17:42:32 2000 ++++ generic/zip_opt.c Fri Feb 15 15:13:22 2002 +@@ -183,13 +183,4 @@ + + /* +- * 'zip' is used, therefore load the required library. +- * And bail out if it is not available. +- */ +- +- if (TCL_OK != TrfLoadZlib (interp)) { +- return TCL_ERROR; +- } +- +- /* + * Now perform the real option check. + */ +--- generic/zip.c 2008-12-23 15:33:06.000000000 -0500 ++++ generic/zip.c 2008-12-23 15:39:08.000000000 -0500 +@@ -28,4 +28,5 @@ + */ + ++#include <zlib.h> + #include "transformInt.h" + +@@ -250,9 +251,9 @@ + + #if 0 +- res = zf.zdeflateInit_ (&c->state, o->level, ++ res = deflateInit_ (&c->state, o->level, + ZLIB_VERSION, sizeof(z_stream)); + #endif + +- res = zf.zdeflateInit2_ (&c->state, o->level, Z_DEFLATED, ++ res = deflateInit2_ (&c->state, o->level, Z_DEFLATED, + o->nowrap ? + -MAX_WBITS : +@@ -308,5 +309,5 @@ + PRINT ("deflateEnd ()\n"); FL; + +- zf.zdeflateEnd (&c->state); ++ deflateEnd (&c->state); + + Tcl_Free ((char*) c->output_buffer); +@@ -366,5 +367,5 @@ + + PRINT ("deflate (Z_NO_FLUSH)\n"); FL; +- res = zf.zdeflate (&c->state, Z_NO_FLUSH); ++ res = deflate (&c->state, Z_NO_FLUSH); + + IN; PRINTLN (ZlibErrorMsg (&c->state, res)); FL; OT; +@@ -451,5 +452,5 @@ + + PRINT ("deflate (Z_NO_FLUSH)\n"); FL; +- res = zf.zdeflate (&c->state, Z_NO_FLUSH); ++ res = deflate (&c->state, Z_NO_FLUSH); + + IN; PRINTLN (ZlibErrorMsg (&c->state, res)); FL; OT; +@@ -526,5 +527,5 @@ + + PRINT ("deflate (Z_FINISH)\n"); FL; +- res = zf.zdeflate (&c->state, Z_FINISH); ++ res = deflate (&c->state, Z_FINISH); + + IN; PRINTLN (ZlibErrorMsg (&c->state, res)); FL; OT; +@@ -587,5 +588,5 @@ + /* execute conversion specific code here (ZIP) */ + +- zf.zdeflateReset (&c->state); ++ deflateReset (&c->state); + + DONE (ZipClearEncoder); +@@ -648,9 +649,9 @@ + + #if 0 +- res = zf.zinflateInit_ (&c->state, ++ res = inflateInit_ (&c->state, + ZLIB_VERSION, sizeof (z_stream)); + #endif + +- res = zf.zinflateInit2_ (&c->state, ++ res = inflateInit2_ (&c->state, + o->nowrap ? + -MAX_WBITS : +@@ -705,5 +706,5 @@ + PRINT ("inflateEnd ()\n"); FL; + +- zf.zinflateEnd (&c->state); ++ inflateEnd (&c->state); + + Tcl_Free ((char*) c->output_buffer); +@@ -769,5 +770,5 @@ + + PRINT ("inflate (Z_NO_FLUSH)\n"); FL; +- res = zf.zinflate (&c->state, Z_NO_FLUSH); ++ res = inflate (&c->state, Z_NO_FLUSH); + + IN; PRINTLN (ZlibErrorMsg (&c->state, res)); FL; OT; +@@ -875,5 +876,5 @@ + + PRINT ("inflate (Z_NO_FLUSH)\n"); FL; +- res = zf.zinflate (&c->state, Z_NO_FLUSH); ++ res = inflate (&c->state, Z_NO_FLUSH); + + IN; PRINTLN (ZlibErrorMsg (&c->state, res)); FL; OT; +@@ -976,5 +977,5 @@ + + PRINT ("inflate (Z_FINISH)\n"); FL; +- res = zf.zinflate (&c->state, Z_FINISH); ++ res = inflate (&c->state, Z_FINISH); + + IN; PRINTLN (ZlibErrorMsg (&c->state, res)); +@@ -1038,5 +1039,5 @@ + /* execute conversion specific code here (ZIP) */ + +- zf.zinflateReset (&c->state); ++ inflateReset (&c->state); + + DONE (ZipClearDecoder); diff --git a/devel/tcl-trf/pkg-descr b/devel/tcl-trf/pkg-descr new file mode 100644 index 000000000000..206ba55ae371 --- /dev/null +++ b/devel/tcl-trf/pkg-descr @@ -0,0 +1,12 @@ +This is a loadable extension to Tcl providing commands for data +conversion, message digests, zlib based compression, error-correction, +channel-based manipulation of binary data. Trf extends the language at +the C-level with so-called ``transformer''-procedures. With the help of +some patches (*) to the core the package is able to intercept all +read/write operations on designated channels, thus giving it the ability +to transform the buffer contents as desired. This allows things like +transparent encryption, compression, charset recoding, etc. Build upon +this framework (and as proof of concept) a collection of tcl-level +commands was implemented. + +WWW: http://www.oche.de/~akupries/soft/trf/ |