]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/openswan-2.4.12-missing-files.patch
Applied "check on BER decoding" security fix
[people/pmueller/ipfire-2.x.git] / src / patches / openswan-2.4.12-missing-files.patch
CommitLineData
4ce37908
MT
1--- /dev/null 2008-04-27 15:35:57.000000000 +0200
2+++ linux/net/ipsec/version.c 2008-05-17 18:35:27.000000000 +0200
3@@ -0,0 +1,44 @@
4+/*
5+ * return IPsec version information
6+ * Copyright (C) 2001 Henry Spencer.
7+ *
8+ * This library is free software; you can redistribute it and/or modify it
9+ * under the terms of the GNU Library General Public License as published by
10+ * the Free Software Foundation; either version 2 of the License, or (at your
11+ * option) any later version. See <http://www.fsf.org/copyleft/lgpl.txt>.
12+ *
13+ * This library is distributed in the hope that it will be useful, but
14+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16+ * License for more details.
17+ *
18+ * RCSID $Id: version.in.c,v 1.2 2004/04/14 05:09:46 ken Exp $
19+ */
20+
21+#ifdef __KERNEL__
22+#include <linux/netdevice.h>
23+#endif
24+
25+#include "openswan.h"
26+
27+#define V "2.4.12" /* substituted in by Makefile */
28+static const char openswan_number[] = V;
29+static const char openswan_string[] = "Openswan " V;
30+
31+/*
32+ - ipsec_version_code - return IPsec version number/code, as string
33+ */
34+const char *
35+ipsec_version_code()
36+{
37+ return openswan_number;
38+}
39+
40+/*
41+ - ipsec_version_string - return full version string
42+ */
43+const char *
44+ipsec_version_string()
45+{
46+ return openswan_string;
47+}
48--- /dev/null 2008-04-27 15:35:57.000000000 +0200
49+++ linux/net/ipsec/zutil.c 2008-05-16 17:28:08.000000000 +0200
50@@ -0,0 +1,227 @@
51+/* zutil.c -- target dependent utility functions for the compression library
52+ * Copyright (C) 1995-2002 Jean-loup Gailly.
53+ * For conditions of distribution and use, see copyright notice in zlib.h
54+ */
55+
56+/* @(#) $Id: zutil.c,v 1.5 2004/07/10 07:48:40 mcr Exp $ */
57+
58+#include <zlib/zutil.h>
59+
60+#define MY_ZCALLOC
61+
62+struct internal_state {int dummy;}; /* for buggy compilers */
63+
64+#ifndef STDC
65+extern void exit OF((int));
66+#endif
67+
68+const char *z_errmsg[10] = {
69+"need dictionary", /* Z_NEED_DICT 2 */
70+"stream end", /* Z_STREAM_END 1 */
71+"", /* Z_OK 0 */
72+"file error", /* Z_ERRNO (-1) */
73+"stream error", /* Z_STREAM_ERROR (-2) */
74+"data error", /* Z_DATA_ERROR (-3) */
75+"insufficient memory", /* Z_MEM_ERROR (-4) */
76+"buffer error", /* Z_BUF_ERROR (-5) */
77+"incompatible version",/* Z_VERSION_ERROR (-6) */
78+""};
79+
80+
81+const char * ZEXPORT zlibVersion()
82+{
83+ return ZLIB_VERSION;
84+}
85+
86+#ifdef DEBUG
87+
88+# ifndef verbose
89+# define verbose 0
90+# endif
91+int z_verbose = verbose;
92+
93+void z_error (m)
94+ char *m;
95+{
96+ fprintf(stderr, "%s\n", m);
97+ exit(1);
98+}
99+#endif
100+
101+/* exported to allow conversion of error code to string for compress() and
102+ * uncompress()
103+ */
104+const char * ZEXPORT zError(err)
105+ int err;
106+{
107+ return ERR_MSG(err);
108+}
109+
110+
111+#ifndef HAVE_MEMCPY
112+
113+void zmemcpy(dest, source, len)
114+ Bytef* dest;
115+ const Bytef* source;
116+ uInt len;
117+{
118+ if (len == 0) return;
119+ do {
120+ *dest++ = *source++; /* ??? to be unrolled */
121+ } while (--len != 0);
122+}
123+
124+int zmemcmp(s1, s2, len)
125+ const Bytef* s1;
126+ const Bytef* s2;
127+ uInt len;
128+{
129+ uInt j;
130+
131+ for (j = 0; j < len; j++) {
132+ if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
133+ }
134+ return 0;
135+}
136+
137+void zmemzero(dest, len)
138+ Bytef* dest;
139+ uInt len;
140+{
141+ if (len == 0) return;
142+ do {
143+ *dest++ = 0; /* ??? to be unrolled */
144+ } while (--len != 0);
145+}
146+#endif
147+
148+#ifdef __TURBOC__
149+#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
150+/* Small and medium model in Turbo C are for now limited to near allocation
151+ * with reduced MAX_WBITS and MAX_MEM_LEVEL
152+ */
153+# define MY_ZCALLOC
154+
155+/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
156+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
157+ * must fix the pointer. Warning: the pointer must be put back to its
158+ * original form in order to free it, use zcfree().
159+ */
160+
161+#define MAX_PTR 10
162+/* 10*64K = 640K */
163+
164+local int next_ptr = 0;
165+
166+typedef struct ptr_table_s {
167+ voidpf org_ptr;
168+ voidpf new_ptr;
169+} ptr_table;
170+
171+local ptr_table table[MAX_PTR];
172+/* This table is used to remember the original form of pointers
173+ * to large buffers (64K). Such pointers are normalized with a zero offset.
174+ * Since MSDOS is not a preemptive multitasking OS, this table is not
175+ * protected from concurrent access. This hack doesn't work anyway on
176+ * a protected system like OS/2. Use Microsoft C instead.
177+ */
178+
179+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
180+{
181+ voidpf buf = opaque; /* just to make some compilers happy */
182+ ulg bsize = (ulg)items*size;
183+
184+ /* If we allocate less than 65520 bytes, we assume that farmalloc
185+ * will return a usable pointer which doesn't have to be normalized.
186+ */
187+ if (bsize < 65520L) {
188+ buf = farmalloc(bsize);
189+ if (*(ush*)&buf != 0) return buf;
190+ } else {
191+ buf = farmalloc(bsize + 16L);
192+ }
193+ if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
194+ table[next_ptr].org_ptr = buf;
195+
196+ /* Normalize the pointer to seg:0 */
197+ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
198+ *(ush*)&buf = 0;
199+ table[next_ptr++].new_ptr = buf;
200+ return buf;
201+}
202+
203+void zcfree (voidpf opaque, voidpf ptr)
204+{
205+ int n;
206+ if (*(ush*)&ptr != 0) { /* object < 64K */
207+ farfree(ptr);
208+ return;
209+ }
210+ /* Find the original pointer */
211+ for (n = 0; n < next_ptr; n++) {
212+ if (ptr != table[n].new_ptr) continue;
213+
214+ farfree(table[n].org_ptr);
215+ while (++n < next_ptr) {
216+ table[n-1] = table[n];
217+ }
218+ next_ptr--;
219+ return;
220+ }
221+ ptr = opaque; /* just to make some compilers happy */
222+ Assert(0, "zcfree: ptr not found");
223+}
224+#endif
225+#endif /* __TURBOC__ */
226+
227+
228+#if defined(M_I86) && !defined(__32BIT__)
229+/* Microsoft C in 16-bit mode */
230+
231+# define MY_ZCALLOC
232+
233+#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
234+# define _halloc halloc
235+# define _hfree hfree
236+#endif
237+
238+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
239+{
240+ if (opaque) opaque = 0; /* to make compiler happy */
241+ return _halloc((long)items, size);
242+}
243+
244+void zcfree (voidpf opaque, voidpf ptr)
245+{
246+ if (opaque) opaque = 0; /* to make compiler happy */
247+ _hfree(ptr);
248+}
249+
250+#endif /* MSC */
251+
252+
253+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
254+
255+#ifndef STDC
256+extern voidp calloc OF((uInt items, uInt size));
257+extern void free OF((voidpf ptr));
258+#endif
259+
260+voidpf zcalloc (opaque, items, size)
261+ voidpf opaque;
262+ unsigned items;
263+ unsigned size;
264+{
265+ if (opaque) items += size - size; /* make compiler happy */
266+ return (voidpf)calloc(items, size);
267+}
268+
269+void zcfree (opaque, ptr)
270+ voidpf opaque;
271+ voidpf ptr;
272+{
273+ free(ptr);
274+ if (opaque) return; /* make compiler happy */
275+}
276+
277+#endif /* MY_ZCALLOC */