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