diff options
Diffstat (limited to 'src/lib/pubkey')
35 files changed, 84 insertions, 100 deletions
diff --git a/src/lib/pubkey/curve25519/curve25519.h b/src/lib/pubkey/curve25519/curve25519.h index 43e998df6..567bb7008 100644 --- a/src/lib/pubkey/curve25519/curve25519.h +++ b/src/lib/pubkey/curve25519/curve25519.h @@ -51,7 +51,7 @@ class BOTAN_DLL Curve25519_PublicKey : public virtual Public_Key m_public(pub.begin(), pub.end()) {} protected: - Curve25519_PublicKey() {} + Curve25519_PublicKey() = default; std::vector<uint8_t> m_public; }; diff --git a/src/lib/pubkey/dh/dh.h b/src/lib/pubkey/dh/dh.h index d5e86d154..f3f4b746b 100644 --- a/src/lib/pubkey/dh/dh.h +++ b/src/lib/pubkey/dh/dh.h @@ -40,7 +40,7 @@ class BOTAN_DLL DH_PublicKey : public virtual DL_Scheme_PublicKey */ DH_PublicKey(const DL_Group& grp, const BigInt& y); protected: - DH_PublicKey() {} + DH_PublicKey() = default; }; /** diff --git a/src/lib/pubkey/dl_algo/dl_algo.h b/src/lib/pubkey/dl_algo/dl_algo.h index 4c0d56931..94bf24387 100644 --- a/src/lib/pubkey/dl_algo/dl_algo.h +++ b/src/lib/pubkey/dl_algo/dl_algo.h @@ -76,7 +76,7 @@ class BOTAN_DLL DL_Scheme_PublicKey : public virtual Public_Key DL_Scheme_PublicKey& operator=(const DL_Scheme_PublicKey& other) = default; protected: - DL_Scheme_PublicKey() {} + DL_Scheme_PublicKey() = default; /** * The DL public key @@ -119,7 +119,7 @@ class BOTAN_DLL DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey, DL_Scheme_PrivateKey& operator=(const DL_Scheme_PrivateKey& other) = default; protected: - DL_Scheme_PrivateKey() {} + DL_Scheme_PrivateKey() = default; /** * The DL private key diff --git a/src/lib/pubkey/dsa/dsa.h b/src/lib/pubkey/dsa/dsa.h index a39105d8f..8fa338748 100644 --- a/src/lib/pubkey/dsa/dsa.h +++ b/src/lib/pubkey/dsa/dsa.h @@ -46,7 +46,7 @@ class BOTAN_DLL DSA_PublicKey : public virtual DL_Scheme_PublicKey create_verification_op(const std::string& params, const std::string& provider) const override; protected: - DSA_PublicKey() {} + DSA_PublicKey() = default; }; /** diff --git a/src/lib/pubkey/ecc_key/ecc_key.h b/src/lib/pubkey/ecc_key/ecc_key.h index 186182ba0..fc60bb17c 100644 --- a/src/lib/pubkey/ecc_key/ecc_key.h +++ b/src/lib/pubkey/ecc_key/ecc_key.h @@ -45,7 +45,9 @@ class BOTAN_DLL EC_PublicKey : public virtual Public_Key EC_PublicKey(const AlgorithmIdentifier& alg_id, const std::vector<uint8_t>& key_bits); + EC_PublicKey(const EC_PublicKey& other) = default; EC_PublicKey& operator=(const EC_PublicKey& other) = default; + virtual ~EC_PublicKey() = default; /** * Get the public point of this key. @@ -135,8 +137,6 @@ class BOTAN_DLL EC_PrivateKey : public virtual EC_PublicKey, const secure_vector<uint8_t>& key_bits, bool with_modular_inverse=false); - EC_PrivateKey& operator=(const EC_PrivateKey& other) = default; - secure_vector<uint8_t> private_key_bits() const override; /** @@ -144,8 +144,12 @@ class BOTAN_DLL EC_PrivateKey : public virtual EC_PublicKey, * @result the private key value of this key object */ const BigInt& private_value() const; + + EC_PrivateKey(const EC_PrivateKey& other) = default; + EC_PrivateKey& operator=(const EC_PrivateKey& other) = default; + ~EC_PrivateKey() = default; protected: - EC_PrivateKey() {} + EC_PrivateKey() = default; BigInt m_private_key; }; diff --git a/src/lib/pubkey/ecdh/ecdh.cpp b/src/lib/pubkey/ecdh/ecdh.cpp index 0ddb39275..f6d2bb251 100644 --- a/src/lib/pubkey/ecdh/ecdh.cpp +++ b/src/lib/pubkey/ecdh/ecdh.cpp @@ -16,8 +16,6 @@ namespace Botan { -ECDH_PublicKey::ECDH_PublicKey() {} - namespace { /** diff --git a/src/lib/pubkey/ecdh/ecdh.h b/src/lib/pubkey/ecdh/ecdh.h index f5dc5a05d..f6ffb0a6e 100644 --- a/src/lib/pubkey/ecdh/ecdh.h +++ b/src/lib/pubkey/ecdh/ecdh.h @@ -57,7 +57,7 @@ class BOTAN_DLL ECDH_PublicKey : public virtual EC_PublicKey { return unlock(EC2OSP(public_point(), type)); } protected: - ECDH_PublicKey(); + ECDH_PublicKey() = default; }; /** diff --git a/src/lib/pubkey/ecdsa/ecdsa.h b/src/lib/pubkey/ecdsa/ecdsa.h index 8281c63fd..304a27776 100644 --- a/src/lib/pubkey/ecdsa/ecdsa.h +++ b/src/lib/pubkey/ecdsa/ecdsa.h @@ -54,7 +54,7 @@ class BOTAN_DLL ECDSA_PublicKey : public virtual EC_PublicKey create_verification_op(const std::string& params, const std::string& provider) const override; protected: - ECDSA_PublicKey() {} + ECDSA_PublicKey() = default; }; /** diff --git a/src/lib/pubkey/ecgdsa/ecgdsa.h b/src/lib/pubkey/ecgdsa/ecgdsa.h index 9fb55de06..06a675531 100644 --- a/src/lib/pubkey/ecgdsa/ecgdsa.h +++ b/src/lib/pubkey/ecgdsa/ecgdsa.h @@ -52,7 +52,7 @@ class BOTAN_DLL ECGDSA_PublicKey : public virtual EC_PublicKey create_verification_op(const std::string& params, const std::string& provider) const override; protected: - ECGDSA_PublicKey() {} + ECGDSA_PublicKey() = default; }; /** diff --git a/src/lib/pubkey/ecies/ecies.h b/src/lib/pubkey/ecies/ecies.h index 6daf5a641..0e348ca23 100644 --- a/src/lib/pubkey/ecies/ecies.h +++ b/src/lib/pubkey/ecies/ecies.h @@ -68,6 +68,8 @@ class BOTAN_DLL ECIES_KA_Params ECIES_KA_Params(const EC_Group& domain, const std::string& kdf_spec, size_t length, PointGFp::Compression_Type compression_type, ECIES_Flags flags); + ECIES_KA_Params(const ECIES_KA_Params&) = default; + ECIES_KA_Params& operator=(const ECIES_KA_Params&) = default; virtual ~ECIES_KA_Params() = default; inline const EC_Group& domain() const @@ -147,6 +149,8 @@ class BOTAN_DLL ECIES_System_Params : public ECIES_KA_Params size_t dem_key_len, const std::string& mac_spec, size_t mac_key_len, PointGFp::Compression_Type compression_type, ECIES_Flags flags); + ECIES_System_Params(const ECIES_System_Params&) = default; + ECIES_System_Params& operator=(const ECIES_System_Params&) = default; virtual ~ECIES_System_Params() = default; /// creates an instance of the message authentication code diff --git a/src/lib/pubkey/eckcdsa/eckcdsa.h b/src/lib/pubkey/eckcdsa/eckcdsa.h index e941a393d..3959c5f78 100644 --- a/src/lib/pubkey/eckcdsa/eckcdsa.h +++ b/src/lib/pubkey/eckcdsa/eckcdsa.h @@ -52,7 +52,7 @@ class BOTAN_DLL ECKCDSA_PublicKey : public virtual EC_PublicKey create_verification_op(const std::string& params, const std::string& provider) const override; protected: - ECKCDSA_PublicKey() {} + ECKCDSA_PublicKey() = default; }; /** diff --git a/src/lib/pubkey/elgamal/elgamal.h b/src/lib/pubkey/elgamal/elgamal.h index 0453e3564..33345d56f 100644 --- a/src/lib/pubkey/elgamal/elgamal.h +++ b/src/lib/pubkey/elgamal/elgamal.h @@ -44,7 +44,7 @@ class BOTAN_DLL ElGamal_PublicKey : public virtual DL_Scheme_PublicKey const std::string& provider) const override; protected: - ElGamal_PublicKey() {} + ElGamal_PublicKey() = default; }; /** diff --git a/src/lib/pubkey/gost_3410/gost_3410.h b/src/lib/pubkey/gost_3410/gost_3410.h index d7ae4a7dc..c6fc148ca 100644 --- a/src/lib/pubkey/gost_3410/gost_3410.h +++ b/src/lib/pubkey/gost_3410/gost_3410.h @@ -58,7 +58,7 @@ class BOTAN_DLL GOST_3410_PublicKey : public virtual EC_PublicKey const std::string& provider) const override; protected: - GOST_3410_PublicKey() {} + GOST_3410_PublicKey() = default; }; /** diff --git a/src/lib/pubkey/mce/code_based_key_gen.cpp b/src/lib/pubkey/mce/code_based_key_gen.cpp index 4d68c875a..7377bc117 100644 --- a/src/lib/pubkey/mce/code_based_key_gen.cpp +++ b/src/lib/pubkey/mce/code_based_key_gen.cpp @@ -33,23 +33,18 @@ struct binary_matrix uint32_t coef(uint32_t i, uint32_t j) { return (m_elem[(i) * m_rwdcnt + (j) / 32] >> (j % 32)) & 1; - }; + } void set_coef_to_one(uint32_t i, uint32_t j) { m_elem[(i) * m_rwdcnt + (j) / 32] |= (static_cast<uint32_t>(1) << ((j) % 32)) ; - }; + } void toggle_coeff(uint32_t i, uint32_t j) { m_elem[(i) * m_rwdcnt + (j) / 32] ^= (static_cast<uint32_t>(1) << ((j) % 32)) ; } - void set_to_zero() - { - zeroise(m_elem); - } - //private: uint32_t m_rown; // number of rows. uint32_t m_coln; // number of columns. diff --git a/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp b/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp index a35fc7458..be2c5380e 100644 --- a/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp +++ b/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp @@ -44,7 +44,7 @@ class gf2m_decomp_rootfind_state void calc_next_Aij(); void calc_Ai_zero(const polyn_gf2m & sigma); secure_vector<gf2m> find_roots(const polyn_gf2m & sigma); - uint32_t get_code_length() const { return code_length; }; + uint32_t get_code_length() const { return code_length; } uint32_t code_length; secure_vector<gf2m> m_Lik; // size is outer_summands * m secure_vector<gf2m> m_Aij; // ... diff --git a/src/lib/pubkey/mce/mceliece.h b/src/lib/pubkey/mce/mceliece.h index 58c242360..946083128 100644 --- a/src/lib/pubkey/mce/mceliece.h +++ b/src/lib/pubkey/mce/mceliece.h @@ -23,13 +23,14 @@ class BOTAN_DLL McEliece_PublicKey : public virtual Public_Key public: explicit McEliece_PublicKey(const std::vector<uint8_t>& key_bits); - McEliece_PublicKey(std::vector<uint8_t> const& pub_matrix, uint32_t the_t, uint32_t the_code_length) : + McEliece_PublicKey(const std::vector<uint8_t>& pub_matrix, uint32_t the_t, uint32_t the_code_length) : m_public_matrix(pub_matrix), m_t(the_t), - m_code_length(the_code_length) - {} + m_code_length(the_code_length){} - McEliece_PublicKey(const McEliece_PublicKey& other); + McEliece_PublicKey(const McEliece_PublicKey& other) = default; + McEliece_PublicKey& operator=(const McEliece_PublicKey& other) = default; + virtual ~McEliece_PublicKey()= default; secure_vector<uint8_t> random_plaintext_element(RandomNumberGenerator& rng) const; diff --git a/src/lib/pubkey/mce/mceliece_key.cpp b/src/lib/pubkey/mce/mceliece_key.cpp index 798f7a91f..4c7eb6670 100644 --- a/src/lib/pubkey/mce/mceliece_key.cpp +++ b/src/lib/pubkey/mce/mceliece_key.cpp @@ -82,13 +82,6 @@ std::vector<uint8_t> McEliece_PublicKey::public_key_bits() const .get_contents_unlocked(); } -McEliece_PublicKey::McEliece_PublicKey(const McEliece_PublicKey & other) : - m_public_matrix(other.m_public_matrix), - m_t(other.m_t), - m_code_length(other.m_code_length) - { - } - size_t McEliece_PublicKey::key_length() const { return m_code_length; diff --git a/src/lib/pubkey/mce/polyn_gf2m.h b/src/lib/pubkey/mce/polyn_gf2m.h index 0782406ea..075cd1c88 100644 --- a/src/lib/pubkey/mce/polyn_gf2m.h +++ b/src/lib/pubkey/mce/polyn_gf2m.h @@ -30,8 +30,7 @@ struct polyn_gf2m explicit polyn_gf2m( std::shared_ptr<GF2m_Field> sp_field ); polyn_gf2m() - :m_deg(-1) - {}; + :m_deg(-1) {} polyn_gf2m(const secure_vector<uint8_t>& encoded, std::shared_ptr<GF2m_Field> sp_field ); @@ -39,12 +38,12 @@ struct polyn_gf2m bool operator==(const polyn_gf2m & other) const ; - bool operator!=(const polyn_gf2m & other) const { return !(*this == other); }; + bool operator!=(const polyn_gf2m & other) const { return !(*this == other); } polyn_gf2m(polyn_gf2m&& other) { this->swap(other); - }; + } polyn_gf2m & operator=(polyn_gf2m&& other) { @@ -74,9 +73,9 @@ struct polyn_gf2m polyn_gf2m(int t, RandomNumberGenerator& rng, std::shared_ptr<GF2m_Field> sp_field); std::shared_ptr<GF2m_Field> get_sp_field() const - { return msp_field; }; + { return msp_field; } - gf2m& operator[](size_t i) { return coeff[i]; }; + gf2m& operator[](size_t i) { return coeff[i]; } gf2m operator[](size_t i) const { return coeff[i]; } @@ -87,7 +86,7 @@ struct polyn_gf2m inline void set_coef(uint32_t i, gf2m v) { coeff[i] = v; - }; + } inline void add_to_coef(uint32_t i, gf2m v) { diff --git a/src/lib/pubkey/pk_keys.h b/src/lib/pubkey/pk_keys.h index 833dda69e..13e0dc768 100644 --- a/src/lib/pubkey/pk_keys.h +++ b/src/lib/pubkey/pk_keys.h @@ -24,10 +24,11 @@ class RandomNumberGenerator; class BOTAN_DLL Public_Key { public: + Public_Key() =default; + Public_Key(const Public_Key& other) = default; + Public_Key& operator=(const Public_Key& other) = default; virtual ~Public_Key() = default; - virtual Public_Key& operator=(const Public_Key& other) = default; - /** * Get the name of the underlying public key scheme. * @return name of the public key scheme @@ -165,10 +166,11 @@ class BOTAN_DLL Public_Key class BOTAN_DLL Private_Key : public virtual Public_Key { public: + Private_Key() = default; + Private_Key(const Private_Key& other) = default; + Private_Key& operator=(const Private_Key& other) = default; virtual ~Private_Key() = default; - virtual Private_Key& operator=(const Private_Key& other) = default; - /** * @return BER encoded private key bits */ @@ -274,7 +276,10 @@ class BOTAN_DLL PK_Key_Agreement_Key : public virtual Private_Key */ virtual std::vector<uint8_t> public_value() const = 0; - virtual ~PK_Key_Agreement_Key() {} + PK_Key_Agreement_Key() = default; + PK_Key_Agreement_Key(const PK_Key_Agreement_Key&) = default; + PK_Key_Agreement_Key& operator=(const PK_Key_Agreement_Key&) = default; + virtual ~PK_Key_Agreement_Key() = default; }; /* diff --git a/src/lib/pubkey/pk_ops.cpp b/src/lib/pubkey/pk_ops.cpp index cf10c4ba2..5c864d966 100644 --- a/src/lib/pubkey/pk_ops.cpp +++ b/src/lib/pubkey/pk_ops.cpp @@ -6,9 +6,6 @@ */ #include <botan/internal/pk_ops_impl.h> -#include <botan/eme.h> -#include <botan/kdf.h> -#include <botan/emsa.h> #include <botan/internal/bit_ops.h> namespace Botan { @@ -20,8 +17,6 @@ PK_Ops::Encryption_with_EME::Encryption_with_EME(const std::string& eme) throw Algorithm_Not_Found(eme); } -PK_Ops::Encryption_with_EME::~Encryption_with_EME() {} - size_t PK_Ops::Encryption_with_EME::max_input_bits() const { return m_eme->maximum_input_size(max_raw_input_bits()); @@ -42,8 +37,6 @@ PK_Ops::Decryption_with_EME::Decryption_with_EME(const std::string& eme) throw Algorithm_Not_Found(eme); } -PK_Ops::Decryption_with_EME::~Decryption_with_EME() {} - secure_vector<uint8_t> PK_Ops::Decryption_with_EME::decrypt(uint8_t& valid_mask, const uint8_t ciphertext[], @@ -59,8 +52,6 @@ PK_Ops::Key_Agreement_with_KDF::Key_Agreement_with_KDF(const std::string& kdf) m_kdf.reset(get_kdf(kdf)); } -PK_Ops::Key_Agreement_with_KDF::~Key_Agreement_with_KDF() {} - secure_vector<uint8_t> PK_Ops::Key_Agreement_with_KDF::agree(size_t key_len, const uint8_t w[], size_t w_len, const uint8_t salt[], size_t salt_len) @@ -81,8 +72,6 @@ PK_Ops::Signature_with_EMSA::Signature_with_EMSA(const std::string& emsa) : throw Algorithm_Not_Found(emsa); } -PK_Ops::Signature_with_EMSA::~Signature_with_EMSA() {} - void PK_Ops::Signature_with_EMSA::update(const uint8_t msg[], size_t msg_len) { if(has_prefix() && !m_prefix_used) @@ -112,8 +101,6 @@ PK_Ops::Verification_with_EMSA::Verification_with_EMSA(const std::string& emsa) throw Algorithm_Not_Found(emsa); } -PK_Ops::Verification_with_EMSA::~Verification_with_EMSA() {} - void PK_Ops::Verification_with_EMSA::update(const uint8_t msg[], size_t msg_len) { if(has_prefix() && !m_prefix_used) @@ -163,8 +150,6 @@ PK_Ops::KEM_Encryption_with_KDF::KEM_Encryption_with_KDF(const std::string& kdf) m_kdf.reset(get_kdf(kdf)); } -PK_Ops::KEM_Encryption_with_KDF::~KEM_Encryption_with_KDF() {} - secure_vector<uint8_t> PK_Ops::KEM_Decryption_with_KDF::kem_decrypt(const uint8_t encap_key[], size_t len, @@ -184,6 +169,4 @@ PK_Ops::KEM_Decryption_with_KDF::KEM_Decryption_with_KDF(const std::string& kdf) m_kdf.reset(get_kdf(kdf)); } -PK_Ops::KEM_Decryption_with_KDF::~KEM_Decryption_with_KDF() {} - } diff --git a/src/lib/pubkey/pk_ops.h b/src/lib/pubkey/pk_ops.h index d3c4c0d9b..d270954f9 100644 --- a/src/lib/pubkey/pk_ops.h +++ b/src/lib/pubkey/pk_ops.h @@ -42,7 +42,7 @@ class BOTAN_DLL Encryption virtual size_t max_input_bits() const = 0; - virtual ~Encryption() {} + virtual ~Encryption() = default; }; /** @@ -55,7 +55,7 @@ class BOTAN_DLL Decryption const uint8_t ciphertext[], size_t ciphertext_len) = 0; - virtual ~Decryption() {} + virtual ~Decryption() = default; }; /** @@ -77,7 +77,7 @@ class BOTAN_DLL Verification */ virtual bool is_valid_signature(const uint8_t sig[], size_t sig_len) = 0; - virtual ~Verification() {} + virtual ~Verification() = default; }; /** @@ -99,7 +99,7 @@ class BOTAN_DLL Signature */ virtual secure_vector<uint8_t> sign(RandomNumberGenerator& rng) = 0; - virtual ~Signature() {} + virtual ~Signature() = default; }; /** @@ -112,7 +112,7 @@ class BOTAN_DLL Key_Agreement const uint8_t other_key[], size_t other_key_len, const uint8_t salt[], size_t salt_len) = 0; - virtual ~Key_Agreement() {} + virtual ~Key_Agreement() = default; }; /** @@ -128,7 +128,7 @@ class BOTAN_DLL KEM_Encryption const uint8_t salt[], size_t salt_len) = 0; - virtual ~KEM_Encryption() {} + virtual ~KEM_Encryption() = default; }; class BOTAN_DLL KEM_Decryption @@ -140,7 +140,7 @@ class BOTAN_DLL KEM_Decryption const uint8_t salt[], size_t salt_len) = 0; - virtual ~KEM_Decryption() {} + virtual ~KEM_Decryption() = default; }; } diff --git a/src/lib/pubkey/pk_ops_impl.h b/src/lib/pubkey/pk_ops_impl.h index f6c1b0510..958bf27ec 100644 --- a/src/lib/pubkey/pk_ops_impl.h +++ b/src/lib/pubkey/pk_ops_impl.h @@ -9,6 +9,9 @@ #define BOTAN_PK_OPERATION_IMPL_H__ #include <botan/pk_ops.h> +#include <botan/eme.h> +#include <botan/kdf.h> +#include <botan/emsa.h> namespace Botan { @@ -22,7 +25,7 @@ class Encryption_with_EME : public Encryption secure_vector<uint8_t> encrypt(const uint8_t msg[], size_t msg_len, RandomNumberGenerator& rng) override; - ~Encryption_with_EME(); + ~Encryption_with_EME() = default; protected: explicit Encryption_with_EME(const std::string& eme); private: @@ -39,7 +42,7 @@ class Decryption_with_EME : public Decryption secure_vector<uint8_t> decrypt(uint8_t& valid_mask, const uint8_t msg[], size_t msg_len) override; - ~Decryption_with_EME(); + ~Decryption_with_EME() = default; protected: explicit Decryption_with_EME(const std::string& eme); private: @@ -51,7 +54,7 @@ class Decryption_with_EME : public Decryption class Verification_with_EMSA : public Verification { public: - ~Verification_with_EMSA(); + ~Verification_with_EMSA() = default; void update(const uint8_t msg[], size_t msg_len) override; bool is_valid_signature(const uint8_t sig[], size_t sig_len) override; @@ -129,7 +132,7 @@ class Signature_with_EMSA : public Signature secure_vector<uint8_t> sign(RandomNumberGenerator& rng) override; protected: explicit Signature_with_EMSA(const std::string& emsa); - ~Signature_with_EMSA(); + ~Signature_with_EMSA() = default; std::string hash_for_signature() { return m_hash; } @@ -173,7 +176,7 @@ class Key_Agreement_with_KDF : public Key_Agreement protected: explicit Key_Agreement_with_KDF(const std::string& kdf); - ~Key_Agreement_with_KDF(); + ~Key_Agreement_with_KDF() = default; private: virtual secure_vector<uint8_t> raw_agree(const uint8_t w[], size_t w_len) = 0; std::unique_ptr<KDF> m_kdf; @@ -195,7 +198,7 @@ class KEM_Encryption_with_KDF : public KEM_Encryption Botan::RandomNumberGenerator& rng) = 0; explicit KEM_Encryption_with_KDF(const std::string& kdf); - ~KEM_Encryption_with_KDF(); + ~KEM_Encryption_with_KDF() = default; private: std::unique_ptr<KDF> m_kdf; }; @@ -214,7 +217,7 @@ class KEM_Decryption_with_KDF : public KEM_Decryption raw_kem_decrypt(const uint8_t encap_key[], size_t len) = 0; explicit KEM_Decryption_with_KDF(const std::string& kdf); - ~KEM_Decryption_with_KDF(); + ~KEM_Decryption_with_KDF() = default;; private: std::unique_ptr<KDF> m_kdf; }; diff --git a/src/lib/pubkey/pubkey.h b/src/lib/pubkey/pubkey.h index a5202d973..bfe444829 100644 --- a/src/lib/pubkey/pubkey.h +++ b/src/lib/pubkey/pubkey.h @@ -68,8 +68,8 @@ class BOTAN_DLL PK_Encryptor */ virtual size_t maximum_input_size() const = 0; - PK_Encryptor() {} - virtual ~PK_Encryptor() {} + PK_Encryptor() = default; + virtual ~PK_Encryptor() = default; PK_Encryptor(const PK_Encryptor&) = delete; PK_Encryptor& operator=(const PK_Encryptor&) = delete; @@ -142,7 +142,7 @@ class BOTAN_DLL PK_Decryptor const uint8_t required_content_offsets[], size_t required_contents) const; - PK_Decryptor() {} + PK_Decryptor() = default; virtual ~PK_Decryptor() = default; PK_Decryptor(const PK_Decryptor&) = delete; diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp index d8deccab3..7d48fd814 100644 --- a/src/lib/pubkey/rsa/rsa.cpp +++ b/src/lib/pubkey/rsa/rsa.cpp @@ -244,7 +244,7 @@ class RSA_Signature_Operation : public PK_Ops::Signature_with_EMSA, { public: - size_t max_input_bits() const override { return get_max_input_bits(); }; + size_t max_input_bits() const override { return get_max_input_bits(); } RSA_Signature_Operation(const RSA_PrivateKey& rsa, const std::string& emsa, RandomNumberGenerator& rng) : PK_Ops::Signature_with_EMSA(emsa), @@ -268,7 +268,7 @@ class RSA_Decryption_Operation : public PK_Ops::Decryption_with_EME, { public: - size_t max_raw_input_bits() const override { return get_max_input_bits(); }; + size_t max_raw_input_bits() const override { return get_max_input_bits(); } RSA_Decryption_Operation(const RSA_PrivateKey& rsa, const std::string& eme, RandomNumberGenerator& rng) : PK_Ops::Decryption_with_EME(eme), @@ -346,7 +346,7 @@ class RSA_Encryption_Operation : public PK_Ops::Encryption_with_EME, { } - size_t max_raw_input_bits() const override { return get_max_input_bits(); }; + size_t max_raw_input_bits() const override { return get_max_input_bits(); } secure_vector<uint8_t> raw_encrypt(const uint8_t msg[], size_t msg_len, RandomNumberGenerator&) override @@ -361,7 +361,7 @@ class RSA_Verify_Operation : public PK_Ops::Verification_with_EMSA, { public: - size_t max_input_bits() const override { return get_max_input_bits(); }; + size_t max_input_bits() const override { return get_max_input_bits(); } RSA_Verify_Operation(const RSA_PublicKey& rsa, const std::string& emsa) : PK_Ops::Verification_with_EMSA(emsa), diff --git a/src/lib/pubkey/rsa/rsa.h b/src/lib/pubkey/rsa/rsa.h index 4d20dce8c..89555b51b 100644 --- a/src/lib/pubkey/rsa/rsa.h +++ b/src/lib/pubkey/rsa/rsa.h @@ -71,7 +71,7 @@ class BOTAN_DLL RSA_PublicKey : public virtual Public_Key const std::string& provider) const override; protected: - RSA_PublicKey() {} + RSA_PublicKey() = default; BigInt m_n, m_e; }; diff --git a/src/lib/pubkey/xmss/atomic.h b/src/lib/pubkey/xmss/atomic.h index cf3f5528c..e2fdaa78d 100644 --- a/src/lib/pubkey/xmss/atomic.h +++ b/src/lib/pubkey/xmss/atomic.h @@ -23,9 +23,10 @@ template <typename T> class Atomic { public: - Atomic() : m_data() {}; + Atomic() = default; Atomic(const Atomic& data) : m_data(data.m_data.load()) {} Atomic(const std::atomic<T>& data) : m_data(data.load()) {} + ~Atomic() = default; Atomic& operator=(const Atomic& a) { diff --git a/src/lib/pubkey/xmss/xmss_common_ops.h b/src/lib/pubkey/xmss/xmss_common_ops.h index 26cb27d26..2aff9b5f8 100644 --- a/src/lib/pubkey/xmss/xmss_common_ops.h +++ b/src/lib/pubkey/xmss/xmss_common_ops.h @@ -26,7 +26,7 @@ class XMSS_Common_Ops { public: XMSS_Common_Ops(XMSS_Parameters::xmss_algorithm_t oid) - : m_xmss_params(oid), m_hash(m_xmss_params.hash_function_name()) {}; + : m_xmss_params(oid), m_hash(m_xmss_params.hash_function_name()) {} protected: /** diff --git a/src/lib/pubkey/xmss/xmss_hash.h b/src/lib/pubkey/xmss/xmss_hash.h index 29a6ff90e..55b5fe930 100644 --- a/src/lib/pubkey/xmss/xmss_hash.h +++ b/src/lib/pubkey/xmss/xmss_hash.h @@ -144,7 +144,7 @@ class XMSS_Hash **/ secure_vector<uint8_t> h_msg_final(); - size_t output_length() const { return m_output_length; }; + size_t output_length() const { return m_output_length; } private: static const uint8_t m_id_f = 0x00; diff --git a/src/lib/pubkey/xmss/xmss_index_registry.h b/src/lib/pubkey/xmss/xmss_index_registry.h index decd50a8a..28701353d 100644 --- a/src/lib/pubkey/xmss/xmss_index_registry.h +++ b/src/lib/pubkey/xmss/xmss_index_registry.h @@ -58,8 +58,7 @@ class XMSS_Index_Registry const secure_vector<uint8_t>& prf); private: - XMSS_Index_Registry() - : m_key_ids(), m_leaf_indices(), m_mutex() {} + XMSS_Index_Registry() = default; static const std::string m_index_hash_function; diff --git a/src/lib/pubkey/xmss/xmss_signature.h b/src/lib/pubkey/xmss/xmss_signature.h index 001465e64..0e6dccc9e 100644 --- a/src/lib/pubkey/xmss/xmss_signature.h +++ b/src/lib/pubkey/xmss/xmss_signature.h @@ -44,7 +44,7 @@ class XMSS_Signature const secure_vector<uint8_t>& randomness, const XMSS_WOTS_PublicKey::TreeSignature& tree_sig) : m_leaf_idx(leaf_idx), m_randomness(randomness), - m_tree_sig(tree_sig) {}; + m_tree_sig(tree_sig) {} /** * Creates an XMSS Signature from a leaf index used for signature @@ -58,7 +58,7 @@ class XMSS_Signature secure_vector<uint8_t>&& randomness, XMSS_WOTS_PublicKey::TreeSignature&& tree_sig) : m_leaf_idx(leaf_idx), m_randomness(std::move(randomness)), - m_tree_sig(std::move(tree_sig)) {}; + m_tree_sig(std::move(tree_sig)) {} size_t unused_leaf_index() const { return m_leaf_idx; } void set_unused_leaf_idx(size_t idx) { m_leaf_idx = idx; } diff --git a/src/lib/pubkey/xmss/xmss_signature_operation.h b/src/lib/pubkey/xmss/xmss_signature_operation.h index 67c2f5e71..e2393750a 100644 --- a/src/lib/pubkey/xmss/xmss_signature_operation.h +++ b/src/lib/pubkey/xmss/xmss_signature_operation.h @@ -38,7 +38,7 @@ class XMSS_Signature_Operation : public virtual PK_Ops::Signature, { public: XMSS_Signature_Operation(const XMSS_PrivateKey& private_key); - virtual ~XMSS_Signature_Operation() {} + virtual ~XMSS_Signature_Operation() = default; /** * Creates an XMSS signature for the message provided through call to diff --git a/src/lib/pubkey/xmss/xmss_verification_operation.h b/src/lib/pubkey/xmss/xmss_verification_operation.h index c3682c0ad..a967fd0ea 100644 --- a/src/lib/pubkey/xmss/xmss_verification_operation.h +++ b/src/lib/pubkey/xmss/xmss_verification_operation.h @@ -33,7 +33,7 @@ namespace Botan { XMSS_Verification_Operation( const XMSS_PublicKey& public_key); - virtual ~XMSS_Verification_Operation() {} + virtual ~XMSS_Verification_Operation() = default; virtual bool is_valid_signature(const uint8_t sig[], size_t sig_len) override; diff --git a/src/lib/pubkey/xmss/xmss_wots_publickey.h b/src/lib/pubkey/xmss/xmss_wots_publickey.h index 5d973fd6a..eb2f9695b 100644 --- a/src/lib/pubkey/xmss/xmss_wots_publickey.h +++ b/src/lib/pubkey/xmss/xmss_wots_publickey.h @@ -35,8 +35,7 @@ class BOTAN_DLL XMSS_WOTS_PublicKey : virtual public Public_Key class TreeSignature { public: - TreeSignature() - : m_ots_sig(), m_auth_path() {} + TreeSignature() = default; TreeSignature(const wots_keysig_t& ots_sig, const wots_keysig_t& auth_path) @@ -191,7 +190,7 @@ class BOTAN_DLL XMSS_WOTS_PublicKey : virtual public Public_Key * Convert the key into the raw key data. The key becomes a length * len vector of n-byte elements. **/ - operator const wots_keysig_t& () const { return m_key; }; + operator const wots_keysig_t& () const { return m_key; } /** * Convert the key into the raw key data. The key becomes a length diff --git a/src/lib/pubkey/xmss/xmss_wots_signature_operation.h b/src/lib/pubkey/xmss/xmss_wots_signature_operation.h index f319ac138..4656c3dd1 100644 --- a/src/lib/pubkey/xmss/xmss_wots_signature_operation.h +++ b/src/lib/pubkey/xmss/xmss_wots_signature_operation.h @@ -32,7 +32,7 @@ class XMSS_WOTS_Signature_Operation : public virtual PK_Ops::Signature, XMSS_WOTS_Signature_Operation( const XMSS_WOTS_Addressed_PrivateKey& private_key); - virtual ~XMSS_WOTS_Signature_Operation() {} + virtual ~XMSS_WOTS_Signature_Operation() = default; /** * Creates a XMSS WOTS signature for the message provided through call diff --git a/src/lib/pubkey/xmss/xmss_wots_verification_operation.h b/src/lib/pubkey/xmss/xmss_wots_verification_operation.h index 0bc5f0db9..5899e4f46 100644 --- a/src/lib/pubkey/xmss/xmss_wots_verification_operation.h +++ b/src/lib/pubkey/xmss/xmss_wots_verification_operation.h @@ -32,7 +32,7 @@ class XMSS_WOTS_Verification_Operation XMSS_WOTS_Verification_Operation( const XMSS_WOTS_Addressed_PublicKey& public_key); - virtual ~XMSS_WOTS_Verification_Operation() {} + virtual ~XMSS_WOTS_Verification_Operation() = default; virtual bool is_valid_signature(const uint8_t sig[], size_t sig_len) override; |