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