From: Francis Dupont Date: Sat, 16 May 2015 23:29:03 +0000 (+0200) Subject: [3513] added static getVersion for cryptolink X-Git-Tag: trac3859_base~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbb8141ba1a147ebd03a887f18f307a830b0840a;p=thirdparty%2Fkea.git [3513] added static getVersion for cryptolink --- diff --git a/src/lib/cryptolink/botan_link.cc b/src/lib/cryptolink/botan_link.cc index ede4f33124..01f192f3ea 100644 --- a/src/lib/cryptolink/botan_link.cc +++ b/src/lib/cryptolink/botan_link.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -43,6 +43,11 @@ CryptoLink::initialize() { } } +std::string +CryptoLink::getVersion() { + return (Botan::version_string()); +} + } // namespace cryptolink } // namespace isc diff --git a/src/lib/cryptolink/cryptolink.h b/src/lib/cryptolink/cryptolink.h index 69e1cc2d97..b9490e7c77 100644 --- a/src/lib/cryptolink/cryptolink.h +++ b/src/lib/cryptolink/cryptolink.h @@ -1,4 +1,4 @@ -// Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -161,6 +161,9 @@ public: /// static void initialize(); + /// \brief Get version string + static std::string getVersion(); + /// \brief Factory function for Hash objects /// /// CryptoLink objects cannot be constructed directly. This diff --git a/src/lib/cryptolink/openssl_link.cc b/src/lib/cryptolink/openssl_link.cc index dd6a732e3f..af47b0b30e 100644 --- a/src/lib/cryptolink/openssl_link.cc +++ b/src/lib/cryptolink/openssl_link.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,8 @@ #include #include +#include + namespace isc { namespace cryptolink { @@ -46,6 +48,11 @@ CryptoLink::initialize() { } } +std::string +CryptoLink::getVersion() { + return (SSLeay_version(SSLEAY_VERSION)); +} + } // namespace cryptolink } // namespace isc diff --git a/src/lib/cryptolink/tests/crypto_unittests.cc b/src/lib/cryptolink/tests/crypto_unittests.cc index fa5b429c72..d08a8250c9 100644 --- a/src/lib/cryptolink/tests/crypto_unittests.cc +++ b/src/lib/cryptolink/tests/crypto_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -22,6 +22,11 @@ using namespace isc::cryptolink; +// Test get version +TEST(CryptoLinkTest, Version) { + EXPECT_NO_THROW(CryptoLink::getVersion()); +} + // Tests whether getCryptoLink() returns a singleton instance TEST(CryptoLinkTest, Singleton) { const CryptoLink& c1 = CryptoLink::getCryptoLink();