summaryrefslogtreecommitdiffstats
path: root/utils.hpp
blob: 9d119b3a0eb4993045c7061312f2add938c86add (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

// With OpenSSL 1.1.0, some functions were deprecated. Need to abstract them
// to make the code backward compatible with older OpenSSL veresions.
// Reference: https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
#if OPENSSL_VERSION_NUMBER < 0x10100000L

#include <openssl/evp.h>

#include <sdbusplus/bus.hpp>

extern "C" {
EVP_MD_CTX* EVP_MD_CTX_new(void);
void EVP_MD_CTX_free(EVP_MD_CTX* ctx);
}

namespace utils
{

/**
 * @brief Gets the D-Bus Service name for the input D-Bus path
 *
 * @param[in] bus  -  Bus handler
 * @param[in] path -  Object Path
 * @param[in] intf -  Interface
 *
 * @return  Service name
 * @error   InternalFailure exception thrown
 */
std::string getService(sdbusplus::bus::bus& bus, const std::string& path,
                       const std::string& intf);

/** @brief Suspend hiomapd.
 *
 * @param[in] bus - The D-Bus bus object.
 */
void hiomapdSuspend(sdbusplus::bus::bus& bus);

/** @brief Resume hiomapd.
 *
 * @param[in] bus - The D-Bus bus object.
 */
void hiomapdResume(sdbusplus::bus::bus& bus);

} // namespace utils

#endif // OPENSSL_VERSION_NUMBER < 0x10100000L
OpenPOWER on IntegriCloud