freebsd-ports/devel/tcl-trf/files/patch-md2
Mikhail Teterin d0b2e40d6b Retreat to using OpenSSL's message digest routines instead of -lmd. They
are sometimes faster and never slower. Using -lmd is still possible by
building with ``TRF_USE_MD=yes''. Bump PORTREVISION.

Use the RIPEMD160* routines from -lcrypto (or -lmd) instead of our own
-- just like for md[25] and sha*. Neither -lcrypto nor -lmd provide
RIPEMD128 (not strong enough?), so stay with our own implementation.

sparc64/amd64 are not expected to work yet...
2004-07-11 08:38:31 +00:00

138 lines
3.1 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/md2.c Wed Aug 9 15:13:17 2000
+++ generic/md2.c Sat Jul 10 17:43:07 2004
@@ -28,4 +28,6 @@
*/
+#include <sys/types.h>
+#include <openssl/md2.h>
#include "loadman.h"
@@ -38,5 +40,5 @@
*/
-#define DIGEST_SIZE (MD2_DIGEST_LENGTH)
+#define DIGEST_SIZE (16)
#define CTX_TYPE MD2_CTX
@@ -45,9 +47,6 @@
*/
-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));
/*
@@ -59,9 +58,9 @@
sizeof (CTX_TYPE),
DIGEST_SIZE,
- MDmd2_Start,
+ (Trf_MDStart *)MD2_Init,
MDmd2_Update,
- MDmd2_UpdateBuf,
+ (Trf_MDUpdateBuf *)MD2_Update,
MDmd2_Final,
- MDmd2_Check
+ NULL
};
@@ -94,30 +93,4 @@
*------------------------------------------------------*
*
- * 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 --
*
@@ -143,33 +116,5 @@
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);
+ MD2_Update ((MD2_CTX*) context, &buf, 1);
}
@@ -198,31 +143,4 @@
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);
+ MD2_Final ((unsigned char*) digest, (MD2_CTX*) context);
}