1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-01 10:59:55 +00:00

- Make it work on 64-bit systems.

- Avoid the build failing when OpenSSL is installed as a port too.

PR:		ports/94921
Submitted by:	Mats Palmgren <mats.palmgren@bredband.net>
This commit is contained in:
Alejandro Pulver 2007-09-29 22:12:20 +00:00
parent cb8c64c20b
commit cc6a4eebad
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=200394
5 changed files with 138 additions and 8 deletions

View File

@ -26,7 +26,6 @@ BUILD_DEPENDS+= keynote:${PORTSDIR}/security/keynote
.endif
USE_RC_SUBR= isakmpd.sh
USE_OPENSSL= yes
WRKSRC= ${WRKDIR}/isakmpd
MAKE_ENV+= BINDIR=${PREFIX}/sbin MANDIR=${PREFIX}/man/man LC_ALL=C
@ -35,8 +34,13 @@ MAN8= certpatch.8 isakmpd.8
MANCOMPRESSED= yes
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 700019
BROKEN= is not buildable with OpenSSL 0.9.8b
.else
OPENSSLINC?= /usr/include
OPENSSLLIB?= /usr/lib
MAKE_ENV+= OPENSSLINC="${OPENSSLINC}" OPENSSLLIB="${OPENSSLLIB}"
.endif
post-patch:

View File

@ -1,21 +1,22 @@
--- sysdep/freebsd/Makefile.sysdep.orig Sat Jun 26 05:40:57 2004
+++ sysdep/freebsd/Makefile.sysdep Sun Dec 12 02:47:19 2004
@@ -40,11 +40,11 @@
--- sysdep/freebsd/Makefile.sysdep.orig Sat Jun 26 00:40:57 2004
+++ sysdep/freebsd/Makefile.sysdep Sat Sep 29 16:36:41 2007
@@ -40,12 +40,11 @@
LIBSYSDEPDIR= ${.CURDIR}/sysdep/common/libsysdep
.endif
-LDADD+= -lgmp ${LIBSYSDEPDIR}/libsysdep.a -lipsec -L/usr/local/lib
+LDADD+= ${LIBSYSDEPDIR}/libsysdep.a -lipsec -L/usr/local/lib
+LDADD+= ${LIBSYSDEPDIR}/libsysdep.a -lipsec -L${OPENSSLLIB}
DPADD+= ${LIBGMP} ${LIBSYSDEPDIR}/libsysdep.a
-CFLAGS+= -DHAVE_GETIFADDRS \
- -I${.CURDIR}/sysdep/common -I/usr/include \
- -I/usr/local/include -I/usr/local/include/openssl
+CFLAGS+= -DHAVE_GETIFADDRS -DHAVE_PCAP \
+ -I${.CURDIR}/sysdep/common -I/usr/include -I/usr/include/openssl \
-I/usr/local/include -I/usr/local/include/openssl
+ -I${.CURDIR}/sysdep/common -I${OPENSSLINC} -I${OPENSSLINC}/openssl
IPSEC_SRCS= pf_key_v2.c
@@ -58,9 +58,6 @@
IPSEC_CFLAGS= -DUSE_PF_KEY_V2
@@ -58,9 +57,6 @@
GENERATED+= sysdep-target
sysdep-target:
cd ${.CURDIR}/sysdep/common/libsysdep; ${MAKE} ${.MAKEFLAGS}

View File

@ -0,0 +1,67 @@
diff -rpu8 sysdep/common/libsysdep/sha1.c sysdep-FIXED/common/libsysdep/sha1.c
--- sysdep/common/libsysdep/sha1.c Sun Jan 28 23:38:48 2001
+++ sysdep-FIXED/common/libsysdep/sha1.c Sat Mar 25 02:48:19 2006
@@ -46,22 +46,22 @@ A million repetitions of "a"
#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
/* Hash a single 512-bit block. This is the core of the algorithm. */
-void SHA1Transform(unsigned long state[5], unsigned char buffer[64])
+void SHA1Transform(UINT4 state[5], unsigned char buffer[64])
{
-unsigned long a, b, c, d, e;
+UINT4 a, b, c, d, e;
typedef union {
unsigned char c[64];
- unsigned long l[16];
+ UINT4 l[16];
} CHAR64LONG16;
CHAR64LONG16* block;
#ifdef SHA1HANDSOFF
static CHAR64LONG16 workspace;
block = &workspace;
memcpy(block, buffer, 64);
#else
block = (CHAR64LONG16*)buffer;
@@ -118,17 +118,17 @@ void SHA1Init(SHA1_CTX* context)
}
/* Run your data through this. */
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len)
{
unsigned int i;
-unsigned long j;
+UINT4 j;
j = context->count[0];
if ((context->count[0] += len << 3) < j) context->count[1] += (len>>29)+1;
j = (j >> 3) & 63;
if ((j + len) > 63) {
memcpy(&context->buffer[j], data, (i = 64-j));
SHA1Transform(context->state, context->buffer);
for ( ; i + 63 < len; i += 64) {
@@ -140,17 +140,17 @@ unsigned long j;
memcpy(&context->buffer[j], &data[i], len - i);
}
/* Add padding and return the message digest. */
void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
{
-unsigned long i, j;
+UINT4 i, j;
unsigned char finalcount[8];
for (i = 0; i < 8; i++) {
finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
>> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
}
SHA1Update(context, (unsigned char *)"\200", 1);
while ((context->count[0] & 504) != 448) {

View File

@ -0,0 +1,32 @@
diff -rpu8 sysdep/common/md5.h sysdep-FIXED/common/md5.h
--- sysdep/common/md5.h Sun Jan 28 23:38:47 2001
+++ sysdep-FIXED/common/md5.h Sat Mar 25 02:47:19 2006
@@ -7,24 +7,26 @@
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
#ifndef PROTOTYPES
#define PROTOTYPES 1
#endif
+#include <sys/types.h>
+
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
+typedef u_int16_t UINT2;
/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
+typedef u_int32_t UINT4;
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list

View File

@ -0,0 +1,26 @@
--- sysdep/common/sha1.h.orig Sun Jan 28 19:38:47 2001
+++ sysdep/common/sha1.h Sat Sep 29 16:27:50 2007
@@ -6,13 +6,20 @@
100% Public Domain
*/
+#include <sys/types.h>
+
+/* Check if already defined by md5.h */
+#ifndef PROTOTYPES
+typedef u_int32_t UINT4;
+#endif
+
typedef struct {
- unsigned long state[5];
- unsigned long count[2];
+ UINT4 state[5];
+ UINT4 count[2];
unsigned char buffer[64];
} SHA1_CTX;
-void SHA1Transform(unsigned long state[5], unsigned char buffer[64]);
+void SHA1Transform(UINT4 state[5], unsigned char buffer[64]);
void SHA1Init(SHA1_CTX* context);
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len);
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);