summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2003-05-12 21:39:51 +0200
committerNiels Möller <nisse@lysator.liu.se>2003-05-12 21:39:51 +0200
commitc5c153855a9ff9fd384d66d58fc652e0fd2e29de (patch)
treeb069e1710e070b5cfec966e956957085e58d012e
parentf747822a59f2495b7a2d8aa5dcecd421ffe1d91e (diff)
downloadnettle-c5c153855a9ff9fd384d66d58fc652e0fd2e29de.tar.gz
* Reordered includes in most or all .c-files. All should now include
config.h. Rev: src/nettle/ChangeLog:1.195 Rev: src/nettle/aes-decrypt-table.c:1.4 Rev: src/nettle/aes-decrypt.c:1.5 Rev: src/nettle/aes-encrypt-table.c:1.4 Rev: src/nettle/aes-encrypt.c:1.5 Rev: src/nettle/aes-meta.c:1.3 Rev: src/nettle/aes-set-decrypt-key.c:1.2 Rev: src/nettle/aes-set-encrypt-key.c:1.2 Rev: src/nettle/aes.c:1.12 Rev: src/nettle/aesdata.c:1.2 Rev: src/nettle/arcfour-meta.c:1.2 Rev: src/nettle/arcfour.c:1.3 Rev: src/nettle/base16-decode.c:1.2 Rev: src/nettle/base16-encode.c:1.2 Rev: src/nettle/base16-meta.c:1.3 Rev: src/nettle/base64-decode.c:1.5 Rev: src/nettle/base64-encode.c:1.3 Rev: src/nettle/base64-meta.c:1.4 Rev: src/nettle/bignum-random.c:1.3 Rev: src/nettle/bignum.c:1.7 Rev: src/nettle/blowfish.c:1.4 Rev: src/nettle/buffer-init.c:1.3 Rev: src/nettle/buffer.c:1.8 Rev: src/nettle/cast128-meta.c:1.3 Rev: src/nettle/cast128.c:1.4 Rev: src/nettle/cbc.c:1.6 Rev: src/nettle/des-compat.c:1.10 Rev: src/nettle/des.c:1.7 Rev: src/nettle/des3.c:1.2 Rev: src/nettle/dsa-keygen.c:1.6 Rev: src/nettle/dsa-sign.c:1.7 Rev: src/nettle/dsa-verify.c:1.4 Rev: src/nettle/dsa.c:1.5 Rev: src/nettle/examples/io.c:1.4 Rev: src/nettle/examples/nettle-benchmark.c:1.8 Rev: src/nettle/examples/nettle-openssl.c:1.2 Rev: src/nettle/examples/rsa-keygen.c:1.10 Rev: src/nettle/examples/rsa-sign.c:1.5 Rev: src/nettle/examples/rsa-verify.c:1.4 Rev: src/nettle/hmac-md5.c:1.5 Rev: src/nettle/hmac-sha1.c:1.2 Rev: src/nettle/hmac-sha256.c:1.2 Rev: src/nettle/hmac.c:1.4 Rev: src/nettle/knuth-lfib.c:1.2 Rev: src/nettle/md5-compat.c:1.3 Rev: src/nettle/md5-meta.c:1.2 Rev: src/nettle/md5.c:1.6 Rev: src/nettle/memxor.c:1.2 Rev: src/nettle/nettle-internal.c:1.3 Rev: src/nettle/pgp-encode.c:1.4 Rev: src/nettle/pkcs1-rsa-md5.c:1.2 Rev: src/nettle/pkcs1-rsa-sha1.c:1.2 Rev: src/nettle/pkcs1.c:1.2 Rev: src/nettle/realloc.c:1.3 Rev: src/nettle/rsa-compat.c:1.8 Rev: src/nettle/rsa-decrypt.c:1.4 Rev: src/nettle/rsa-encrypt.c:1.5 Rev: src/nettle/rsa-keygen.c:1.5 Rev: src/nettle/rsa-md5-sign.c:1.2 Rev: src/nettle/rsa-md5-verify.c:1.2 Rev: src/nettle/rsa-sha1-sign.c:1.2 Rev: src/nettle/rsa-sha1-verify.c:1.2 Rev: src/nettle/rsa-sign.c:1.3 Rev: src/nettle/rsa-verify.c:1.2 Rev: src/nettle/rsa.c:1.12 Rev: src/nettle/rsa2openpgp.c:1.2 Rev: src/nettle/rsa2sexp.c:1.7 Rev: src/nettle/serpent-meta.c:1.2 Rev: src/nettle/serpent.c:1.4 Rev: src/nettle/sexp-format.c:1.9 Rev: src/nettle/sexp-transport-format.c:1.2 Rev: src/nettle/sexp-transport.c:1.4 Rev: src/nettle/sexp.c:1.14 Rev: src/nettle/sexp2bignum.c:1.5 Rev: src/nettle/sexp2dsa.c:1.4 Rev: src/nettle/sexp2rsa.c:1.11 Rev: src/nettle/sha1-meta.c:1.2 Rev: src/nettle/sha1.c:1.8 Rev: src/nettle/sha256-meta.c:1.2 Rev: src/nettle/sha256.c:1.3 Rev: src/nettle/tools/input.c:1.2 Rev: src/nettle/tools/misc.c:1.2 Rev: src/nettle/tools/output.c:1.3 Rev: src/nettle/tools/parse.c:1.2 Rev: src/nettle/tools/sexp-conv.c:1.14 Rev: src/nettle/twofish-meta.c:1.2 Rev: src/nettle/twofish.c:1.6 Rev: src/nettle/yarrow256.c:1.17 Rev: src/nettle/yarrow_key_event.c:1.4
-rw-r--r--ChangeLog5
-rw-r--r--aes-decrypt-table.c4
-rw-r--r--aes-decrypt.c6
-rw-r--r--aes-encrypt-table.c4
-rw-r--r--aes-encrypt.c6
-rw-r--r--aes-meta.c4
-rw-r--r--aes-set-decrypt-key.c6
-rw-r--r--aes-set-encrypt-key.c6
-rw-r--r--aes.c8
-rw-r--r--aesdata.c6
-rw-r--r--arcfour-meta.c4
-rw-r--r--arcfour.c6
-rw-r--r--base16-decode.c6
-rw-r--r--base16-encode.c4
-rw-r--r--base16-meta.c4
-rw-r--r--base64-decode.c6
-rw-r--r--base64-encode.c5
-rw-r--r--base64-meta.c4
-rw-r--r--bignum-random.c6
-rw-r--r--bignum.c6
-rw-r--r--blowfish.c8
-rw-r--r--buffer-init.c8
-rw-r--r--buffer.c6
-rw-r--r--cast128-meta.c4
-rw-r--r--cast128.c8
-rw-r--r--cbc.c10
-rw-r--r--des-compat.c10
-rw-r--r--des.c8
-rw-r--r--des3.c4
-rw-r--r--dsa-keygen.c6
-rw-r--r--dsa-sign.c6
-rw-r--r--dsa-verify.c6
-rw-r--r--dsa.c2
-rw-r--r--examples/io.c6
-rw-r--r--examples/nettle-benchmark.c23
-rw-r--r--examples/nettle-openssl.c6
-rw-r--r--examples/rsa-keygen.c16
-rw-r--r--examples/rsa-sign.c4
-rw-r--r--examples/rsa-verify.c9
-rw-r--r--hmac-md5.c4
-rw-r--r--hmac-sha1.c4
-rw-r--r--hmac-sha256.c4
-rw-r--r--hmac.c10
-rw-r--r--knuth-lfib.c10
-rw-r--r--md5-compat.c4
-rw-r--r--md5-meta.c4
-rw-r--r--md5.c10
-rw-r--r--memxor.c4
-rw-r--r--nettle-internal.c10
-rw-r--r--pgp-encode.c12
-rw-r--r--pkcs1-rsa-md5.c10
-rw-r--r--pkcs1-rsa-sha1.c10
-rw-r--r--pkcs1.c6
-rw-r--r--realloc.c4
-rw-r--r--rsa-compat.c2
-rw-r--r--rsa-decrypt.c10
-rw-r--r--rsa-encrypt.c10
-rw-r--r--rsa-keygen.c8
-rw-r--r--rsa-md5-sign.c6
-rw-r--r--rsa-md5-verify.c6
-rw-r--r--rsa-sha1-sign.c8
-rw-r--r--rsa-sha1-verify.c6
-rw-r--r--rsa-sign.c2
-rw-r--r--rsa-verify.c2
-rw-r--r--rsa.c6
-rw-r--r--rsa2openpgp.c8
-rw-r--r--rsa2sexp.c2
-rw-r--r--serpent-meta.c4
-rw-r--r--serpent.c9
-rw-r--r--sexp-format.c8
-rw-r--r--sexp-transport-format.c4
-rw-r--r--sexp-transport.c10
-rw-r--r--sexp.c10
-rw-r--r--sexp2bignum.c2
-rw-r--r--sexp2dsa.c6
-rw-r--r--sexp2rsa.c6
-rw-r--r--sha1-meta.c4
-rw-r--r--sha1.c10
-rw-r--r--sha256-meta.c4
-rw-r--r--sha256.c10
-rw-r--r--tools/input.c6
-rw-r--r--tools/misc.c6
-rw-r--r--tools/output.c6
-rw-r--r--tools/parse.c10
-rw-r--r--tools/sexp-conv.c20
-rw-r--r--twofish-meta.c4
-rw-r--r--twofish.c10
-rw-r--r--yarrow256.c10
-rw-r--r--yarrow_key_event.c4
89 files changed, 412 insertions, 189 deletions
diff --git a/ChangeLog b/ChangeLog
index de37089d..fcff246d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-12 Niels Möller <nisse@cuckoo.hack.org>
+
+ * Reordered includes in most or all .c-files. All should now
+ include config.h.
+
2003-05-12 Niels Möller <niels@s3.kth.se>
* configure.ac: Use LSH_FUNC_ALLOCA.
diff --git a/aes-decrypt-table.c b/aes-decrypt-table.c
index 8eceb2bc..b975b39d 100644
--- a/aes-decrypt-table.c
+++ b/aes-decrypt-table.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "aes-internal.h"
const struct aes_table
diff --git a/aes-decrypt.c b/aes-decrypt.c
index 50b7f86f..5eedffbd 100644
--- a/aes-decrypt.c
+++ b/aes-decrypt.c
@@ -23,10 +23,14 @@
* MA 02111-1307, USA.
*/
-#include "aes-internal.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
+#include "aes-internal.h"
+
void
aes_decrypt(struct aes_ctx *ctx,
unsigned length, uint8_t *dst,
diff --git a/aes-encrypt-table.c b/aes-encrypt-table.c
index 89f79673..de21ff9c 100644
--- a/aes-encrypt-table.c
+++ b/aes-encrypt-table.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "aes-internal.h"
/* Tables are assembled using little-endian byte order, including the
diff --git a/aes-encrypt.c b/aes-encrypt.c
index bc6a1cff..466ca372 100644
--- a/aes-encrypt.c
+++ b/aes-encrypt.c
@@ -23,10 +23,14 @@
* MA 02111-1307, USA.
*/
-#include "aes-internal.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
+#include "aes-internal.h"
+
/* On my sparc, encryption is significantly slower than decryption,
* even though the *only* difference is which table is passed to _aes_crypt.
*
diff --git a/aes-meta.c b/aes-meta.c
index db2a84f0..7b6fc5ac 100644
--- a/aes-meta.c
+++ b/aes-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "aes.h"
diff --git a/aes-set-decrypt-key.c b/aes-set-decrypt-key.c
index 0247a6e2..e0b75ea1 100644
--- a/aes-set-decrypt-key.c
+++ b/aes-set-decrypt-key.c
@@ -25,9 +25,13 @@
/* Originally written by Rafael R. Sevilla <dido@pacific.net.ph> */
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "aes-internal.h"
-/* Tables for comoutations in the AES GF2 field. */
+/* Tables for computations in the AES GF2 field. */
static const uint8_t log[0x100] =
{
0x00,0x00,0x19,0x01,0x32,0x02,0x1a,0xc6,
diff --git a/aes-set-encrypt-key.c b/aes-set-encrypt-key.c
index 1dcf05fb..63fb1b46 100644
--- a/aes-set-encrypt-key.c
+++ b/aes-set-encrypt-key.c
@@ -25,10 +25,14 @@
/* Originally written by Rafael R. Sevilla <dido@pacific.net.ph> */
-#include "aes-internal.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
+#include "aes-internal.h"
+
/* Tables for comoutations in the AES GF2 field. */
static const uint8_t log[0x100] =
{
diff --git a/aes.c b/aes.c
index cf7ed328..bf5c827c 100644
--- a/aes.c
+++ b/aes.c
@@ -25,12 +25,16 @@
/* Originally written by Rafael R. Sevilla <dido@pacific.net.ph> */
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
+
#include "aes-internal.h"
#include "macros.h"
-#include <assert.h>
-
#ifndef AES_DEBUG
# define AES_DEBUG 0
#endif
diff --git a/aesdata.c b/aesdata.c
index cb6a5d87..babb382f 100644
--- a/aesdata.c
+++ b/aesdata.c
@@ -1,3 +1,7 @@
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <assert.h>
#include <inttypes.h>
#include <stdlib.h>
@@ -38,7 +42,7 @@ xtime(unsigned x)
return x;
}
-/* Computes the expoenntiatiom and logarithm tables for GF_2, to the
+/* Computes the exponentiatiom and logarithm tables for GF_2, to the
* base x+1 (0x03). The unit element is 1 (0x01).*/
static void
compute_log(void)
diff --git a/arcfour-meta.c b/arcfour-meta.c
index 0886a619..af988ce4 100644
--- a/arcfour-meta.c
+++ b/arcfour-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "arcfour.h"
diff --git a/arcfour.c b/arcfour.c
index 70d0fd35..03c9cd88 100644
--- a/arcfour.c
+++ b/arcfour.c
@@ -23,10 +23,14 @@
* MA 02111-1307, USA.
*/
-#include "arcfour.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
+#include "arcfour.h"
+
#define SWAP(a,b) do { int _t = a; a = b; b = _t; } while(0)
void
diff --git a/base16-decode.c b/base16-decode.c
index a5e6185c..a76d0fe2 100644
--- a/base16-decode.c
+++ b/base16-decode.c
@@ -23,11 +23,15 @@
* MA 02111-1307, USA.
*/
-#include "base16.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <stdlib.h>
+#include "base16.h"
+
void
base16_decode_init(struct base16_decode_ctx *ctx)
{
diff --git a/base16-encode.c b/base16-encode.c
index 48ce3006..bc95bc90 100644
--- a/base16-encode.c
+++ b/base16-encode.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "base16.h"
diff --git a/base16-meta.c b/base16-meta.c
index 89d9a27d..b3709f39 100644
--- a/base16-meta.c
+++ b/base16-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "base16.h"
diff --git a/base64-decode.c b/base64-decode.c
index c1c0d2f0..0ead7325 100644
--- a/base64-decode.c
+++ b/base64-decode.c
@@ -22,11 +22,15 @@
* MA 02111-1307, USA.
*/
-#include "base64.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <stdlib.h>
+#include "base64.h"
+
#define TABLE_INVALID -1
#define TABLE_SPACE -2
#define TABLE_END -3
diff --git a/base64-encode.c b/base64-encode.c
index 02aa14a6..6fc5e6ba 100644
--- a/base64-encode.c
+++ b/base64-encode.c
@@ -22,11 +22,14 @@
* MA 02111-1307, USA.
*/
-#include "base64.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <stdlib.h>
+#include "base64.h"
static const uint8_t encode_table[64] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
diff --git a/base64-meta.c b/base64-meta.c
index 1c827db8..608e7b64 100644
--- a/base64-meta.c
+++ b/base64-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "base64.h"
diff --git a/bignum-random.c b/bignum-random.c
index 145ed9b0..9b1a404b 100644
--- a/bignum-random.c
+++ b/bignum-random.c
@@ -24,15 +24,15 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if HAVE_LIBGMP
-#include "bignum.h"
-
#include <stdlib.h>
+#include "bignum.h"
+
void
nettle_mpz_random_size(mpz_t x,
void *ctx, nettle_random_func random,
diff --git a/bignum.c b/bignum.c
index 59bca94e..f9f12034 100644
--- a/bignum.c
+++ b/bignum.c
@@ -24,16 +24,16 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if HAVE_LIBGMP
-#include "bignum.h"
-
#include <assert.h>
#include <string.h>
+#include "bignum.h"
+
/* Two's complement negation means that -x = ~x + 1, ~x = -(x+1),
* and we use that x = ~~x = ~(-x-1).
*
diff --git a/blowfish.c b/blowfish.c
index fa0657e0..3cfb76c3 100644
--- a/blowfish.c
+++ b/blowfish.c
@@ -31,12 +31,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
+
#include "blowfish.h"
#include "macros.h"
-#include <assert.h>
-
/* Initial keysetup state */
static const struct blowfish_ctx
initial_ctx =
diff --git a/buffer-init.c b/buffer-init.c
index 242cacad..1eccd7fc 100644
--- a/buffer-init.c
+++ b/buffer-init.c
@@ -22,11 +22,15 @@
* MA 02111-1307, USA.
*/
-#include "buffer.h"
-#include "realloc.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <stdlib.h>
+#include "buffer.h"
+#include "realloc.h"
+
/* This is in a separate file so that we don't link in realloc in
* programs that don't need it. */
diff --git a/buffer.c b/buffer.c
index fe875412..4e96b552 100644
--- a/buffer.c
+++ b/buffer.c
@@ -23,12 +23,16 @@
* MA 02111-1307, USA.
*/
-#include "buffer.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include "buffer.h"
+
int
nettle_buffer_grow(struct nettle_buffer *buffer,
unsigned length)
diff --git a/cast128-meta.c b/cast128-meta.c
index a0343722..5c15a08e 100644
--- a/cast128-meta.c
+++ b/cast128-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "cast128.h"
diff --git a/cast128.c b/cast128.c
index 75783e5d..4abbafb3 100644
--- a/cast128.c
+++ b/cast128.c
@@ -29,13 +29,17 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
+
#include "cast128.h"
#include "cast128_sboxes.h"
#include "macros.h"
-#include <assert.h>
-
#define CAST_SMALL_KEY 10
#define CAST_SMALL_ROUNDS 12
#define CAST_FULL_ROUNDS 16
diff --git a/cbc.c b/cbc.c
index 0eb96f02..7e9b4a3a 100644
--- a/cbc.c
+++ b/cbc.c
@@ -23,14 +23,18 @@
* MA 02111-1307, USA.
*/
-#include "cbc.h"
-
-#include "memxor.h"
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include "cbc.h"
+
+#include "memxor.h"
+
void
cbc_encrypt(void *ctx, void (*f)(void *ctx,
unsigned length, uint8_t *dst,
diff --git a/des-compat.c b/des-compat.c
index da8f61a6..51aada3e 100644
--- a/des-compat.c
+++ b/des-compat.c
@@ -23,15 +23,19 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <string.h>
+#include <assert.h>
+
#include "des-compat.h"
#include "cbc.h"
#include "macros.h"
#include "memxor.h"
-#include <string.h>
-#include <assert.h>
-
struct des_compat_des3 { struct des_ctx *keys[3]; };
typedef void (*cbc_crypt_func)(void *, uint32_t, uint8_t *, const uint8_t *);
diff --git a/des.c b/des.c
index 9f4f3252..cccfe0d4 100644
--- a/des.c
+++ b/des.c
@@ -30,12 +30,16 @@
* Please see the file `descore.README' for the complete copyright notice.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
+
#include "des.h"
#include "desCode.h"
-#include <assert.h>
-
static ENCRYPT(DesSmallFipsEncrypt,TEMPSMALL, LOADFIPS,KEYMAPSMALL,SAVEFIPS)
static DECRYPT(DesSmallFipsDecrypt,TEMPSMALL, LOADFIPS,KEYMAPSMALL,SAVEFIPS)
diff --git a/des3.c b/des3.c
index 85186c33..6bba214d 100644
--- a/des3.c
+++ b/des3.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "des.h"
/* It's possible to make some more general pipe construction, like the
diff --git a/dsa-keygen.c b/dsa-keygen.c
index 0e2b9cb7..2bd9fd66 100644
--- a/dsa-keygen.c
+++ b/dsa-keygen.c
@@ -24,18 +24,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <stdlib.h>
+
#include "dsa.h"
#include "bignum.h"
#include "memxor.h"
-#include <stdlib.h>
-
/* The (slow) NIST method of generating DSA primes. Algorithm 4.56 of
* Handbook of Applied Cryptography. */
diff --git a/dsa-sign.c b/dsa-sign.c
index 605a8ca0..7204e7fc 100644
--- a/dsa-sign.c
+++ b/dsa-sign.c
@@ -24,17 +24,17 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <stdlib.h>
+
#include "dsa.h"
#include "bignum.h"
-#include <stdlib.h>
-
void
dsa_sign_digest(const struct dsa_public_key *pub,
diff --git a/dsa-verify.c b/dsa-verify.c
index 87c2a48a..798f1ab8 100644
--- a/dsa-verify.c
+++ b/dsa-verify.c
@@ -24,17 +24,17 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <stdlib.h>
+
#include "dsa.h"
#include "bignum.h"
-#include <stdlib.h>
-
int
dsa_verify_digest(const struct dsa_public_key *key,
const uint8_t *digest,
diff --git a/dsa.c b/dsa.c
index 8b9a37d6..ed733b6c 100644
--- a/dsa.c
+++ b/dsa.c
@@ -24,7 +24,7 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
diff --git a/examples/io.c b/examples/io.c
index 34d69082..48d7b801 100644
--- a/examples/io.c
+++ b/examples/io.c
@@ -25,13 +25,13 @@
#if HAVE_CONFIG_H
# include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include "io.h"
+#endif
#include <stdarg.h>
#include <stdlib.h>
+#include "io.h"
+
#define RANDOM_DEVICE "/dev/urandom"
#define BUFSIZE 1000
diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c
index 98799c1c..49e39f98 100644
--- a/examples/nettle-benchmark.c
+++ b/examples/nettle-benchmark.c
@@ -26,7 +26,15 @@
#if HAVE_CONFIG_H
# include "config.h"
-#endif /* HAVE_CONFIG_H */
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <time.h>
#include "aes.h"
#include "arcfour.h"
@@ -41,19 +49,6 @@
#include "cbc.h"
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <time.h>
-
-#if __GNUC__
-# define UNUSED __attribute__ ((__unused__))
-#else
-# define UNUSED
-#endif
/* Encrypt 10MB, 1K at a time. */
#define BENCH_BLOCK 1024
diff --git a/examples/nettle-openssl.c b/examples/nettle-openssl.c
index 029fc637..f50490aa 100644
--- a/examples/nettle-openssl.c
+++ b/examples/nettle-openssl.c
@@ -25,19 +25,19 @@
#if HAVE_CONFIG_H
# include "config.h"
-#endif /* HAVE_CONFIG_H */
+#endif
/* Openssl glue, for comparative benchmarking only */
#if HAVE_LIBCRYPTO
-#include "nettle-internal.h"
+#include <assert.h>
#include <openssl/blowfish.h>
#include <openssl/des.h>
#include <openssl/cast.h>
-#include <assert.h>
+#include "nettle-internal.h"
/* Blowfish */
diff --git a/examples/rsa-keygen.c b/examples/rsa-keygen.c
index 95c29b94..da11eda8 100644
--- a/examples/rsa-keygen.c
+++ b/examples/rsa-keygen.c
@@ -22,12 +22,9 @@
* MA 02111-1307, USA.
*/
-#include "buffer.h"
-#include "rsa.h"
-#include "sexp.h"
-#include "yarrow.h"
-
-#include "io.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <ctype.h>
#include <errno.h>
@@ -38,6 +35,13 @@
/* For getopt */
#include <unistd.h>
+#include "buffer.h"
+#include "rsa.h"
+#include "sexp.h"
+#include "yarrow.h"
+
+#include "io.h"
+
#define KEYSIZE 500
#define ESIZE 30
diff --git a/examples/rsa-sign.c b/examples/rsa-sign.c
index ad653a53..3a97b26c 100644
--- a/examples/rsa-sign.c
+++ b/examples/rsa-sign.c
@@ -22,6 +22,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/examples/rsa-verify.c b/examples/rsa-verify.c
index 95fa608d..ad808d0f 100644
--- a/examples/rsa-verify.c
+++ b/examples/rsa-verify.c
@@ -22,15 +22,18 @@
* MA 02111-1307, USA.
*/
-
-#include "rsa.h"
-#include "io.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include "rsa.h"
+#include "io.h"
+
static int
read_signature(const char *name, mpz_t s)
{
diff --git a/hmac-md5.c b/hmac-md5.c
index 647d0e6e..99ce1f93 100644
--- a/hmac-md5.c
+++ b/hmac-md5.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "hmac.h"
void
diff --git a/hmac-sha1.c b/hmac-sha1.c
index fab0fe4d..64c079e5 100644
--- a/hmac-sha1.c
+++ b/hmac-sha1.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "hmac.h"
void
diff --git a/hmac-sha256.c b/hmac-sha256.c
index df285c59..9ead853b 100644
--- a/hmac-sha256.c
+++ b/hmac-sha256.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "hmac.h"
void
diff --git a/hmac.c b/hmac.c
index c4fc7f02..2d8a61f6 100644
--- a/hmac.c
+++ b/hmac.c
@@ -23,13 +23,17 @@
* MA 02111-1307, USA.
*/
-#include "hmac.h"
-
-#include "memxor.h"
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
#include <assert.h>
#include <string.h>
+#include "hmac.h"
+
+#include "memxor.h"
+
#define IPAD 0x36
#define OPAD 0x5c
diff --git a/knuth-lfib.c b/knuth-lfib.c
index 4188a066..bb867d2f 100644
--- a/knuth-lfib.c
+++ b/knuth-lfib.c
@@ -31,13 +31,17 @@
* applications. It is useful for generating deterministic but
* random-looking test data, and is used by the Nettle testsuite. */
-#include "knuth-lfib.h"
-
-#include "macros.h"
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
+#include "knuth-lfib.h"
+
+#include "macros.h"
+
#define KK _KNUTH_LFIB_KK
#define LL 37
#define MM (1UL << 30)
diff --git a/md5-compat.c b/md5-compat.c
index f6e0acf1..1ed7b29a 100644
--- a/md5-compat.c
+++ b/md5-compat.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include "md5-compat.h"
void
diff --git a/md5-meta.c b/md5-meta.c
index f0af2379..1bf34ccc 100644
--- a/md5-meta.c
+++ b/md5-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include "nettle-meta.h"
#include "md5.h"
diff --git a/md5.c b/md5.c
index e1a25421..bdfc51c3 100644
--- a/md5.c
+++ b/md5.c
@@ -26,13 +26,17 @@
/* Based on public domain code hacked by Colin Plumb, Andrew Kuchling, and
* Niels Möller. */
-#include "md5.h"
-
-#include "macros.h"
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
#include <assert.h>
#include <string.h>
+#include "md5.h"
+
+#include "macros.h"
+
/* A block, treated as a sequence of 32-bit words. */
#define MD5_DATA_LENGTH 16
diff --git a/memxor.c b/memxor.c
index b3a8ae22..990b40f4 100644
--- a/memxor.c
+++ b/memxor.c
@@ -7,6 +7,10 @@
if the source overlaps with the destination.
Return DESTADDR. */
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include "memxor.h"
uint8_t *memxor(uint8_t *dst, const uint8_t *src, size_t n)
diff --git a/nettle-internal.c b/nettle-internal.c
index 52e79b0b..069dcce3 100644
--- a/nettle-internal.c
+++ b/nettle-internal.c
@@ -24,13 +24,17 @@
* MA 02111-1307, USA.
*/
-#include "nettle-internal.h"
-#include "des.h"
-#include "blowfish.h"
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
+#include "nettle-internal.h"
+#include "des.h"
+#include "blowfish.h"
+
/* DES uses a different signature for the key set function.
* And we have to adjust parity. */
static void
diff --git a/pgp-encode.c b/pgp-encode.c
index 744326ef..aa4b96b5 100644
--- a/pgp-encode.c
+++ b/pgp-encode.c
@@ -23,16 +23,20 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "pgp.h"
#include "base64.h"
#include "buffer.h"
#include "macros.h"
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
int
pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i)
{
diff --git a/pkcs1-rsa-md5.c b/pkcs1-rsa-md5.c
index 5273ee8e..c337232d 100644
--- a/pkcs1-rsa-md5.c
+++ b/pkcs1-rsa-md5.c
@@ -24,20 +24,20 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "rsa.h"
#include "bignum.h"
#include "pkcs1.h"
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
/* From pkcs-1v2
*
* md5 OBJECT IDENTIFIER ::=
diff --git a/pkcs1-rsa-sha1.c b/pkcs1-rsa-sha1.c
index 95174119..b2f94a89 100644
--- a/pkcs1-rsa-sha1.c
+++ b/pkcs1-rsa-sha1.c
@@ -24,20 +24,20 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "rsa.h"
#include "bignum.h"
#include "pkcs1.h"
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
/* From pkcs-1v2
*
* id-sha1 OBJECT IDENTIFIER ::=
diff --git a/pkcs1.c b/pkcs1.c
index 104af2ac..f8893691 100644
--- a/pkcs1.c
+++ b/pkcs1.c
@@ -24,16 +24,16 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
-#include "pkcs1.h"
-
#include <assert.h>
#include <string.h>
+#include "pkcs1.h"
+
void
pkcs1_signature_prefix(unsigned length,
uint8_t *buffer,
diff --git a/realloc.c b/realloc.c
index 59500dfa..57e6d428 100644
--- a/realloc.c
+++ b/realloc.c
@@ -26,11 +26,11 @@
# include "config.h"
#endif
-#include "realloc.h"
-
#include <stdlib.h>
#include <stdio.h>
+#include "realloc.h"
+
void *
nettle_realloc(void *ctx UNUSED, void *p, unsigned length)
{
diff --git a/rsa-compat.c b/rsa-compat.c
index a5db6755..6e994385 100644
--- a/rsa-compat.c
+++ b/rsa-compat.c
@@ -24,7 +24,7 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
diff --git a/rsa-decrypt.c b/rsa-decrypt.c
index 41f720a0..6f53c3db 100644
--- a/rsa-decrypt.c
+++ b/rsa-decrypt.c
@@ -24,19 +24,19 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
-#include "rsa.h"
-
-#include "bignum.h"
-
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include "rsa.h"
+
+#include "bignum.h"
+
int
rsa_decrypt(const struct rsa_private_key *key,
unsigned *length, uint8_t *message,
diff --git a/rsa-encrypt.c b/rsa-encrypt.c
index 66a08c0f..8dbf04bc 100644
--- a/rsa-encrypt.c
+++ b/rsa-encrypt.c
@@ -24,19 +24,19 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
-#include "rsa.h"
-
-#include "bignum.h"
-
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include "rsa.h"
+
+#include "bignum.h"
+
int
rsa_encrypt(const struct rsa_public_key *key,
/* For padding */
diff --git a/rsa-keygen.c b/rsa-keygen.c
index 14f0063a..fc465f6f 100644
--- a/rsa-keygen.c
+++ b/rsa-keygen.c
@@ -24,18 +24,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
-#include "rsa.h"
-#include "bignum.h"
-
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
+#include "rsa.h"
+#include "bignum.h"
+
#ifndef DEBUG
# define DEBUG 0
#endif
diff --git a/rsa-md5-sign.c b/rsa-md5-sign.c
index 4bcaf717..710baa78 100644
--- a/rsa-md5-sign.c
+++ b/rsa-md5-sign.c
@@ -24,18 +24,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <assert.h>
+
#include "rsa.h"
#include "bignum.h"
#include "pkcs1.h"
-#include <assert.h>
-
void
rsa_md5_sign(const struct rsa_private_key *key,
struct md5_ctx *hash,
diff --git a/rsa-md5-verify.c b/rsa-md5-verify.c
index 727cc8e6..5b8d4341 100644
--- a/rsa-md5-verify.c
+++ b/rsa-md5-verify.c
@@ -24,18 +24,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <assert.h>
+
#include "rsa.h"
#include "bignum.h"
#include "pkcs1.h"
-#include <assert.h>
-
int
rsa_md5_verify(const struct rsa_public_key *key,
struct md5_ctx *hash,
diff --git a/rsa-sha1-sign.c b/rsa-sha1-sign.c
index d48bb802..a3eea7a6 100644
--- a/rsa-sha1-sign.c
+++ b/rsa-sha1-sign.c
@@ -24,18 +24,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
-#include "rsa.h"
+#include <assert.h>
+
+include "rsa.h"
#include "bignum.h"
#include "pkcs1.h"
-#include <assert.h>
-
void
rsa_sha1_sign(const struct rsa_private_key *key,
struct sha1_ctx *hash,
diff --git a/rsa-sha1-verify.c b/rsa-sha1-verify.c
index 717a392d..f1dd2fd8 100644
--- a/rsa-sha1-verify.c
+++ b/rsa-sha1-verify.c
@@ -24,18 +24,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <assert.h>
+
#include "rsa.h"
#include "bignum.h"
#include "pkcs1.h"
-#include <assert.h>
-
int
rsa_sha1_verify(const struct rsa_public_key *key,
struct sha1_ctx *hash,
diff --git a/rsa-sign.c b/rsa-sign.c
index 7eb46280..5a89b4ac 100644
--- a/rsa-sign.c
+++ b/rsa-sign.c
@@ -24,7 +24,7 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
diff --git a/rsa-verify.c b/rsa-verify.c
index 7a6d381f..c872dd02 100644
--- a/rsa-verify.c
+++ b/rsa-verify.c
@@ -24,7 +24,7 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
diff --git a/rsa.c b/rsa.c
index 1e1ffb8c..9fd77c92 100644
--- a/rsa.c
+++ b/rsa.c
@@ -24,7 +24,7 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
@@ -33,10 +33,6 @@
#include "bignum.h"
-/* FIXME: Perhaps we should split this into several functions, so that
- * one can link in the signature functions without also getting the
- * verify functions. */
-
void
rsa_public_key_init(struct rsa_public_key *key)
{
diff --git a/rsa2openpgp.c b/rsa2openpgp.c
index 87012855..f3f01f07 100644
--- a/rsa2openpgp.c
+++ b/rsa2openpgp.c
@@ -23,15 +23,19 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#if WITH_PUBLIC_KEY
+#include <time.h>
+
#include "rsa.h"
#include "buffer.h"
#include "pgp.h"
-#include <time.h>
-
/* According to RFC 2440, a public key consists of the following packets:
*
diff --git a/rsa2sexp.c b/rsa2sexp.c
index 75f5645c..26720aa9 100644
--- a/rsa2sexp.c
+++ b/rsa2sexp.c
@@ -23,7 +23,7 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
diff --git a/serpent-meta.c b/serpent-meta.c
index b95c49dc..204d2a16 100644
--- a/serpent-meta.c
+++ b/serpent-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "serpent.h"
diff --git a/serpent.c b/serpent.c
index 1e7cb419..db41b820 100644
--- a/serpent.c
+++ b/serpent.c
@@ -35,16 +35,17 @@
* selection process. No other use is allowed." However, the authors
* later decided to GPL the code. /nisse */
-/* FIXME: Use the READ_UINT32 and WRITE_UINT32 macros, where
- * applicable. */
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
#include "serpent.h"
#include "serpent_sboxes.h"
#include "macros.h"
-#include <assert.h>
-
void
serpent_set_key(struct serpent_ctx *ctx,
unsigned key_size, const uint8_t *key)
diff --git a/sexp-format.c b/sexp-format.c
index 134a081d..94601b6b 100644
--- a/sexp-format.c
+++ b/sexp-format.c
@@ -24,18 +24,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
-#include "sexp.h"
-#include "buffer.h"
-
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "sexp.h"
+#include "buffer.h"
+
#if HAVE_LIBGMP
# include "bignum.h"
#endif
diff --git a/sexp-transport-format.c b/sexp-transport-format.c
index feb685dc..c8ac89cd 100644
--- a/sexp-transport-format.c
+++ b/sexp-transport-format.c
@@ -23,6 +23,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "sexp.h"
#include "base64.h"
diff --git a/sexp-transport.c b/sexp-transport.c
index a0d7b1d3..37865e70 100644
--- a/sexp-transport.c
+++ b/sexp-transport.c
@@ -23,13 +23,17 @@
* MA 02111-1307, USA.
*/
-#include "sexp.h"
-
-#include "base64.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <string.h>
+#include "sexp.h"
+
+#include "base64.h"
+
/* NOTE: Decodes the input string in place */
int
sexp_transport_iterator_first(struct sexp_iterator *iterator,
diff --git a/sexp.c b/sexp.c
index e246211b..e6dce172 100644
--- a/sexp.c
+++ b/sexp.c
@@ -23,13 +23,17 @@
* MA 02111-1307, USA.
*/
-#include "sexp.h"
-
-#include "macros.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <stdlib.h>
#include <string.h>
+#include "sexp.h"
+
+#include "macros.h"
+
/* Initializes the iterator, but one has to call next to get to the
* first element. */
static void
diff --git a/sexp2bignum.c b/sexp2bignum.c
index e75e6988..56b5703e 100644
--- a/sexp2bignum.c
+++ b/sexp2bignum.c
@@ -23,7 +23,7 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if HAVE_LIBGMP
diff --git a/sexp2dsa.c b/sexp2dsa.c
index 4d99cf4a..cb76853f 100644
--- a/sexp2dsa.c
+++ b/sexp2dsa.c
@@ -23,18 +23,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <string.h>
+
#include "dsa.h"
#include "bignum.h"
#include "sexp.h"
-#include <string.h>
-
#define GET(x, l, v) \
do { \
if (!nettle_mpz_set_sexp((x), (l), (v)) \
diff --git a/sexp2rsa.c b/sexp2rsa.c
index f0084d60..48fe3abe 100644
--- a/sexp2rsa.c
+++ b/sexp2rsa.c
@@ -23,18 +23,18 @@
*/
#if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#if WITH_PUBLIC_KEY
+#include <string.h>
+
#include "rsa.h"
#include "bignum.h"
#include "sexp.h"
-#include <string.h>
-
#define GET(x, l, v) \
do { \
if (!nettle_mpz_set_sexp((x), (l), (v)) \
diff --git a/sha1-meta.c b/sha1-meta.c
index c2e0ebb6..d201da8a 100644
--- a/sha1-meta.c
+++ b/sha1-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "sha.h"
diff --git a/sha1.c b/sha1.c
index 18e644b9..391f5479 100644
--- a/sha1.c
+++ b/sha1.c
@@ -35,14 +35,18 @@
* effort (for example the reengineering of a great many Capstone chips).
*/
-#include "sha.h"
-
-#include "macros.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include "sha.h"
+
+#include "macros.h"
+
/* A block, treated as a sequence of 32-bit words. */
#define SHA1_DATA_LENGTH 16
diff --git a/sha256-meta.c b/sha256-meta.c
index f60c9fc6..c21c7924 100644
--- a/sha256-meta.c
+++ b/sha256-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "sha.h"
diff --git a/sha256.c b/sha256.c
index 76ce5f35..619cb721 100644
--- a/sha256.c
+++ b/sha256.c
@@ -25,14 +25,18 @@
/* Modelled after the sha1.c code by Peter Gutmann. */
-#include "sha.h"
-
-#include "macros.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include "sha.h"
+
+#include "macros.h"
+
/* A block, treated as a sequence of 32-bit words. */
#define SHA256_DATA_LENGTH 16
diff --git a/tools/input.c b/tools/input.c
index 4e9eda1c..69addb7e 100644
--- a/tools/input.c
+++ b/tools/input.c
@@ -20,13 +20,17 @@
* MA 02111-1307, USA.
*/
-#include "input.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include "input.h"
+
void
sexp_input_init(struct sexp_input *input, FILE *f)
{
diff --git a/tools/misc.c b/tools/misc.c
index 91c1d50c..c49f81b0 100644
--- a/tools/misc.c
+++ b/tools/misc.c
@@ -20,12 +20,16 @@
* MA 02111-1307, USA.
*/
-#include "misc.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include "misc.h"
+
void
die(const char *format, ...)
{
diff --git a/tools/output.c b/tools/output.c
index 53071d9e..d9735f5c 100644
--- a/tools/output.c
+++ b/tools/output.c
@@ -20,7 +20,9 @@
* MA 02111-1307, USA.
*/
-#include "output.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <errno.h>
@@ -28,6 +30,8 @@
#include <stdlib.h>
#include <string.h>
+#include "output.h"
+
void
sexp_output_init(struct sexp_output *output, FILE *f,
unsigned width, int prefer_hex)
diff --git a/tools/parse.c b/tools/parse.c
index 6c5f5ada..f48d2578 100644
--- a/tools/parse.c
+++ b/tools/parse.c
@@ -20,13 +20,17 @@
* MA 02111-1307, USA.
*/
-#include "parse.h"
-
-#include "input.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <stdlib.h>
+#include "parse.h"
+
+#include "input.h"
+
void
sexp_compound_token_init(struct sexp_compound_token *token)
{
diff --git a/tools/sexp-conv.c b/tools/sexp-conv.c
index 9e8bc547..0d614063 100644
--- a/tools/sexp-conv.c
+++ b/tools/sexp-conv.c
@@ -23,16 +23,9 @@
* MA 02111-1307, USA.
*/
-#define BUG_ADDRESS "nettle-bugs@lists.lysator.liu.se"
-
-#include "buffer.h"
-#include "nettle-meta.h"
-
-#include "getopt.h"
-
-#include "input.h"
-#include "output.h"
-#include "parse.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <errno.h>
@@ -40,9 +33,16 @@
#include <stdlib.h>
#include <string.h>
+#include "buffer.h"
+#include "nettle-meta.h"
+#include "getopt.h"
+#include "input.h"
+#include "output.h"
+#include "parse.h"
+#define BUG_ADDRESS "nettle-bugs@lists.lysator.liu.se"
/* Conversion functions. */
diff --git a/twofish-meta.c b/twofish-meta.c
index 7c3d065e..7e463256 100644
--- a/twofish-meta.c
+++ b/twofish-meta.c
@@ -20,6 +20,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "nettle-meta.h"
#include "twofish.h"
diff --git a/twofish.c b/twofish.c
index 2a341e84..9ebcf1b0 100644
--- a/twofish.c
+++ b/twofish.c
@@ -31,13 +31,17 @@
* MA 02111-1307, USA.
*/
-#include "twofish.h"
-
-#include "macros.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <string.h>
+#include "twofish.h"
+
+#include "macros.h"
+
/* Bitwise rotations on 32-bit words. These are defined as macros that
* evaluate their argument twice, so do not apply to any expressions with
* side effects.
diff --git a/yarrow256.c b/yarrow256.c
index 6a275d69..ba06fdc4 100644
--- a/yarrow256.c
+++ b/yarrow256.c
@@ -23,14 +23,18 @@
* MA 02111-1307, USA.
*/
-#include "yarrow.h"
-
-#include "macros.h"
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include "yarrow.h"
+
+#include "macros.h"
+
#ifndef YARROW_DEBUG
#define YARROW_DEBUG 0
#endif
diff --git a/yarrow_key_event.c b/yarrow_key_event.c
index 9b25c96c..92360d99 100644
--- a/yarrow_key_event.c
+++ b/yarrow_key_event.c
@@ -22,6 +22,10 @@
* MA 02111-1307, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "yarrow.h"
void