ports/devel/tcl-trf/files/patch-sha1
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

141 lines
3.2 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/sha1.c Wed Aug 9 15:13:18 2000
+++ generic/sha1.c Sat Jul 10 18:00:47 2004
@@ -28,5 +28,6 @@
*/
#include "loadman.h"
+#include <openssl/sha.h>
/*
@@ -49,9 +50,6 @@
*/
-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));
/*
@@ -67,9 +65,9 @@
sizeof (CTX_TYPE),
DIGEST_SIZE,
- MDsha1_Start,
+ (Trf_MDStart *)SHA1_Init,
MDsha1_Update,
- MDsha1_UpdateBuf,
+ (Trf_MDUpdateBuf *)SHA1_Update,
MDsha1_Final,
- MDsha1_Check
+ NULL
};
@@ -106,30 +104,4 @@
*------------------------------------------------------*
*
- * 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 --
*
@@ -155,33 +127,5 @@
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);
+ SHA1_Update ((SHA_CTX*) context, &buf, 1);
}
@@ -211,9 +155,9 @@
{
#ifndef OTP
- sha1f.final ((unsigned char*) digest, (SHA_CTX*) context);
+ SHA1_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];
@@ -224,30 +168,3 @@
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);
}