blob: 1b761f87ab147b3f4e45ab9546ad2403bc0f0694 [file] [log] [blame]
Patrick Venture5794fcf2017-10-26 11:11:14 -07001#include "ipmid.hpp"
Tom Joseph7cbe2282018-03-21 21:17:33 +05302#include "nlohmann/json.hpp"
Patrick Venture5794fcf2017-10-26 11:11:14 -07003
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 Venture0b02be92018-08-31 11:55:55 -070015ipmi_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 Venture5794fcf2017-10-26 11:11:14 -070020
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 Venture0b02be92018-08-31 11:55:55 -070032ipmi_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 Venture5794fcf2017-10-26 11:11:14 -070037
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 Venture0b02be92018-08-31 11:55:55 -070049ipmi_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 Venture5794fcf2017-10-26 11:11:14 -070054
Tom Joseph7cbe2282018-03-21 21:17:33 +053055/** @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 Venture0b02be92018-08-31 11:55:55 -070066ipmi_ret_t getChannelCipherSuites(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
Tom Joseph7cbe2282018-03-21 21:17:33 +053067 ipmi_request_t request,
68 ipmi_response_t response,
69 ipmi_data_len_t data_len,
70 ipmi_context_t context);
71
72namespace cipher
73{
74
75static constexpr auto defaultChannelNumber = 1;
76static constexpr auto listTypeMask = 0x80;
77static constexpr auto listCipherSuite = 0x80;
78static constexpr auto listIndexMask = 0x3F;
79static constexpr auto respSize = 16;
80
81using Json = nlohmann::json;
Patrick Venture0b02be92018-08-31 11:55:55 -070082static constexpr auto configFile = "/usr/share/ipmi-providers/cipher_list.json";
Tom Joseph7cbe2282018-03-21 21:17:33 +053083static constexpr auto cipher = "cipher";
84static constexpr auto stdCipherSuite = 0xC0;
85static constexpr auto oemCipherSuite = 0xC1;
86static constexpr auto oem = "oemiana";
87static constexpr auto auth = "authentication";
88static constexpr auto integrity = "integrity";
89static constexpr auto integrityTag = 0x40;
90static constexpr auto conf = "confidentiality";
91static constexpr auto confTag = 0x80;
92
Patrick Venture0b02be92018-08-31 11:55:55 -070093} // namespace cipher
Tom Joseph7cbe2282018-03-21 21:17:33 +053094
95/** @struct GetChannelCipherRequest
96 *
97 * IPMI payload for Get Channel Cipher Suites command request
98 */
99struct GetChannelCipherRequest
100{
Patrick Venture0b02be92018-08-31 11:55:55 -0700101 uint8_t channelNumber; //!< Channel Number
102 uint8_t payloadType; //!< Payload type number
103 uint8_t listIndex; //!< List Index
Tom Joseph7cbe2282018-03-21 21:17:33 +0530104} __attribute__((packed));
105
106/** @struct GetChannelCipherRespHeader
107 *
108 * IPMI payload for Get Channel Cipher Suites command response header
109 */
110struct GetChannelCipherRespHeader
111{
Patrick Venture0b02be92018-08-31 11:55:55 -0700112 uint8_t channelNumber; //!< Channel Number
Tom Joseph7cbe2282018-03-21 21:17:33 +0530113} __attribute__((packed));