summaryrefslogtreecommitdiffstats
path: root/package/isakmpd/patches/030-openssl_hashes.patch
blob: f50afc598ed86491950b6d1266e907d9c575e58f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
Index: isakmpd-20041012.orig/GNUmakefile
===================================================================
--- isakmpd-20041012.orig.orig/GNUmakefile	2007-06-04 13:22:39.722816496 +0200
+++ isakmpd-20041012.orig/GNUmakefile	2007-06-04 13:22:40.000774240 +0200
@@ -76,13 +76,14 @@
 		isakmp_fld.c isakmp_fld.h
 MAN=		isakmpd.8 isakmpd.conf.5 isakmpd.policy.5
 
-CFLAGS+=	-O2 ${DEBUG} -Wall -DNEED_SYSDEP_APP \
+CFLAGS+=	${DEBUG} -Wall -DNEED_SYSDEP_APP \
 		-I${.CURDIR} -I${.CURDIR}/sysdep/${OS} -I. \
 
 # Different debugging & profiling suggestions
 
 # Include symbolic debugging info
 DEBUG=		-g
+CFLAGS+=	-g
 
 # Do execution time profiles
 #CFLAGS+=	-pg
@@ -175,6 +176,14 @@
 CFLAGS+=        -DUSE_RAWKEY
 endif
 
+ifdef USE_OPENSSL_MD5
+CFLAGS+=	-DUSE_OPENSSL_MD5
+endif
+
+ifdef USE_OPENSSL_SHA1
+CFLAGS+=	-DUSE_OPENSSL_SHA1
+endif
+
 SRCS+=		${IPSEC_SRCS} ${X509} ${POLICY} ${EC} ${AGGRESSIVE} ${DNSSEC} \
 			$(ISAKMP_CFG) ${DPD} ${NAT_TRAVERSAL}
 CFLAGS+=	${IPSEC_CFLAGS}
Index: isakmpd-20041012.orig/sysdep/common/libsysdep/GNUmakefile
===================================================================
--- isakmpd-20041012.orig.orig/sysdep/common/libsysdep/GNUmakefile	2007-06-04 13:22:38.959932472 +0200
+++ isakmpd-20041012.orig/sysdep/common/libsysdep/GNUmakefile	2007-06-04 13:22:40.000774240 +0200
@@ -31,10 +31,18 @@
 .CURDIR:=	$(shell pwd)
 
 LIB=		sysdep
-SRCS=		arc4random.c blowfish.c cast.c md5.c sha1.c strlcat.c strlcpy.c
+SRCS=		arc4random.c blowfish.c cast.c strlcat.c strlcpy.c
 NOMAN=
 CFLAGS+=	-I${.CURDIR}/.. -I/usr/include/machine
 
+ifeq (,$(findstring USE_OPENSSL_MD5,$(CFLAGS)))
+SRCS+=md5.c
+endif
+
+ifeq (,$(findstring USE_OPENSSL_SHA1,$(CFLAGS)))
+SRCS+=sha1.c
+endif
+
 lib${LIB}.a: ${SRCS:%.c=%.o}
 	ar cq $@ ${SRCS:%.c=%.o}
 
Index: isakmpd-20041012.orig/sysdep/common/libsysdep/md5.c
===================================================================
--- isakmpd-20041012.orig.orig/sysdep/common/libsysdep/md5.c	2007-06-04 13:22:38.964931712 +0200
+++ isakmpd-20041012.orig/sysdep/common/libsysdep/md5.c	2007-06-04 13:22:40.000774240 +0200
@@ -5,6 +5,8 @@
  * changes to accommodate it in the kernel by ji.
  */
 
+#ifndef USE_OPENSSL_MD5
+
 /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
  */
 
@@ -390,3 +392,4 @@
 #endif
 #endif
 
+#endif /* USE_OPENSSL_MD5 */
Index: isakmpd-20041012.orig/sysdep/common/libsysdep/sha1.c
===================================================================
--- isakmpd-20041012.orig.orig/sysdep/common/libsysdep/sha1.c	2007-06-04 13:22:38.970930800 +0200
+++ isakmpd-20041012.orig/sysdep/common/libsysdep/sha1.c	2007-06-04 13:22:40.001774088 +0200
@@ -1,5 +1,7 @@
 /*	$OpenBSD: sha1.c,v 1.2 2001/01/28 22:38:48 niklas Exp $	*/
 
+#ifndef USE_OPENSSL_SHA1
+
 /*
 SHA-1 in C
 By Steve Reid <steve@edmweb.com>
@@ -171,3 +173,5 @@
     SHA1Transform(context->state, context->buffer);
 #endif
 }
+
+#endif /* USE_OPENSSL_SHA1 */
Index: isakmpd-20041012.orig/sysdep/common/md5.h
===================================================================
--- isakmpd-20041012.orig.orig/sysdep/common/md5.h	2007-06-04 13:22:38.976929888 +0200
+++ isakmpd-20041012.orig/sysdep/common/md5.h	2007-06-04 13:22:40.001774088 +0200
@@ -1,5 +1,15 @@
 /*	$OpenBSD: md5.h,v 1.2 2001/01/28 22:38:47 niklas Exp $	*/
 
+#ifdef USE_OPENSSL_MD5
+
+#include <openssl/md5.h>
+
+#define MD5Init		MD5_Init
+#define	MD5Update	MD5_Update
+#define	MD5Final	MD5_Final
+
+#else	/* USE_OPENSSL_MD5 */
+
 /* GLOBAL.H - RSAREF types and constants
  */
 
@@ -71,3 +81,5 @@
 void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
 
 #define _MD5_H_
+
+#endif	/* USE_OPENSSL_MD5 */
Index: isakmpd-20041012.orig/sysdep/common/sha1.h
===================================================================
--- isakmpd-20041012.orig.orig/sysdep/common/sha1.h	2007-06-04 13:22:38.982928976 +0200
+++ isakmpd-20041012.orig/sysdep/common/sha1.h	2007-06-04 13:22:40.001774088 +0200
@@ -1,5 +1,16 @@
 /*	$OpenBSD: sha1.h,v 1.2 2001/01/28 22:38:47 niklas Exp $	*/
 
+#ifdef USE_OPENSSL_SHA1
+
+#include <openssl/sha.h>
+
+typedef SHA_CTX SHA1_CTX;
+#define	SHA1Init	SHA1_Init
+#define	SHA1Update	SHA1_Update
+#define	SHA1Final	SHA1_Final
+
+#else	/* USE_OPENSSL_SHA1 */
+
 /*
 SHA-1 in C
 By Steve Reid <steve@edmweb.com>
@@ -16,3 +27,5 @@
 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);
+
+#endif	/* USE_OPENSSL_SHA1 */
Index: isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep
===================================================================
--- isakmpd-20041012.orig.orig/sysdep/linux/GNUmakefile.sysdep	2007-06-04 13:22:39.722816496 +0200
+++ isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep	2007-06-04 13:22:40.001774088 +0200
@@ -47,6 +47,8 @@
 USE_LIBCRYPO=	defined
 HAVE_DLOPEN=	defined
 USE_KEYNOTE=	defined
+USE_OPENSSL_MD5=	defined
+USE_OPENSSL_SHA1=	defined
 
 # hack libsysdep.a dependenc
 ${LIBSYSDEPDIR}/.depend ${LIBSYSDEP}: