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
5 + * return IPsec version information
6 + * Copyright (C) 2001 Henry Spencer.
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>.
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.
18 + * RCSID $Id: version.in.c,v 1.2 2004/04/14 05:09:46 ken Exp $
22 +#include <linux/netdevice.h>
25 +#include "openswan.h"
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;
32 + - ipsec_version_code - return IPsec version number/code, as string
37 + return openswan_number;
41 + - ipsec_version_string - return full version string
44 +ipsec_version_string()
46 + return openswan_string;
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
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
56 +/* @(#) $Id: zutil.c,v 1.5 2004/07/10 07:48:40 mcr Exp $ */
58 +#include <zlib/zutil.h>
62 +struct internal_state {int dummy;}; /* for buggy compilers */
65 +extern void exit OF((int));
68 +const char *z_errmsg[10] = {
69 +"need dictionary", /* Z_NEED_DICT 2 */
70 +"stream end", /* Z_STREAM_END 1 */
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) */
81 +const char * ZEXPORT zlibVersion()
83 + return ZLIB_VERSION;
91 +int z_verbose = verbose;
96 + fprintf(stderr, "%s\n", m);
101 +/* exported to allow conversion of error code to string for compress() and
104 +const char * ZEXPORT zError(err)
107 + return ERR_MSG(err);
113 +void zmemcpy(dest, source, len)
115 + const Bytef* source;
118 + if (len == 0) return;
120 + *dest++ = *source++; /* ??? to be unrolled */
121 + } while (--len != 0);
124 +int zmemcmp(s1, s2, len)
131 + for (j = 0; j < len; j++) {
132 + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
137 +void zmemzero(dest, len)
141 + if (len == 0) return;
143 + *dest++ = 0; /* ??? to be unrolled */
144 + } while (--len != 0);
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
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().
164 +local int next_ptr = 0;
166 +typedef struct ptr_table_s {
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.
179 +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
181 + voidpf buf = opaque; /* just to make some compilers happy */
182 + ulg bsize = (ulg)items*size;
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.
187 + if (bsize < 65520L) {
188 + buf = farmalloc(bsize);
189 + if (*(ush*)&buf != 0) return buf;
191 + buf = farmalloc(bsize + 16L);
193 + if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
194 + table[next_ptr].org_ptr = buf;
196 + /* Normalize the pointer to seg:0 */
197 + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
199 + table[next_ptr++].new_ptr = buf;
203 +void zcfree (voidpf opaque, voidpf ptr)
206 + if (*(ush*)&ptr != 0) { /* object < 64K */
210 + /* Find the original pointer */
211 + for (n = 0; n < next_ptr; n++) {
212 + if (ptr != table[n].new_ptr) continue;
214 + farfree(table[n].org_ptr);
215 + while (++n < next_ptr) {
216 + table[n-1] = table[n];
221 + ptr = opaque; /* just to make some compilers happy */
222 + Assert(0, "zcfree: ptr not found");
225 +#endif /* __TURBOC__ */
228 +#if defined(M_I86) && !defined(__32BIT__)
229 +/* Microsoft C in 16-bit mode */
233 +#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
234 +# define _halloc halloc
235 +# define _hfree hfree
238 +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
240 + if (opaque) opaque = 0; /* to make compiler happy */
241 + return _halloc((long)items, size);
244 +void zcfree (voidpf opaque, voidpf ptr)
246 + if (opaque) opaque = 0; /* to make compiler happy */
253 +#ifndef MY_ZCALLOC /* Any system without a special alloc function */
256 +extern voidp calloc OF((uInt items, uInt size));
257 +extern void free OF((voidpf ptr));
260 +voidpf zcalloc (opaque, items, size)
265 + if (opaque) items += size - size; /* make compiler happy */
266 + return (voidpf)calloc(items, size);
269 +void zcfree (opaque, ptr)
274 + if (opaque) return; /* make compiler happy */
277 +#endif /* MY_ZCALLOC */