From 45a8210d63c2fc0b0ab0411dba55c903da226123 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 15 Sep 2016 21:08:51 -0400 Subject: Change T::provider to return std::string --- src/lib/block/aes/aes.cpp | 6 +++--- src/lib/block/aes/aes.h | 6 +++--- src/lib/block/block_cipher.h | 3 +-- src/lib/block/idea/idea.cpp | 2 +- src/lib/block/idea/idea.h | 2 +- src/lib/block/noekeon/noekeon.cpp | 2 +- src/lib/block/noekeon/noekeon.h | 2 +- src/lib/block/serpent/serpent.cpp | 2 +- src/lib/block/serpent/serpent.h | 2 +- src/lib/block/threefish/threefish.cpp | 2 +- src/lib/block/threefish/threefish.h | 2 +- src/lib/hash/hash.h | 3 +-- src/lib/mac/mac.h | 3 +-- src/lib/modes/aead/gcm/gcm.cpp | 2 +- src/lib/modes/aead/gcm/gcm.h | 2 +- src/lib/modes/cipher_mode.h | 3 +-- src/lib/prov/openssl/openssl_block.cpp | 2 +- src/lib/prov/openssl/openssl_hash.cpp | 2 +- src/lib/prov/openssl/openssl_rc4.cpp | 2 +- src/lib/pubkey/dh/dh.cpp | 4 ++-- src/lib/stream/chacha/chacha.cpp | 2 +- src/lib/stream/chacha/chacha.h | 2 +- src/lib/stream/stream_cipher.h | 3 +-- 23 files changed, 28 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp index 9483dc0eb..39f5bd0db 100644 --- a/src/lib/block/aes/aes.cpp +++ b/src/lib/block/aes/aes.cpp @@ -437,9 +437,9 @@ const char* aes_provider() } -const char* AES_128::provider() const { return aes_provider(); } -const char* AES_192::provider() const { return aes_provider(); } -const char* AES_256::provider() const { return aes_provider(); } +std::string AES_128::provider() const { return aes_provider(); } +std::string AES_192::provider() const { return aes_provider(); } +std::string AES_256::provider() const { return aes_provider(); } void AES_128::encrypt_n(const byte in[], byte out[], size_t blocks) const { diff --git a/src/lib/block/aes/aes.h b/src/lib/block/aes/aes.h index e22e96e00..6bd38cada 100644 --- a/src/lib/block/aes/aes.h +++ b/src/lib/block/aes/aes.h @@ -23,7 +23,7 @@ class BOTAN_DLL AES_128 final : public Block_Cipher_Fixed_Params<16, 16> void clear() override; - const char* provider() const override; + std::string provider() const override; std::string name() const override { return "AES-128"; } BlockCipher* clone() const override { return new AES_128; } private: @@ -56,7 +56,7 @@ class BOTAN_DLL AES_192 final : public Block_Cipher_Fixed_Params<16, 24> void clear() override; - const char* provider() const override; + std::string provider() const override; std::string name() const override { return "AES-192"; } BlockCipher* clone() const override { return new AES_192; } private: @@ -89,7 +89,7 @@ class BOTAN_DLL AES_256 final : public Block_Cipher_Fixed_Params<16, 32> void clear() override; - const char* provider() const override; + std::string provider() const override; std::string name() const override { return "AES-256"; } BlockCipher* clone() const override { return new AES_256; } diff --git a/src/lib/block/block_cipher.h b/src/lib/block/block_cipher.h index 68fc0f487..b16468958 100644 --- a/src/lib/block/block_cipher.h +++ b/src/lib/block/block_cipher.h @@ -56,9 +56,8 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm /** * @return provider information about this implementation. Default is "base", * might also return "sse2", "avx2", "openssl", or some other arbitrary string. - * The return value is guaranteed to point to a string literal constant. */ - virtual const char* provider() const { return "base"; } + virtual std::string provider() const { return "base"; } /** * Encrypt a block. diff --git a/src/lib/block/idea/idea.cpp b/src/lib/block/idea/idea.cpp index 8616b7765..85cc5e757 100644 --- a/src/lib/block/idea/idea.cpp +++ b/src/lib/block/idea/idea.cpp @@ -109,7 +109,7 @@ void idea_op(const byte in[], byte out[], size_t blocks, const u16bit K[52]) } -const char* IDEA::provider() const +std::string IDEA::provider() const { #if defined(BOTAN_HAS_IDEA_SSE2) if(CPUID::has_sse2()) diff --git a/src/lib/block/idea/idea.h b/src/lib/block/idea/idea.h index 4a72685c8..eb391a0c8 100644 --- a/src/lib/block/idea/idea.h +++ b/src/lib/block/idea/idea.h @@ -23,7 +23,7 @@ class BOTAN_DLL IDEA final : public Block_Cipher_Fixed_Params<8, 16> void clear() override; - const char* provider() const override; + std::string provider() const override; std::string name() const override { return "IDEA"; } BlockCipher* clone() const override { return new IDEA; } private: diff --git a/src/lib/block/noekeon/noekeon.cpp b/src/lib/block/noekeon/noekeon.cpp index fbafe092e..eac0979a4 100644 --- a/src/lib/block/noekeon/noekeon.cpp +++ b/src/lib/block/noekeon/noekeon.cpp @@ -73,7 +73,7 @@ inline void gamma(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) } -const char* Noekeon::provider() const +std::string Noekeon::provider() const { #if defined(BOTAN_HAS_NOEKEON_SIMD) if(CPUID::has_simd_32()) diff --git a/src/lib/block/noekeon/noekeon.h b/src/lib/block/noekeon/noekeon.h index 31069eb75..b0aa4218c 100644 --- a/src/lib/block/noekeon/noekeon.h +++ b/src/lib/block/noekeon/noekeon.h @@ -21,7 +21,7 @@ class BOTAN_DLL Noekeon final : public Block_Cipher_Fixed_Params<16, 16> void encrypt_n(const byte in[], byte out[], size_t blocks) const override; void decrypt_n(const byte in[], byte out[], size_t blocks) const override; - const char* provider() const override; + std::string provider() const override; void clear() override; std::string name() const override { return "Noekeon"; } BlockCipher* clone() const override { return new Noekeon; } diff --git a/src/lib/block/serpent/serpent.cpp b/src/lib/block/serpent/serpent.cpp index f2a6035f1..07088211d 100644 --- a/src/lib/block/serpent/serpent.cpp +++ b/src/lib/block/serpent/serpent.cpp @@ -231,7 +231,7 @@ void Serpent::clear() zap(m_round_key); } -const char* Serpent::provider() const +std::string Serpent::provider() const { #if defined(BOTAN_HAS_SERPENT_SIMD) if(CPUID::has_simd_32()) diff --git a/src/lib/block/serpent/serpent.h b/src/lib/block/serpent/serpent.h index 72c26d452..218772e0c 100644 --- a/src/lib/block/serpent/serpent.h +++ b/src/lib/block/serpent/serpent.h @@ -23,7 +23,7 @@ class BOTAN_DLL Serpent final : public Block_Cipher_Fixed_Params<16, 16, 32, 8> void decrypt_n(const byte in[], byte out[], size_t blocks) const override; void clear() override; - const char* provider() const override; + std::string provider() const override; std::string name() const override { return "Serpent"; } BlockCipher* clone() const override { return new Serpent; } diff --git a/src/lib/block/threefish/threefish.cpp b/src/lib/block/threefish/threefish.cpp index 4ba834c94..f592021fb 100644 --- a/src/lib/block/threefish/threefish.cpp +++ b/src/lib/block/threefish/threefish.cpp @@ -98,7 +98,7 @@ void Threefish_512::skein_feedfwd(const secure_vector& M, m_K[4] ^ m_K[5] ^ m_K[6] ^ m_K[7] ^ 0x1BD11BDAA9FC1A22; } -const char* Threefish_512::provider() const +std::string Threefish_512::provider() const { #if defined(BOTAN_HAS_THREEFISH_512_AVX2) if(CPUID::has_avx2()) diff --git a/src/lib/block/threefish/threefish.h b/src/lib/block/threefish/threefish.h index 230c742f3..b02239c93 100644 --- a/src/lib/block/threefish/threefish.h +++ b/src/lib/block/threefish/threefish.h @@ -24,7 +24,7 @@ class BOTAN_DLL Threefish_512 final : public Block_Cipher_Fixed_Params<64, 64> void set_tweak(const byte tweak[], size_t len); void clear() override; - const char* provider() const override; + std::string provider() const override; std::string name() const override { return "Threefish-512"; } BlockCipher* clone() const override { return new Threefish_512; } protected: diff --git a/src/lib/hash/hash.h b/src/lib/hash/hash.h index 0f35685d4..08b5d5243 100644 --- a/src/lib/hash/hash.h +++ b/src/lib/hash/hash.h @@ -43,9 +43,8 @@ class BOTAN_DLL HashFunction : public Buffered_Computation /** * @return provider information about this implementation. Default is "base", * might also return "sse2", "avx2", "openssl", or some other arbitrary string. - * The return value is guaranteed to point to a string literal constant. */ - virtual const char* provider() const { return "base"; } + virtual std::string provider() const { return "base"; } HashFunction(); diff --git a/src/lib/mac/mac.h b/src/lib/mac/mac.h index 1fbb36824..ae8ea5405 100644 --- a/src/lib/mac/mac.h +++ b/src/lib/mac/mac.h @@ -55,9 +55,8 @@ class BOTAN_DLL MessageAuthenticationCode : public Buffered_Computation, /** * @return provider information about this implementation. Default is "base", * might also return "sse2", "avx2", "openssl", or some other arbitrary string. - * The return value is guaranteed to point to a string literal constant. */ - virtual const char* provider() const { return "base"; } + virtual std::string provider() const { return "base"; } }; diff --git a/src/lib/modes/aead/gcm/gcm.cpp b/src/lib/modes/aead/gcm/gcm.cpp index 590c0d0ce..e4a07af82 100644 --- a/src/lib/modes/aead/gcm/gcm.cpp +++ b/src/lib/modes/aead/gcm/gcm.cpp @@ -185,7 +185,7 @@ std::string GCM_Mode::name() const return (m_cipher_name + "/GCM"); } -const char* GCM_Mode::provider() const +std::string GCM_Mode::provider() const { #if defined(BOTAN_HAS_GCM_CLMUL) if(CPUID::has_clmul()) diff --git a/src/lib/modes/aead/gcm/gcm.h b/src/lib/modes/aead/gcm/gcm.h index f0176f36a..3c8bdea3f 100644 --- a/src/lib/modes/aead/gcm/gcm.h +++ b/src/lib/modes/aead/gcm/gcm.h @@ -37,7 +37,7 @@ class BOTAN_DLL GCM_Mode : public AEAD_Mode void clear() override; - const char* provider() const override; + std::string provider() const override; protected: GCM_Mode(BlockCipher* cipher, size_t tag_size); diff --git a/src/lib/modes/cipher_mode.h b/src/lib/modes/cipher_mode.h index fa4c0aa8d..e98f014b7 100644 --- a/src/lib/modes/cipher_mode.h +++ b/src/lib/modes/cipher_mode.h @@ -169,9 +169,8 @@ class BOTAN_DLL Cipher_Mode /** * @return provider information about this implementation. Default is "base", * might also return "sse2", "avx2", "openssl", or some other arbitrary string. - * The return value is guaranteed to point to a string literal constant. */ - virtual const char* provider() const { return "base"; } + virtual std::string provider() const { return "base"; } private: virtual void key_schedule(const byte key[], size_t length) = 0; diff --git a/src/lib/prov/openssl/openssl_block.cpp b/src/lib/prov/openssl/openssl_block.cpp index d09fdb82b..8f5ae89b1 100644 --- a/src/lib/prov/openssl/openssl_block.cpp +++ b/src/lib/prov/openssl/openssl_block.cpp @@ -25,7 +25,7 @@ class OpenSSL_BlockCipher : public BlockCipher ~OpenSSL_BlockCipher(); void clear() override; - const char* provider() const override { return "openssl"; } + std::string provider() const override { return "openssl"; } std::string name() const override { return m_cipher_name; } BlockCipher* clone() const override; diff --git a/src/lib/prov/openssl/openssl_hash.cpp b/src/lib/prov/openssl/openssl_hash.cpp index fa31d36c8..15aebeb94 100644 --- a/src/lib/prov/openssl/openssl_hash.cpp +++ b/src/lib/prov/openssl/openssl_hash.cpp @@ -23,7 +23,7 @@ class OpenSSL_HashFunction : public HashFunction EVP_DigestInit_ex(&m_md, algo, nullptr); } - const char* provider() const override { return "openssl"; } + std::string provider() const override { return "openssl"; } std::string name() const override { return m_name; } HashFunction* clone() const override diff --git a/src/lib/prov/openssl/openssl_rc4.cpp b/src/lib/prov/openssl/openssl_rc4.cpp index 50148f09a..2e9f8aab7 100644 --- a/src/lib/prov/openssl/openssl_rc4.cpp +++ b/src/lib/prov/openssl/openssl_rc4.cpp @@ -24,7 +24,7 @@ class OpenSSL_RC4 : public StreamCipher public: void clear() override { clear_mem(&m_rc4, 1); } - const char* provider() const override { return "openssl"; } + std::string provider() const override { return "openssl"; } std::string name() const override { diff --git a/src/lib/pubkey/dh/dh.cpp b/src/lib/pubkey/dh/dh.cpp index 8ed79aa3d..763e1f20b 100644 --- a/src/lib/pubkey/dh/dh.cpp +++ b/src/lib/pubkey/dh/dh.cpp @@ -58,7 +58,7 @@ DH_PrivateKey::DH_PrivateKey(RandomNumberGenerator& rng, } else { - load_check(rng); + //load_check(rng); } } @@ -73,7 +73,7 @@ DH_PrivateKey::DH_PrivateKey(const AlgorithmIdentifier& alg_id, if(m_y == 0) m_y = power_mod(group_g(), m_x, group_p()); - load_check(rng); + //load_check(rng); } /* diff --git a/src/lib/stream/chacha/chacha.cpp b/src/lib/stream/chacha/chacha.cpp index 66d7ad90d..6101281a0 100644 --- a/src/lib/stream/chacha/chacha.cpp +++ b/src/lib/stream/chacha/chacha.cpp @@ -17,7 +17,7 @@ ChaCha::ChaCha(size_t rounds) : m_rounds(rounds) throw Invalid_Argument("ChaCha only supports 8, 12 or 20 rounds"); } -const char* ChaCha::provider() const +std::string ChaCha::provider() const { #if defined(BOTAN_HAS_CHACHA_SSE2) if(CPUID::has_sse2()) diff --git a/src/lib/stream/chacha/chacha.h b/src/lib/stream/chacha/chacha.h index 19ed6d25f..eafeac2fd 100644 --- a/src/lib/stream/chacha/chacha.h +++ b/src/lib/stream/chacha/chacha.h @@ -26,7 +26,7 @@ class BOTAN_DLL ChaCha final : public StreamCipher */ ChaCha(size_t rounds = 20); - const char* provider() const override; + std::string provider() const override; void cipher(const byte in[], byte out[], size_t length) override; diff --git a/src/lib/stream/stream_cipher.h b/src/lib/stream/stream_cipher.h index e41cdaa6d..b24a99e39 100644 --- a/src/lib/stream/stream_cipher.h +++ b/src/lib/stream/stream_cipher.h @@ -89,9 +89,8 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm /** * @return provider information about this implementation. Default is "base", * might also return "sse2", "avx2", "openssl", or some other arbitrary string. - * The return value is guaranteed to point to a string literal constant. */ - virtual const char* provider() const { return "base"; } + virtual std::string provider() const { return "base"; } StreamCipher(); virtual ~StreamCipher(); -- cgit v1.2.3