From 3ebe7d1b080e18d64dadfa0df08186fa5c8f0fae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Mon, 12 May 2003 21:39:51 +0200
Subject: [PATCH] * 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
---
 src/nettle/ChangeLog                   |  5 +++++
 src/nettle/aes-decrypt-table.c         |  4 ++++
 src/nettle/aes-decrypt.c               |  6 +++++-
 src/nettle/aes-encrypt-table.c         |  4 ++++
 src/nettle/aes-encrypt.c               |  6 +++++-
 src/nettle/aes-meta.c                  |  4 ++++
 src/nettle/aes-set-decrypt-key.c       |  6 +++++-
 src/nettle/aes-set-encrypt-key.c       |  6 +++++-
 src/nettle/aes.c                       |  8 ++++++--
 src/nettle/aesdata.c                   |  6 +++++-
 src/nettle/arcfour-meta.c              |  4 ++++
 src/nettle/arcfour.c                   |  6 +++++-
 src/nettle/base16-decode.c             |  6 +++++-
 src/nettle/base16-encode.c             |  4 ++++
 src/nettle/base16-meta.c               |  4 ++++
 src/nettle/base64-decode.c             |  6 +++++-
 src/nettle/base64-encode.c             |  5 ++++-
 src/nettle/base64-meta.c               |  4 ++++
 src/nettle/bignum-random.c             |  6 +++---
 src/nettle/bignum.c                    |  6 +++---
 src/nettle/blowfish.c                  |  8 ++++++--
 src/nettle/buffer-init.c               |  8 ++++++--
 src/nettle/buffer.c                    |  6 +++++-
 src/nettle/cast128-meta.c              |  4 ++++
 src/nettle/cast128.c                   |  8 ++++++--
 src/nettle/cbc.c                       | 10 +++++++---
 src/nettle/des-compat.c                | 10 +++++++---
 src/nettle/des.c                       |  8 ++++++--
 src/nettle/des3.c                      |  4 ++++
 src/nettle/dsa-keygen.c                |  6 +++---
 src/nettle/dsa-sign.c                  |  6 +++---
 src/nettle/dsa-verify.c                |  6 +++---
 src/nettle/dsa.c                       |  2 +-
 src/nettle/examples/io.c               |  6 +++---
 src/nettle/examples/nettle-benchmark.c | 23 +++++++++--------------
 src/nettle/examples/nettle-openssl.c   |  6 +++---
 src/nettle/examples/rsa-keygen.c       | 16 ++++++++++------
 src/nettle/examples/rsa-sign.c         |  4 ++++
 src/nettle/examples/rsa-verify.c       |  9 ++++++---
 src/nettle/hmac-md5.c                  |  4 ++++
 src/nettle/hmac-sha1.c                 |  4 ++++
 src/nettle/hmac-sha256.c               |  4 ++++
 src/nettle/hmac.c                      | 10 +++++++---
 src/nettle/knuth-lfib.c                | 10 +++++++---
 src/nettle/md5-compat.c                |  4 ++++
 src/nettle/md5-meta.c                  |  4 ++++
 src/nettle/md5.c                       | 10 +++++++---
 src/nettle/memxor.c                    |  4 ++++
 src/nettle/nettle-internal.c           | 10 +++++++---
 src/nettle/pgp-encode.c                | 12 ++++++++----
 src/nettle/pkcs1-rsa-md5.c             | 10 +++++-----
 src/nettle/pkcs1-rsa-sha1.c            | 10 +++++-----
 src/nettle/pkcs1.c                     |  6 +++---
 src/nettle/realloc.c                   |  4 ++--
 src/nettle/rsa-compat.c                |  2 +-
 src/nettle/rsa-decrypt.c               | 10 +++++-----
 src/nettle/rsa-encrypt.c               | 10 +++++-----
 src/nettle/rsa-keygen.c                |  8 ++++----
 src/nettle/rsa-md5-sign.c              |  6 +++---
 src/nettle/rsa-md5-verify.c            |  6 +++---
 src/nettle/rsa-sha1-sign.c             |  8 ++++----
 src/nettle/rsa-sha1-verify.c           |  6 +++---
 src/nettle/rsa-sign.c                  |  2 +-
 src/nettle/rsa-verify.c                |  2 +-
 src/nettle/rsa.c                       |  6 +-----
 src/nettle/rsa2openpgp.c               |  8 ++++++--
 src/nettle/rsa2sexp.c                  |  2 +-
 src/nettle/serpent-meta.c              |  4 ++++
 src/nettle/serpent.c                   |  9 +++++----
 src/nettle/sexp-format.c               |  8 ++++----
 src/nettle/sexp-transport-format.c     |  4 ++++
 src/nettle/sexp-transport.c            | 10 +++++++---
 src/nettle/sexp.c                      | 10 +++++++---
 src/nettle/sexp2bignum.c               |  2 +-
 src/nettle/sexp2dsa.c                  |  6 +++---
 src/nettle/sexp2rsa.c                  |  6 +++---
 src/nettle/sha1-meta.c                 |  4 ++++
 src/nettle/sha1.c                      | 10 +++++++---
 src/nettle/sha256-meta.c               |  4 ++++
 src/nettle/sha256.c                    | 10 +++++++---
 src/nettle/tools/input.c               |  6 +++++-
 src/nettle/tools/misc.c                |  6 +++++-
 src/nettle/tools/output.c              |  6 +++++-
 src/nettle/tools/parse.c               | 10 +++++++---
 src/nettle/tools/sexp-conv.c           | 20 ++++++++++----------
 src/nettle/twofish-meta.c              |  4 ++++
 src/nettle/twofish.c                   | 10 +++++++---
 src/nettle/yarrow256.c                 | 10 +++++++---
 src/nettle/yarrow_key_event.c          |  4 ++++
 89 files changed, 412 insertions(+), 189 deletions(-)

