aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/asn1/asn1_oid.h2
-rw-r--r--src/lib/block/gost_28147/gost_28147.h5
-rw-r--r--src/lib/compression/zlib/zlib.h2
-rw-r--r--src/lib/entropy/dev_random/dev_random.h2
-rw-r--r--src/lib/entropy/proc_walk/proc_walk.h2
-rw-r--r--src/lib/hash/sha3/sha3.h2
-rw-r--r--src/lib/hash/shake/shake.h4
-rw-r--r--src/lib/hash/streebog/streebog.h2
-rw-r--r--src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h2
-rw-r--r--src/lib/kdf/sp800_108/sp800_108.h6
-rw-r--r--src/lib/math/bigint/bigint.h2
-rw-r--r--src/lib/math/numbertheory/dsa_gen.cpp6
-rw-r--r--src/lib/rng/hmac_drbg/hmac_drbg.h4
-rw-r--r--src/lib/stream/chacha/chacha.h2
14 files changed, 23 insertions, 20 deletions
diff --git a/src/lib/asn1/asn1_oid.h b/src/lib/asn1/asn1_oid.h
index 8f3f20f2f..14600129a 100644
--- a/src/lib/asn1/asn1_oid.h
+++ b/src/lib/asn1/asn1_oid.h
@@ -63,7 +63,7 @@ class BOTAN_PUBLIC_API(2,0) OID final : public ASN1_Object
* Construct an OID from a string.
* @param str a string in the form "a.b.c" etc., where a,b,c are numbers
*/
- OID(const std::string& str = "");
+ explicit OID(const std::string& str = "");
private:
std::vector<uint32_t> m_id;
};
diff --git a/src/lib/block/gost_28147/gost_28147.h b/src/lib/block/gost_28147/gost_28147.h
index fb2e981ac..09581191e 100644
--- a/src/lib/block/gost_28147/gost_28147.h
+++ b/src/lib/block/gost_28147/gost_28147.h
@@ -40,7 +40,7 @@ class BOTAN_PUBLIC_API(2,0) GOST_28147_89_Params final
* Federation
* @param name of the parameter set
*/
- GOST_28147_89_Params(const std::string& name = "R3411_94_TestParam");
+ explicit GOST_28147_89_Params(const std::string& name = "R3411_94_TestParam");
private:
const uint8_t* m_sboxes;
std::string m_name;
@@ -64,6 +64,9 @@ class BOTAN_PUBLIC_API(2,0) GOST_28147_89 final : public Block_Cipher_Fixed_Para
* @param params the sbox parameters to use
*/
explicit GOST_28147_89(const GOST_28147_89_Params& params);
+
+ explicit GOST_28147_89(const std::string& param_name) :
+ GOST_28147_89(GOST_28147_89_Params(param_name)) {}
private:
explicit GOST_28147_89(const std::vector<uint32_t>& other_SBOX) :
m_SBOX(other_SBOX), m_EK(8) {}
diff --git a/src/lib/compression/zlib/zlib.h b/src/lib/compression/zlib/zlib.h
index 9b88a3305..2dd897981 100644
--- a/src/lib/compression/zlib/zlib.h
+++ b/src/lib/compression/zlib/zlib.h
@@ -63,7 +63,7 @@ class BOTAN_PUBLIC_API(2,0) Deflate_Decompression final : public Stream_Decompre
class BOTAN_PUBLIC_API(2,0) Gzip_Compression final : public Stream_Compression
{
public:
- Gzip_Compression(uint8_t os_code = 255) : m_os_code(os_code) {}
+ explicit Gzip_Compression(uint8_t os_code = 255) : m_os_code(os_code) {}
std::string name() const override { return "Gzip_Compression"; }
private:
diff --git a/src/lib/entropy/dev_random/dev_random.h b/src/lib/entropy/dev_random/dev_random.h
index 1c358e509..6195f8564 100644
--- a/src/lib/entropy/dev_random/dev_random.h
+++ b/src/lib/entropy/dev_random/dev_random.h
@@ -24,7 +24,7 @@ class Device_EntropySource final : public Entropy_Source
size_t poll(RandomNumberGenerator& rng) override;
- Device_EntropySource(const std::vector<std::string>& fsnames);
+ explicit Device_EntropySource(const std::vector<std::string>& fsnames);
~Device_EntropySource();
private:
diff --git a/src/lib/entropy/proc_walk/proc_walk.h b/src/lib/entropy/proc_walk/proc_walk.h
index c261c4d92..4c5013d29 100644
--- a/src/lib/entropy/proc_walk/proc_walk.h
+++ b/src/lib/entropy/proc_walk/proc_walk.h
@@ -30,7 +30,7 @@ class ProcWalking_EntropySource final : public Entropy_Source
size_t poll(RandomNumberGenerator& rng) override;
- ProcWalking_EntropySource(const std::string& root_dir) :
+ explicit ProcWalking_EntropySource(const std::string& root_dir) :
m_path(root_dir), m_dir(nullptr) {}
private:
diff --git a/src/lib/hash/sha3/sha3.h b/src/lib/hash/sha3/sha3.h
index c198515df..ac01ca6dc 100644
--- a/src/lib/hash/sha3/sha3.h
+++ b/src/lib/hash/sha3/sha3.h
@@ -25,7 +25,7 @@ class BOTAN_PUBLIC_API(2,0) SHA_3 : public HashFunction
* @param output_bits the size of the hash output; must be one of
* 224, 256, 384, or 512
*/
- SHA_3(size_t output_bits);
+ explicit SHA_3(size_t output_bits);
size_t hash_block_size() const override { return m_bitrate / 8; }
size_t output_length() const override { return m_output_bits / 8; }
diff --git a/src/lib/hash/shake/shake.h b/src/lib/hash/shake/shake.h
index 5ec35901f..72b8e123e 100644
--- a/src/lib/hash/shake/shake.h
+++ b/src/lib/hash/shake/shake.h
@@ -25,7 +25,7 @@ class BOTAN_PUBLIC_API(2,0) SHAKE_128 final : public HashFunction
* @param output_bits the desired output size in bits
* must be a multiple of 8
*/
- SHAKE_128(size_t output_bits);
+ explicit SHAKE_128(size_t output_bits);
size_t hash_block_size() const override { return SHAKE_128_BITRATE / 8; }
size_t output_length() const override { return m_output_bits / 8; }
@@ -57,7 +57,7 @@ class BOTAN_PUBLIC_API(2,0) SHAKE_256 final : public HashFunction
* @param output_bits the desired output size in bits
* must be a multiple of 8
*/
- SHAKE_256(size_t output_bits);
+ explicit SHAKE_256(size_t output_bits);
size_t hash_block_size() const override { return SHAKE_256_BITRATE / 8; }
size_t output_length() const override { return m_output_bits / 8; }
diff --git a/src/lib/hash/streebog/streebog.h b/src/lib/hash/streebog/streebog.h
index 5e83efb39..70e38733f 100644
--- a/src/lib/hash/streebog/streebog.h
+++ b/src/lib/hash/streebog/streebog.h
@@ -28,7 +28,7 @@ class BOTAN_PUBLIC_API(2,2) Streebog : public HashFunction
std::unique_ptr<HashFunction> copy_state() const override;
- Streebog(size_t output_bits);
+ explicit Streebog(size_t output_bits);
protected:
void add_data(const uint8_t input[], size_t length) override;
void final_result(uint8_t out[]) override;
diff --git a/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h b/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h
index fcd465436..7a95a093b 100644
--- a/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h
+++ b/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h
@@ -31,7 +31,7 @@ class BOTAN_PUBLIC_API(2,0) KDF1_18033 final : public KDF
/**
* @param h hash function to use
*/
- KDF1_18033(HashFunction* h) : m_hash(h) {}
+ explicit KDF1_18033(HashFunction* h) : m_hash(h) {}
private:
std::unique_ptr<HashFunction> m_hash;
};
diff --git a/src/lib/kdf/sp800_108/sp800_108.h b/src/lib/kdf/sp800_108/sp800_108.h
index d74c876f7..25802f69e 100644
--- a/src/lib/kdf/sp800_108/sp800_108.h
+++ b/src/lib/kdf/sp800_108/sp800_108.h
@@ -48,7 +48,7 @@ class BOTAN_PUBLIC_API(2,0) SP800_108_Counter final : public KDF
/**
* @param mac MAC algorithm to use
*/
- SP800_108_Counter(MessageAuthenticationCode* mac) : m_prf(mac) {}
+ explicit SP800_108_Counter(MessageAuthenticationCode* mac) : m_prf(mac) {}
private:
std::unique_ptr<MessageAuthenticationCode> m_prf;
};
@@ -85,7 +85,7 @@ class BOTAN_PUBLIC_API(2,0) SP800_108_Feedback final : public KDF
const uint8_t salt[], size_t salt_len,
const uint8_t label[], size_t label_len) const override;
- SP800_108_Feedback(MessageAuthenticationCode* mac) : m_prf(mac) {}
+ explicit SP800_108_Feedback(MessageAuthenticationCode* mac) : m_prf(mac) {}
private:
std::unique_ptr<MessageAuthenticationCode> m_prf;
};
@@ -122,7 +122,7 @@ class BOTAN_PUBLIC_API(2,0) SP800_108_Pipeline final : public KDF
const uint8_t salt[], size_t salt_len,
const uint8_t label[], size_t label_len) const override;
- SP800_108_Pipeline(MessageAuthenticationCode* mac) : m_prf(mac) {}
+ explicit SP800_108_Pipeline(MessageAuthenticationCode* mac) : m_prf(mac) {}
private:
std::unique_ptr<MessageAuthenticationCode> m_prf;
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index e33adcf68..2dabd43a5 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -65,7 +65,7 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
*
* @param str the string to parse for an integer value
*/
- BigInt(const std::string& str);
+ explicit BigInt(const std::string& str);
/**
* Create a BigInt from an integer in a byte array
diff --git a/src/lib/math/numbertheory/dsa_gen.cpp b/src/lib/math/numbertheory/dsa_gen.cpp
index e345910ca..55190d60b 100644
--- a/src/lib/math/numbertheory/dsa_gen.cpp
+++ b/src/lib/math/numbertheory/dsa_gen.cpp
@@ -61,7 +61,7 @@ bool generate_dsa_primes(RandomNumberGenerator& rng,
public:
explicit Seed(const std::vector<uint8_t>& s) : m_seed(s) {}
- operator std::vector<uint8_t>& () { return m_seed; }
+ const std::vector<uint8_t>& value() const { return m_seed; }
Seed& operator++()
{
@@ -76,7 +76,7 @@ bool generate_dsa_primes(RandomNumberGenerator& rng,
Seed seed(seed_c);
- q.binary_decode(hash->process(seed));
+ q.binary_decode(hash->process(seed.value()));
q.set_bit(qbits-1);
q.set_bit(0);
@@ -94,7 +94,7 @@ bool generate_dsa_primes(RandomNumberGenerator& rng,
for(size_t k = 0; k <= n; ++k)
{
++seed;
- hash->update(seed);
+ hash->update(seed.value());
hash->final(&V[HASH_SIZE * (n-k)]);
}
diff --git a/src/lib/rng/hmac_drbg/hmac_drbg.h b/src/lib/rng/hmac_drbg/hmac_drbg.h
index bcde0db13..edf38b684 100644
--- a/src/lib/rng/hmac_drbg/hmac_drbg.h
+++ b/src/lib/rng/hmac_drbg/hmac_drbg.h
@@ -31,7 +31,7 @@ class BOTAN_PUBLIC_API(2,0) HMAC_DRBG final : public Stateful_RNG
* in response. In this case, an exception will be thrown rather
* than generating duplicated output.
*/
- HMAC_DRBG(std::unique_ptr<MessageAuthenticationCode> prf);
+ explicit HMAC_DRBG(std::unique_ptr<MessageAuthenticationCode> prf);
/**
* Initialize an HMAC_DRBG instance with the given MAC as PRF (normally HMAC)
@@ -122,7 +122,7 @@ class BOTAN_PUBLIC_API(2,0) HMAC_DRBG final : public Stateful_RNG
/**
* Constructor taking a string for the hash
*/
- HMAC_DRBG(const std::string& hmac_hash) :
+ explicit HMAC_DRBG(const std::string& hmac_hash) :
Stateful_RNG(),
m_mac(MessageAuthenticationCode::create_or_throw("HMAC(" + hmac_hash + ")")),
m_max_number_of_bytes_per_request(64 * 1024)
diff --git a/src/lib/stream/chacha/chacha.h b/src/lib/stream/chacha/chacha.h
index e53ae9e8c..6b2371553 100644
--- a/src/lib/stream/chacha/chacha.h
+++ b/src/lib/stream/chacha/chacha.h
@@ -25,7 +25,7 @@ class BOTAN_PUBLIC_API(2,0) ChaCha final : public StreamCipher
* @note Currently only 8, 12 or 20 rounds are supported, all others
* will throw an exception
*/
- ChaCha(size_t rounds = 20);
+ explicit ChaCha(size_t rounds = 20);
std::string provider() const override;