aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_newhope.cpp2
-rw-r--r--src/tests/test_ocb.cpp2
-rw-r--r--src/tests/test_pkcs11_low_level.cpp18
-rw-r--r--src/tests/test_psk_db.cpp2
-rw-r--r--src/tests/test_tls.cpp6
-rw-r--r--src/tests/test_utils.cpp2
-rw-r--r--src/tests/unit_tls.cpp4
-rw-r--r--src/tests/unit_x509.cpp2
8 files changed, 22 insertions, 16 deletions
diff --git a/src/tests/test_newhope.cpp b/src/tests/test_newhope.cpp
index 14e4a0190..310cf5653 100644
--- a/src/tests/test_newhope.cpp
+++ b/src/tests/test_newhope.cpp
@@ -78,7 +78,7 @@ class NEWHOPE_RNG final : public Botan::RandomNumberGenerator
/* ignored */
}
- NEWHOPE_RNG(const std::vector<uint8_t>& seed)
+ explicit NEWHOPE_RNG(const std::vector<uint8_t>& seed)
{
m_chacha = Botan::StreamCipher::create_or_throw("ChaCha20");
diff --git a/src/tests/test_ocb.cpp b/src/tests/test_ocb.cpp
index 6c13e851e..c55ec6c0b 100644
--- a/src/tests/test_ocb.cpp
+++ b/src/tests/test_ocb.cpp
@@ -24,7 +24,7 @@ namespace {
class OCB_Wide_Test_Block_Cipher final : public Botan::BlockCipher
{
public:
- OCB_Wide_Test_Block_Cipher(size_t bs) : m_bs(bs) {}
+ explicit OCB_Wide_Test_Block_Cipher(size_t bs) : m_bs(bs) {}
std::string name() const override { return "OCB_ToyCipher"; }
size_t block_size() const override { return m_bs; }
diff --git a/src/tests/test_pkcs11_low_level.cpp b/src/tests/test_pkcs11_low_level.cpp
index bbf3816d8..2e147de5b 100644
--- a/src/tests/test_pkcs11_low_level.cpp
+++ b/src/tests/test_pkcs11_low_level.cpp
@@ -44,6 +44,7 @@ class RAII_LowLevel
m_low_level->C_Initialize(&init_args);
}
+
~RAII_LowLevel() noexcept
{
try
@@ -65,6 +66,11 @@ class RAII_LowLevel
}
}
+ RAII_LowLevel(const RAII_LowLevel& other) = delete;
+ RAII_LowLevel(RAII_LowLevel&& other) = delete;
+ RAII_LowLevel& operator=(const RAII_LowLevel& other) = delete;
+ RAII_LowLevel& operator=(RAII_LowLevel&& other) = delete;
+
std::vector<SlotId> get_slots(bool token_present) const
{
std::vector<SlotId> slots;
@@ -606,16 +612,16 @@ Test::Result test_c_set_pin()
}
// Simple data object
-ObjectClass object_class = ObjectClass::Data;
-std::string label = "A data object";
-std::string data = "Sample data";
-Bbool btrue = True;
+const ObjectClass object_class = ObjectClass::Data;
+const std::string label = "A data object";
+const std::string data = "Sample data";
+const Bbool btrue = True;
std::array<Attribute, 4> dtemplate =
{
{
- { static_cast<CK_ATTRIBUTE_TYPE>(AttributeType::Class), &object_class, sizeof(object_class) },
- { static_cast<CK_ATTRIBUTE_TYPE>(AttributeType::Token), &btrue, sizeof(btrue) },
+ { static_cast<CK_ATTRIBUTE_TYPE>(AttributeType::Class), const_cast<ObjectClass*>(&object_class), sizeof(object_class) },
+ { static_cast<CK_ATTRIBUTE_TYPE>(AttributeType::Token), const_cast<Bbool*>(&btrue), sizeof(btrue) },
{ static_cast<CK_ATTRIBUTE_TYPE>(AttributeType::Label), const_cast<char*>(label.c_str()), static_cast<CK_ULONG>(label.size()) },
{ static_cast<CK_ATTRIBUTE_TYPE>(AttributeType::Value), const_cast<char*>(data.c_str()), static_cast<CK_ULONG>(data.size()) }
}
diff --git a/src/tests/test_psk_db.cpp b/src/tests/test_psk_db.cpp
index 2ec1b66b2..21f9011ab 100644
--- a/src/tests/test_psk_db.cpp
+++ b/src/tests/test_psk_db.cpp
@@ -21,7 +21,7 @@ namespace {
class Test_Map_PSK_Db : public Botan::Encrypted_PSK_Database
{
public:
- Test_Map_PSK_Db(const Botan::secure_vector<uint8_t>& master_key) :
+ explicit Test_Map_PSK_Db(const Botan::secure_vector<uint8_t>& master_key) :
Botan::Encrypted_PSK_Database(master_key)
{}
diff --git a/src/tests/test_tls.cpp b/src/tests/test_tls.cpp
index 750dacafe..b460f84fd 100644
--- a/src/tests/test_tls.cpp
+++ b/src/tests/test_tls.cpp
@@ -136,7 +136,7 @@ class TLS_CBC_Tests final : public Text_Based_Test
class ZeroMac : public Botan::MessageAuthenticationCode
{
public:
- ZeroMac(size_t mac_len) : m_mac_len(mac_len) {}
+ explicit ZeroMac(size_t mac_len) : m_mac_len(mac_len) {}
void clear() override {}
@@ -156,7 +156,7 @@ class TLS_CBC_Tests final : public Text_Based_Test
return Botan::Key_Length_Specification(0, 0, 1);
}
- virtual std::unique_ptr<MessageAuthenticationCode> new_object() const override
+ std::unique_ptr<MessageAuthenticationCode> new_object() const override
{
return std::make_unique<ZeroMac>(m_mac_len);
}
@@ -170,7 +170,7 @@ class TLS_CBC_Tests final : public Text_Based_Test
class Noop_Block_Cipher : public Botan::BlockCipher
{
public:
- Noop_Block_Cipher(size_t bs) : m_bs(bs) {}
+ explicit Noop_Block_Cipher(size_t bs) : m_bs(bs) {}
void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
{
diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp
index cb0ab23f5..11becee12 100644
--- a/src/tests/test_utils.cpp
+++ b/src/tests/test_utils.cpp
@@ -739,7 +739,7 @@ class UUID_Tests : public Test
class AllSame_RNG : public Botan::RandomNumberGenerator
{
public:
- AllSame_RNG(uint8_t b) : m_val(b) {}
+ explicit AllSame_RNG(uint8_t b) : m_val(b) {}
void randomize(uint8_t out[], size_t len) override
{
diff --git a/src/tests/unit_tls.cpp b/src/tests/unit_tls.cpp
index 7e0339451..2885db3ec 100644
--- a/src/tests/unit_tls.cpp
+++ b/src/tests/unit_tls.cpp
@@ -282,7 +282,7 @@ class TLS_Handshake_Test final
bool empty() const override { return false; }
- Test_Extension(Botan::TLS::Connection_Side side)
+ explicit Test_Extension(Botan::TLS::Connection_Side side)
{
const uint8_t client_extn[6] = { 'c', 'l', 'i', 'e', 'n', 't' };
const uint8_t server_extn[6] = { 's', 'e', 'r', 'v', 'e', 'r' };
@@ -396,7 +396,7 @@ class TLS_Handshake_Test final
return "test/3";
}
- virtual std::string tls_decode_group_param(Botan::TLS::Group_Params group_param) override
+ std::string tls_decode_group_param(Botan::TLS::Group_Params group_param) override
{
if(static_cast<uint16_t>(group_param) == 0xFEE1)
return "secp112r1";
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp
index acfd5c154..5e8254b91 100644
--- a/src/tests/unit_x509.cpp
+++ b/src/tests/unit_x509.cpp
@@ -1366,7 +1366,7 @@ class String_Extension final : public Botan::Certificate_Extension
{
public:
String_Extension() = default;
- String_Extension(const std::string& val) : m_contents(val) {}
+ explicit String_Extension(const std::string& val) : m_contents(val) {}
std::string value() const
{