diff --git a/src/nettle/ChangeLog b/src/nettle/ChangeLog
index de37089da..fcff246da 100644
--- a/src/nettle/ChangeLog
+++ b/src/nettle/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/src/nettle/aes-decrypt-table.c b/src/nettle/aes-decrypt-table.c
index 8eceb2bce..b975b39d3 100644
--- a/src/nettle/aes-decrypt-table.c
+++ b/src/nettle/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/src/nettle/aes-decrypt.c b/src/nettle/aes-decrypt.c
index 50b7f86ff..5eedffbda 100644
--- a/src/nettle/aes-decrypt.c
+++ b/src/nettle/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/src/nettle/aes-encrypt-table.c b/src/nettle/aes-encrypt-table.c
index 89f796739..de21ff9cb 100644
--- a/src/nettle/aes-encrypt-table.c
+++ b/src/nettle/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/src/nettle/aes-encrypt.c b/src/nettle/aes-encrypt.c
index bc6a1cff6..466ca3722 100644
--- a/src/nettle/aes-encrypt.c
+++ b/src/nettle/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/src/nettle/aes-meta.c b/src/nettle/aes-meta.c
index db2a84f0e..7b6fc5ac3 100644
--- a/src/nettle/aes-meta.c
+++ b/src/nettle/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/src/nettle/aes-set-decrypt-key.c b/src/nettle/aes-set-decrypt-key.c
index 0247a6e2b..e0b75ea17 100644
--- a/src/nettle/aes-set-decrypt-key.c
+++ b/src/nettle/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/src/nettle/aes-set-encrypt-key.c b/src/nettle/aes-set-encrypt-key.c
index 1dcf05fb0..63fb1b46d 100644
--- a/src/nettle/aes-set-encrypt-key.c
+++ b/src/nettle/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/src/nettle/aes.c b/src/nettle/aes.c
index cf7ed3284..bf5c827cf 100644
--- a/src/nettle/aes.c
+++ b/src/nettle/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/src/nettle/aesdata.c b/src/nettle/aesdata.c
index cb6a5d87c..babb382fc 100644
--- a/src/nettle/aesdata.c
+++ b/src/nettle/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/src/nettle/arcfour-meta.c b/src/nettle/arcfour-meta.c
index 0886a6199..af988ce49 100644
--- a/src/nettle/arcfour-meta.c
+++ b/src/nettle/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/src/nettle/arcfour.c b/src/nettle/arcfour.c
index 70d0fd35f..03c9cd880 100644
--- a/src/nettle/arcfour.c
+++ b/src/nettle/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/src/nettle/base16-decode.c b/src/nettle/base16-decode.c
index a5e6185c9..a76d0fe29 100644
--- a/src/nettle/base16-decode.c
+++ b/src/nettle/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/src/nettle/base16-encode.c b/src/nettle/base16-encode.c
index 48ce3006c..bc95bc900 100644
--- a/src/nettle/base16-encode.c
+++ b/src/nettle/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/src/nettle/base16-meta.c b/src/nettle/base16-meta.c
index 89d9a27de..b3709f39c 100644
--- a/src/nettle/base16-meta.c
+++ b/src/nettle/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/src/nettle/base64-decode.c b/src/nettle/base64-decode.c
index c1c0d2f08..0ead7325d 100644
--- a/src/nettle/base64-decode.c
+++ b/src/nettle/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/src/nettle/base64-encode.c b/src/nettle/base64-encode.c
index 02aa14a65..6fc5e6ba1 100644
--- a/src/nettle/base64-encode.c
+++ b/src/nettle/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/src/nettle/base64-meta.c b/src/nettle/base64-meta.c
index 1c827db87..608e7b645 100644
--- a/src/nettle/base64-meta.c
+++ b/src/nettle/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/src/nettle/bignum-random.c b/src/nettle/bignum-random.c
index 145ed9b02..9b1a404b3 100644
--- a/src/nettle/bignum-random.c
+++ b/src/nettle/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/src/nettle/bignum.c b/src/nettle/bignum.c
index 59bca94e0..f9f12034b 100644
--- a/src/nettle/bignum.c
+++ b/src/nettle/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/src/nettle/blowfish.c b/src/nettle/blowfish.c
index fa0657e04..3cfb76c31 100644
--- a/src/nettle/blowfish.c
+++ b/src/nettle/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/src/nettle/buffer-init.c b/src/nettle/buffer-init.c
index 242cacad3..1eccd7fc7 100644
--- a/src/nettle/buffer-init.c
+++ b/src/nettle/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/src/nettle/buffer.c b/src/nettle/buffer.c
index fe8754126..4e96b552e 100644
--- a/src/nettle/buffer.c
+++ b/src/nettle/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/src/nettle/cast128-meta.c b/src/nettle/cast128-meta.c
index a0343722e..5c15a08e4 100644
--- a/src/nettle/cast128-meta.c
+++ b/src/nettle/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/src/nettle/cast128.c b/src/nettle/cast128.c
index 75783e5dd..4abbafb35 100644
--- a/src/nettle/cast128.c
+++ b/src/nettle/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/src/nettle/cbc.c b/src/nettle/cbc.c
index 0eb96f022..7e9b4a3a2 100644
--- a/src/nettle/cbc.c
+++ b/src/nettle/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/src/nettle/des-compat.c b/src/nettle/des-compat.c
index da8f61a62..51aada3e7 100644
--- a/src/nettle/des-compat.c
+++ b/src/nettle/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/src/nettle/des.c b/src/nettle/des.c
index 9f4f32522..cccfe0d46 100644
--- a/src/nettle/des.c
+++ b/src/nettle/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/src/nettle/des3.c b/src/nettle/des3.c
index 85186c336..6bba214de 100644
--- a/src/nettle/des3.c
+++ b/src/nettle/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/src/nettle/dsa-keygen.c b/src/nettle/dsa-keygen.c
index 0e2b9cb7e..2bd9fd660 100644
--- a/src/nettle/dsa-keygen.c
+++ b/src/nettle/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/src/nettle/dsa-sign.c b/src/nettle/dsa-sign.c
index 605a8ca0f..7204e7fc8 100644
--- a/src/nettle/dsa-sign.c
+++ b/src/nettle/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/src/nettle/dsa-verify.c b/src/nettle/dsa-verify.c
index 87c2a48a0..798f1ab86 100644
--- a/src/nettle/dsa-verify.c
+++ b/src/nettle/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/src/nettle/dsa.c b/src/nettle/dsa.c
index 8b9a37d61..ed733b6c4 100644
--- a/src/nettle/dsa.c
+++ b/src/nettle/dsa.c
@@ -24,7 +24,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
 #endif
 
 #if WITH_PUBLIC_KEY
