diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-12-23 04:33:32 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-12-23 04:33:32 +0000 |
commit | 240d00ccd27633050d6be0531a777f845b5b5440 (patch) | |
tree | 29cb992a046c08dd2cfb239776fcbb1a8c6be710 /include | |
parent | 29b88a9674bfc30b4c7a4401f9169584b56e571a (diff) |
o Ansi function headers
o Add __BEGIN_DECLS/__END_DECLS to include files
o Safe macros
o Remove useless variable assignment in the End function of *hl.c
o Some minor KNF, needs more
From Dan Weeks
Diffstat (limited to 'include')
-rw-r--r-- | include/md4.h | 6 | ||||
-rw-r--r-- | include/md5.h | 6 | ||||
-rw-r--r-- | include/rmd160.h | 6 | ||||
-rw-r--r-- | include/sha1.h | 36 |
4 files changed, 35 insertions, 19 deletions
diff --git a/include/md4.h b/include/md4.h index 89cabf7436d..0bd4e4a5a08 100644 --- a/include/md4.h +++ b/include/md4.h @@ -1,5 +1,5 @@ /* MD4.H - header file for MD4C.C - * $OpenBSD: md4.h,v 1.6 2002/02/16 21:27:17 millert Exp $ + * $OpenBSD: md4.h,v 1.7 2002/12/23 04:33:31 millert Exp $ */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All @@ -33,6 +33,9 @@ typedef struct MD4Context { unsigned char buffer[64]; /* input buffer */ } MD4_CTX; +#include <sys/cdefs.h> + +__BEGIN_DECLS void MD4Init(MD4_CTX *); void MD4Update(MD4_CTX *, const unsigned char *, size_t); void MD4Final(unsigned char [16], MD4_CTX *); @@ -40,5 +43,6 @@ void MD4Transform(u_int32_t [4], const unsigned char [64]); char * MD4End(MD4_CTX *, char *); char * MD4File(char *, char *); char * MD4Data(const unsigned char *, size_t, char *); +__END_DECLS #endif /* _MD4_H_ */ diff --git a/include/md5.h b/include/md5.h index 8190b176186..958340196eb 100644 --- a/include/md5.h +++ b/include/md5.h @@ -1,5 +1,5 @@ /* MD5.H - header file for MD5C.C - * $OpenBSD: md5.h,v 1.6 2002/02/16 21:27:17 millert Exp $ + * $OpenBSD: md5.h,v 1.7 2002/12/23 04:33:31 millert Exp $ */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All @@ -34,6 +34,9 @@ typedef struct MD5Context { unsigned char buffer[64]; /* input buffer */ } MD5_CTX; +#include <sys/cdefs.h> + +__BEGIN_DECLS void MD5Init(MD5_CTX *); void MD5Update(MD5_CTX *, const unsigned char *, size_t); void MD5Final(unsigned char [16], MD5_CTX *); @@ -41,5 +44,6 @@ void MD5Transform(u_int32_t [4], const unsigned char [64]); char * MD5End(MD5_CTX *, char *); char * MD5File(char *, char *); char * MD5Data(const unsigned char *, size_t, char *); +__END_DECLS #endif /* _MD5_H_ */ diff --git a/include/rmd160.h b/include/rmd160.h index b950fd7f393..b31b07f6e87 100644 --- a/include/rmd160.h +++ b/include/rmd160.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rmd160.h,v 1.6 2002/02/16 21:27:17 millert Exp $ */ +/* $OpenBSD: rmd160.h,v 1.7 2002/12/23 04:33:31 millert Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * @@ -32,6 +32,9 @@ typedef struct RMD160Context { u_char buffer[64]; /* input buffer */ } RMD160_CTX; +#include <sys/cdefs.h> + +__BEGIN_DECLS void RMD160Init(RMD160_CTX *); void RMD160Transform(u_int32_t [5], const u_char [64]); void RMD160Update(RMD160_CTX *, const u_char *, u_int32_t); @@ -39,5 +42,6 @@ void RMD160Final(u_char [20], RMD160_CTX *); char *RMD160End(RMD160_CTX *, char *); char *RMD160File(char *, char *); char *RMD160Data(const u_char *, size_t, char *); +__END_DECLS #endif /* _RMD160_H */ diff --git a/include/sha1.h b/include/sha1.h index 58733f1632d..613a7140969 100644 --- a/include/sha1.h +++ b/include/sha1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1.h,v 1.10 2002/02/16 21:27:17 millert Exp $ */ +/* $OpenBSD: sha1.h,v 1.11 2002/12/23 04:33:31 millert Exp $ */ /* * SHA-1 in C @@ -11,10 +11,13 @@ typedef struct { u_int32_t state[5]; - u_int32_t count[2]; + u_int32_t count[2]; u_char buffer[64]; } SHA1_CTX; - + +#include <sys/cdefs.h> + +__BEGIN_DECLS void SHA1Transform(u_int32_t state[5], const u_char buffer[64]); void SHA1Init(SHA1_CTX *context); void SHA1Update(SHA1_CTX *context, const u_char *data, u_int len); @@ -22,21 +25,22 @@ void SHA1Final(u_char digest[20], SHA1_CTX *context); char *SHA1End(SHA1_CTX *, char *); char *SHA1File(char *, char *); char *SHA1Data(const u_char *, size_t, char *); +__END_DECLS #define SHA1_DIGESTSIZE 20 #define SHA1_BLOCKSIZE 64 -#define HTONDIGEST(x) { \ - x[0] = htonl(x[0]); \ - x[1] = htonl(x[1]); \ - x[2] = htonl(x[2]); \ - x[3] = htonl(x[3]); \ - x[4] = htonl(x[4]); } - -#define NTOHDIGEST(x) { \ - x[0] = ntohl(x[0]); \ - x[1] = ntohl(x[1]); \ - x[2] = ntohl(x[2]); \ - x[3] = ntohl(x[3]); \ - x[4] = ntohl(x[4]); } +#define HTONDIGEST(x) do { \ + x[0] = htonl(x[0]); \ + x[1] = htonl(x[1]); \ + x[2] = htonl(x[2]); \ + x[3] = htonl(x[3]); \ + x[4] = htonl(x[4]); } while (0) + +#define NTOHDIGEST(x) do { \ + x[0] = ntohl(x[0]); \ + x[1] = ntohl(x[1]); \ + x[2] = ntohl(x[2]); \ + x[3] = ntohl(x[3]); \ + x[4] = ntohl(x[4]); } while (0) #endif /* _SHA1_H */ |