diff --git a/plugins/qca-botan/qca-botan.cpp b/plugins/qca-botan/qca-botan.cpp --- a/plugins/qca-botan/qca-botan.cpp +++ b/plugins/qca-botan/qca-botan.cpp @@ -34,7 +34,9 @@ #include #include #include +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(2,0,0) #include +#endif #include #endif @@ -228,17 +230,14 @@ }; //----------------------------------------------------------- +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(2,0,0) class BotanHKDFContext: public QCA::HKDFContext { public: BotanHKDFContext(const QString &hashName, QCA::Provider *p, const QString &type) : QCA::HKDFContext(p, type) { Botan::HMAC *hashObj; -#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(2,0,0) - hashObj = new Botan::HMAC(Botan::global_state().algorithm_factory().make_hash_function(hashName.toStdString())); -#else hashObj = new Botan::HMAC(Botan::HashFunction::create_or_throw(hashName.toStdString()).release()); -#endif m_hkdf = new Botan::HKDF(hashObj); } @@ -268,6 +267,7 @@ protected: Botan::HKDF* m_hkdf; }; +#endif //----------------------------------------------------------- @@ -459,7 +459,9 @@ list += "pbkdf1(sha1)"; list += "pbkdf1(md2)"; list += "pbkdf2(sha1)"; +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(2,0,0) list += "hkdf(sha256)"; +#endif list += "aes128-ecb"; list += "aes128-cbc"; list += "aes128-cfb"; @@ -525,8 +527,10 @@ return new BotanPBKDFContext( QString("PBKDF1(MD2)"), this, type ); else if ( type == "pbkdf2(sha1)" ) return new BotanPBKDFContext( QString("PBKDF2(SHA-1)"), this, type ); +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(2,0,0) else if ( type == "hkdf(sha256)" ) return new BotanHKDFContext( QString("SHA-256"), this, type ); +#endif else if ( type == "aes128-ecb" ) return new BotanCipherContext( QString("AES-128"), QString("ECB"), QString("NoPadding"), this, type ); else if ( type == "aes128-cbc" ) diff --git a/plugins/qca-ossl/qca-ossl.cpp b/plugins/qca-ossl/qca-ossl.cpp --- a/plugins/qca-ossl/qca-ossl.cpp +++ b/plugins/qca-ossl/qca-ossl.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -68,6 +67,10 @@ #define RSA_F_RSA_EAY_PRIVATE_DECRYPT RSA_F_RSA_OSSL_PRIVATE_DECRYPT #endif +#ifdef OSSL_110 +#include +#endif + using namespace QCA; namespace opensslQCAPlugin { @@ -1277,6 +1280,7 @@ protected: }; +#ifdef OSSL_110 class opensslHkdfContext : public HKDFContext { public: @@ -1305,6 +1309,7 @@ return out; } }; +#endif class opensslHMACContext : public MACContext { @@ -7411,7 +7416,9 @@ #endif list += "pbkdf1(sha1)"; list += "pbkdf2(sha1)"; +#ifdef OSSL_110 list += "hkdf(sha256)"; +#endif list += "pkey"; list += "dlgroup"; list += "rsa"; @@ -7482,8 +7489,10 @@ #endif else if ( type == "pbkdf2(sha1)" ) return new opensslPbkdf2Context( this, type ); +#ifdef OSSL_110 else if ( type == "hkdf(sha256)" ) return new opensslHkdfContext( this, type ); +#endif else if ( type == "hmac(md5)" ) return new opensslHMACContext( EVP_md5(), this, type ); else if ( type == "hmac(sha1)" )