diff --git a/src/nettle/examples/io.c b/src/nettle/examples/io.c
index 34d690825..48d7b801e 100644
--- a/src/nettle/examples/io.c
+++ b/src/nettle/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/src/nettle/examples/nettle-benchmark.c b/src/nettle/examples/nettle-benchmark.c
index 98799c1ca..49e39f987 100644
--- a/src/nettle/examples/nettle-benchmark.c
+++ b/src/nettle/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/src/nettle/examples/nettle-openssl.c b/src/nettle/examples/nettle-openssl.c
index 029fc637d..f50490aa2 100644
--- a/src/nettle/examples/nettle-openssl.c
+++ b/src/nettle/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/src/nettle/examples/rsa-keygen.c b/src/nettle/examples/rsa-keygen.c
index 95c29b94f..da11eda8b 100644
--- a/src/nettle/examples/rsa-keygen.c
+++ b/src/nettle/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/src/nettle/examples/rsa-sign.c b/src/nettle/examples/rsa-sign.c
index ad653a534..3a97b26c5 100644
--- a/src/nettle/examples/rsa-sign.c
+++ b/src/nettle/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/src/nettle/examples/rsa-verify.c b/src/nettle/examples/rsa-verify.c
index 95fa608d0..ad808d0f0 100644
--- a/src/nettle/examples/rsa-verify.c
+++ b/src/nettle/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/src/nettle/hmac-md5.c b/src/nettle/hmac-md5.c
index 647d0e6ed..99ce1f934 100644
--- a/src/nettle/hmac-md5.c
+++ b/src/nettle/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/src/nettle/hmac-sha1.c b/src/nettle/hmac-sha1.c
index fab0fe4d8..64c079e52 100644
--- a/src/nettle/hmac-sha1.c
+++ b/src/nettle/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/src/nettle/hmac-sha256.c b/src/nettle/hmac-sha256.c
index df285c59b..9ead853b5 100644
--- a/src/nettle/hmac-sha256.c
+++ b/src/nettle/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/src/nettle/hmac.c b/src/nettle/hmac.c
index c4fc7f02b..2d8a61f6a 100644
--- a/src/nettle/hmac.c
+++ b/src/nettle/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/src/nettle/knuth-lfib.c b/src/nettle/knuth-lfib.c
index 4188a0661..bb867d2ff 100644
--- a/src/nettle/knuth-lfib.c
+++ b/src/nettle/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/src/nettle/md5-compat.c b/src/nettle/md5-compat.c
index f6e0acf1a..1ed7b29ad 100644
--- a/src/nettle/md5-compat.c
+++ b/src/nettle/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/src/nettle/md5-meta.c b/src/nettle/md5-meta.c
index f0af23791..1bf34ccc3 100644
--- a/src/nettle/md5-meta.c
+++ b/src/nettle/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/src/nettle/md5.c b/src/nettle/md5.c
index e1a254214..bdfc51c33 100644
--- a/src/nettle/md5.c
+++ b/src/nettle/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/src/nettle/memxor.c b/src/nettle/memxor.c
index b3a8ae226..990b40f48 100644
--- a/src/nettle/memxor.c
+++ b/src/nettle/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/src/nettle/nettle-internal.c b/src/nettle/nettle-internal.c
index 52e79b0bc..069dcce3c 100644
--- a/src/nettle/nettle-internal.c
+++ b/src/nettle/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/src/nettle/pgp-encode.c b/src/nettle/pgp-encode.c
index 744326ef4..aa4b96b51 100644
--- a/src/nettle/pgp-encode.c
+++ b/src/nettle/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/src/nettle/pkcs1-rsa-md5.c b/src/nettle/pkcs1-rsa-md5.c
index 5273ee8ed..c337232dd 100644
--- a/src/nettle/pkcs1-rsa-md5.c
+++ b/src/nettle/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/src/nettle/pkcs1-rsa-sha1.c b/src/nettle/pkcs1-rsa-sha1.c
index 951741194..b2f94a896 100644
--- a/src/nettle/pkcs1-rsa-sha1.c
+++ b/src/nettle/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/src/nettle/pkcs1.c b/src/nettle/pkcs1.c
index 104af2acb..f88936916 100644
--- a/src/nettle/pkcs1.c
+++ b/src/nettle/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/src/nettle/realloc.c b/src/nettle/realloc.c
index 59500dfa7..57e6d428e 100644
--- a/src/nettle/realloc.c
+++ b/src/nettle/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/src/nettle/rsa-compat.c b/src/nettle/rsa-compat.c
index a5db67551..6e9943856 100644
--- a/src/nettle/rsa-compat.c
+++ b/src/nettle/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/src/nettle/rsa-decrypt.c b/src/nettle/rsa-decrypt.c
index 41f720a05..6f53c3dbf 100644
--- a/src/nettle/rsa-decrypt.c
+++ b/src/nettle/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/src/nettle/rsa-encrypt.c b/src/nettle/rsa-encrypt.c
index 66a08c0fa..8dbf04bc7 100644
--- a/src/nettle/rsa-encrypt.c
+++ b/src/nettle/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/src/nettle/rsa-keygen.c b/src/nettle/rsa-keygen.c
index 14f0063af..fc465f6ff 100644
--- a/src/nettle/rsa-keygen.c
+++ b/src/nettle/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/src/nettle/rsa-md5-sign.c b/src/nettle/rsa-md5-sign.c
index 4bcaf717a..710baa78a 100644
--- a/src/nettle/rsa-md5-sign.c
+++ b/src/nettle/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/src/nettle/rsa-md5-verify.c b/src/nettle/rsa-md5-verify.c
index 727cc8e6f..5b8d43410 100644
--- a/src/nettle/rsa-md5-verify.c
+++ b/src/nettle/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/src/nettle/rsa-sha1-sign.c b/src/nettle/rsa-sha1-sign.c
index d48bb802a..a3eea7a6a 100644
--- a/src/nettle/rsa-sha1-sign.c
+++ b/src/nettle/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/src/nettle/rsa-sha1-verify.c b/src/nettle/rsa-sha1-verify.c
index 717a392d5..f1dd2fd81 100644
--- a/src/nettle/rsa-sha1-verify.c
+++ b/src/nettle/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/src/nettle/rsa-sign.c b/src/nettle/rsa-sign.c
index 7eb46280d..5a89b4ac7 100644
--- a/src/nettle/rsa-sign.c
+++ b/src/nettle/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/src/nettle/rsa-verify.c b/src/nettle/rsa-verify.c
index 7a6d381fd..c872dd022 100644
--- a/src/nettle/rsa-verify.c
+++ b/src/nettle/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/src/nettle/rsa.c b/src/nettle/rsa.c
index 1e1ffb8c7..9fd77c92a 100644
--- a/src/nettle/rsa.c
+++ b/src/nettle/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/src/nettle/rsa2openpgp.c b/src/nettle/rsa2openpgp.c
index 87012855a..f3f01f07b 100644
--- a/src/nettle/rsa2openpgp.c
+++ b/src/nettle/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/src/nettle/rsa2sexp.c b/src/nettle/rsa2sexp.c
index 75f5645c7..26720aa9f 100644
--- a/src/nettle/rsa2sexp.c
+++ b/src/nettle/rsa2sexp.c
@@ -23,7 +23,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
 #endif
 
 #if WITH_PUBLIC_KEY
