blob: 8e5accbc02bb279a3dc9e9788a2888963953af4d [file] [log] [blame]
Tom Joseph7cbe2282018-03-21 21:17:33 +05301#include "nlohmann/json.hpp"
Patrick Venture5794fcf2017-10-26 11:11:14 -07002
Ayushi Smriti5c3b72c2019-08-30 13:47:31 +00003#include <ipmid/api.hpp>
Vernon Mauery392050f2019-04-01 14:53:19 -07004
Patrick Venture5794fcf2017-10-26 11:11:14 -07005/** @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 Venture0b02be92018-08-31 11:55:55 -070016ipmi_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 Venture5794fcf2017-10-26 11:11:14 -070021
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 Venture0b02be92018-08-31 11:55:55 -070033ipmi_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 Venture5794fcf2017-10-26 11:11:14 -070038
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 Venture0b02be92018-08-31 11:55:55 -070050ipmi_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 Venture5794fcf2017-10-26 11:11:14 -070055
Ayushi Smriti5c3b72c2019-08-30 13:47:31 +000056/** @brief this command is used to look up what authentication, integrity,
57 * confidentiality algorithms are supported.
Tom Joseph7cbe2282018-03-21 21:17:33 +053058 *
Ayushi Smriti5c3b72c2019-08-30 13:47:31 +000059 * @ param ctx - context pointer
60 * @ param channelNumber - channel number
61 * @ param payloadType - payload type
62 * @ param listIndex - list index
63 * @ param algoSelectBit - list algorithms
Tom Joseph7cbe2282018-03-21 21:17:33 +053064 *
Ayushi Smriti5c3b72c2019-08-30 13:47:31 +000065 * @returns ipmi completion code plus response data
66 * - rspChannel - channel number for authentication algorithm.
67 * - rspRecords - cipher suite records.
68 **/
69ipmi::RspType<uint8_t, // Channel Number
70 std::vector<uint8_t> // Cipher Records
71 >
72 getChannelCipherSuites(ipmi::Context::ptr ctx, uint4_t channelNumber,
73 uint4_t reserved1, uint8_t payloadType,
74 uint6_t listIndex, uint1_t reserved2,
75 uint1_t algoSelectBit);
Tom Joseph7cbe2282018-03-21 21:17:33 +053076
77namespace cipher
78{
79
Tom Joseph7cbe2282018-03-21 21:17:33 +053080static constexpr auto listCipherSuite = 0x80;
Tom Joseph7cbe2282018-03-21 21:17:33 +053081
82using Json = nlohmann::json;
Patrick Venture0b02be92018-08-31 11:55:55 -070083static constexpr auto configFile = "/usr/share/ipmi-providers/cipher_list.json";
Tom Joseph7cbe2282018-03-21 21:17:33 +053084static constexpr auto cipher = "cipher";
85static constexpr auto stdCipherSuite = 0xC0;
86static constexpr auto oemCipherSuite = 0xC1;
87static constexpr auto oem = "oemiana";
88static constexpr auto auth = "authentication";
89static constexpr auto integrity = "integrity";
90static constexpr auto integrityTag = 0x40;
91static constexpr auto conf = "confidentiality";
92static constexpr auto confTag = 0x80;
93
Patrick Venture0b02be92018-08-31 11:55:55 -070094} // namespace cipher