aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--news.rst5
-rw-r--r--src/lib/asn1/asn1_obj.cpp2
-rw-r--r--src/lib/asn1/asn1_str.cpp1
-rw-r--r--src/lib/asn1/ber_dec.h2
-rw-r--r--src/lib/asn1/der_enc.cpp1
-rw-r--r--src/lib/base/scan_name.h3
-rw-r--r--src/lib/base/secmem.h3
-rw-r--r--src/lib/block/aes/aes.cpp1
-rw-r--r--src/lib/block/lion/lion.cpp1
-rw-r--r--src/lib/block/misty1/misty1.cpp1
-rw-r--r--src/lib/entropy/proc_walk/proc_walk.cpp1
-rw-r--r--src/lib/filters/codec_filt/hex_filt.cpp1
-rw-r--r--src/lib/filters/pipe.cpp1
-rw-r--r--src/lib/filters/pipe.h3
-rw-r--r--src/lib/filters/pipe_rw.cpp1
-rw-r--r--src/lib/hash/keccak/keccak.cpp1
-rw-r--r--src/lib/hash/sha3/sha3.cpp1
-rw-r--r--src/lib/hash/shake/shake.cpp1
-rw-r--r--src/lib/hash/skein/skein_512.cpp1
-rw-r--r--src/lib/hash/tiger/tiger.cpp1
-rw-r--r--src/lib/kdf/hkdf/hkdf.h1
-rw-r--r--src/lib/kdf/kdf.cpp6
-rw-r--r--src/lib/kdf/prf_tls/prf_tls.cpp1
-rw-r--r--src/lib/kdf/sp800_108/sp800_108.cpp1
-rw-r--r--src/lib/kdf/sp800_56a/sp800_56a.cpp1
-rw-r--r--src/lib/kdf/sp800_56c/sp800_56c.cpp2
-rw-r--r--src/lib/mac/gmac/gmac.h8
-rw-r--r--src/lib/math/bigint/big_rand.cpp2
-rw-r--r--src/lib/math/bigint/bigint.cpp2
-rw-r--r--src/lib/math/bigint/bigint.h4
-rw-r--r--src/lib/math/ec_gfp/curve_gfp.cpp1
-rw-r--r--src/lib/math/ec_gfp/curve_gfp.h2
-rw-r--r--src/lib/math/ec_gfp/point_gfp.cpp3
-rw-r--r--src/lib/math/numbertheory/dsa_gen.cpp3
-rw-r--r--src/lib/math/numbertheory/make_prm.cpp2
-rw-r--r--src/lib/math/numbertheory/numthry.cpp1
-rw-r--r--src/lib/math/numbertheory/numthry.h3
-rw-r--r--src/lib/misc/srp6/srp6.cpp2
-rw-r--r--src/lib/misc/srp6/srp6.h4
-rw-r--r--src/lib/misc/tss/tss.cpp2
-rw-r--r--src/lib/misc/tss/tss.h4
-rw-r--r--src/lib/modes/aead/aead.cpp1
-rw-r--r--src/lib/modes/aead/ccm/ccm.cpp2
-rw-r--r--src/lib/modes/aead/ccm/ccm.h2
-rw-r--r--src/lib/modes/aead/eax/eax.cpp1
-rw-r--r--src/lib/modes/aead/siv/siv.cpp1
-rw-r--r--src/lib/modes/cfb/cfb.cpp1
-rw-r--r--src/lib/modes/cipher_mode.cpp5
-rw-r--r--src/lib/modes/xts/xts.cpp1
-rw-r--r--src/lib/passhash/bcrypt/bcrypt.cpp3
-rw-r--r--src/lib/passhash/bcrypt/bcrypt.h4
-rw-r--r--src/lib/passhash/passhash9/passhash9.cpp1
-rw-r--r--src/lib/passhash/passhash9/passhash9.h4
-rw-r--r--src/lib/pbkdf/pbkdf2/pbkdf2.cpp1
-rw-r--r--src/lib/pbkdf/pbkdf2/pbkdf2.h1
-rw-r--r--src/lib/pk_pad/eme.cpp1
-rw-r--r--src/lib/pk_pad/eme.h3
-rw-r--r--src/lib/pk_pad/eme_oaep/oaep.cpp2
-rw-r--r--src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp2
-rw-r--r--src/lib/pk_pad/emsa.cpp1
-rw-r--r--src/lib/pk_pad/emsa.h3
-rw-r--r--src/lib/pk_pad/emsa1/emsa1.cpp1
-rw-r--r--src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp1
-rw-r--r--src/lib/pk_pad/emsa_pssr/pssr.cpp2
-rw-r--r--src/lib/pk_pad/emsa_raw/emsa_raw.cpp1
-rw-r--r--src/lib/pk_pad/emsa_x931/emsa_x931.cpp1
-rw-r--r--src/lib/pk_pad/iso9796/iso9796.cpp4
-rw-r--r--src/lib/pk_pad/mgf1/mgf1.cpp2
-rw-r--r--src/lib/pk_pad/mgf1/mgf1.h4
-rw-r--r--src/lib/prov/pkcs11/p11_ecdh.cpp1
-rw-r--r--src/lib/prov/pkcs11/p11_mechanism.cpp1
-rw-r--r--src/lib/pubkey/ecdh/ecdh.cpp1
-rw-r--r--src/lib/pubkey/ecies/ecies.cpp1
-rw-r--r--src/lib/pubkey/pk_algs.cpp1
-rw-r--r--src/lib/tls/tls_policy.cpp1
-rw-r--r--src/lib/tls/tls_policy.h1
-rw-r--r--src/lib/tls/tls_record.h1
-rw-r--r--src/lib/tls/tls_seq_numbers.h1
-rw-r--r--src/lib/utils/cpuid/cpuid.cpp1
-rw-r--r--src/lib/utils/exceptn.h1
-rw-r--r--src/lib/utils/http_util/http_util.h1
-rw-r--r--src/lib/utils/types.h10
-rw-r--r--src/lib/x509/name_constraint.cpp1
-rw-r--r--src/lib/x509/ocsp.cpp1
-rw-r--r--src/lib/x509/x509_ext.h1
-rw-r--r--src/lib/x509/x509cert.cpp3
-rw-r--r--src/tests/test_bigint.cpp1
-rw-r--r--src/tests/test_otp.cpp1
-rw-r--r--src/tests/test_x509_path.cpp1
-rw-r--r--src/tests/tests.cpp1
90 files changed, 92 insertions, 83 deletions
diff --git a/news.rst b/news.rst
index 4d2a565a5..56553e84b 100644
--- a/news.rst
+++ b/news.rst
@@ -164,6 +164,11 @@ Version 2.3.0, Not Yet Released
* Fix a bug in FFI tests that caused the test files not to be found when using
``--data-dir`` option (GH #1149)
+* Header files have been cleaned up to remove uncessary inclusions. In some
+ cases it may be required to include additional botan headers to get all the
+ declarations that were previously visible. For example, ``bigint.h`` no longer
+ includes ``rng.h``, but just forward declares ``RandomNumberGenerator``.
+
* Improved support for IBM xlc compiler.
Version 2.2.0, 2017-08-07
diff --git a/src/lib/asn1/asn1_obj.cpp b/src/lib/asn1/asn1_obj.cpp
index 4ccb11c3f..2dc73738c 100644
--- a/src/lib/asn1/asn1_obj.cpp
+++ b/src/lib/asn1/asn1_obj.cpp
@@ -7,9 +7,7 @@
#include <botan/asn1_obj.h>
#include <botan/der_enc.h>
-#include <botan/ber_dec.h>
#include <botan/data_src.h>
-#include <botan/parsing.h>
#include <botan/internal/stl_util.h>
namespace Botan {
diff --git a/src/lib/asn1/asn1_str.cpp b/src/lib/asn1/asn1_str.cpp
index 81012f284..526e10158 100644
--- a/src/lib/asn1/asn1_str.cpp
+++ b/src/lib/asn1/asn1_str.cpp
@@ -9,7 +9,6 @@
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
#include <botan/charset.h>
-#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/asn1/ber_dec.h b/src/lib/asn1/ber_dec.h
index e725ef583..75616ed16 100644
--- a/src/lib/asn1/ber_dec.h
+++ b/src/lib/asn1/ber_dec.h
@@ -8,7 +8,7 @@
#ifndef BOTAN_BER_DECODER_H_
#define BOTAN_BER_DECODER_H_
-#include <botan/asn1_oid.h>
+#include <botan/asn1_obj.h>
#include <botan/data_src.h>
namespace Botan {
diff --git a/src/lib/asn1/der_enc.cpp b/src/lib/asn1/der_enc.cpp
index 31955e915..141391a1d 100644
--- a/src/lib/asn1/der_enc.cpp
+++ b/src/lib/asn1/der_enc.cpp
@@ -9,7 +9,6 @@
#include <botan/asn1_obj.h>
#include <botan/bigint.h>
#include <botan/loadstor.h>
-#include <botan/parsing.h>
#include <botan/internal/bit_ops.h>
#include <algorithm>
diff --git a/src/lib/base/scan_name.h b/src/lib/base/scan_name.h
index 38f432f3a..9bc5afde8 100644
--- a/src/lib/base/scan_name.h
+++ b/src/lib/base/scan_name.h
@@ -8,10 +8,9 @@
#ifndef BOTAN_SCAN_NAME_H_
#define BOTAN_SCAN_NAME_H_
-#include <botan/exceptn.h>
+#include <botan/types.h>
#include <string>
#include <vector>
-#include <map>
namespace Botan {
diff --git a/src/lib/base/secmem.h b/src/lib/base/secmem.h
index cdcbb3236..5b77ed925 100644
--- a/src/lib/base/secmem.h
+++ b/src/lib/base/secmem.h
@@ -8,7 +8,8 @@
#ifndef BOTAN_SECURE_MEMORY_BUFFERS_H_
#define BOTAN_SECURE_MEMORY_BUFFERS_H_
-#include <botan/mem_ops.h>
+#include <botan/types.h> // IWYU pragma: export
+#include <botan/mem_ops.h> // IWYU pragma: export
#include <algorithm>
#include <vector>
#include <deque>
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp
index 0878d84ae..b4be14d3d 100644
--- a/src/lib/block/aes/aes.cpp
+++ b/src/lib/block/aes/aes.cpp
@@ -10,7 +10,6 @@
#include <botan/aes.h>
#include <botan/loadstor.h>
#include <botan/cpuid.h>
-#include <botan/internal/bit_ops.h>
/*
* This implementation is based on table lookups which are known to be
diff --git a/src/lib/block/lion/lion.cpp b/src/lib/block/lion/lion.cpp
index 4df22dd0b..7959de585 100644
--- a/src/lib/block/lion/lion.cpp
+++ b/src/lib/block/lion/lion.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/lion.h>
-#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/block/misty1/misty1.cpp b/src/lib/block/misty1/misty1.cpp
index 9afed9168..3e2677fce 100644
--- a/src/lib/block/misty1/misty1.cpp
+++ b/src/lib/block/misty1/misty1.cpp
@@ -7,7 +7,6 @@
#include <botan/misty1.h>
#include <botan/loadstor.h>
-#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/entropy/proc_walk/proc_walk.cpp b/src/lib/entropy/proc_walk/proc_walk.cpp
index 5132ac951..1fb040b1b 100644
--- a/src/lib/entropy/proc_walk/proc_walk.cpp
+++ b/src/lib/entropy/proc_walk/proc_walk.cpp
@@ -8,7 +8,6 @@
*/
#include <botan/internal/proc_walk.h>
-#include <botan/secmem.h>
#include <deque>
#ifndef _POSIX_C_SOURCE
diff --git a/src/lib/filters/codec_filt/hex_filt.cpp b/src/lib/filters/codec_filt/hex_filt.cpp
index 31e6b3824..ffaa7d567 100644
--- a/src/lib/filters/codec_filt/hex_filt.cpp
+++ b/src/lib/filters/codec_filt/hex_filt.cpp
@@ -7,7 +7,6 @@
#include <botan/hex_filt.h>
#include <botan/hex.h>
-#include <botan/parsing.h>
#include <botan/charset.h>
#include <botan/exceptn.h>
#include <algorithm>
diff --git a/src/lib/filters/pipe.cpp b/src/lib/filters/pipe.cpp
index 9af5a2158..3c901d0b7 100644
--- a/src/lib/filters/pipe.cpp
+++ b/src/lib/filters/pipe.cpp
@@ -8,7 +8,6 @@
#include <botan/pipe.h>
#include <botan/internal/out_buf.h>
#include <botan/secqueue.h>
-#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/filters/pipe.h b/src/lib/filters/pipe.h
index 677bd460b..24b536bf7 100644
--- a/src/lib/filters/pipe.h
+++ b/src/lib/filters/pipe.h
@@ -10,13 +10,14 @@
#define BOTAN_PIPE_H_
#include <botan/data_src.h>
-#include <botan/filter.h>
#include <botan/exceptn.h>
#include <initializer_list>
#include <iosfwd>
namespace Botan {
+class Filter;
+
/**
* This class represents pipe objects.
* A set of filters can be placed into a pipe, and information flows
diff --git a/src/lib/filters/pipe_rw.cpp b/src/lib/filters/pipe_rw.cpp
index dacc91008..fa24198ab 100644
--- a/src/lib/filters/pipe_rw.cpp
+++ b/src/lib/filters/pipe_rw.cpp
@@ -7,6 +7,7 @@
*/
#include <botan/pipe.h>
+#include <botan/filter.h>
#include <botan/internal/out_buf.h>
namespace Botan {
diff --git a/src/lib/hash/keccak/keccak.cpp b/src/lib/hash/keccak/keccak.cpp
index f51b53e06..94e3f70ba 100644
--- a/src/lib/hash/keccak/keccak.cpp
+++ b/src/lib/hash/keccak/keccak.cpp
@@ -7,7 +7,6 @@
#include <botan/keccak.h>
#include <botan/sha3.h>
-#include <botan/parsing.h>
#include <botan/exceptn.h>
namespace Botan {
diff --git a/src/lib/hash/sha3/sha3.cpp b/src/lib/hash/sha3/sha3.cpp
index a31b3bd14..e829c3f70 100644
--- a/src/lib/hash/sha3/sha3.cpp
+++ b/src/lib/hash/sha3/sha3.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/sha3.h>
-#include <botan/parsing.h>
#include <botan/exceptn.h>
namespace Botan {
diff --git a/src/lib/hash/shake/shake.cpp b/src/lib/hash/shake/shake.cpp
index 329aec080..ab7c9debe 100644
--- a/src/lib/hash/shake/shake.cpp
+++ b/src/lib/hash/shake/shake.cpp
@@ -7,7 +7,6 @@
#include <botan/shake.h>
#include <botan/sha3.h>
-#include <botan/parsing.h>
#include <botan/exceptn.h>
namespace Botan {
diff --git a/src/lib/hash/skein/skein_512.cpp b/src/lib/hash/skein/skein_512.cpp
index eaa3090a4..1df3da62d 100644
--- a/src/lib/hash/skein/skein_512.cpp
+++ b/src/lib/hash/skein/skein_512.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/skein_512.h>
-#include <botan/parsing.h>
#include <botan/exceptn.h>
#include <algorithm>
diff --git a/src/lib/hash/tiger/tiger.cpp b/src/lib/hash/tiger/tiger.cpp
index 0851742c0..13ae4a792 100644
--- a/src/lib/hash/tiger/tiger.cpp
+++ b/src/lib/hash/tiger/tiger.cpp
@@ -7,7 +7,6 @@
#include <botan/tiger.h>
#include <botan/exceptn.h>
-#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/kdf/hkdf/hkdf.h b/src/lib/kdf/hkdf/hkdf.h
index 1d8d3c159..e63973497 100644
--- a/src/lib/kdf/hkdf/hkdf.h
+++ b/src/lib/kdf/hkdf/hkdf.h
@@ -10,7 +10,6 @@
#define BOTAN_HKDF_H_
#include <botan/mac.h>
-#include <botan/hash.h>
#include <botan/kdf.h>
namespace Botan {
diff --git a/src/lib/kdf/kdf.cpp b/src/lib/kdf/kdf.cpp
index 4b55b6962..f3d962c14 100644
--- a/src/lib/kdf/kdf.cpp
+++ b/src/lib/kdf/kdf.cpp
@@ -26,11 +26,7 @@
#include <botan/kdf1_iso18033.h>
#endif
-#if defined(BOTAN_HAS_TLS_V10_PRF)
-#include <botan/prf_tls.h>
-#endif
-
-#if defined(BOTAN_HAS_TLS_V12_PRF)
+#if defined(BOTAN_HAS_TLS_V10_PRF) || defined(BOTAN_HAS_TLS_V12_PRF)
#include <botan/prf_tls.h>
#endif
diff --git a/src/lib/kdf/prf_tls/prf_tls.cpp b/src/lib/kdf/prf_tls/prf_tls.cpp
index ead41f505..69383e98e 100644
--- a/src/lib/kdf/prf_tls/prf_tls.cpp
+++ b/src/lib/kdf/prf_tls/prf_tls.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/prf_tls.h>
-#include <botan/hmac.h>
namespace Botan {
diff --git a/src/lib/kdf/sp800_108/sp800_108.cpp b/src/lib/kdf/sp800_108/sp800_108.cpp
index 8b1af2ea7..0f9eed1f2 100644
--- a/src/lib/kdf/sp800_108/sp800_108.cpp
+++ b/src/lib/kdf/sp800_108/sp800_108.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/sp800_108.h>
-#include <botan/hmac.h>
#include <iterator>
diff --git a/src/lib/kdf/sp800_56a/sp800_56a.cpp b/src/lib/kdf/sp800_56a/sp800_56a.cpp
index 8698e5bee..8e9bcf856 100644
--- a/src/lib/kdf/sp800_56a/sp800_56a.cpp
+++ b/src/lib/kdf/sp800_56a/sp800_56a.cpp
@@ -7,7 +7,6 @@
*/
#include <botan/sp800_56a.h>
-#include <botan/hmac.h>
#include <botan/scan_name.h>
#include <botan/exceptn.h>
diff --git a/src/lib/kdf/sp800_56c/sp800_56c.cpp b/src/lib/kdf/sp800_56c/sp800_56c.cpp
index 30a49e8ee..544a650ea 100644
--- a/src/lib/kdf/sp800_56c/sp800_56c.cpp
+++ b/src/lib/kdf/sp800_56c/sp800_56c.cpp
@@ -5,9 +5,7 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/sp800_108.h>
#include <botan/sp800_56c.h>
-#include <botan/hmac.h>
namespace Botan {
diff --git a/src/lib/mac/gmac/gmac.h b/src/lib/mac/gmac/gmac.h
index 64550d2b1..ed586b4ea 100644
--- a/src/lib/mac/gmac/gmac.h
+++ b/src/lib/mac/gmac/gmac.h
@@ -8,19 +8,15 @@
#ifndef BOTAN_GMAC_H_
#define BOTAN_GMAC_H_
-#include <botan/gcm.h>
#include <botan/mac.h>
-#include <botan/types.h>
-#include <algorithm>
+#include <botan/gcm.h>
namespace Botan {
/**
* GMAC
*/
-class BOTAN_PUBLIC_API(2,0) GMAC : public MessageAuthenticationCode,
- public GHASH
-
+class BOTAN_PUBLIC_API(2,0) GMAC : public MessageAuthenticationCode, public GHASH
{
public:
void clear() override;
diff --git a/src/lib/math/bigint/big_rand.cpp b/src/lib/math/bigint/big_rand.cpp
index 506e9776a..1b715d1b4 100644
--- a/src/lib/math/bigint/big_rand.cpp
+++ b/src/lib/math/bigint/big_rand.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/bigint.h>
-#include <botan/parsing.h>
+#include <botan/rng.h>
#include <botan/internal/rounding.h>
namespace Botan {
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp
index a91a685e0..5bf91df23 100644
--- a/src/lib/math/bigint/bigint.cpp
+++ b/src/lib/math/bigint/bigint.cpp
@@ -7,8 +7,6 @@
#include <botan/bigint.h>
#include <botan/internal/mp_core.h>
-#include <botan/loadstor.h>
-#include <botan/parsing.h>
#include <botan/internal/rounding.h>
#include <botan/internal/bit_ops.h>
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index 683a1f596..0b116f3cc 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -9,14 +9,16 @@
#ifndef BOTAN_BIGINT_H_
#define BOTAN_BIGINT_H_
-#include <botan/rng.h>
#include <botan/secmem.h>
#include <botan/mp_types.h>
+#include <botan/exceptn.h>
#include <botan/loadstor.h>
#include <iosfwd>
namespace Botan {
+class RandomNumberGenerator;
+
/**
* Arbitrary precision integer
*/
diff --git a/src/lib/math/ec_gfp/curve_gfp.cpp b/src/lib/math/ec_gfp/curve_gfp.cpp
index 96593e601..efeb5210f 100644
--- a/src/lib/math/ec_gfp/curve_gfp.cpp
+++ b/src/lib/math/ec_gfp/curve_gfp.cpp
@@ -8,6 +8,7 @@
#include <botan/curve_gfp.h>
#include <botan/curve_nistp.h>
+#include <botan/numthry.h>
#include <botan/internal/mp_core.h>
#include <botan/internal/mp_asmi.h>
diff --git a/src/lib/math/ec_gfp/curve_gfp.h b/src/lib/math/ec_gfp/curve_gfp.h
index 330d0ba0d..805359ba9 100644
--- a/src/lib/math/ec_gfp/curve_gfp.h
+++ b/src/lib/math/ec_gfp/curve_gfp.h
@@ -10,7 +10,7 @@
#ifndef BOTAN_GFP_CURVE_H_
#define BOTAN_GFP_CURVE_H_
-#include <botan/numthry.h>
+#include <botan/bigint.h>
#include <memory>
namespace Botan {
diff --git a/src/lib/math/ec_gfp/point_gfp.cpp b/src/lib/math/ec_gfp/point_gfp.cpp
index 5283b7352..c549823aa 100644
--- a/src/lib/math/ec_gfp/point_gfp.cpp
+++ b/src/lib/math/ec_gfp/point_gfp.cpp
@@ -9,8 +9,7 @@
#include <botan/point_gfp.h>
#include <botan/numthry.h>
-#include <botan/loadstor.h>
-#include <botan/internal/rounding.h>
+#include <botan/rng.h>
namespace Botan {
diff --git a/src/lib/math/numbertheory/dsa_gen.cpp b/src/lib/math/numbertheory/dsa_gen.cpp
index e8d620f4c..e345910ca 100644
--- a/src/lib/math/numbertheory/dsa_gen.cpp
+++ b/src/lib/math/numbertheory/dsa_gen.cpp
@@ -7,8 +7,7 @@
#include <botan/numthry.h>
#include <botan/hash.h>
-#include <botan/parsing.h>
-#include <algorithm>
+#include <botan/rng.h>
namespace Botan {
diff --git a/src/lib/math/numbertheory/make_prm.cpp b/src/lib/math/numbertheory/make_prm.cpp
index 9443bb9a1..f06f1978e 100644
--- a/src/lib/math/numbertheory/make_prm.cpp
+++ b/src/lib/math/numbertheory/make_prm.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/numthry.h>
-#include <botan/parsing.h>
+#include <botan/rng.h>
#include <algorithm>
namespace Botan {
diff --git a/src/lib/math/numbertheory/numthry.cpp b/src/lib/math/numbertheory/numthry.cpp
index 27fb73d08..961f50043 100644
--- a/src/lib/math/numbertheory/numthry.cpp
+++ b/src/lib/math/numbertheory/numthry.cpp
@@ -7,6 +7,7 @@
#include <botan/numthry.h>
#include <botan/reducer.h>
+#include <botan/rng.h>
#include <botan/internal/bit_ops.h>
#include <botan/internal/mp_core.h>
#include <botan/internal/ct_utils.h>
diff --git a/src/lib/math/numbertheory/numthry.h b/src/lib/math/numbertheory/numthry.h
index 91dcda68d..286304f7e 100644
--- a/src/lib/math/numbertheory/numthry.h
+++ b/src/lib/math/numbertheory/numthry.h
@@ -10,10 +10,11 @@
#include <botan/bigint.h>
#include <botan/pow_mod.h>
-#include <botan/rng.h>
namespace Botan {
+class RandomNumberGenerator;
+
/**
* Fused multiply-add
* @param a an integer
diff --git a/src/lib/misc/srp6/srp6.cpp b/src/lib/misc/srp6/srp6.cpp
index 12107715f..44e137237 100644
--- a/src/lib/misc/srp6/srp6.cpp
+++ b/src/lib/misc/srp6/srp6.cpp
@@ -6,6 +6,8 @@
*/
#include <botan/srp6.h>
+#include <botan/rng.h>
+#include <botan/hash.h>
#include <botan/dl_group.h>
#include <botan/numthry.h>
diff --git a/src/lib/misc/srp6/srp6.h b/src/lib/misc/srp6/srp6.h
index a35098839..464b67252 100644
--- a/src/lib/misc/srp6/srp6.h
+++ b/src/lib/misc/srp6/srp6.h
@@ -9,13 +9,13 @@
#define BOTAN_RFC5054_SRP6_H_
#include <botan/bigint.h>
-#include <botan/hash.h>
-#include <botan/rng.h>
#include <botan/symkey.h>
#include <string>
namespace Botan {
+class RandomNumberGenerator;
+
/**
* SRP6a Client side
* @param username the username we are attempting login for
diff --git a/src/lib/misc/tss/tss.cpp b/src/lib/misc/tss/tss.cpp
index 2039e5fea..33a21314e 100644
--- a/src/lib/misc/tss/tss.cpp
+++ b/src/lib/misc/tss/tss.cpp
@@ -6,6 +6,8 @@
*/
#include <botan/tss.h>
+#include <botan/rng.h>
+#include <botan/hash.h>
#include <botan/loadstor.h>
#include <botan/hex.h>
#include <botan/sha2_32.h>
diff --git a/src/lib/misc/tss/tss.h b/src/lib/misc/tss/tss.h
index f1f503201..d1fd15f24 100644
--- a/src/lib/misc/tss/tss.h
+++ b/src/lib/misc/tss/tss.h
@@ -9,12 +9,12 @@
#define BOTAN_RTSS_H_
#include <botan/secmem.h>
-#include <botan/hash.h>
-#include <botan/rng.h>
#include <vector>
namespace Botan {
+class RandomNumberGenerator;
+
/**
* A split secret, using the format from draft-mcgrew-tss-03
*/
diff --git a/src/lib/modes/aead/aead.cpp b/src/lib/modes/aead/aead.cpp
index 1b7b78be7..e8885dc0e 100644
--- a/src/lib/modes/aead/aead.cpp
+++ b/src/lib/modes/aead/aead.cpp
@@ -6,6 +6,7 @@
#include <botan/aead.h>
#include <botan/scan_name.h>
+#include <botan/parsing.h>
#include <sstream>
#if defined(BOTAN_HAS_BLOCK_CIPHER)
diff --git a/src/lib/modes/aead/ccm/ccm.cpp b/src/lib/modes/aead/ccm/ccm.cpp
index 5a1de4908..6149718f0 100644
--- a/src/lib/modes/aead/ccm/ccm.cpp
+++ b/src/lib/modes/aead/ccm/ccm.cpp
@@ -7,7 +7,7 @@
*/
#include <botan/ccm.h>
-#include <botan/parsing.h>
+#include <botan/loadstor.h>
namespace Botan {
diff --git a/src/lib/modes/aead/ccm/ccm.h b/src/lib/modes/aead/ccm/ccm.h
index 38c0affe7..4d4fe73e2 100644
--- a/src/lib/modes/aead/ccm/ccm.h
+++ b/src/lib/modes/aead/ccm/ccm.h
@@ -11,8 +11,6 @@
#include <botan/aead.h>
#include <botan/block_cipher.h>
-#include <botan/stream_cipher.h>
-#include <botan/mac.h>
namespace Botan {
diff --git a/src/lib/modes/aead/eax/eax.cpp b/src/lib/modes/aead/eax/eax.cpp
index 66cd90151..dd0e458e7 100644
--- a/src/lib/modes/aead/eax/eax.cpp
+++ b/src/lib/modes/aead/eax/eax.cpp
@@ -9,7 +9,6 @@
#include <botan/eax.h>
#include <botan/cmac.h>
#include <botan/ctr.h>
-#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/modes/aead/siv/siv.cpp b/src/lib/modes/aead/siv/siv.cpp
index 70545243b..8e3d07059 100644
--- a/src/lib/modes/aead/siv/siv.cpp
+++ b/src/lib/modes/aead/siv/siv.cpp
@@ -10,7 +10,6 @@
#include <botan/cmac.h>
#include <botan/internal/poly_dbl.h>
#include <botan/ctr.h>
-#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/modes/cfb/cfb.cpp b/src/lib/modes/cfb/cfb.cpp
index d22f1a35b..63904ed27 100644
--- a/src/lib/modes/cfb/cfb.cpp
+++ b/src/lib/modes/cfb/cfb.cpp
@@ -7,7 +7,6 @@
*/
#include <botan/cfb.h>
-#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/modes/cipher_mode.cpp b/src/lib/modes/cipher_mode.cpp
index 74d565f33..6023102da 100644
--- a/src/lib/modes/cipher_mode.cpp
+++ b/src/lib/modes/cipher_mode.cpp
@@ -8,6 +8,7 @@
#include <botan/cipher_mode.h>
#include <botan/stream_mode.h>
#include <botan/scan_name.h>
+#include <botan/parsing.h>
#include <sstream>
#if defined(BOTAN_HAS_BLOCK_CIPHER)
@@ -30,10 +31,6 @@
#include <botan/xts.h>
#endif
-#if defined(BOTAN_HAS_MODE_XTS)
- #include <botan/xts.h>
-#endif
-
#if defined(BOTAN_HAS_OPENSSL)
#include <botan/internal/openssl.h>
#endif
diff --git a/src/lib/modes/xts/xts.cpp b/src/lib/modes/xts/xts.cpp
index 4a4250f84..53e959258 100644
--- a/src/lib/modes/xts/xts.cpp
+++ b/src/lib/modes/xts/xts.cpp
@@ -7,7 +7,6 @@
*/
#include <botan/xts.h>
-#include <botan/loadstor.h>
#include <botan/internal/poly_dbl.h>
namespace Botan {
diff --git a/src/lib/passhash/bcrypt/bcrypt.cpp b/src/lib/passhash/bcrypt/bcrypt.cpp
index 73456dead..8424de7e2 100644
--- a/src/lib/passhash/bcrypt/bcrypt.cpp
+++ b/src/lib/passhash/bcrypt/bcrypt.cpp
@@ -6,9 +6,10 @@
*/
#include <botan/bcrypt.h>
-#include <botan/loadstor.h>
+#include <botan/rng.h>
#include <botan/blowfish.h>
#include <botan/base64.h>
+#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/passhash/bcrypt/bcrypt.h b/src/lib/passhash/bcrypt/bcrypt.h
index c88df2745..51db8062d 100644
--- a/src/lib/passhash/bcrypt/bcrypt.h
+++ b/src/lib/passhash/bcrypt/bcrypt.h
@@ -8,10 +8,12 @@
#ifndef BOTAN_BCRYPT_H_
#define BOTAN_BCRYPT_H_
-#include <botan/rng.h>
+#include <botan/types.h>
namespace Botan {
+class RandomNumberGenerator;
+
/**
* Create a password hash using Bcrypt
* @param password the password
diff --git a/src/lib/passhash/passhash9/passhash9.cpp b/src/lib/passhash/passhash9/passhash9.cpp
index 1fa88c8c4..47c7d0342 100644
--- a/src/lib/passhash/passhash9/passhash9.cpp
+++ b/src/lib/passhash/passhash9/passhash9.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/passhash9.h>
+#include <botan/rng.h>
#include <botan/loadstor.h>
#include <botan/pbkdf2.h>
#include <botan/base64.h>
diff --git a/src/lib/passhash/passhash9/passhash9.h b/src/lib/passhash/passhash9/passhash9.h
index 75847bfa5..825c63da6 100644
--- a/src/lib/passhash/passhash9/passhash9.h
+++ b/src/lib/passhash/passhash9/passhash9.h
@@ -8,10 +8,12 @@
#ifndef BOTAN_PASSHASH9_H_
#define BOTAN_PASSHASH9_H_
-#include <botan/rng.h>
+#include <botan/types.h>
namespace Botan {
+class RandomNumberGenerator;
+
/**
* Create a password hash using PBKDF2
* @param password the password
diff --git a/src/lib/pbkdf/pbkdf2/pbkdf2.cpp b/src/lib/pbkdf/pbkdf2/pbkdf2.cpp
index 03e746717..4e1a73331 100644
--- a/src/lib/pbkdf/pbkdf2/pbkdf2.cpp
+++ b/src/lib/pbkdf/pbkdf2/pbkdf2.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/pbkdf2.h>
-#include <botan/loadstor.h>
#include <botan/internal/rounding.h>
namespace Botan {
diff --git a/src/lib/pbkdf/pbkdf2/pbkdf2.h b/src/lib/pbkdf/pbkdf2/pbkdf2.h
index 6d1ddc94b..ea357cac0 100644
--- a/src/lib/pbkdf/pbkdf2/pbkdf2.h
+++ b/src/lib/pbkdf/pbkdf2/pbkdf2.h
@@ -10,7 +10,6 @@
#include <botan/pbkdf.h>
#include <botan/mac.h>
-#include <botan/hash.h>
namespace Botan {
diff --git a/src/lib/pk_pad/eme.cpp b/src/lib/pk_pad/eme.cpp
index 85efe1615..aa62f4196 100644
--- a/src/lib/pk_pad/eme.cpp
+++ b/src/lib/pk_pad/eme.cpp
@@ -7,6 +7,7 @@
#include <botan/eme.h>
#include <botan/scan_name.h>
+#include <botan/exceptn.h>
#if defined(BOTAN_HAS_EME_OAEP)
#include <botan/oaep.h>
diff --git a/src/lib/pk_pad/eme.h b/src/lib/pk_pad/eme.h
index 8842358fe..26523bc88 100644
--- a/src/lib/pk_pad/eme.h
+++ b/src/lib/pk_pad/eme.h
@@ -9,10 +9,11 @@
#define BOTAN_PUBKEY_EME_ENCRYPTION_PAD_H_
#include <botan/secmem.h>
-#include <botan/rng.h>
namespace Botan {
+class RandomNumberGenerator;
+
/**
* Encoding Method for Encryption
*/
diff --git a/src/lib/pk_pad/eme_oaep/oaep.cpp b/src/lib/pk_pad/eme_oaep/oaep.cpp
index 71f5c14e0..5e567d0c2 100644
--- a/src/lib/pk_pad/eme_oaep/oaep.cpp
+++ b/src/lib/pk_pad/eme_oaep/oaep.cpp
@@ -7,6 +7,8 @@
#include <botan/oaep.h>
#include <botan/mgf1.h>
+#include <botan/exceptn.h>
+#include <botan/rng.h>
#include <botan/internal/ct_utils.h>
namespace Botan {
diff --git a/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp b/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp
index 5d4f950f5..58aadbc38 100644
--- a/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp
+++ b/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp
@@ -6,6 +6,8 @@
*/
#include <botan/eme_pkcs.h>
+#include <botan/exceptn.h>
+#include <botan/rng.h>
#include <botan/internal/ct_utils.h>
namespace Botan {
diff --git a/src/lib/pk_pad/emsa.cpp b/src/lib/pk_pad/emsa.cpp
index d78c562c9..2c3370f4d 100644
--- a/src/lib/pk_pad/emsa.cpp
+++ b/src/lib/pk_pad/emsa.cpp
@@ -6,6 +6,7 @@
#include <botan/emsa.h>
#include <botan/scan_name.h>
+#include <botan/exceptn.h>
#if defined(BOTAN_HAS_EMSA1)
#include <botan/emsa1.h>
diff --git a/src/lib/pk_pad/emsa.h b/src/lib/pk_pad/emsa.h
index 270aa9298..d45185f30 100644
--- a/src/lib/pk_pad/emsa.h
+++ b/src/lib/pk_pad/emsa.h
@@ -9,10 +9,11 @@
#define BOTAN_PUBKEY_EMSA_H_
#include <botan/secmem.h>
-#include <botan/rng.h>
namespace Botan {
+class RandomNumberGenerator;
+
/**
* EMSA, from IEEE 1363s Encoding Method for Signatures, Appendix
*
diff --git a/src/lib/pk_pad/emsa1/emsa1.cpp b/src/lib/pk_pad/emsa1/emsa1.cpp
index e3580ff93..db9f2432f 100644
--- a/src/lib/pk_pad/emsa1/emsa1.cpp
+++ b/src/lib/pk_pad/emsa1/emsa1.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/emsa1.h>
+#include <botan/exceptn.h>
namespace Botan {
diff --git a/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp b/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp
index d5a6aa8fb..4175fe4b3 100644
--- a/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp
+++ b/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp
@@ -7,6 +7,7 @@
#include <botan/emsa_pkcs1.h>
#include <botan/hash_id.h>
+#include <botan/exceptn.h>
namespace Botan {
diff --git a/src/lib/pk_pad/emsa_pssr/pssr.cpp b/src/lib/pk_pad/emsa_pssr/pssr.cpp
index f0fd69a78..941da7d99 100644
--- a/src/lib/pk_pad/emsa_pssr/pssr.cpp
+++ b/src/lib/pk_pad/emsa_pssr/pssr.cpp
@@ -6,6 +6,8 @@
*/
#include <botan/pssr.h>
+#include <botan/exceptn.h>
+#include <botan/rng.h>
#include <botan/mgf1.h>
#include <botan/internal/bit_ops.h>
diff --git a/src/lib/pk_pad/emsa_raw/emsa_raw.cpp b/src/lib/pk_pad/emsa_raw/emsa_raw.cpp
index cf2426298..0302033f0 100644
--- a/src/lib/pk_pad/emsa_raw/emsa_raw.cpp
+++ b/src/lib/pk_pad/emsa_raw/emsa_raw.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/emsa_raw.h>
+#include <botan/exceptn.h>
namespace Botan {
diff --git a/src/lib/pk_pad/emsa_x931/emsa_x931.cpp b/src/lib/pk_pad/emsa_x931/emsa_x931.cpp
index 8d90bd245..91227328e 100644
--- a/src/lib/pk_pad/emsa_x931/emsa_x931.cpp
+++ b/src/lib/pk_pad/emsa_x931/emsa_x931.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/emsa_x931.h>
+#include <botan/exceptn.h>
#include <botan/hash_id.h>
namespace Botan {
diff --git a/src/lib/pk_pad/iso9796/iso9796.cpp b/src/lib/pk_pad/iso9796/iso9796.cpp
index 8608e7239..b8375af68 100644
--- a/src/lib/pk_pad/iso9796/iso9796.cpp
+++ b/src/lib/pk_pad/iso9796/iso9796.cpp
@@ -6,9 +6,11 @@
*/
#include <botan/iso9796.h>
+#include <botan/rng.h>
+#include <botan/exceptn.h>
#include <botan/mgf1.h>
-#include <botan/internal/bit_ops.h>
#include <botan/hash_id.h>
+#include <botan/internal/bit_ops.h>
#include <botan/internal/ct_utils.h>
namespace Botan {
diff --git a/src/lib/pk_pad/mgf1/mgf1.cpp b/src/lib/pk_pad/mgf1/mgf1.cpp
index 8903ac6f0..dbfac5110 100644
--- a/src/lib/pk_pad/mgf1/mgf1.cpp
+++ b/src/lib/pk_pad/mgf1/mgf1.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/mgf1.h>
-#include <botan/exceptn.h>
+#include <botan/hash.h>
#include <algorithm>
namespace Botan {
diff --git a/src/lib/pk_pad/mgf1/mgf1.h b/src/lib/pk_pad/mgf1/mgf1.h
index 65227afef..9eb652a82 100644
--- a/src/lib/pk_pad/mgf1/mgf1.h
+++ b/src/lib/pk_pad/mgf1/mgf1.h
@@ -8,10 +8,12 @@
#ifndef BOTAN_MGF1_H_
#define BOTAN_MGF1_H_
-#include <botan/hash.h>
+#include <botan/types.h>
namespace Botan {
+class HashFunction;
+
/**
* MGF1 from PKCS #1 v2.0
* @param hash hash function to use
diff --git a/src/lib/prov/pkcs11/p11_ecdh.cpp b/src/lib/prov/pkcs11/p11_ecdh.cpp
index 088b93894..5ec5c063d 100644
--- a/src/lib/prov/pkcs11/p11_ecdh.cpp
+++ b/src/lib/prov/pkcs11/p11_ecdh.cpp
@@ -11,7 +11,6 @@
#if defined(BOTAN_HAS_ECDH)
#include <botan/internal/p11_mechanism.h>
-#include <botan/ber_dec.h>
#include <botan/der_enc.h>
#include <botan/pk_ops.h>
#include <botan/rng.h>
diff --git a/src/lib/prov/pkcs11/p11_mechanism.cpp b/src/lib/prov/pkcs11/p11_mechanism.cpp
index 290465dac..1621317cc 100644
--- a/src/lib/prov/pkcs11/p11_mechanism.cpp
+++ b/src/lib/prov/pkcs11/p11_mechanism.cpp
@@ -8,6 +8,7 @@
#include <botan/internal/p11_mechanism.h>
#include <botan/scan_name.h>
+#include <botan/parsing.h>
#include <botan/emsa.h>
#include <tuple>
diff --git a/src/lib/pubkey/ecdh/ecdh.cpp b/src/lib/pubkey/ecdh/ecdh.cpp
index f6d2bb251..799e8aac9 100644
--- a/src/lib/pubkey/ecdh/ecdh.cpp
+++ b/src/lib/pubkey/ecdh/ecdh.cpp
@@ -8,6 +8,7 @@
*/
#include <botan/ecdh.h>
+#include <botan/numthry.h>
#include <botan/internal/pk_ops_impl.h>
#if defined(BOTAN_HAS_OPENSSL)
diff --git a/src/lib/pubkey/ecies/ecies.cpp b/src/lib/pubkey/ecies/ecies.cpp
index b8fcea64b..d1edf058c 100644
--- a/src/lib/pubkey/ecies/ecies.cpp
+++ b/src/lib/pubkey/ecies/ecies.cpp
@@ -7,6 +7,7 @@
*/
#include <botan/ecies.h>
+#include <botan/numthry.h>
#include <botan/cipher_mode.h>
#include <botan/internal/ct_utils.h>
diff --git a/src/lib/pubkey/pk_algs.cpp b/src/lib/pubkey/pk_algs.cpp
index 743918923..8a39a5ade 100644
--- a/src/lib/pubkey/pk_algs.cpp
+++ b/src/lib/pubkey/pk_algs.cpp
@@ -7,6 +7,7 @@
#include <botan/pk_algs.h>
#include <botan/oids.h>
+#include <botan/parsing.h>
#if defined(BOTAN_HAS_RSA)
#include <botan/rsa.h>
diff --git a/src/lib/tls/tls_policy.cpp b/src/lib/tls/tls_policy.cpp
index 863958eaa..822b41e5e 100644
--- a/src/lib/tls/tls_policy.cpp
+++ b/src/lib/tls/tls_policy.cpp
@@ -11,6 +11,7 @@
#include <botan/tls_magic.h>
#include <botan/tls_exceptn.h>
#include <botan/internal/stl_util.h>
+#include <botan/parsing.h>
namespace Botan {
diff --git a/src/lib/tls/tls_policy.h b/src/lib/tls/tls_policy.h
index 84e65609d..1ac3e40f2 100644
--- a/src/lib/tls/tls_policy.h
+++ b/src/lib/tls/tls_policy.h
@@ -12,6 +12,7 @@
#include <botan/tls_ciphersuite.h>
#include <botan/x509cert.h>
#include <botan/dl_group.h>
+#include <botan/parsing.h>
#include <vector>
#include <sstream>
diff --git a/src/lib/tls/tls_record.h b/src/lib/tls/tls_record.h
index b2078c651..42939b7fd 100644
--- a/src/lib/tls/tls_record.h
+++ b/src/lib/tls/tls_record.h
@@ -16,6 +16,7 @@
#include <botan/mac.h>
#include <vector>
#include <chrono>
+#include <functional>
namespace Botan {
diff --git a/src/lib/tls/tls_seq_numbers.h b/src/lib/tls/tls_seq_numbers.h
index dfebeae91..3f08f27cb 100644
--- a/src/lib/tls/tls_seq_numbers.h
+++ b/src/lib/tls/tls_seq_numbers.h
@@ -9,6 +9,7 @@
#define BOTAN_TLS_SEQ_NUMBERS_H_
#include <botan/types.h>
+#include <map>
namespace Botan {
diff --git a/src/lib/utils/cpuid/cpuid.cpp b/src/lib/utils/cpuid/cpuid.cpp
index 3948853ac..d4e15c16b 100644
--- a/src/lib/utils/cpuid/cpuid.cpp
+++ b/src/lib/utils/cpuid/cpuid.cpp
@@ -8,6 +8,7 @@
#include <botan/cpuid.h>
#include <botan/types.h>
#include <botan/exceptn.h>
+#include <botan/parsing.h>
#include <ostream>
namespace Botan {
diff --git a/src/lib/utils/exceptn.h b/src/lib/utils/exceptn.h
index e5f2e51f7..bb8c245f6 100644
--- a/src/lib/utils/exceptn.h
+++ b/src/lib/utils/exceptn.h
@@ -9,7 +9,6 @@
#define BOTAN_EXCEPTION_H_
#include <botan/types.h>
-#include <botan/parsing.h>
#include <exception>
#include <string>
diff --git a/src/lib/utils/http_util/http_util.h b/src/lib/utils/http_util/http_util.h
index a81dd85df..9e4d215ef 100644
--- a/src/lib/utils/http_util/http_util.h
+++ b/src/lib/utils/http_util/http_util.h
@@ -14,6 +14,7 @@
#include <map>
#include <chrono>
#include <string>
+#include <functional>
namespace Botan {
diff --git a/src/lib/utils/types.h b/src/lib/utils/types.h
index deccc2b93..98671bfa8 100644
--- a/src/lib/utils/types.h
+++ b/src/lib/utils/types.h
@@ -9,11 +9,11 @@
#ifndef BOTAN_TYPES_H_
#define BOTAN_TYPES_H_
-#include <botan/build.h>
-#include <botan/assert.h>
-#include <cstddef>
-#include <cstdint>
-#include <memory>
+#include <botan/build.h> // IWYU pragma: export
+#include <botan/assert.h> // IWYU pragma: export
+#include <cstddef> // IWYU pragma: export
+#include <cstdint> // IWYU pragma: export
+#include <memory> // IWYU pragma: export
/**
* The primary namespace for the botan library
diff --git a/src/lib/x509/name_constraint.cpp b/src/lib/x509/name_constraint.cpp
index 703c6770c..fc91a5477 100644
--- a/src/lib/x509/name_constraint.cpp
+++ b/src/lib/x509/name_constraint.cpp
@@ -12,6 +12,7 @@
#include <botan/loadstor.h>
#include <botan/x509_dn.h>
#include <botan/x509cert.h>
+#include <botan/parsing.h>
#include <sstream>
namespace Botan {
diff --git a/src/lib/x509/ocsp.cpp b/src/lib/x509/ocsp.cpp
index be8e6ed1d..c437fa45e 100644
--- a/src/lib/x509/ocsp.cpp
+++ b/src/lib/x509/ocsp.cpp
@@ -14,6 +14,7 @@
#include <botan/base64.h>
#include <botan/pubkey.h>
#include <botan/x509path.h>
+#include <botan/parsing.h>
#if defined(BOTAN_HAS_HTTP_UTIL)
#include <botan/http_util.h>
diff --git a/src/lib/x509/x509_ext.h b/src/lib/x509/x509_ext.h
index bd2ec86c3..134c2ec3e 100644
--- a/src/lib/x509/x509_ext.h
+++ b/src/lib/x509/x509_ext.h
@@ -16,6 +16,7 @@
#include <botan/name_constraint.h>
#include <botan/key_constraint.h>
#include <botan/crl_ent.h>
+#include <set>
namespace Botan {
diff --git a/src/lib/x509/x509cert.cpp b/src/lib/x509/x509cert.cpp
index 40bdbf477..785f414c3 100644
--- a/src/lib/x509/x509cert.cpp
+++ b/src/lib/x509/x509cert.cpp
@@ -8,13 +8,10 @@
#include <botan/x509cert.h>
#include <botan/x509_ext.h>
-#include <botan/der_enc.h>
#include <botan/ber_dec.h>
-#include <botan/internal/stl_util.h>
#include <botan/parsing.h>
#include <botan/bigint.h>
#include <botan/oids.h>
-#include <botan/pem.h>
#include <botan/hash.h>
#include <botan/hex.h>
#include <algorithm>
diff --git a/src/tests/test_bigint.cpp b/src/tests/test_bigint.cpp
index 61be15d15..132723727 100644
--- a/src/tests/test_bigint.cpp
+++ b/src/tests/test_bigint.cpp
@@ -10,6 +10,7 @@
#include <botan/bigint.h>
#include <botan/numthry.h>
#include <botan/reducer.h>
+ #include <botan/parsing.h>
#include <cmath>
#endif
diff --git a/src/tests/test_otp.cpp b/src/tests/test_otp.cpp
index 480065194..12295c96c 100644
--- a/src/tests/test_otp.cpp
+++ b/src/tests/test_otp.cpp
@@ -8,6 +8,7 @@
#include "tests.h"
#if defined(BOTAN_HAS_HOTP)
+ #include <botan/parsing.h>
#include <botan/hotp.h>
#endif
diff --git a/src/tests/test_x509_path.cpp b/src/tests/test_x509_path.cpp
index e7cd9c18c..544d1b35d 100644
--- a/src/tests/test_x509_path.cpp
+++ b/src/tests/test_x509_path.cpp
@@ -10,6 +10,7 @@
#include <botan/x509path.h>
#include <botan/calendar.h>
#include <botan/internal/filesystem.h>
+ #include <botan/parsing.h>
#endif
#include <algorithm>
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 9a35caf7d..243878bcd 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -9,6 +9,7 @@
#include <sstream>
#include <iomanip>
#include <botan/hex.h>
+#include <botan/parsing.h>
#include <botan/internal/filesystem.h>
#include <botan/internal/bit_ops.h>
#include <botan/internal/stl_util.h>