diff --git a/src/nettle/serpent-meta.c b/src/nettle/serpent-meta.c
index b95c49dc3..204d2a16f 100644
--- a/src/nettle/serpent-meta.c
+++ b/src/nettle/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/src/nettle/serpent.c b/src/nettle/serpent.c
index 1e7cb419c..db41b820e 100644
--- a/src/nettle/serpent.c
+++ b/src/nettle/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/src/nettle/sexp-format.c b/src/nettle/sexp-format.c
index 134a081d5..94601b6bc 100644
--- a/src/nettle/sexp-format.c
+++ b/src/nettle/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/src/nettle/sexp-transport-format.c b/src/nettle/sexp-transport-format.c
index feb685dcd..c8ac89cd4 100644
--- a/src/nettle/sexp-transport-format.c
+++ b/src/nettle/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/src/nettle/sexp-transport.c b/src/nettle/sexp-transport.c
index a0d7b1d36..37865e709 100644
--- a/src/nettle/sexp-transport.c
+++ b/src/nettle/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/src/nettle/sexp.c b/src/nettle/sexp.c
index e246211bb..e6dce172a 100644
--- a/src/nettle/sexp.c
+++ b/src/nettle/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/src/nettle/sexp2bignum.c b/src/nettle/sexp2bignum.c
index e75e6988c..56b5703e4 100644
--- a/src/nettle/sexp2bignum.c
+++ b/src/nettle/sexp2bignum.c
@@ -23,7 +23,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
 #endif
 
 #if HAVE_LIBGMP
