Commit 7a85a55739fb094d865dcd38838a429cffafab8c

Guillem Jover 2016-02-09T10:17:55

Remove hidden dependencies from public headers Include <sys/types.h> in all public headers as they need them, so that programs do not need to add such header to be able to build.

diff --git a/include/md4.h b/include/md4.h
index 57f77bc..ccd524f 100644
--- a/include/md4.h
+++ b/include/md4.h
@@ -16,6 +16,9 @@
 #ifndef _MD4_H_
 #define _MD4_H_
 
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
 #include <stdint.h>
 
 #define	MD4_BLOCK_LENGTH		64
@@ -28,8 +31,6 @@ typedef struct MD4Context {
 	uint8_t buffer[MD4_BLOCK_LENGTH];	/* input buffer */
 } MD4_CTX;
 
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
 void	 MD4Init(MD4_CTX *);
 void	 MD4Update(MD4_CTX *, const uint8_t *, size_t);
diff --git a/include/md5.h b/include/md5.h
index e6f151e..0a0a4ff 100644
--- a/include/md5.h
+++ b/include/md5.h
@@ -15,6 +15,9 @@
 #ifndef _MD5_H_
 #define _MD5_H_
 
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
 #include <stdint.h>
 
 #define	MD5_BLOCK_LENGTH		64
@@ -27,8 +30,6 @@ typedef struct MD5Context {
 	uint8_t buffer[MD5_BLOCK_LENGTH];	/* input buffer */
 } MD5_CTX;
 
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
 void	 MD5Init(MD5_CTX *);
 void	 MD5Update(MD5_CTX *, const uint8_t *, size_t);
diff --git a/include/rmd160.h b/include/rmd160.h
index 3cda0b9..b9fef11 100644
--- a/include/rmd160.h
+++ b/include/rmd160.h
@@ -25,6 +25,9 @@
 #ifndef  _RMD160_H
 #define  _RMD160_H
 
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
 #include <stdint.h>
 
 #define	RMD160_BLOCK_LENGTH		64
@@ -38,8 +41,6 @@ typedef struct RMD160Context {
 	uint8_t buffer[RMD160_BLOCK_LENGTH];	/* input buffer */
 } RMD160_CTX;
 
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
 void	 RMD160Init(RMD160_CTX *);
 void	 RMD160Transform(uint32_t [5], const uint8_t [RMD160_BLOCK_LENGTH]);
diff --git a/include/sha1.h b/include/sha1.h
index c56cc1b..bf21e58 100644
--- a/include/sha1.h
+++ b/include/sha1.h
@@ -9,6 +9,9 @@
 #ifndef _SHA1_H
 #define _SHA1_H
 
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
 #include <stdint.h>
 
 #define	SHA1_BLOCK_LENGTH		64
@@ -21,8 +24,6 @@ typedef struct {
     uint8_t buffer[SHA1_BLOCK_LENGTH];
 } SHA1_CTX;
 
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
 void SHA1Init(SHA1_CTX *);
 void SHA1Pad(SHA1_CTX *);
diff --git a/include/sha2.h b/include/sha2.h
index 631e6ae..9cfd273 100644
--- a/include/sha2.h
+++ b/include/sha2.h
@@ -37,6 +37,9 @@
 #ifndef _SHA2_H
 #define _SHA2_H
 
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
 #include <stdint.h>
 
 /*** SHA-256/384/512 Various Length Definitions ***********************/
@@ -61,8 +64,6 @@ typedef struct _SHA2_CTX {
 	uint8_t		buffer[SHA512_BLOCK_LENGTH];
 } SHA2_CTX;
 
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
 void SHA256Init(SHA2_CTX *);
 void SHA256Transform(uint32_t state[8], const uint8_t [SHA256_BLOCK_LENGTH]);