commit | c21979d3ba95235893bd400084c52a8098a63eba | [log] [tgz] |
---|---|---|
author | Davide Pesavento <davide.pesavento@lip6.fr> | Sat Sep 16 14:52:17 2017 -0400 |
committer | Davide Pesavento <davide.pesavento@lip6.fr> | Sat Sep 16 14:53:34 2017 -0400 |
tree | d545ec4338aa7a34ce324222efe10e4030ec5beb | |
parent | cafa4026ec5e06d04137a040ba05ed36b4eda86e [diff] |
security: deduplicate getting the key type from an EVP_PKEY structure Change-Id: Idba7ddcdd10672a0305fe16b1e278f397ff094fe
diff --git a/src/security/detail/openssl-helper.cpp b/src/security/detail/openssl-helper.cpp index 12d1106..27177e2 100644 --- a/src/security/detail/openssl-helper.cpp +++ b/src/security/detail/openssl-helper.cpp
@@ -36,6 +36,17 @@ } } +int +getEvpPkeyType(EVP_PKEY* key) +{ + return +#if OPENSSL_VERSION_NUMBER < 0x1010000fL + EVP_PKEY_type(key->type); +#else + EVP_PKEY_base_id(key); +#endif // OPENSSL_VERSION_NUMBER < 0x1010000fL +} + EvpPkeyCtx::EvpPkeyCtx(EVP_PKEY* key) : m_ctx(EVP_PKEY_CTX_new(key, nullptr)) {
diff --git a/src/security/detail/openssl-helper.hpp b/src/security/detail/openssl-helper.hpp index ddd1ea6..dfc630d 100644 --- a/src/security/detail/openssl-helper.hpp +++ b/src/security/detail/openssl-helper.hpp
@@ -32,6 +32,9 @@ const EVP_MD* toDigestEvpMd(DigestAlgorithm algo); +int +getEvpPkeyType(EVP_PKEY* key); + class EvpPkeyCtx : noncopyable { public: