Index: branches/2018Q4/devel/tcl-trf/Makefile =================================================================== --- branches/2018Q4/devel/tcl-trf/Makefile (revision 483698) +++ branches/2018Q4/devel/tcl-trf/Makefile (revision 483699) @@ -1,86 +1,50 @@ # Created by: Mikhail Teterin # $FreeBSD$ PORTNAME= Trf PORTVERSION= 2.1.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel tcl MASTER_SITES= SF/tcltrf/tcltrf/${PORTVERSION} PKGNAMEPREFIX= tcl- DISTNAME= trf${PORTVERSION} MAINTAINER= mi@aldan.algebra.com COMMENT= Data conversion, digests, compression, error-correction for Tcl LICENSE= Tcl_Trf_License LICENSE_NAME= Tcl Trf License LICENSE_FILE= ${WRKSRC}/doc/license.terms LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept -BROKEN_SSL= openssl-devel -BROKEN_SSL_REASON_openssl-devel= use of undeclared identifier 'SHA_Init' - +TEST_DEPENDS= ${LOCALBASE}/lib/Memchan2.3/libMemchan.so.1:devel/tcl-memchan ALL_TARGET= all USES+= tcl:tea tar:bzip2 USE_LDCONFIG= ${PREFIX}/lib/Trf DDIR= ${PREFIX}/lib/tcl${TCL_VER}/Trf CFLAGS+= -Wall -Werror MAKE_ENV+= INSTALL_DATA="${INSTALL_DATA}" -TEST_TARGET= do-test - REINPLACE_ARGS= -i "" CONFIGURE_ARGS+=--enable-static-zlib --enable-static-bzlib \ --enable-static-md5 -.include -post-patch: -.if defined(TRF_USE_MD) - # - # Using FreeBSD's own -lmd instead of OpenSSL's -lcrypto - # - ${REINPLACE_CMD} -E -e 's,openssl/,,' \ - -e 's,(MD[5])_([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 - # -USES+= ssl -CONFIGURE_ARGS+= --with-ssl=${OPENSSLBASE} -CFLAGS+= -I${OPENSSLINC} -.endif - do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/lib/Trf ${INSTALL_DATA} ${WRKSRC}/libTrf${PORTVERSION}.so \ ${WRKSRC}/pkgIndex.tcl ${STAGEDIR}${PREFIX}/lib/Trf/ for m in ${WRKSRC}/doc/man/*.n ; \ do \ ${INSTALL_MAN} $$m ${STAGEDIR}${MANNPREFIX}/man/mann/ ;\ done ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/Trf/libTrf${PORTVERSION}.so do-test: - @if ! ${PKG_BIN} info --quiet tcl-memchan; then \ - ${PRINTF} "*****************\n%s\n*****************\n" \ - "devel/tcl-memchan must be installed for the tests to work"; \ - exit 1; \ - fi cd ${WRKSRC}/tests && ${SETENV} TCLLIBPATH="${WRKSRC}" ${TCLSH} all -.include PLIST_SUB+= TCL_DVER=${TCL_VER:C/\.//} VER=${PORTVERSION} -.if defined(OPENSSLBASE) && ${OPENSSLBASE} != "/usr" -MAKE_ENV+= SSLINC=-I${OPENSSLINC} SSLLIB=-L${OPENSSLLIB} -.endif - -.include +.include Index: branches/2018Q4/devel/tcl-trf/files/patch-Makefile =================================================================== --- branches/2018Q4/devel/tcl-trf/files/patch-Makefile (revision 483698) +++ branches/2018Q4/devel/tcl-trf/files/patch-Makefile (revision 483699) @@ -1,16 +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 ++LIBS = @PKG_LIBS@ @LIBS@ -lz -lbz2 -lcrypt -lmd AR = @AR@ CFLAGS = @CFLAGS@ Index: branches/2018Q4/devel/tcl-trf/files/patch-md5dig =================================================================== --- branches/2018Q4/devel/tcl-trf/files/patch-md5dig (revision 483698) +++ branches/2018Q4/devel/tcl-trf/files/patch-md5dig (revision 483699) @@ -1,257 +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 -+#include ++#include /* * 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)); ++static void MDmd5_OTP_Final _ANSI_ARGS_ ((VOID* digest, VOID* context)); +#endif /* @@ -71,9 +68,13 @@ sizeof (CTX_TYPE), DIGEST_SIZE, - MDmd5_Start, - MDmd5_Update, - MDmd5_UpdateBuf, - MDmd5_Final, - MDmd5_Check -+ (Trf_MDStart *)MD5_Init, ++ (Trf_MDStart *)MD5Init, + NULL, -+ (Trf_MDUpdateBuf *)MD5_Update, ++ (Trf_MDUpdateBuf *)MD5Update, +#ifdef OTP + MDmd5_OTP_Final, +#else -+ (Trf_MDFinal *)MD5_Final, ++ (Trf_MDFinal *)MD5Final, +#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); ++ MD5Final (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 Index: branches/2018Q4/devel/tcl-trf/files/patch-rmd160 =================================================================== --- branches/2018Q4/devel/tcl-trf/files/patch-rmd160 (revision 483698) +++ branches/2018Q4/devel/tcl-trf/files/patch-rmd160 (revision 483699) @@ -1,284 +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 ++#include /* @@ -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" Index: branches/2018Q4/devel/tcl-trf/files/patch-sha =================================================================== --- branches/2018Q4/devel/tcl-trf/files/patch-sha (revision 483698) +++ branches/2018Q4/devel/tcl-trf/files/patch-sha (revision 483699) @@ -1,255 +1,253 @@ ---- generic/sha.c.orig 2009-06-18 04:54:44 UTC +--- generic/sha.c 2009-06-18 04:54:44 UTC +++ generic/sha.c -@@ -27,15 +27,11 @@ +@@ -27,15 +27,9 @@ * CVS: $Id: sha.c,v 1.4 2007/10/05 23:12:21 andreas_kupries Exp $ */ -#include "transformInt.h" -#include "sha/sha.h" -+#include -+#ifndef OPENSSL_NO_SHA0 -#ifdef WORDS_BIGENDIAN -#undef LITTLE_ENDIAN -#else -#undef LITTLE_ENDIAN -#define LITTLE_ENDIAN -#endif +#include "transformInt.h" -+#include ++#include /* * Generator description @@ -45,32 +41,10 @@ * message digest. */ -#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. */ @@ -79,10 +53,10 @@ static Trf_MessageDigestDescription mdDe "sha", 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 }; -@@ -110,182 +84,5 @@ Tcl_Interp* interp; +@@ -110,182 +84,4 @@ Tcl_Interp* interp; { 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 +-#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" Index: branches/2018Q4/devel/tcl-trf/files/patch-sha1 =================================================================== --- branches/2018Q4/devel/tcl-trf/files/patch-sha1 (revision 483698) +++ branches/2018Q4/devel/tcl-trf/files/patch-sha1 (revision 483699) @@ -1,193 +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 ++#include /* @@ -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)); ++static void MDsha1_OTP_Final _ANSI_ARGS_ ((VOID* digest, VOID *context)); +#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 Index: branches/2018Q4/devel/tcl-trf/files/patch-zlib =================================================================== --- branches/2018Q4/devel/tcl-trf/files/patch-zlib (revision 483698) +++ branches/2018Q4/devel/tcl-trf/files/patch-zlib (revision 483699) @@ -1,300 +1,347 @@ --- 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 /* @@ -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 ++++ generic/crc_zlib.c 2018-10-21 00:42:01.795595000 -0400 @@ -29,4 +29,5 @@ #include "transformInt.h" +#include /* -@@ -47,7 +48,6 @@ +@@ -46,8 +47,5 @@ + static void MDcrcz_Start _ANSI_ARGS_ ((VOID* context)); - static void MDcrcz_Update _ANSI_ARGS_ ((VOID* context, unsigned int character)); +-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)); ++static void MDcrcz_Final _ANSI_ARGS_ ((VOID* digest, VOID *context)); /* -@@ -63,5 +63,5 @@ - MDcrcz_UpdateBuf, +@@ -60,8 +58,8 @@ + DIGEST_SIZE, + MDcrcz_Start, +- MDcrcz_Update, +- MDcrcz_UpdateBuf, ++ NULL, ++ (Trf_MDUpdateBuf *)crc32, MDcrcz_Final, - MDcrcz_Check + NULL }; -@@ -118,5 +118,5 @@ +@@ -118,66 +116,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; - +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDcrcz_Update -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a single character. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDcrcz_Update (context, character) +-VOID* context; +-unsigned int character; +-{ +- /* call md specific update here */ +- +- unsigned char buf = character; +- - CRC = zf.zcrc32 (CRC, &buf, 1); -+ CRC = crc32(CRC, &buf, 1); - } - -@@ -175,9 +175,9 @@ - VOID* context; - unsigned char* buffer; +-} +- +-/* +- *------------------------------------------------------* +- * +- * MDcrcz_UpdateBuf -- +- * +- * ------------------------------------------------* +- * Update the internal state of the message digest +- * generator for a character buffer. +- * ------------------------------------------------* +- * +- * Sideeffects: +- * As of the called procedure. +- * +- * Result: +- * None. +- * +- *------------------------------------------------------* +- */ +- +-static void +-MDcrcz_UpdateBuf (context, buffer, bufLen) +-VOID* context; +-unsigned char* buffer; -int bufLen; -+size_t bufLen; - { - /* call md specific update here */ - +-{ +- /* call md specific update here */ +- - CRC = zf.zcrc32 (CRC, buffer, bufLen); -+ CRC = crc32(CRC, buffer, bufLen); ++ CRC = crc32(0L, Z_NULL, 0); } -@@ -202,5 +202,5 @@ +@@ -202,5 +139,5 @@ static void -MDcrcz_Final (context, digest) +MDcrcz_Final (digest, context) VOID* context; VOID* digest; -@@ -217,28 +217,2 @@ +@@ -217,28 +154,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 #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); Index: branches/2018Q4/devel/tcl-trf/pkg-descr =================================================================== --- branches/2018Q4/devel/tcl-trf/pkg-descr (revision 483698) +++ branches/2018Q4/devel/tcl-trf/pkg-descr (revision 483699) @@ -1,12 +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/ +WWW: https://wiki.tcl-lang.org/479 Index: branches/2018Q4 =================================================================== --- branches/2018Q4 (revision 483698) +++ branches/2018Q4 (revision 483699) Property changes on: branches/2018Q4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r482639