d0b2e40d6b
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...
204 lines
4.5 KiB
Text
204 lines
4.5 KiB
Text
--- generic/md5dig.c Wed Aug 9 15:13:17 2000
|
||
+++ generic/md5dig.c Sat Jul 10 16:40:44 2004
|
||
@@ -30,4 +30,6 @@
|
||
#include "loadman.h"
|
||
|
||
+#include <sys/types.h>
|
||
+#include <openssl/md5.h>
|
||
/*
|
||
* Generator description
|
||
@@ -38,7 +39,4 @@
|
||
*/
|
||
|
||
-#define MD5_CTX struct md5_ctx
|
||
-#define MD5_CTXP (struct md5_ctx*)
|
||
-
|
||
#ifndef OTP
|
||
#define DIGEST_SIZE (16)
|
||
@@ -52,10 +50,6 @@
|
||
*/
|
||
|
||
-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));
|
||
|
||
/*
|
||
@@ -72,9 +66,9 @@
|
||
sizeof (CTX_TYPE),
|
||
DIGEST_SIZE,
|
||
- MDmd5_Start,
|
||
+ (Trf_MDStart *)MD5_Init,
|
||
MDmd5_Update,
|
||
- MDmd5_UpdateBuf,
|
||
+ (Trf_MDUpdateBuf *)MD5_Update,
|
||
MDmd5_Final,
|
||
- MDmd5_Check
|
||
+ NULL,
|
||
};
|
||
|
||
@@ -111,38 +105,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 +128,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
|
||
+ MD5_Update ((MD5_CTX*) context, &buf, 1);
|
||
}
|
||
|
||
@@ -243,6 +156,5 @@
|
||
{
|
||
#ifndef OTP
|
||
- /* MD5Final ((unsigned char*) digest, (MD5_CTX*) context); */
|
||
- md5f.final (MD5_CTXP context, (unsigned char*) digest);
|
||
+ MD5_Final ((unsigned char*) digest, (MD5_CTX*) context);
|
||
#else
|
||
int i;
|
||
@@ -250,5 +162,5 @@
|
||
|
||
/* MD5Final ((unsigned char*) result, (MD5_CTX*) context);*/
|
||
- md5f.final (MD5_CTXP context, (unsigned char*) result);
|
||
+ MD5_Final ((unsigned char*) result, (MD5_CTX*) context);
|
||
|
||
for (i = 0; i < 8; i++)
|
||
@@ -265,54 +177,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
|