The below-mentioned PR identified a problem, which should've been
caught by the test-harness -- but was not, because the harness was not used correctly (for 10 years). Provide a new harness and fix the reported problem as well as another one -- with MD2 digests -- identified by the now-functioning test-suit. Bump PORTREVISION... PR: 237132 Reported by: Vadim Zborovsky
This commit is contained in:
parent
ce4aab0cf1
commit
f65a5e70f9
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=498636
4 changed files with 66 additions and 46 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
PORTNAME= Trf
|
||||
PORTVERSION= 2.1.4
|
||||
PORTREVISION= 2
|
||||
PORTREVISION= 3
|
||||
CATEGORIES= devel tcl
|
||||
MASTER_SITES= SF/tcltrf/tcltrf/${PORTVERSION}
|
||||
PKGNAMEPREFIX= tcl-
|
||||
|
@ -41,7 +41,8 @@ do-install:
|
|||
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/Trf/libTrf${PORTVERSION}.so
|
||||
|
||||
do-test:
|
||||
cd ${WRKSRC}/tests && ${SETENV} TCLLIBPATH="${WRKSRC}" ${TCLSH} all
|
||||
cd ${WRKSRC} && ${SETENV} TCLLIBPATH="${WRKSRC}" ${TCLSH} \
|
||||
${FILESDIR}/alltests.tcl
|
||||
|
||||
PLIST_SUB+= TCL_DVER=${TCL_VER:C/\.//} VER=${PORTVERSION}
|
||||
|
||||
|
|
24
devel/tcl-trf/files/alltests.tcl
Normal file
24
devel/tcl-trf/files/alltests.tcl
Normal file
|
@ -0,0 +1,24 @@
|
|||
package require tcltest
|
||||
|
||||
source test.setup
|
||||
|
||||
namespace import ::tcltest::*
|
||||
|
||||
foreach c {hasZlib hasSSL hasBz} {
|
||||
testConstraint $c 1
|
||||
}
|
||||
|
||||
proc defblock {name hexdata} {
|
||||
upvar $name x
|
||||
|
||||
regsub -all { *} $hexdata {} hexdata
|
||||
regsub -all "\n" $hexdata {} hexdata
|
||||
# single long hex string now
|
||||
|
||||
set x $hexdata
|
||||
}
|
||||
|
||||
configure -singleproc true -verbose bel
|
||||
|
||||
testsDirectory tests
|
||||
runAllTests
|
|
@ -8,12 +8,7 @@
|
|||
+#include "md2d.h"
|
||||
|
||||
/*
|
||||
@@ -38,18 +39,8 @@
|
||||
*/
|
||||
|
||||
-#define DIGEST_SIZE (MD2_DIGEST_LENGTH)
|
||||
+#define DIGEST_SIZE (20)
|
||||
#define CTX_TYPE MD2_CTX
|
||||
@@ -42,14 +43,4 @@
|
||||
|
||||
/*
|
||||
- * Declarations of internal procedures.
|
||||
|
|
|
@ -94,36 +94,47 @@
|
|||
-}
|
||||
-
|
||||
--- generic/crc_zlib.c 2009-06-18 00:54:43.000000000 -0400
|
||||
+++ generic/crc_zlib.c 2018-10-21 00:42:01.795595000 -0400
|
||||
+++ generic/crc_zlib.c 2019-04-11 00:09:21.075344000 -0400
|
||||
@@ -29,4 +29,5 @@
|
||||
|
||||
#include "transformInt.h"
|
||||
+#include <zlib.h>
|
||||
|
||||
/*
|
||||
@@ -46,8 +47,5 @@
|
||||
@@ -39,5 +40,5 @@
|
||||
|
||||
#define DIGEST_SIZE 4 /* byte == 32 bit */
|
||||
-#define CTX_TYPE uLong
|
||||
+#define CTX_TYPE uint32_t
|
||||
|
||||
/*
|
||||
@@ -46,8 +47,6 @@
|
||||
|
||||
static void MDcrcz_Start _ANSI_ARGS_ ((VOID* context));
|
||||
-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));
|
||||
|
||||
/*
|
||||
@@ -60,8 +58,8 @@
|
||||
@@ -60,11 +59,11 @@
|
||||
DIGEST_SIZE,
|
||||
MDcrcz_Start,
|
||||
- MDcrcz_Update,
|
||||
- MDcrcz_UpdateBuf,
|
||||
+ NULL,
|
||||
+ (Trf_MDUpdateBuf *)crc32,
|
||||
MDcrcz_UpdateBuf,
|
||||
MDcrcz_Final,
|
||||
- MDcrcz_Check
|
||||
+ NULL
|
||||
};
|
||||
|
||||
@@ -118,66 +116,5 @@
|
||||
-#define CRC (*((uLong*) context))
|
||||
+#define CRC (*((CTX_TYPE *) context))
|
||||
|
||||
/*
|
||||
@@ -118,36 +117,5 @@
|
||||
/* call md specific initialization here */
|
||||
|
||||
- CRC = zf.zcrc32 (0L, Z_NULL, 0);
|
||||
|
@ -158,47 +169,36 @@
|
|||
- 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);
|
||||
}
|
||||
|
||||
@@ -202,5 +139,5 @@
|
||||
@@ -175,9 +143,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 +170,5 @@
|
||||
|
||||
static void
|
||||
-MDcrcz_Final (context, digest)
|
||||
+MDcrcz_Final (digest, context)
|
||||
VOID* context;
|
||||
VOID* digest;
|
||||
@@ -217,28 +154,2 @@
|
||||
@@ -208,5 +176,5 @@
|
||||
/* call md specific finalization here */
|
||||
|
||||
- uLong crc = CRC;
|
||||
+ CTX_TYPE crc = CRC;
|
||||
char* out = (char*) digest;
|
||||
|
||||
@@ -217,28 +185,2 @@
|
||||
out [0] = (char) ((crc >> 0) & 0xff);
|
||||
}
|
||||
-
|
||||
|
|
Loading…
Reference in a new issue