--- 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 +#include #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); }