diff --git a/src/nettle/sexp2dsa.c b/src/nettle/sexp2dsa.c
index 4d99cf4a7..cb76853fc 100644
--- a/src/nettle/sexp2dsa.c
+++ b/src/nettle/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/src/nettle/sexp2rsa.c b/src/nettle/sexp2rsa.c
index f0084d60b..48fe3abef 100644
--- a/src/nettle/sexp2rsa.c
+++ b/src/nettle/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/src/nettle/sha1-meta.c b/src/nettle/sha1-meta.c
index c2e0ebb6a..d201da8af 100644
--- a/src/nettle/sha1-meta.c
+++ b/src/nettle/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/src/nettle/sha1.c b/src/nettle/sha1.c
index 18e644b92..391f5479b 100644
--- a/src/nettle/sha1.c
+++ b/src/nettle/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/src/nettle/sha256-meta.c b/src/nettle/sha256-meta.c
index f60c9fc6e..c21c79244 100644
--- a/src/nettle/sha256-meta.c
+++ b/src/nettle/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/src/nettle/sha256.c b/src/nettle/sha256.c
index 76ce5f353..619cb7211 100644
--- a/src/nettle/sha256.c
+++ b/src/nettle/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/src/nettle/tools/input.c b/src/nettle/tools/input.c
index 4e9eda1cf..69addb7eb 100644
--- a/src/nettle/tools/input.c
+++ b/src/nettle/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/src/nettle/tools/misc.c b/src/nettle/tools/misc.c
index 91c1d50c6..c49f81b0d 100644
--- a/src/nettle/tools/misc.c
+++ b/src/nettle/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/src/nettle/tools/output.c b/src/nettle/tools/output.c
index 53071d9ee..d9735f5ca 100644
--- a/src/nettle/tools/output.c
+++ b/src/nettle/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/src/nettle/tools/parse.c b/src/nettle/tools/parse.c
index 6c5f5ada2..f48d25783 100644
--- a/src/nettle/tools/parse.c
+++ b/src/nettle/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/src/nettle/tools/sexp-conv.c b/src/nettle/tools/sexp-conv.c
index 9e8bc547a..0d6140634 100644
--- a/src/nettle/tools/sexp-conv.c
+++ b/src/nettle/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/src/nettle/twofish-meta.c b/src/nettle/twofish-meta.c
index 7c3d065ee..7e463256c 100644
--- a/src/nettle/twofish-meta.c
+++ b/src/nettle/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/src/nettle/twofish.c b/src/nettle/twofish.c
index 2a341e844..9ebcf1b0e 100644
--- a/src/nettle/twofish.c
+++ b/src/nettle/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/src/nettle/yarrow256.c b/src/nettle/yarrow256.c
index 6a275d69a..ba06fdc4f 100644
--- a/src/nettle/yarrow256.c
+++ b/src/nettle/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/src/nettle/yarrow_key_event.c b/src/nettle/yarrow_key_event.c
index 9b25c96ce..92360d99e 100644
--- a/src/nettle/yarrow_key_event.c
+++ b/src/nettle/yarrow_key_event.c
@@ -22,6 +22,10 @@
  * MA 02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include "yarrow.h"
 
 void
-- 
GitLab