summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorniklas <niklas@openbsd.org>1997-02-21 08:42:31 +0000
committerniklas <niklas@openbsd.org>1997-02-21 08:42:31 +0000
commit74b06250ec249041829f22bd0af3da4b99ba89c9 (patch)
treed228b60fdd769f1e7f16df73816bee5ab553f026
parentFixed error introduced with last patch. (diff)
downloadwireguard-openbsd-74b06250ec249041829f22bd0af3da4b99ba89c9.tar.xz
wireguard-openbsd-74b06250ec249041829f22bd0af3da4b99ba89c9.zip
-nostdinc and big endian cleanup
-rw-r--r--sys/netinet/ip_ahhmacmd5.c6
-rw-r--r--sys/netinet/ip_ahhmacsha1.c6
-rw-r--r--sys/netinet/ip_ipsp.c2
-rw-r--r--sys/netinet/ip_ipsp.h10
-rw-r--r--sys/netinet/ip_md5c.c5
-rw-r--r--sys/netinet/ip_sha1.c3
-rw-r--r--sys/netinet/libdeslite/des.h20
-rw-r--r--sys/netinet/libdeslite/des_locl.h31
-rw-r--r--sys/netinet/libdeslite/set_key.c2
9 files changed, 35 insertions, 50 deletions
diff --git a/sys/netinet/ip_ahhmacmd5.c b/sys/netinet/ip_ahhmacmd5.c
index 008fef0e575..c4ddea126a9 100644
--- a/sys/netinet/ip_ahhmacmd5.c
+++ b/sys/netinet/ip_ahhmacmd5.c
@@ -35,11 +35,15 @@
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/kernel.h>
+#include <sys/socketvar.h>
+
#include <machine/cpu.h>
+#include <machine/endian.h>
#include <net/if.h>
#include <net/route.h>
#include <net/netisr.h>
+#include <net/raw_cb.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -49,8 +53,6 @@
#include <netinet/ip_var.h>
#include <netinet/ip_icmp.h>
-#include <sys/socketvar.h>
-#include <net/raw_cb.h>
#include <net/encap.h>
#include <netinet/ip_ipsp.h>
diff --git a/sys/netinet/ip_ahhmacsha1.c b/sys/netinet/ip_ahhmacsha1.c
index af306827e7c..6e66955fe06 100644
--- a/sys/netinet/ip_ahhmacsha1.c
+++ b/sys/netinet/ip_ahhmacsha1.c
@@ -35,11 +35,15 @@
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/kernel.h>
+#include <sys/socketvar.h>
+
#include <machine/cpu.h>
+#include <machine/endian.h>
#include <net/if.h>
#include <net/route.h>
#include <net/netisr.h>
+#include <net/raw_cb.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -49,8 +53,6 @@
#include <netinet/ip_var.h>
#include <netinet/ip_icmp.h>
-#include <sys/socketvar.h>
-#include <net/raw_cb.h>
#include <net/encap.h>
#include <netinet/ip_ipsp.h>
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c
index 3f5e6b88648..a99c7bbb69c 100644
--- a/sys/netinet/ip_ipsp.c
+++ b/sys/netinet/ip_ipsp.c
@@ -51,9 +51,7 @@
#include <net/raw_cb.h>
#include <net/encap.h>
-#define IPSEC_IPSP_C
#include <netinet/ip_ipsp.h>
-#undef IPSEC_IPSP_C
#include <netinet/ip_ah.h>
#include <netinet/ip_esp.h>
diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h
index 85e122a752e..8fecdb7ff84 100644
--- a/sys/netinet/ip_ipsp.h
+++ b/sys/netinet/ip_ipsp.h
@@ -66,9 +66,8 @@ struct xformsw
#define IPSEC_ZEROES_SIZE 64
-#ifdef IPSEC_IPSP_C
#if BYTE_ORDER == LITTLE_ENDIAN
-inline u_int64_t
+static __inline u_int64_t
htonq(u_int64_t q)
{
register u_int32_t u, l;
@@ -88,11 +87,8 @@ htonq(u_int64_t q)
#else
#error "Please fix <machine/endian.h>"
#endif
-#else
-u_int64_t htonq(u_int64_t);
-#define ntohq(_x) htonq(_x)
-extern unsigned char ipseczeroes[IPSEC_ZEROES_SIZE];
-#endif
+
+extern unsigned char ipseczeroes[];
#ifdef _KERNEL
#undef ENCDEBUG
diff --git a/sys/netinet/ip_md5c.c b/sys/netinet/ip_md5c.c
index 80eae87b3c7..809f60c4765 100644
--- a/sys/netinet/ip_md5c.c
+++ b/sys/netinet/ip_md5c.c
@@ -39,8 +39,9 @@ documentation and/or software.
*/
#include <sys/param.h>
+#include <sys/systm.h>
+
#include <netinet/ip_md5.h>
-#include <string.h>
#define HAVEBCOPY
@@ -64,6 +65,8 @@ documentation and/or software.
#define S43 15
#define S44 21
+#define MD5Transform _MD5Transform
+
static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
#if BYTE_ORDER == LITTLE_ENDIAN
diff --git a/sys/netinet/ip_sha1.c b/sys/netinet/ip_sha1.c
index c90a61d0033..1668049ced8 100644
--- a/sys/netinet/ip_sha1.c
+++ b/sys/netinet/ip_sha1.c
@@ -18,8 +18,9 @@ A million repetitions of "a"
#define SHA1HANDSOFF
#include <sys/param.h>
+#include <sys/systm.h>
+
#include <netinet/ip_sha1.h>
-#include <string.h>
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
diff --git a/sys/netinet/libdeslite/des.h b/sys/netinet/libdeslite/des.h
index 32a30616756..c49eeb0f408 100644
--- a/sys/netinet/libdeslite/des.h
+++ b/sys/netinet/libdeslite/des.h
@@ -48,7 +48,9 @@
#ifndef HEADER_DES_H
#define HEADER_DES_H
+#ifndef _KERNEL
#include <stdio.h>
+#endif
typedef unsigned char des_cblock[8];
typedef struct des_ks_struct
@@ -183,11 +185,12 @@ void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
des_key_schedule schedule, des_cblock *ivec, int *num);
-/* Extra functions from Mark Murray <mark@grondar.za> */
-void des_cblock_print_file(des_cblock *cb, FILE *fp);
-/* The following functions are not in the normal unix build or the
+/*
+ * Extra functions from Mark Murray <mark@grondar.za>
+ * The following functions are not in the normal unix build or the
* SSLeay build. When using the SSLeay build, use RAND_seed()
- * and RAND_bytes() instead. */
+ * and RAND_bytes() instead.
+ */
int des_new_random_key(des_cblock *key);
void des_init_random_number_generator(des_cblock *key);
void des_set_random_generator_seed(des_cblock *key);
@@ -232,11 +235,12 @@ void des_string_to_2keys();
void des_cfb64_encrypt();
void des_ofb64_encrypt();
-/* Extra functions from Mark Murray <mark@grondar.za> */
-void des_cblock_print_file();
-/* The following functions are not in the normal unix build or the
+/*
+ * Extra functions from Mark Murray <mark@grondar.za>
+ * The following functions are not in the normal unix build or the
* SSLeay build. When using the SSLeay build, use RAND_seed()
- * and RAND_bytes() instead. */
+ * and RAND_bytes() instead.
+ */
int des_new_random_key();
void des_init_random_number_generator();
void des_set_random_generator_seed();
diff --git a/sys/netinet/libdeslite/des_locl.h b/sys/netinet/libdeslite/des_locl.h
index acd1ea79313..ce0cabb927b 100644
--- a/sys/netinet/libdeslite/des_locl.h
+++ b/sys/netinet/libdeslite/des_locl.h
@@ -47,11 +47,11 @@
#ifndef HEADER_DES_LOCL_H
#define HEADER_DES_LOCL_H
-#include <stdio.h>
-#include <stdlib.h>
-#ifndef MSDOS
-#include <unistd.h>
-#endif
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+
#include "des.h"
/* the following is tweaked from a config script, that is why it is a
@@ -60,31 +60,10 @@
#undef DES_USE_PTR
#endif
-#ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */
-#include <stdlib.h>
-#include <time.h>
-#include <io.h>
-#define RAND
-#undef PROTO
-#define PROTO
-#endif
-
-#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS)
-#include <string.h>
-#endif
-
#ifndef RAND
#define RAND
#endif
-#ifdef MSDOS
-#define getpid() 2
-extern int errno;
-#define RAND
-#undef PROTO
-#define PROTO
-#endif
-
#if defined(NOCONST)
#define const
#endif
diff --git a/sys/netinet/libdeslite/set_key.c b/sys/netinet/libdeslite/set_key.c
index e4df27e0572..a97542cf2c1 100644
--- a/sys/netinet/libdeslite/set_key.c
+++ b/sys/netinet/libdeslite/set_key.c
@@ -126,7 +126,7 @@ des_cblock (*key);
* this section very often :-(, thanks to
* engineering@MorningStar.Com for the fix
* eay 93/06/29 */
- if (memcmp(weak_keys[i],key,sizeof(key)) == 0) return(1);
+ if (bcmp(weak_keys[i],key,sizeof(key)) == 0) return(1);
return(0);
}