Repository: randombit/botan
Pull request #3288 (2023-02-15 19:28:10)

Further clang-tidy warning fixes


Patch:
diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp
index 8cbc4f182..d3a26a769 100644
--- a/src/cli/cli.cpp
+++ b/src/cli/cli.cpp
@@ -53,9 +53,12 @@ int Command::run(const std::vector<std::string>& params)
    {
    try
       {
-      m_args.reset(new Argument_Parser(m_spec,
-                                       {"verbose", "help"},
-                                       {"output", "error-output", "rng-type", "drbg-seed"}));
+      const std::vector<std::string> extra_flags = {"verbose", "help"};
+      const std::vector<std::string> extra_opts =
+         {"output", "error-output", "rng-type", "drbg-seed"};
+
+      m_args = std::make_unique<Argument_Parser>(
+         m_spec, extra_flags, extra_opts);
 
       m_args->parse_args(params);
 
@@ -65,7 +68,7 @@ int Command::run(const std::vector<std::string>& params)
 
          if(!output_file.empty())
             {
-            m_output_stream.reset(new std::ofstream(output_file, std::ios::binary));
+            m_output_stream = std::make_unique<std::ofstream>(output_file, std::ios::binary);
             if(!m_output_stream->good())
                throw CLI_IO_Error("opening", output_file);
             }
@@ -77,7 +80,7 @@ int Command::run(const std::vector<std::string>& params)
 
          if(!output_file.empty())
             {
-            m_error_output_stream.reset(new std::ofstream(output_file, std::ios::binary));
+            m_error_output_stream = std::make_unique<std::ofstream>(output_file, std::ios::binary);
             if(!m_error_output_stream->good())
                throw CLI_IO_Error("opening", output_file);
             }
diff --git a/src/cli/tls_client.cpp b/src/cli/tls_client.cpp
index 3b52473f6..e70a1dae3 100644
--- a/src/cli/tls_client.cpp
+++ b/src/cli/tls_client.cpp
@@ -22,8 +22,8 @@
    #include <botan/tls_session_manager_sqlite.h>
 #endif
 
-#include <string>
 #include <memory>
+#include <string>
 
 #include "socket_utils.h"
 #include "tls_helpers.h"
@@ -87,7 +87,7 @@ class TLS_Client final : public Command, public Botan::TLS::Callbacks
 
          if(!session_mgr)
             {
-            session_mgr.reset(new Botan::TLS::Session_Manager_In_Memory(rng()));
+            session_mgr = std::make_unique<Botan::TLS::Session_Manager_In_Memory>(rng());
             }
 
          auto policy = load_tls_policy(get_arg("policy"));
@@ -101,7 +101,7 @@ class TLS_Client final : public Command, public Botan::TLS::Callbacks
 
          if(!policy)
             {
-            policy.reset(new Botan::TLS::Policy);
+            policy = std::make_unique<Botan::TLS::Policy>();
             }
 
          const bool use_tcp = (transport == "tcp");
diff --git a/src/cli/tls_server.cpp b/src/cli/tls_server.cpp
index 4fcc3bef3..77257893e 100644
--- a/src/cli/tls_server.cpp
+++ b/src/cli/tls_server.cpp
@@ -34,6 +34,7 @@
 
 #include <list>
 #include <fstream>
+#include <memory>
 
 #include "tls_helpers.h"
 #include "socket_utils.h"
@@ -163,7 +164,7 @@ class TLS_Server final : public Command, public Botan::TLS::Callbacks
                uint64_t timestamp = Botan::OS::get_high_resolution_clock();
                const std::string dump_file =
                   dump_traces_to + "/tls_" + std::to_string(timestamp) + ".bin";
-               dump_stream.reset(new std::ofstream(dump_file.c_str()));
+               dump_stream = std::make_unique<std::ofstream>(dump_file.c_str());
                }
 
             try
diff --git a/src/lib/asn1/ber_dec.cpp b/src/lib/asn1/ber_dec.cpp
index 63192a991..be203cf71 100644
--- a/src/lib/asn1/ber_dec.cpp
+++ b/src/lib/asn1/ber_dec.cpp
@@ -9,6 +9,7 @@
 #include <botan/bigint.h>
 #include <botan/internal/loadstor.h>
 #include <botan/internal/safeint.h>
+#include <memory>
 
 namespace Botan {
 
@@ -311,7 +312,7 @@ BER_Decoder& BER_Decoder::end_cons()
 
 BER_Decoder::BER_Decoder(BER_Object&& obj, BER_Decoder* parent)
    {
-   m_data_src.reset(new DataSource_BERObject(std::move(obj)));
+   m_data_src = std::make_unique<DataSource_BERObject>(std::move(obj));
    m_source = m_data_src.get();
    m_parent = parent;
    }
@@ -329,7 +330,7 @@ BER_Decoder::BER_Decoder(DataSource& src)
  */
 BER_Decoder::BER_Decoder(const uint8_t data[], size_t length)
    {
-   m_data_src.reset(new DataSource_Memory(data, length));
+   m_data_src = std::make_unique<DataSource_Memory>(data, length);
    m_source = m_data_src.get();
    }
 
@@ -338,7 +339,7 @@ BER_Decoder::BER_Decoder(const uint8_t data[], size_t length)
 */
 BER_Decoder::BER_Decoder(const secure_vector<uint8_t>& data)
    {
-   m_data_src.reset(new DataSource_Memory(data));
+   m_data_src = std::make_unique<DataSource_Memory>(data);
    m_source = m_data_src.get();
    }
 
@@ -347,7 +348,7 @@ BER_Decoder::BER_Decoder(const secure_vector<uint8_t>& data)
 */
 BER_Decoder::BER_Decoder(const std::vector<uint8_t>& data)
    {
-   m_data_src.reset(new DataSource_Memory(data.data(), data.size()));
+   m_data_src = std::make_unique<DataSource_Memory>(data.data(), data.size());
    m_source = m_data_src.get();
    }
 
diff --git a/src/lib/ffi/ffi_cert.cpp b/src/lib/ffi/ffi_cert.cpp
index d636187dd..044af5221 100644
--- a/src/lib/ffi/ffi_cert.cpp
+++ b/src/lib/ffi/ffi_cert.cpp
@@ -7,6 +7,7 @@
 #include <botan/ffi.h>
 #include <botan/internal/ffi_util.h>
 #include <botan/internal/ffi_pkey.h>
+#include <memory>
 
 #if defined(BOTAN_HAS_X509_CERTIFICATES)
    #include <botan/x509cert.h>
@@ -298,13 +299,13 @@ int botan_x509_cert_verify(int* result_code,
 
       if(trusted_path && *trusted_path)
          {
-         trusted_from_path.reset(new Botan::Certificate_Store_In_Memory(trusted_path));
+         trusted_from_path = std::make_unique<Botan::Certificate_Store_In_Memory>(trusted_path);
          trusted_roots.push_back(trusted_from_path.get());
          }
 
       if(trusted_len > 0)
          {
-         trusted_extra.reset(new Botan::Certificate_Store_In_Memory);
+         trusted_extra = std::make_unique<Botan::Certificate_Store_In_Memory>();
          for(size_t i = 0; i != trusted_len; ++i)
             {
             trusted_extra->add_certificate(safe_get(trusted[i]));
@@ -452,13 +453,13 @@ int botan_x509_cert_verify_with_crl(
 
       if(trusted_path && *trusted_path)
          {
-         trusted_from_path.reset(new Botan::Certificate_Store_In_Memory(trusted_path));
+         trusted_from_path = std::make_unique<Botan::Certificate_Store_In_Memory>(trusted_path);
          trusted_roots.push_back(trusted_from_path.get());
          }
 
       if(trusted_len > 0)
          {
-         trusted_extra.reset(new Botan::Certificate_Store_In_Memory);
+         trusted_extra = std::make_unique<Botan::Certificate_Store_In_Memory>();
          for(size_t i = 0; i != trusted_len; ++i)
             {
             trusted_extra->add_certificate(safe_get(trusted[i]));
@@ -468,7 +469,7 @@ int botan_x509_cert_verify_with_crl(
 
       if(crls_len > 0)
          {
-         trusted_crls.reset(new Botan::Certificate_Store_In_Memory);
+         trusted_crls = std::make_unique<Botan::Certificate_Store_In_Memory>();
          for(size_t i = 0; i != crls_len; ++i)
             {
             trusted_crls->add_crl(safe_get(crls[i]));
diff --git a/src/lib/ffi/ffi_rng.cpp b/src/lib/ffi/ffi_rng.cpp
index 56af8672e..2bd4f2ec1 100644
--- a/src/lib/ffi/ffi_rng.cpp
+++ b/src/lib/ffi/ffi_rng.cpp
@@ -12,6 +12,7 @@
 #include <botan/auto_rng.h>
 
 #include <functional>
+#include <memory>
 
 #if defined(BOTAN_HAS_PROCESSOR_RNG)
 #include <botan/processor_rng.h>
@@ -33,20 +34,20 @@ int botan_rng_init(botan_rng_t* rng_out, const char* rng_type)
 
    if(rng_type_s == "system")
       {
-      rng.reset(new Botan::System_RNG);
+      rng = std::make_unique<Botan::System_RNG>();
       }
    else if(rng_type_s == "user" || rng_type_s == "user-threadsafe")
       {
-      rng.reset(new Botan::AutoSeeded_RNG);
+      rng = std::make_unique<Botan::AutoSeeded_RNG>();
       }
    else if(rng_type_s == "null")
       {
-      rng.reset(new Botan::Null_RNG);
+      rng = std::make_unique<Botan::Null_RNG>();
       }
 #if defined(BOTAN_HAS_PROCESSOR_RNG)
    else if((rng_type_s == "rdrand" || rng_type_s == "hwrng") && Botan::Processor_RNG::available())
       {
-      rng.reset(new Botan::Processor_RNG);
+      rng = std::make_unique<Botan::Processor_RNG>();
       }
 #endif
 
diff --git a/src/lib/filters/pipe.cpp b/src/lib/filters/pipe.cpp
index 214a91c38..016bf0b6b 100644
--- a/src/lib/filters/pipe.cpp
+++ b/src/lib/filters/pipe.cpp
@@ -8,6 +8,7 @@
 #include <botan/pipe.h>
 #include <botan/internal/out_buf.h>
 #include <botan/internal/secqueue.h>
+#include <memory>
 
 namespace Botan {
 
@@ -40,7 +41,7 @@ Pipe::Pipe(Filter* f1, Filter* f2, Filter* f3, Filter* f4) :
 */
 Pipe::Pipe(std::initializer_list<Filter*> args)
    {
-   m_outputs.reset(new Output_Buffers);
+   m_outputs = std::make_unique<Output_Buffers>();
    m_pipe = nullptr;
    m_default_read = 0;
    m_inside_msg = false;
diff --git a/src/lib/filters/threaded_fork.cpp b/src/lib/filters/threaded_fork.cpp
index 16206bfa2..4831bff3a 100644
--- a/src/lib/filters/threaded_fork.cpp
+++ b/src/lib/filters/threaded_fork.cpp
@@ -92,9 +92,8 @@ void Threaded_Fork::set_next(Filter* f[], size_t n)
       for(size_t i = m_threads.size(); i != n; ++i)
          {
          m_threads.push_back(
-            std::shared_ptr<std::thread>(
-               new std::thread(
-                  std::bind(&Threaded_Fork::thread_entry, this, m_next[i]))));
+            std::make_shared<std::thread>(
+               std::bind(&Threaded_Fork::thread_entry, this, m_next[i])));
          }
       }
    }
diff --git a/src/lib/misc/fpe_fe1/fpe_fe1.cpp b/src/lib/misc/fpe_fe1/fpe_fe1.cpp
index 16ce62610..263b0fbdc 100644
--- a/src/lib/misc/fpe_fe1/fpe_fe1.cpp
+++ b/src/lib/misc/fpe_fe1/fpe_fe1.cpp
@@ -85,7 +85,7 @@ FPE_FE1::FPE_FE1(const BigInt& n,
          std::swap(m_a, m_b);
       }
 
-   mod_a.reset(new Modular_Reducer(m_a));
+   mod_a = std::make_unique<Modular_Reducer>(m_a);
    }
 
 FPE_FE1::~FPE_FE1() = default;
diff --git a/src/lib/modes/aead/ocb/ocb.cpp b/src/lib/modes/aead/ocb/ocb.cpp
index 0fea89f2b..5bbb31872 100644
--- a/src/lib/modes/aead/ocb/ocb.cpp
+++ b/src/lib/modes/aead/ocb/ocb.cpp
@@ -233,7 +233,7 @@ Key_Length_Specification OCB_Mode::key_spec() const
 void OCB_Mode::key_schedule(const uint8_t key[], size_t length)
    {
    m_cipher->set_key(key, length);
-   m_L.reset(new L_computer(*m_cipher));
+   m_L = std::make_unique<L_computer>(*m_cipher);
    }
 
 void OCB_Mode::set_associated_data(const uint8_t ad[], size_t ad_len)
diff --git a/src/lib/prov/pkcs11/p11_module.cpp b/src/lib/prov/pkcs11/p11_module.cpp
index 9fb655b82..0322dad5b 100644
--- a/src/lib/prov/pkcs11/p11_module.cpp
+++ b/src/lib/prov/pkcs11/p11_module.cpp
@@ -40,9 +40,9 @@ void Module::reload(C_InitializeArgs init_args)
       m_low_level->C_Finalize(nullptr);
       }
 
-   m_library.reset(new Dynamically_Loaded_Library(m_file_path));
+   m_library = std::make_unique<Dynamically_Loaded_Library>(m_file_path);
    LowLevel::C_GetFunctionList(*m_library, &m_func_list);
-   m_low_level.reset(new LowLevel(m_func_list));
+   m_low_level = std::make_unique<LowLevel>(m_func_list);
 
    m_low_level->C_Initialize(&init_args);
    }
diff --git a/src/lib/pubkey/ecdsa/ecdsa.cpp b/src/lib/pubkey/ecdsa/ecdsa.cpp
index c7b6be6ca..c26396daf 100644
--- a/src/lib/pubkey/ecdsa/ecdsa.cpp
+++ b/src/lib/pubkey/ecdsa/ecdsa.cpp
@@ -144,7 +144,7 @@ class ECDSA_Signature_Operation final : public PK_Ops::Signature_with_EMSA
          m_x(ecdsa.private_value())
          {
 #if defined(BOTAN_HAS_RFC6979_GENERATOR)
-         m_rfc6979.reset(new RFC6979_Nonce_Generator(this->hash_for_signature(), m_group.get_order(), m_x));
+         m_rfc6979 = std::make_unique<RFC6979_Nonce_Generator>(this->hash_for_signature(), m_group.get_order(), m_x);
 #endif
 
          m_b = m_group.random_scalar(rng);
diff --git a/src/lib/pubkey/rfc6979/rfc6979.cpp b/src/lib/pubkey/rfc6979/rfc6979.cpp
index 3a67e6951..5270a5aa8 100644
--- a/src/lib/pubkey/rfc6979/rfc6979.cpp
+++ b/src/lib/pubkey/rfc6979/rfc6979.cpp
@@ -20,7 +20,7 @@ RFC6979_Nonce_Generator::RFC6979_Nonce_Generator(const std::string& hash,
    m_rng_in(m_rlen * 2),
    m_rng_out(m_rlen)
    {
-   m_hmac_drbg.reset(new HMAC_DRBG(MessageAuthenticationCode::create("HMAC(" + hash + ")")));
+   m_hmac_drbg = std::make_unique<HMAC_DRBG>(MessageAuthenticationCode::create("HMAC(" + hash + ")"));
    BigInt::encode_1363(m_rng_in.data(), m_rlen, x);
    }
 
diff --git a/src/lib/rng/auto_rng/auto_rng.cpp b/src/lib/rng/auto_rng/auto_rng.cpp
index 3ff7bf867..da7f5e469 100644
--- a/src/lib/rng/auto_rng/auto_rng.cpp
+++ b/src/lib/rng/auto_rng/auto_rng.cpp
@@ -23,18 +23,18 @@ AutoSeeded_RNG::~AutoSeeded_RNG() = default;
 AutoSeeded_RNG::AutoSeeded_RNG(RandomNumberGenerator& underlying_rng,
                                size_t reseed_interval)
    {
-   m_rng.reset(new HMAC_DRBG(MessageAuthenticationCode::create_or_throw(BOTAN_AUTO_RNG_HMAC),
+   m_rng = std::make_unique<HMAC_DRBG>(MessageAuthenticationCode::create_or_throw(BOTAN_AUTO_RNG_HMAC),
                              underlying_rng,
-                             reseed_interval));
+                             reseed_interval);
    force_reseed();
    }
 
 AutoSeeded_RNG::AutoSeeded_RNG(Entropy_Sources& entropy_sources,
                                size_t reseed_interval)
    {
-   m_rng.reset(new HMAC_DRBG(MessageAuthenticationCode::create_or_throw(BOTAN_AUTO_RNG_HMAC),
+   m_rng = std::make_unique<HMAC_DRBG>(MessageAuthenticationCode::create_or_throw(BOTAN_AUTO_RNG_HMAC),
                              entropy_sources,
-                             reseed_interval));
+                             reseed_interval);
    force_reseed();
    }
 
@@ -42,9 +42,9 @@ AutoSeeded_RNG::AutoSeeded_RNG(RandomNumberGenerator& underlying_rng,
                                Entropy_Sources& entropy_sources,
                                size_t reseed_interval)
    {
-   m_rng.reset(new HMAC_DRBG(
+   m_rng = std::make_unique<HMAC_DRBG>(
                   MessageAuthenticationCode::create_or_throw(BOTAN_AUTO_RNG_HMAC),
-                  underlying_rng, entropy_sources, reseed_interval));
+                  underlying_rng, entropy_sources, reseed_interval);
    force_reseed();
    }
 
diff --git a/src/lib/tls/tls12/tls_cbc/tls_cbc.cpp b/src/lib/tls/tls12/tls_cbc/tls_cbc.cpp
index d368af331..de4302258 100644
--- a/src/lib/tls/tls12/tls_cbc/tls_cbc.cpp
+++ b/src/lib/tls/tls12/tls_cbc/tls_cbc.cpp
@@ -46,9 +46,9 @@ TLS_CBC_HMAC_AEAD_Mode::TLS_CBC_HMAC_AEAD_Mode(Cipher_Dir dir,
 
    auto null_padding = std::make_unique<Null_Padding>();
    if(dir == Cipher_Dir::Encryption)
-      m_cbc.reset(new CBC_Encryption(std::move(cipher), std::move(null_padding)));
+      m_cbc = std::make_unique<CBC_Encryption>(std::move(cipher), std::move(null_padding));
    else
-      m_cbc.reset(new CBC_Decryption(std::move(cipher), std::move(null_padding)));
+      m_cbc = std::make_unique<CBC_Decryption>(std::move(cipher), std::move(null_padding));
    }
 
 void TLS_CBC_HMAC_AEAD_Mode::clear()
diff --git a/src/lib/tls/tls12/tls_channel_impl_12.cpp b/src/lib/tls/tls12/tls_channel_impl_12.cpp
index b2fddc7ee..917e6f30d 100644
--- a/src/lib/tls/tls12/tls_channel_impl_12.cpp
+++ b/src/lib/tls/tls12/tls_channel_impl_12.cpp
@@ -125,9 +125,9 @@ Handshake_State& Channel_Impl_12::create_handshake_state(Protocol_Version versio
    if(!m_sequence_numbers)
       {
       if(version.is_datagram_protocol())
-         m_sequence_numbers.reset(new Datagram_Sequence_Numbers);
+         m_sequence_numbers = std::make_unique<Datagram_Sequence_Numbers>();
       else
-         m_sequence_numbers.reset(new Stream_Sequence_Numbers);
+         m_sequence_numbers = std::make_unique<Stream_Sequence_Numbers>();
       }
 
    using namespace std::placeholders;
@@ -135,16 +135,16 @@ Handshake_State& Channel_Impl_12::create_handshake_state(Protocol_Version versio
    std::unique_ptr<Handshake_IO> io;
    if(version.is_datagram_protocol())
       {
-      io.reset(new Datagram_Handshake_IO(
+      io = std::make_unique<Datagram_Handshake_IO>(
                   std::bind(&Channel_Impl_12::send_record_under_epoch, this, _1, _2, _3),
                   sequence_numbers(),
                   static_cast<uint16_t>(m_policy.dtls_default_mtu()),
                   m_policy.dtls_initial_timeout(),
-                  m_policy.dtls_maximum_timeout()));
+                  m_policy.dtls_maximum_timeout());
       }
    else
       {
-      io.reset(new Stream_Handshake_IO(std::bind(&Channel_Impl_12::send_record, this, _1, _2)));
+      io = std::make_unique<Stream_Handshake_IO>(std::bind(&Channel_Impl_12::send_record, this, _1, _2));
       }
 
    m_pending_state = new_handshake_state(std::move(io));
diff --git a/src/lib/tls/tls12/tls_record.cpp b/src/lib/tls/tls12/tls_record.cpp
index de1b0276b..71ece28bd 100644
--- a/src/lib/tls/tls12/tls_record.cpp
+++ b/src/lib/tls/tls12/tls_record.cpp
@@ -49,23 +49,23 @@ Connection_Cipher_State::Connection_Cipher_State(Protocol_Version version,
 
       if(our_side)
          {
-         m_aead.reset(new TLS_CBC_HMAC_AEAD_Encryption(
+         m_aead = std::make_unique<TLS_CBC_HMAC_AEAD_Encryption>(
                          std::move(cipher),
                          std::move(mac),
                          suite.cipher_keylen(),
                          suite.mac_keylen(),
                          version,
-                         uses_encrypt_then_mac));
+                         uses_encrypt_then_mac);
          }
       else
          {
-         m_aead.reset(new TLS_CBC_HMAC_AEAD_Decryption(
+         m_aead = std::make_unique<TLS_CBC_HMAC_AEAD_Decryption>(
                          std::move(cipher),
                          std::move(mac),
                          suite.cipher_keylen(),
                          suite.mac_keylen(),
                          version,
-                         uses_encrypt_then_mac));
+                         uses_encrypt_then_mac);
          }
 
 #else
diff --git a/src/lib/utils/locking_allocator/locking_allocator.cpp b/src/lib/utils/locking_allocator/locking_allocator.cpp
index 3fef3d7a6..423f9cf11 100644
--- a/src/lib/utils/locking_allocator/locking_allocator.cpp
+++ b/src/lib/utils/locking_allocator/locking_allocator.cpp
@@ -51,7 +51,7 @@ mlock_allocator::mlock_allocator()
 
       if(!m_locked_pages.empty())
          {
-         m_pool.reset(new Memory_Pool(m_locked_pages, page_size));
+         m_pool = std::make_unique<Memory_Pool>(m_locked_pages, page_size);
          }
       }
    }
diff --git a/src/lib/utils/mem_pool/mem_pool.cpp b/src/lib/utils/mem_pool/mem_pool.cpp
index 17b0b6c0d..e3185b1e5 100644
--- a/src/lib/utils/mem_pool/mem_pool.cpp
+++ b/src/lib/utils/mem_pool/mem_pool.cpp
@@ -149,7 +149,8 @@ class BitMap final
       explicit BitMap(size_t bits) : m_len(bits)
          {
          m_bits.resize((bits + BITMASK_BITS - 1) / BITMASK_BITS);
-         m_main_mask = static_cast<bitmask_type>(~0);
+         // MSVC warns if the cast isn't there, clang-tidy warns that the cast is pointless
+         m_main_mask = static_cast<bitmask_type>(~0); // NOLINT(bugprone-misplaced-widening-cast)
          m_last_mask = m_main_mask;
 
          if(bits % BITMASK_BITS != 0)
diff --git a/src/lib/x509/x509_ext.cpp b/src/lib/x509/x509_ext.cpp
index fc46c3968..68a5bb869 100644
--- a/src/lib/x509/x509_ext.cpp
+++ b/src/lib/x509/x509_ext.cpp
@@ -96,7 +96,7 @@ Extensions::create_extn_obj(const OID& oid,
       }
    catch(Decoding_Error&)
       {
-      extn.reset(new Cert_Extension::Unknown_Extension(oid, critical));
+      extn = std::make_unique<Cert_Extension::Unknown_Extension>(oid, critical);
       extn->decode_inner(body);
       }
    return extn;
diff --git a/src/scripts/dev_tools/run_clang_tidy.py b/src/scripts/dev_tools/run_clang_tidy.py
index 3f3f2ea54..38636fd55 100755
--- a/src/scripts/dev_tools/run_clang_tidy.py
+++ b/src/scripts/dev_tools/run_clang_tidy.py
@@ -13,12 +13,17 @@ enabled_checks = [
     'bugprone-*',
     'cert-*',
     'clang-analyzer-*',
-    'modernize-concat-nested-namespaces',
     'performance-*',
     'portability-*',
+
+    'modernize-concat-nested-namespaces',
+    'modernize-make-unique',
+    'modernize-make-shared',
+
     'readability-container-size-empty',
     'readability-static-definition-in-anonymous-namespace',
     'readability-convert-member-functions-to-static',
+
     'hicpp-special-member-functions',
 
 #    'cppcoreguidelines-*',
@@ -48,8 +53,6 @@ disabled_needs_work = [
     'hicpp-explicit-conversions',
     'modernize-pass-by-value',
     'modernize-use-nodiscard',
-    'modernize-make-unique',
-    'modernize-make-shared',
     'modernize-avoid-bind', # used a lot in pkcs11
     'modernize-use-trailing-return-type',
     'performance-inefficient-string-concatenation',


Test patch:
diff --git a/src/tests/test_certstor_system.cpp b/src/tests/test_certstor_system.cpp
index ee42e03f4..495f79bb1 100644
--- a/src/tests/test_certstor_system.cpp
+++ b/src/tests/test_certstor_system.cpp
@@ -14,6 +14,7 @@
 #include <botan/ber_dec.h>
 #include <botan/der_enc.h>
 #include <botan/hex.h>
+#include <memory>
 
 namespace Botan_Tests {
 
@@ -331,7 +332,7 @@ class Certstor_System_Tests final : public Test
          try
             {
             open_result.start_timer();
-            system.reset(new Botan::System_Certificate_Store);
+            system = std::make_unique<Botan::System_Certificate_Store>();
             open_result.end_timer();
             }
          catch(Botan::Not_Implemented& e)
diff --git a/src/tests/test_ecdsa.cpp b/src/tests/test_ecdsa.cpp
index 08b27d950..69523899b 100644
--- a/src/tests/test_ecdsa.cpp
+++ b/src/tests/test_ecdsa.cpp
@@ -243,7 +243,7 @@ class ECDSA_Invalid_Key_Tests final : public Text_Based_Test
 
          try
             {
-            public_point.reset(new Botan::EC_Point(group.point(x, y)));
+            public_point = std::make_unique<Botan::EC_Point>(group.point(x, y));
             }
          catch(Botan::Invalid_Argument&)
             {
diff --git a/src/tests/test_ocb.cpp b/src/tests/test_ocb.cpp
index b737db111..70f700ca7 100644
--- a/src/tests/test_ocb.cpp
+++ b/src/tests/test_ocb.cpp
@@ -188,7 +188,7 @@ class OCB_Wide_Long_KAT_Tests final : public Text_Based_Test
                bs = 64;
             else
                throw Test_Error("Unknown cipher for OCB wide block long test");
-            cipher.reset(new OCB_Wide_Test_Block_Cipher(bs));
+            cipher = std::make_unique<OCB_Wide_Test_Block_Cipher>(bs);
             }
 
          Botan::OCB_Encryption enc(std::move(cipher), std::min<size_t>(bs, 32));
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp
index 0ccf2dc73..be82df146 100644
--- a/src/tests/test_pkcs11_high_level.cpp
+++ b/src/tests/test_pkcs11_high_level.cpp
@@ -10,6 +10,7 @@
 #include "tests.h"
 #include "test_pkcs11.h"
 
+#include <memory>
 #include <string>
 #include <vector>
 #include <memory>
@@ -103,8 +104,8 @@ class TestSession
          m_module(new Module(Test::pkcs11_lib()))
          {
          std::vector<SlotId> slot_vec = Slot::get_available_slots(*m_module, true);
-         m_slot.reset(new Slot(*m_module, slot_vec.at(0)));
-         m_session.reset(new Session(*m_slot, false));
+         m_slot = std::make_unique<Slot>(*m_module, slot_vec.at(0));
+         m_session = std::make_unique<Session>(*m_slot, false);
          if(login)
             {
             m_session->login(UserType::User, PIN());
diff --git a/src/tests/test_pkcs11_low_level.cpp b/src/tests/test_pkcs11_low_level.cpp
index d3b72507e..b38397ca4 100644
--- a/src/tests/test_pkcs11_low_level.cpp
+++ b/src/tests/test_pkcs11_low_level.cpp
@@ -38,7 +38,7 @@ class RAII_LowLevel
          m_is_session_open(false), m_is_logged_in(false)
          {
          LowLevel::C_GetFunctionList(m_module, &m_func_list);
-         m_low_level.reset(new LowLevel(m_func_list));
+         m_low_level = std::make_unique<LowLevel>(m_func_list);
 
          C_InitializeArgs init_args = { nullptr, nullptr, nullptr, nullptr, static_cast<CK_FLAGS>(Flag::OsLockingOk), nullptr };
 
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp
index 9a234f865..b419faaf3 100644
--- a/src/tests/test_pubkey.cpp
+++ b/src/tests/test_pubkey.cpp
@@ -136,7 +136,7 @@ PK_Signature_Generation_Test::run_one_test(const std::string& pad_hdr, const Var
 
       try
          {
-         verifier.reset(new Botan::PK_Verifier(*pubkey, padding, Botan::Signature_Format::Standard, verify_provider));
+         verifier = std::make_unique<Botan::PK_Verifier>(*pubkey, padding, Botan::Signature_Format::Standard, verify_provider);
          }
       catch(Botan::Lookup_Error&)
          {
@@ -158,7 +158,7 @@ PK_Signature_Generation_Test::run_one_test(const std::string& pad_hdr, const Var
 
       try
          {
-         signer.reset(new Botan::PK_Signer(*privkey, Test::rng(), padding, Botan::Signature_Format::Standard, sign_provider));
+         signer = std::make_unique<Botan::PK_Signer>(*privkey, Test::rng(), padding, Botan::Signature_Format::Standard, sign_provider);
 
          if(vars.has_key("Nonce"))
             {
@@ -224,7 +224,7 @@ PK_Signature_Verification_Test::run_one_test(const std::string& pad_hdr, const V
 
       try
          {
-         verifier.reset(new Botan::PK_Verifier(*pubkey, padding, sig_format(), verify_provider));
+         verifier = std::make_unique<Botan::PK_Verifier>(*pubkey, padding, sig_format(), verify_provider);
          }
       catch(Botan::Lookup_Error&)
          {
@@ -278,7 +278,7 @@ PK_Signature_NonVerification_Test::run_one_test(const std::string& pad_hdr, cons
 
       try
          {
-         verifier.reset(new Botan::PK_Verifier(*pubkey, padding, Botan::Signature_Format::Standard, verify_provider));
+         verifier = std::make_unique<Botan::PK_Verifier>(*pubkey, padding, Botan::Signature_Format::Standard, verify_provider);
          result.test_eq("incorrect signature rejected", verifier->verify_message(message, invalid_signature), false);
          }
       catch(Botan::Lookup_Error&)
@@ -307,8 +307,8 @@ PK_Sign_Verify_DER_Test::run()
 
       try
          {
-         signer.reset(new Botan::PK_Signer(*privkey, Test::rng(), padding, Botan::Signature_Format::DerSequence, provider));
-         verifier.reset(new Botan::PK_Verifier(*privkey, padding, Botan::Signature_Format::DerSequence, provider));
+         signer = std::make_unique<Botan::PK_Signer>(*privkey, Test::rng(), padding, Botan::Signature_Format::DerSequence, provider);
+         verifier = std::make_unique<Botan::PK_Verifier>(*privkey, padding, Botan::Signature_Format::DerSequence, provider);
          }
       catch(Botan::Lookup_Error& e)
          {
@@ -370,7 +370,7 @@ PK_Encryption_Decryption_Test::run_one_test(const std::string& pad_hdr, const Va
 
       try
          {
-         decryptor.reset(new Botan::PK_Decryptor_EME(*privkey, Test::rng(), padding, dec_provider));
+         decryptor = std::make_unique<Botan::PK_Decryptor_EME>(*privkey, Test::rng(), padding, dec_provider);
          }
       catch(Botan::Lookup_Error&)
          {
@@ -402,7 +402,7 @@ PK_Encryption_Decryption_Test::run_one_test(const std::string& pad_hdr, const Va
 
       try
          {
-         encryptor.reset(new Botan::PK_Encryptor_EME(*pubkey, Test::rng(), padding, enc_provider));
+         encryptor = std::make_unique<Botan::PK_Encryptor_EME>(*pubkey, Test::rng(), padding, enc_provider);
          }
       catch(Botan::Lookup_Error&)
          {
@@ -473,7 +473,7 @@ PK_Decryption_Test::run_one_test(const std::string& pad_hdr, const VarMap& vars)
 
       try
          {
-         decryptor.reset(new Botan::PK_Decryptor_EME(*privkey, Test::rng(), padding, dec_provider));
+         decryptor = std::make_unique<Botan::PK_Decryptor_EME>(*privkey, Test::rng(), padding, dec_provider);
          }
       catch(Botan::Lookup_Error&)
          {
@@ -515,7 +515,7 @@ Test::Result PK_KEM_Test::run_one_test(const std::string& /*header*/, const VarM
    std::unique_ptr<Botan::PK_KEM_Encryptor> enc;
    try
       {
-      enc.reset(new Botan::PK_KEM_Encryptor(pubkey, Test::rng(), kdf));
+      enc = std::make_unique<Botan::PK_KEM_Encryptor>(pubkey, Test::rng(), kdf);
       }
    catch(Botan::Lookup_Error&)
       {
@@ -538,7 +538,7 @@ Test::Result PK_KEM_Test::run_one_test(const std::string& /*header*/, const VarM
    std::unique_ptr<Botan::PK_KEM_Decryptor> dec;
    try
       {
-      dec.reset(new Botan::PK_KEM_Decryptor(*privkey, Test::rng(), kdf));
+      dec = std::make_unique<Botan::PK_KEM_Decryptor>(*privkey, Test::rng(), kdf);
       }
    catch(Botan::Lookup_Error& e)
       {
@@ -577,7 +577,7 @@ Test::Result PK_Key_Agreement_Test::run_one_test(const std::string& header, cons
 
       try
          {
-         kas.reset(new Botan::PK_Key_Agreement(*privkey, Test::rng(), kdf, provider));
+         kas = std::make_unique<Botan::PK_Key_Agreement>(*privkey, Test::rng(), kdf, provider);
 
          auto derived_key = kas->derive_key(key_len, pubkey).bits_of();
          result.test_eq(provider, "agreement", derived_key, shared);
@@ -836,7 +836,7 @@ Test::Result PK_Key_Generation_Stability_Test::run_one_test(const std::string&,
 #if defined(BOTAN_HAS_HMAC_DRBG)
    if(rng_algo == "HMAC_DRBG")
       {
-      rng.reset(new Botan::HMAC_DRBG(rng_params));
+      rng = std::make_unique<Botan::HMAC_DRBG>(rng_params);
       }
 #endif
 
@@ -844,7 +844,7 @@ Test::Result PK_Key_Generation_Stability_Test::run_one_test(const std::string&,
       {
       if(!rng_params.empty())
          throw Test_Error("Expected empty RngParams for Fixed RNG");
-      rng.reset(new Fixed_Output_RNG());
+      rng = std::make_unique<Fixed_Output_RNG>();
       }
 
    if(rng)
diff --git a/src/tests/test_tls.cpp b/src/tests/test_tls.cpp
index 9eb135978..18aa0f024 100644
--- a/src/tests/test_tls.cpp
+++ b/src/tests/test_tls.cpp
@@ -362,27 +362,27 @@ class Test_TLS_Policy_Text : public Test
          std::unique_ptr<Botan::TLS::Policy> policy;
          if(policy_str == "default")
             {
-            policy.reset(new Botan::TLS::Policy);
+            policy = std::make_unique<Botan::TLS::Policy>();
             }
          else if(policy_str == "suiteb_128")
             {
-            policy.reset(new Botan::TLS::NSA_Suite_B_128);
+            policy = std::make_unique<Botan::TLS::NSA_Suite_B_128>();
             }
          else if(policy_str == "suiteb_192")
             {
-            policy.reset(new Botan::TLS::NSA_Suite_B_192);
+            policy = std::make_unique<Botan::TLS::NSA_Suite_B_192>();
             }
          else if(policy_str == "bsi")
             {
-            policy.reset(new Botan::TLS::BSI_TR_02102_2);
+            policy = std::make_unique<Botan::TLS::BSI_TR_02102_2>();
             }
          else if(policy_str == "strict")
             {
-            policy.reset(new Botan::TLS::Strict_Policy);
+            policy = std::make_unique<Botan::TLS::Strict_Policy>();
             }
          else if(policy_str == "datagram")
             {
-            policy.reset(new Botan::TLS::Datagram_Policy);
+            policy = std::make_unique<Botan::TLS::Datagram_Policy>();
             }
          else
             {
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 248be273b..9f3db9e4a 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -1108,7 +1108,7 @@ std::string Text_Based_Test::get_next_line()
                }
             }
 
-         m_cur.reset(new std::ifstream(m_srcs[0]));
+         m_cur = std::make_unique<std::ifstream>(m_srcs[0]);
          m_cur_src_name = m_srcs[0];
 
          // Reinit cpuid on new file if needed
diff --git a/src/tests/unit_tls.cpp b/src/tests/unit_tls.cpp
index 875d895eb..0e2365a16 100644
--- a/src/tests/unit_tls.cpp
+++ b/src/tests/unit_tls.cpp
@@ -265,12 +265,12 @@ class TLS_Handshake_Test final
          m_rng(rng),
          m_client_auth(expect_client_auth)
          {
-         m_server_cb.reset(new Test_Callbacks(m_results, offer_version, m_s2c, m_server_recv));
-         m_client_cb.reset(new Test_Callbacks(m_results, offer_version, m_c2s, m_client_recv));
+         m_server_cb = std::make_unique<Test_Callbacks>(m_results, offer_version, m_s2c, m_server_recv);
+         m_client_cb = std::make_unique<Test_Callbacks>(m_results, offer_version, m_c2s, m_client_recv);
 
-         m_server.reset(
-            new Botan::TLS::Server(*m_server_cb, server_sessions, m_creds, server_policy, m_rng,
-                                   offer_version.is_datagram_protocol())
+         m_server = std::make_unique<Botan::TLS::Server>(
+            *m_server_cb, server_sessions, m_creds, server_policy, m_rng,
+                                   offer_version.is_datagram_protocol()
             );
 
          }
@@ -461,12 +461,12 @@ void TLS_Handshake_Test::go()
    bool server_has_written = false;
 
    std::unique_ptr<Botan::TLS::Client> client;
-   client.reset(
-      new Botan::TLS::Client(*m_client_cb, m_client_sessions, m_creds,
+   client = std::make_unique<Botan::TLS::Client>(
+      *m_client_cb, m_client_sessions, m_creds,
                              m_client_policy, m_rng,
                              Botan::TLS::Server_Information("server.example.com"),
                              m_offer_version,
-                             protocols_offered));
+                             protocols_offered);
 
    size_t rounds = 0;
 
@@ -789,8 +789,8 @@ class TLS_Unit_Tests final : public Test
             new Botan::TLS::Session_Manager_SQLite("server pass", rng, ":memory:", 10, std::chrono::seconds(4)));
 
 #else
-         client_ses.reset(new Botan::TLS::Session_Manager_In_Memory(rng));
-         server_ses.reset(new Botan::TLS::Session_Manager_In_Memory(rng));
+         client_ses = std::make_unique<Botan::TLS::Session_Manager_In_Memory>(rng);
+         server_ses = std::make_unique<Botan::TLS::Session_Manager_In_Memory>(rng);
 #endif
 
          std::unique_ptr<Botan::Credentials_Manager> creds(create_creds(rng));