freebsd-ports/devel/tcl-trf/files/patch-md5dig
Mikhail Teterin daa8cb06f0 From the software's self-description:
Trf is a TCL extension library. It extends the language
	at the C-level with so-called ``transformer''-procedures.
	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,
	most of them related to cryptography.

WWW: http://www.oche.de/~akupries/soft/trf/
2002-02-15 07:34:07 +00:00

193 lines
4 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--- generic/md5dig.c Wed Aug 9 15:13:17 2000
+++ generic/md5dig.c Fri Feb 15 00:41:42 2002
@@ -29,5 +29,5 @@
#include "loadman.h"
-
+#include <md5.h>
/*
* Generator description
@@ -38,7 +38,4 @@
*/
-#define MD5_CTX struct md5_ctx
-#define MD5_CTXP (struct md5_ctx*)
-
#ifndef OTP
#define DIGEST_SIZE (16)
@@ -72,9 +69,9 @@
sizeof (CTX_TYPE),
DIGEST_SIZE,
- MDmd5_Start,
+ MD5Init,
MDmd5_Update,
- MDmd5_UpdateBuf,
+ MD5Update,
MDmd5_Final,
- MDmd5_Check
+ NULL,
};
@@ -111,38 +108,4 @@
*------------------------------------------------------*
*
- * 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 --
*
@@ -168,52 +131,5 @@
unsigned char buf = character;
- /* MD5Update ((MD5_CTX*) context, &buf, 1); */
-
- md5f.update (&buf, 1, MD5_CTXP context);
-}
-
-/*
- *------------------------------------------------------*
- *
- * 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 ((unsigned char*) buffer, bufLen, MD5_CTXP context);
-
-#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
+ MD5Update ((MD5_CTX*) context, &buf, 1);
}
@@ -243,6 +159,5 @@
{
#ifndef OTP
- /* MD5Final ((unsigned char*) digest, (MD5_CTX*) context); */
- md5f.final (MD5_CTXP context, (unsigned char*) digest);
+ MD5Final ((unsigned char*) digest, (MD5_CTX*) context);
#else
int i;
@@ -250,5 +165,5 @@
/* MD5Final ((unsigned char*) result, (MD5_CTX*) context);*/
- md5f.final (MD5_CTXP context, (unsigned char*) result);
+ MD5Final ((unsigned char*) result, (MD5_CTX*) context);
for (i = 0; i < 8; i++)
@@ -265,54 +180,2 @@
#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;
-{
-#ifdef MD5_STATIC_BUILD
- return TCL_OK;
-#else
- return TrfLoadMD5 (interp);
-#endif
-}
-
-/* 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