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
This commit is contained in:
Mikhail Teterin 2018-10-21 05:13:12 +00:00
parent de3cfeb6df
commit 4a1ca02b61
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=482639
8 changed files with 95 additions and 86 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= Trf
PORTVERSION= 2.1.4
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel tcl
MASTER_SITES= SF/tcltrf/tcltrf/${PORTVERSION}
PKGNAMEPREFIX= tcl-
@ -17,9 +17,7 @@ LICENSE_NAME= Tcl Trf License
LICENSE_FILE= ${WRKSRC}/doc/license.terms
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
BROKEN_SSL= openssl-devel
BROKEN_SSL_REASON_openssl-devel= use of undeclared identifier 'SHA_Init'
TEST_DEPENDS= ${LOCALBASE}/lib/Memchan2.3/libMemchan.so.1:devel/tcl-memchan
ALL_TARGET= all
USES+= tcl:tea tar:bzip2
@ -29,34 +27,10 @@ CFLAGS+= -Wall -Werror
MAKE_ENV+= INSTALL_DATA="${INSTALL_DATA}"
TEST_TARGET= do-test
REINPLACE_ARGS= -i ""
CONFIGURE_ARGS+=--enable-static-zlib --enable-static-bzlib \
--enable-static-md5
.include <bsd.port.options.mk>
post-patch:
.if defined(TRF_USE_MD)
#
# Using FreeBSD's own -lmd instead of OpenSSL's -lcrypto
#
${REINPLACE_CMD} -E -e 's,openssl/,,' \
-e 's,(MD[5])_([A-Z][a-z]),\1\2,g' \
${WRKSRC}/generic/*.[ch]
${REINPLACE_CMD} 's,-lcrypto,-lmd,' ${WRKSRC}/Makefile.in
.else
#
# Using OpenSSL's implementations of message digests (-lcrypto)
# To use FreeBSD's own -lmd, stop now and restart make with:
#
# -DTRF_USE_MD
#
USES+= ssl
CONFIGURE_ARGS+= --with-ssl=${OPENSSLBASE}
CFLAGS+= -I${OPENSSLINC}
.endif
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/lib/Trf
${INSTALL_DATA} ${WRKSRC}/libTrf${PORTVERSION}.so \
@ -68,19 +42,9 @@ do-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/Trf/libTrf${PORTVERSION}.so
do-test:
@if ! ${PKG_BIN} info --quiet tcl-memchan; then \
${PRINTF} "*****************\n%s\n*****************\n" \
"devel/tcl-memchan must be installed for the tests to work"; \
exit 1; \
fi
cd ${WRKSRC}/tests && ${SETENV} TCLLIBPATH="${WRKSRC}" ${TCLSH} all
.include <bsd.port.pre.mk>
PLIST_SUB+= TCL_DVER=${TCL_VER:C/\.//} VER=${PORTVERSION}
.if defined(OPENSSLBASE) && ${OPENSSLBASE} != "/usr"
MAKE_ENV+= SSLINC=-I${OPENSSLINC} SSLLIB=-L${OPENSSLLIB}
.endif
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View file

@ -11,6 +11,6 @@
CPPFLAGS = @CPPFLAGS@
-LIBS = @PKG_LIBS@ @LIBS@
+LIBS = @PKG_LIBS@ @LIBS@ -lz -lbz2 -lcrypt ${SSLLIB} -lcrypto
+LIBS = @PKG_LIBS@ @LIBS@ -lz -lbz2 -lcrypt -lmd
AR = @AR@
CFLAGS = @CFLAGS@

View file

@ -7,7 +7,7 @@
+#include "transformInt.h"
+#include <sys/types.h>
+#include <openssl/md5.h>
+#include <md5.h>
/*
* Generator description
@@ -38,6 +40,4 @@
@ -27,7 +27,7 @@
-static void MDmd5_Final _ANSI_ARGS_ ((VOID* context, VOID* digest));
-static int MDmd5_Check _ANSI_ARGS_ ((Tcl_Interp* interp));
+#ifdef OTP
+static void MDmd5_OTP_Final _ANSI_ARGS_ ((VOID* context, VOID* digest));
+static void MDmd5_OTP_Final _ANSI_ARGS_ ((VOID* digest, VOID* context));
+#endif
/*
@ -39,13 +39,13 @@
- MDmd5_UpdateBuf,
- MDmd5_Final,
- MDmd5_Check
+ (Trf_MDStart *)MD5_Init,
+ (Trf_MDStart *)MD5Init,
+ NULL,
+ (Trf_MDUpdateBuf *)MD5_Update,
+ (Trf_MDUpdateBuf *)MD5Update,
+#ifdef OTP
+ MDmd5_OTP_Final,
+#else
+ (Trf_MDFinal *)MD5_Final,
+ (Trf_MDFinal *)MD5Final,
+#endif
+ NULL,
};
@ -189,7 +189,7 @@
- /* MD5Final ((unsigned char*) result, (MD5_CTX*) context);*/
- md5f.final ((unsigned char*) result, MD5_CTXP context);
+ MD5_Final (result, (MD5_CTX*) context);
+ MD5Final (result, (MD5_CTX*) context);
for (i = 0; i < 8; i++)
@@ -255,5 +142,4 @@

