aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-03-05 13:10:30 -0500
committerJack Lloyd <[email protected]>2016-03-05 13:10:30 -0500
commita3ce0bd1e9e018ea69741c4380bf065cccedec93 (patch)
tree71eac335b7bdc3a845b1d6599b78e337ad00433c /src/lib/pubkey
parent2467ccccd48fc502ee3e04d847d514e88d88b144 (diff)
parentc3540ae668a523c0155677c4ee4c9099910110bc (diff)
Make almost all single argument constructors `explicit`
GH #444
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r--src/lib/pubkey/curve25519/curve25519.h6
-rw-r--r--src/lib/pubkey/ec_group/ec_group.h4
-rw-r--r--src/lib/pubkey/mce/gf2m_small_m.h2
-rw-r--r--src/lib/pubkey/mce/mceliece.h4
-rw-r--r--src/lib/pubkey/mce/polyn_gf2m.h2
-rw-r--r--src/lib/pubkey/pk_ops_impl.h14
-rw-r--r--src/lib/pubkey/pkcs8.h2
-rw-r--r--src/lib/pubkey/rsa/rsa.cpp4
8 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/pubkey/curve25519/curve25519.h b/src/lib/pubkey/curve25519/curve25519.h
index c3e3d4e60..9d2868d6d 100644
--- a/src/lib/pubkey/curve25519/curve25519.h
+++ b/src/lib/pubkey/curve25519/curve25519.h
@@ -32,7 +32,7 @@ class BOTAN_DLL Curve25519_PublicKey : public virtual Public_Key
Curve25519_PublicKey(const AlgorithmIdentifier& alg_id,
const secure_vector<byte>& key_bits);
- Curve25519_PublicKey(const secure_vector<byte>& pub) : m_public(pub) {}
+ explicit Curve25519_PublicKey(const secure_vector<byte>& pub) : m_public(pub) {}
protected:
Curve25519_PublicKey() {}
secure_vector<byte> m_public;
@@ -47,9 +47,9 @@ class BOTAN_DLL Curve25519_PrivateKey : public Curve25519_PublicKey,
const secure_vector<byte>& key_bits,
RandomNumberGenerator& rng);
- Curve25519_PrivateKey(RandomNumberGenerator& rng);
+ explicit Curve25519_PrivateKey(RandomNumberGenerator& rng);
- Curve25519_PrivateKey(const secure_vector<byte>& secret_key);
+ explicit Curve25519_PrivateKey(const secure_vector<byte>& secret_key);
std::vector<byte> public_value() const override { return Curve25519_PublicKey::public_value(); }
diff --git a/src/lib/pubkey/ec_group/ec_group.h b/src/lib/pubkey/ec_group/ec_group.h
index c7e52b238..a03b97a68 100644
--- a/src/lib/pubkey/ec_group/ec_group.h
+++ b/src/lib/pubkey/ec_group/ec_group.h
@@ -54,13 +54,13 @@ class BOTAN_DLL EC_Group
* Decode a BER encoded ECC domain parameter set
* @param ber_encoding the bytes of the BER encoding
*/
- EC_Group(const std::vector<byte>& ber_encoding);
+ explicit EC_Group(const std::vector<byte>& ber_encoding);
/**
* Create an EC domain by OID (or throw if unknown)
* @param oid the OID of the EC domain to create
*/
- EC_Group(const OID& oid);
+ explicit EC_Group(const OID& oid);
/**
* Create an EC domain from PEM encoding (as from PEM_encode), or
diff --git a/src/lib/pubkey/mce/gf2m_small_m.h b/src/lib/pubkey/mce/gf2m_small_m.h
index 6a8de4424..0b27a82e3 100644
--- a/src/lib/pubkey/mce/gf2m_small_m.h
+++ b/src/lib/pubkey/mce/gf2m_small_m.h
@@ -25,7 +25,7 @@ typedef u16bit gf2m;
class BOTAN_DLL GF2m_Field
{
public:
- GF2m_Field(size_t extdeg);
+ explicit GF2m_Field(size_t extdeg);
gf2m gf_mul(gf2m x, gf2m y) const
{
diff --git a/src/lib/pubkey/mce/mceliece.h b/src/lib/pubkey/mce/mceliece.h
index b9e54ec0e..311f0f253 100644
--- a/src/lib/pubkey/mce/mceliece.h
+++ b/src/lib/pubkey/mce/mceliece.h
@@ -21,7 +21,7 @@ namespace Botan {
class BOTAN_DLL McEliece_PublicKey : public virtual Public_Key
{
public:
- McEliece_PublicKey(const std::vector<byte>& key_bits);
+ explicit McEliece_PublicKey(const std::vector<byte>& key_bits);
McEliece_PublicKey(std::vector<byte> const& pub_matrix, u32bit the_t, u32bit the_code_length) :
m_public_matrix(pub_matrix),
@@ -90,7 +90,7 @@ class BOTAN_DLL McEliece_PrivateKey : public virtual McEliece_PublicKey,
*/
McEliece_PrivateKey(RandomNumberGenerator& rng, size_t code_length, size_t t);
- McEliece_PrivateKey(const secure_vector<byte>& key_bits);
+ explicit McEliece_PrivateKey(const secure_vector<byte>& key_bits);
McEliece_PrivateKey(polyn_gf2m const& goppa_polyn,
std::vector<u32bit> const& parity_check_matrix_coeffs,
diff --git a/src/lib/pubkey/mce/polyn_gf2m.h b/src/lib/pubkey/mce/polyn_gf2m.h
index 938c1f553..62264e480 100644
--- a/src/lib/pubkey/mce/polyn_gf2m.h
+++ b/src/lib/pubkey/mce/polyn_gf2m.h
@@ -27,7 +27,7 @@ struct polyn_gf2m
/**
* create a zero polynomial:
*/
- polyn_gf2m( std::shared_ptr<GF2m_Field> sp_field );
+ explicit polyn_gf2m( std::shared_ptr<GF2m_Field> sp_field );
polyn_gf2m()
:m_deg(-1)
diff --git a/src/lib/pubkey/pk_ops_impl.h b/src/lib/pubkey/pk_ops_impl.h
index bda3434bf..9be65cf21 100644
--- a/src/lib/pubkey/pk_ops_impl.h
+++ b/src/lib/pubkey/pk_ops_impl.h
@@ -23,7 +23,7 @@ class Encryption_with_EME : public Encryption
~Encryption_with_EME();
protected:
- Encryption_with_EME(const std::string& eme);
+ explicit Encryption_with_EME(const std::string& eme);
private:
virtual size_t max_raw_input_bits() const = 0;
@@ -41,7 +41,7 @@ class Decryption_with_EME : public Decryption
~Decryption_with_EME();
protected:
- Decryption_with_EME(const std::string& eme);
+ explicit Decryption_with_EME(const std::string& eme);
private:
virtual size_t max_raw_input_bits() const = 0;
virtual secure_vector<byte> raw_decrypt(const byte msg[], size_t len) = 0;
@@ -59,7 +59,7 @@ class Verification_with_EMSA : public Verification
protected:
- Verification_with_EMSA(const std::string& emsa);
+ explicit Verification_with_EMSA(const std::string& emsa);
~Verification_with_EMSA();
/**
@@ -105,7 +105,7 @@ class Signature_with_EMSA : public Signature
secure_vector<byte> sign(RandomNumberGenerator& rng) override;
protected:
- Signature_with_EMSA(const std::string& emsa);
+ explicit Signature_with_EMSA(const std::string& emsa);
~Signature_with_EMSA();
private:
@@ -132,7 +132,7 @@ class Key_Agreement_with_KDF : public Key_Agreement
const byte salt[], size_t salt_len) override;
protected:
- Key_Agreement_with_KDF(const std::string& kdf);
+ explicit Key_Agreement_with_KDF(const std::string& kdf);
~Key_Agreement_with_KDF();
private:
virtual secure_vector<byte> raw_agree(const byte w[], size_t w_len) = 0;
@@ -154,7 +154,7 @@ class KEM_Encryption_with_KDF : public KEM_Encryption
secure_vector<byte>& raw_shared_key,
Botan::RandomNumberGenerator& rng) = 0;
- KEM_Encryption_with_KDF(const std::string& kdf);
+ explicit KEM_Encryption_with_KDF(const std::string& kdf);
~KEM_Encryption_with_KDF();
private:
std::unique_ptr<KDF> m_kdf;
@@ -173,7 +173,7 @@ class KEM_Decryption_with_KDF : public KEM_Decryption
virtual secure_vector<byte>
raw_kem_decrypt(const byte encap_key[], size_t len) = 0;
- KEM_Decryption_with_KDF(const std::string& kdf);
+ explicit KEM_Decryption_with_KDF(const std::string& kdf);
~KEM_Decryption_with_KDF();
private:
std::unique_ptr<KDF> m_kdf;
diff --git a/src/lib/pubkey/pkcs8.h b/src/lib/pubkey/pkcs8.h
index 9dc5265c7..791a612df 100644
--- a/src/lib/pubkey/pkcs8.h
+++ b/src/lib/pubkey/pkcs8.h
@@ -19,7 +19,7 @@ namespace Botan {
*/
struct BOTAN_DLL PKCS8_Exception : public Decoding_Error
{
- PKCS8_Exception(const std::string& error) :
+ explicit PKCS8_Exception(const std::string& error) :
Decoding_Error("PKCS #8: " + error) {}
};
diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp
index 18a694754..eb9fc2892 100644
--- a/src/lib/pubkey/rsa/rsa.cpp
+++ b/src/lib/pubkey/rsa/rsa.cpp
@@ -71,7 +71,7 @@ class RSA_Private_Operation
protected:
size_t get_max_input_bits() const { return (m_n.bits() - 1); }
- RSA_Private_Operation(const RSA_PrivateKey& rsa) :
+ explicit RSA_Private_Operation(const RSA_PrivateKey& rsa) :
m_n(rsa.get_n()),
m_q(rsa.get_q()),
m_c(rsa.get_c()),
@@ -190,7 +190,7 @@ class RSA_KEM_Decryption_Operation : public PK_Ops::KEM_Decryption_with_KDF,
class RSA_Public_Operation
{
public:
- RSA_Public_Operation(const RSA_PublicKey& rsa) :
+ explicit RSA_Public_Operation(const RSA_PublicKey& rsa) :
m_n(rsa.get_n()), m_powermod_e_n(rsa.get_e(), rsa.get_n())
{}