Adriana Kobylak | 70ca242 | 2018-09-06 14:23:38 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | // With OpenSSL 1.1.0, some functions were deprecated. Need to abstract them |
| 4 | // to make the code backward compatible with older OpenSSL veresions. |
| 5 | // Reference: https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes |
| 6 | #if OPENSSL_VERSION_NUMBER < 0x10100000L |
| 7 | |
| 8 | #include <openssl/evp.h> |
| 9 | |
Lei YU | e499446 | 2019-03-14 14:41:53 +0800 | [diff] [blame] | 10 | #include <sdbusplus/bus.hpp> |
Brad Bishop | 8facccf | 2020-11-04 09:44:58 -0500 | [diff] [blame] | 11 | |
Andrew Geissler | ab139ce | 2020-05-16 13:22:09 -0500 | [diff] [blame] | 12 | #include <string> |
Lei YU | e499446 | 2019-03-14 14:41:53 +0800 | [diff] [blame] | 13 | |
Brad Bishop | 8facccf | 2020-11-04 09:44:58 -0500 | [diff] [blame] | 14 | extern "C" |
| 15 | { |
| 16 | EVP_MD_CTX* EVP_MD_CTX_new(void); |
| 17 | void EVP_MD_CTX_free(EVP_MD_CTX* ctx); |
Adriana Kobylak | 70ca242 | 2018-09-06 14:23:38 -0500 | [diff] [blame] | 18 | } |
| 19 | |
Lei YU | e499446 | 2019-03-14 14:41:53 +0800 | [diff] [blame] | 20 | namespace utils |
| 21 | { |
| 22 | |
| 23 | /** |
| 24 | * @brief Gets the D-Bus Service name for the input D-Bus path |
| 25 | * |
| 26 | * @param[in] bus - Bus handler |
| 27 | * @param[in] path - Object Path |
| 28 | * @param[in] intf - Interface |
| 29 | * |
| 30 | * @return Service name |
| 31 | * @error InternalFailure exception thrown |
| 32 | */ |
Patrick Williams | 0dea199 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 33 | std::string getService(sdbusplus::bus_t& bus, const std::string& path, |
Lei YU | e499446 | 2019-03-14 14:41:53 +0800 | [diff] [blame] | 34 | const std::string& intf); |
| 35 | |
| 36 | /** @brief Suspend hiomapd. |
| 37 | * |
| 38 | * @param[in] bus - The D-Bus bus object. |
| 39 | */ |
Patrick Williams | 0dea199 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 40 | void hiomapdSuspend(sdbusplus::bus_t& bus); |
Lei YU | e499446 | 2019-03-14 14:41:53 +0800 | [diff] [blame] | 41 | |
| 42 | /** @brief Resume hiomapd. |
| 43 | * |
| 44 | * @param[in] bus - The D-Bus bus object. |
| 45 | */ |
Patrick Williams | 0dea199 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 46 | void hiomapdResume(sdbusplus::bus_t& bus); |
Lei YU | e499446 | 2019-03-14 14:41:53 +0800 | [diff] [blame] | 47 | |
Adriana Kobylak | 56a4677 | 2022-02-25 16:37:37 +0000 | [diff] [blame] | 48 | /** @brief Set the Hardware Management Console Managed bios attribute to |
| 49 | * Disabled to clear the indication that the system is HMC-managed. |
| 50 | * |
| 51 | * @param[in] bus - The D-Bus bus object. |
| 52 | */ |
Patrick Williams | 0dea199 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 53 | void clearHMCManaged(sdbusplus::bus_t& bus); |
Adriana Kobylak | 56a4677 | 2022-02-25 16:37:37 +0000 | [diff] [blame] | 54 | |
Adriana Kobylak | f9a72a7 | 2022-05-20 14:52:29 +0000 | [diff] [blame] | 55 | /** @brief Set the Clear hypervisor NVRAM bios attribute to Enabled to indicate |
| 56 | * to the hypervisor to clear its NVRAM. |
| 57 | * |
| 58 | * @param[in] bus - The D-Bus bus object. |
| 59 | */ |
Patrick Williams | 0dea199 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 60 | void setClearNvram(sdbusplus::bus_t& bus); |
Adriana Kobylak | f9a72a7 | 2022-05-20 14:52:29 +0000 | [diff] [blame] | 61 | |
Adriana Kobylak | 267c413 | 2022-02-25 20:00:07 +0000 | [diff] [blame] | 62 | /** @brief DeleteAll error logs |
| 63 | * |
| 64 | * @param[in] bus - The D-Bus bus object. |
| 65 | */ |
Patrick Williams | 0dea199 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 66 | void deleteAllErrorLogs(sdbusplus::bus_t& bus); |
Adriana Kobylak | 267c413 | 2022-02-25 20:00:07 +0000 | [diff] [blame] | 67 | |
Lei YU | e499446 | 2019-03-14 14:41:53 +0800 | [diff] [blame] | 68 | } // namespace utils |
| 69 | |
Adriana Kobylak | 70ca242 | 2018-09-06 14:23:38 -0500 | [diff] [blame] | 70 | #endif // OPENSSL_VERSION_NUMBER < 0x10100000L |