View file

@ -4,7 +4,7 @@
#include "transformInt.h"
-#include "ripemd/rmd160.h"
+#include <openssl/ripemd.h>
+#include <ripemd.h>
/*
@@ -40,27 +40,4 @@

View file

@ -1,13 +1,11 @@
--- generic/sha.c.orig 2009-06-18 04:54:44 UTC
--- generic/sha.c 2009-06-18 04:54:44 UTC
+++ generic/sha.c
@@ -27,15 +27,11 @@
@@ -27,15 +27,9 @@
* CVS: $Id: sha.c,v 1.4 2007/10/05 23:12:21 andreas_kupries Exp $
*/
-#include "transformInt.h"
-#include "sha/sha.h"
+#include <openssl/opensslconf.h>
+#ifndef OPENSSL_NO_SHA0
-#ifdef WORDS_BIGENDIAN
-#undef LITTLE_ENDIAN
@ -16,7 +14,7 @@
-#define LITTLE_ENDIAN
-#endif
+#include "transformInt.h"
+#include <openssl/sha.h>
+#include <sha.h>
/*
* Generator description
@ -70,7 +68,7 @@
NULL
};
@@ -110,182 +84,5 @@ Tcl_Interp* interp;
@@ -110,182 +84,4 @@ Tcl_Interp* interp;
{
return Trf_RegisterMessageDigest (interp, &mdDescription);
}
@ -239,7 +237,7 @@
-
-#ifndef WORDS_BIGENDIAN
- Trf_FlipRegisterLong (s->s.digest, SHA_DIGESTSIZE);
#endif
-#endif
-
- memcpy (digest, s->s.digest, SHA_DIGESTSIZE);
-}

View file

@ -5,7 +5,7 @@
-#include "loadman.h"
+#include "transformInt.h"
+#include <openssl/sha.h>
+#include <sha.h>
/*
@@ -39,5 +40,5 @@
@ -24,7 +24,7 @@
-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* context, VOID* digest));
+static void MDsha1_OTP_Final _ANSI_ARGS_ ((VOID* digest, VOID *context));
+#endif
/*

View file

@ -94,64 +94,111 @@
-}
-
--- generic/crc_zlib.c 2009-06-18 00:54:43.000000000 -0400
+++ generic/crc_zlib.c 2009-07-12 23:51:04.000000000 -0400
+++ generic/crc_zlib.c 2018-10-21 00:42:01.795595000 -0400
@@ -29,4 +29,5 @@
#include "transformInt.h"
+#include <zlib.h>
/*
@@ -47,7 +48,6 @@
@@ -46,8 +47,5 @@
static void MDcrcz_Start _ANSI_ARGS_ ((VOID* context));
static void MDcrcz_Update _ANSI_ARGS_ ((VOID* context, unsigned int character));
-static void MDcrcz_Update _ANSI_ARGS_ ((VOID* context, unsigned int character));
-static void MDcrcz_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, int bufLen));
-static void MDcrcz_Final _ANSI_ARGS_ ((VOID* context, VOID* digest));
-static int MDcrcz_Check _ANSI_ARGS_ ((Tcl_Interp* interp));
+static void MDcrcz_UpdateBuf _ANSI_ARGS_ ((VOID* context, unsigned char* buffer, size_t bufLen));
+static void MDcrcz_Final _ANSI_ARGS_ ((VOID* digest, VOID* context));
+static void MDcrcz_Final _ANSI_ARGS_ ((VOID* digest, VOID *context));
/*
@@ -63,5 +63,5 @@
MDcrcz_UpdateBuf,
@@ -60,8 +58,8 @@
DIGEST_SIZE,
MDcrcz_Start,
- MDcrcz_Update,
- MDcrcz_UpdateBuf,
+ NULL,
+ (Trf_MDUpdateBuf *)crc32,
MDcrcz_Final,
- MDcrcz_Check
+ NULL
};
@@ -118,5 +118,5 @@
@@ -118,66 +116,5 @@
/* call md specific initialization here */
- CRC = zf.zcrc32 (0L, Z_NULL, 0);
-}
-
-/*
- *------------------------------------------------------*
- *
- * MDcrcz_Update --
- *
- * ------------------------------------------------*
- * Update the internal state of the message digest
- * generator for a single character.
- * ------------------------------------------------*
- *
- * Sideeffects:
- * As of the called procedure.
- *
- * Result:
- * None.
- *
- *------------------------------------------------------*
- */
-
-static void
-MDcrcz_Update (context, character)
-VOID* context;
-unsigned int character;
-{
- /* call md specific update here */
-
- unsigned char buf = character;
-
- CRC = zf.zcrc32 (CRC, &buf, 1);
-}
-
-/*
- *------------------------------------------------------*
- *
- * MDcrcz_UpdateBuf --
- *
- * ------------------------------------------------*
- * Update the internal state of the message digest
- * generator for a character buffer.
- * ------------------------------------------------*
- *
- * Sideeffects:
- * As of the called procedure.
- *
- * Result:
- * None.
- *
- *------------------------------------------------------*
- */
-
-static void
-MDcrcz_UpdateBuf (context, buffer, bufLen)
-VOID* context;
-unsigned char* buffer;
-int bufLen;
-{
- /* call md specific update here */
-
- CRC = zf.zcrc32 (CRC, buffer, bufLen);
+ CRC = crc32(0L, Z_NULL, 0);
}
@@ -149,5 +149,5 @@
unsigned char buf = character;
- CRC = zf.zcrc32 (CRC, &buf, 1);
+ CRC = crc32(CRC, &buf, 1);
}
@@ -175,9 +175,9 @@
VOID* context;
unsigned char* buffer;
-int bufLen;
+size_t bufLen;
{
/* call md specific update here */
- CRC = zf.zcrc32 (CRC, buffer, bufLen);
+ CRC = crc32(CRC, buffer, bufLen);
}
@@ -202,5 +202,5 @@
@@ -202,5 +139,5 @@
static void
-MDcrcz_Final (context, digest)
+MDcrcz_Final (digest, context)
VOID* context;
VOID* digest;
@@ -217,28 +217,2 @@
@@ -217,28 +154,2 @@
out [0] = (char) ((crc >> 0) & 0xff);
}
-

View file

@ -9,4 +9,4 @@ transparent encryption, compression, charset recoding, etc. Build upon
this framework (and as proof of concept) a collection of tcl-level
commands was implemented.
WWW: http://www.oche.de/~akupries/soft/trf/
WWW: https://wiki.tcl-lang.org/479