ports/devel/tcl-trf/files/patch-sha1
Mikhail Teterin 4a1ca02b61 Stop chasing the whims of OpenSSL and use our own -lmd
as the source of various digest-algorithms. Years ago,
when I was undertaking the replacement of the bundled
implementations with those found in the base system, it
seemed like OpenSSL will be more stable... Ha-ha.

Fix the WWW, while I'm here.

PR:		229026
Submitted by:	brnrd
Reported by:	Package Fallout
2018-10-21 05:13:12 +00:00

193 lines
4.3 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 2009-06-18 00:54:44.000000000 -0400
+++ generic/sha1.c 2009-07-12 23:39:47.000000000 -0400
@@ -28,5 +28,6 @@
*/
-#include "loadman.h"
+#include "transformInt.h"
+#include <sha.h>
/*
@@ -39,5 +40,5 @@
#ifndef OTP
-#define DIGEST_SIZE (SHA_DIGEST_LENGTH)
+#define DIGEST_SIZE (20)
#else
#define DIGEST_SIZE (8)
@@ -49,9 +50,7 @@
*/
-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));
+#ifdef OTP
+static void MDsha1_OTP_Final _ANSI_ARGS_ ((VOID* digest, VOID *context));
+#endif
/*
@@ -67,9 +66,13 @@
sizeof (CTX_TYPE),
DIGEST_SIZE,
- MDsha1_Start,
- MDsha1_Update,
- MDsha1_UpdateBuf,
- MDsha1_Final,
- MDsha1_Check
+ (Trf_MDStart *)SHA1_Init,
+ NULL,
+ (Trf_MDUpdateBuf *)SHA1_Update,
+#ifdef OTP
+ MDsha1_OTP_Final,
+#else
+ (Trf_MDFinal *)SHA1_Final,
+#endif
+ NULL,
};
@@ -103,91 +106,9 @@
}
+#ifdef OTP
/*
*------------------------------------------------------*
*
- * 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 --
- *
- * ------------------------------------------------*
- * Update the internal state of the message digest
- * generator for a single character.
- * ------------------------------------------------*
- *
- * Sideeffects:
- * As of the called procedure.
- *
- * Result:
- * None.
- *
- *------------------------------------------------------*
- */
-
-static void
-MDsha1_Update (context, character)
-VOID* context;
-unsigned int character;
-{
- 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);
-}
-
-/*
- *------------------------------------------------------*
- *
- * MDsha1_Final --
+ * MDsha1_OTP_Final --
*
* ------------------------------------------------*
@@ -206,14 +127,11 @@
static void
-MDsha1_Final (context, digest)
+MDsha1_OTP_Final (digest, context)
VOID* context;
VOID* digest;
{
-#ifndef OTP
- sha1f.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];
@@ -223,31 +141,4 @@
Trf_FlipRegisterLong ((VOID*) result, DIGEST_SIZE);
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);
}
+#endif