Tom Joseph | 7cbe228 | 2018-03-21 21:17:33 +0530 | [diff] [blame] | 1 | #include "nlohmann/json.hpp" |
Patrick Venture | 5794fcf | 2017-10-26 11:11:14 -0700 | [diff] [blame] | 2 | |
Vernon Mauery | 392050f | 2019-04-01 14:53:19 -0700 | [diff] [blame] | 3 | #include <ipmid/api.h> |
| 4 | |
Patrick Venture | 5794fcf | 2017-10-26 11:11:14 -0700 | [diff] [blame] | 5 | /** @brief The set channel access IPMI command. |
| 6 | * |
| 7 | * @param[in] netfn |
| 8 | * @param[in] cmd |
| 9 | * @param[in] request |
| 10 | * @param[in,out] response |
| 11 | * @param[out] data_len |
| 12 | * @param[in] context |
| 13 | * |
| 14 | * @return IPMI_CC_OK on success, non-zero otherwise. |
| 15 | */ |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 16 | ipmi_ret_t ipmi_set_channel_access(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 17 | ipmi_request_t request, |
| 18 | ipmi_response_t response, |
| 19 | ipmi_data_len_t data_len, |
| 20 | ipmi_context_t context); |
Patrick Venture | 5794fcf | 2017-10-26 11:11:14 -0700 | [diff] [blame] | 21 | |
| 22 | /** @brief The get channel access IPMI command. |
| 23 | * |
| 24 | * @param[in] netfn |
| 25 | * @param[in] cmd |
| 26 | * @param[in] request |
| 27 | * @param[in,out] response |
| 28 | * @param[out] data_len |
| 29 | * @param[in] context |
| 30 | * |
| 31 | * @return IPMI_CC_OK on success, non-zero otherwise. |
| 32 | */ |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 33 | ipmi_ret_t ipmi_get_channel_access(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 34 | ipmi_request_t request, |
| 35 | ipmi_response_t response, |
| 36 | ipmi_data_len_t data_len, |
| 37 | ipmi_context_t context); |
Patrick Venture | 5794fcf | 2017-10-26 11:11:14 -0700 | [diff] [blame] | 38 | |
| 39 | /** @brief The get channel info IPMI command. |
| 40 | * |
| 41 | * @param[in] netfn |
| 42 | * @param[in] cmd |
| 43 | * @param[in] request |
| 44 | * @param[in,out] response |
| 45 | * @param[out] data_len |
| 46 | * @param[in] context |
| 47 | * |
| 48 | * @return IPMI_CC_OK on success, non-zero otherwise. |
| 49 | */ |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 50 | ipmi_ret_t ipmi_app_channel_info(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 51 | ipmi_request_t request, |
| 52 | ipmi_response_t response, |
| 53 | ipmi_data_len_t data_len, |
| 54 | ipmi_context_t context); |
Patrick Venture | 5794fcf | 2017-10-26 11:11:14 -0700 | [diff] [blame] | 55 | |
Tom Joseph | 7cbe228 | 2018-03-21 21:17:33 +0530 | [diff] [blame] | 56 | /** @brief Implementation of get channel cipher suites command |
| 57 | * |
| 58 | * @param[in] netfn - Net Function |
| 59 | * @param[in] cmd - Command |
| 60 | * @param[in] request - Request pointer |
| 61 | * @param[in,out] response - Response pointer |
| 62 | * @param[in,out] data_len - Data Length |
| 63 | * @param[in] context - Context |
| 64 | * |
| 65 | * @return IPMI_CC_OK on success, non-zero otherwise. |
| 66 | */ |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 67 | ipmi_ret_t getChannelCipherSuites(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
Tom Joseph | 7cbe228 | 2018-03-21 21:17:33 +0530 | [diff] [blame] | 68 | ipmi_request_t request, |
| 69 | ipmi_response_t response, |
| 70 | ipmi_data_len_t data_len, |
| 71 | ipmi_context_t context); |
| 72 | |
| 73 | namespace cipher |
| 74 | { |
| 75 | |
| 76 | static constexpr auto defaultChannelNumber = 1; |
| 77 | static constexpr auto listTypeMask = 0x80; |
| 78 | static constexpr auto listCipherSuite = 0x80; |
| 79 | static constexpr auto listIndexMask = 0x3F; |
| 80 | static constexpr auto respSize = 16; |
| 81 | |
| 82 | using Json = nlohmann::json; |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 83 | static constexpr auto configFile = "/usr/share/ipmi-providers/cipher_list.json"; |
Tom Joseph | 7cbe228 | 2018-03-21 21:17:33 +0530 | [diff] [blame] | 84 | static constexpr auto cipher = "cipher"; |
| 85 | static constexpr auto stdCipherSuite = 0xC0; |
| 86 | static constexpr auto oemCipherSuite = 0xC1; |
| 87 | static constexpr auto oem = "oemiana"; |
| 88 | static constexpr auto auth = "authentication"; |
| 89 | static constexpr auto integrity = "integrity"; |
| 90 | static constexpr auto integrityTag = 0x40; |
| 91 | static constexpr auto conf = "confidentiality"; |
| 92 | static constexpr auto confTag = 0x80; |
| 93 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 94 | } // namespace cipher |
Tom Joseph | 7cbe228 | 2018-03-21 21:17:33 +0530 | [diff] [blame] | 95 | |
| 96 | /** @struct GetChannelCipherRequest |
| 97 | * |
| 98 | * IPMI payload for Get Channel Cipher Suites command request |
| 99 | */ |
| 100 | struct GetChannelCipherRequest |
| 101 | { |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 102 | uint8_t channelNumber; //!< Channel Number |
| 103 | uint8_t payloadType; //!< Payload type number |
| 104 | uint8_t listIndex; //!< List Index |
Tom Joseph | 7cbe228 | 2018-03-21 21:17:33 +0530 | [diff] [blame] | 105 | } __attribute__((packed)); |
| 106 | |
| 107 | /** @struct GetChannelCipherRespHeader |
| 108 | * |
| 109 | * IPMI payload for Get Channel Cipher Suites command response header |
| 110 | */ |
| 111 | struct GetChannelCipherRespHeader |
| 112 | { |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 113 | uint8_t channelNumber; //!< Channel Number |
Tom Joseph | 7cbe228 | 2018-03-21 21:17:33 +0530 | [diff] [blame] | 114 | } __attribute__((packed)); |