From 74b06250ec249041829f22bd0af3da4b99ba89c9 Mon Sep 17 00:00:00 2001 From: niklas Date: Fri, 21 Feb 1997 08:42:31 +0000 Subject: [PATCH] -nostdinc and big endian cleanup --- sys/netinet/ip_ahhmacmd5.c | 6 ++++-- sys/netinet/ip_ahhmacsha1.c | 6 ++++-- sys/netinet/ip_ipsp.c | 2 -- sys/netinet/ip_ipsp.h | 10 +++------- sys/netinet/ip_md5c.c | 5 ++++- sys/netinet/ip_sha1.c | 3 ++- sys/netinet/libdeslite/des.h | 20 ++++++++++++-------- sys/netinet/libdeslite/des_locl.h | 31 +++++-------------------------- sys/netinet/libdeslite/set_key.c | 2 +- 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 #include #include +#include + #include +#include #include #include #include +#include #include #include @@ -49,8 +53,6 @@ #include #include -#include -#include #include #include 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 #include #include +#include + #include +#include #include #include #include +#include #include #include @@ -49,8 +53,6 @@ #include #include -#include -#include #include #include 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 #include -#define IPSEC_IPSP_C #include -#undef IPSEC_IPSP_C #include #include 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 " #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 +#include + #include -#include #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 +#include + #include -#include #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 +#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 */ -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 + * 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 */ -void des_cblock_print_file(); -/* The following functions are not in the normal unix build or the +/* + * Extra functions from Mark Murray + * 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 -#include -#ifndef MSDOS -#include -#endif + +#include +#include +#include + #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 -#include -#include -#define RAND -#undef PROTO -#define PROTO -#endif - -#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) -#include -#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); } -- 2.20.1