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