17cbe2286STom Joseph #include "nlohmann/json.hpp"
25794fcf6SPatrick Venture 
3*5c3b72c6SAyushi Smriti #include <ipmid/api.hpp>
4392050faSVernon Mauery 
55794fcf6SPatrick Venture /** @brief The set channel access IPMI command.
65794fcf6SPatrick Venture  *
75794fcf6SPatrick Venture  *  @param[in] netfn
85794fcf6SPatrick Venture  *  @param[in] cmd
95794fcf6SPatrick Venture  *  @param[in] request
105794fcf6SPatrick Venture  *  @param[in,out] response
115794fcf6SPatrick Venture  *  @param[out] data_len
125794fcf6SPatrick Venture  *  @param[in] context
135794fcf6SPatrick Venture  *
145794fcf6SPatrick Venture  *  @return IPMI_CC_OK on success, non-zero otherwise.
155794fcf6SPatrick Venture  */
160b02be92SPatrick Venture ipmi_ret_t ipmi_set_channel_access(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
175794fcf6SPatrick Venture                                    ipmi_request_t request,
185794fcf6SPatrick Venture                                    ipmi_response_t response,
195794fcf6SPatrick Venture                                    ipmi_data_len_t data_len,
205794fcf6SPatrick Venture                                    ipmi_context_t context);
215794fcf6SPatrick Venture 
225794fcf6SPatrick Venture /** @brief The get channel access IPMI command.
235794fcf6SPatrick Venture  *
245794fcf6SPatrick Venture  *  @param[in] netfn
255794fcf6SPatrick Venture  *  @param[in] cmd
265794fcf6SPatrick Venture  *  @param[in] request
275794fcf6SPatrick Venture  *  @param[in,out] response
285794fcf6SPatrick Venture  *  @param[out] data_len
295794fcf6SPatrick Venture  *  @param[in] context
305794fcf6SPatrick Venture  *
315794fcf6SPatrick Venture  *  @return IPMI_CC_OK on success, non-zero otherwise.
325794fcf6SPatrick Venture  */
330b02be92SPatrick Venture ipmi_ret_t ipmi_get_channel_access(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
345794fcf6SPatrick Venture                                    ipmi_request_t request,
355794fcf6SPatrick Venture                                    ipmi_response_t response,
365794fcf6SPatrick Venture                                    ipmi_data_len_t data_len,
375794fcf6SPatrick Venture                                    ipmi_context_t context);
385794fcf6SPatrick Venture 
395794fcf6SPatrick Venture /** @brief The get channel info IPMI command.
405794fcf6SPatrick Venture  *
415794fcf6SPatrick Venture  *  @param[in] netfn
425794fcf6SPatrick Venture  *  @param[in] cmd
435794fcf6SPatrick Venture  *  @param[in] request
445794fcf6SPatrick Venture  *  @param[in,out] response
455794fcf6SPatrick Venture  *  @param[out] data_len
465794fcf6SPatrick Venture  *  @param[in] context
475794fcf6SPatrick Venture  *
485794fcf6SPatrick Venture  *  @return IPMI_CC_OK on success, non-zero otherwise.
495794fcf6SPatrick Venture  */
500b02be92SPatrick Venture ipmi_ret_t ipmi_app_channel_info(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
515794fcf6SPatrick Venture                                  ipmi_request_t request,
525794fcf6SPatrick Venture                                  ipmi_response_t response,
535794fcf6SPatrick Venture                                  ipmi_data_len_t data_len,
545794fcf6SPatrick Venture                                  ipmi_context_t context);
555794fcf6SPatrick Venture 
56*5c3b72c6SAyushi Smriti /** @brief this command is used to look up what authentication, integrity,
57*5c3b72c6SAyushi Smriti  *  confidentiality algorithms are supported.
587cbe2286STom Joseph  *
59*5c3b72c6SAyushi Smriti  *  @ param ctx - context pointer
60*5c3b72c6SAyushi Smriti  *  @ param channelNumber - channel number
61*5c3b72c6SAyushi Smriti  *  @ param payloadType - payload type
62*5c3b72c6SAyushi Smriti  *  @ param listIndex - list index
63*5c3b72c6SAyushi Smriti  *  @ param algoSelectBit - list algorithms
647cbe2286STom Joseph  *
65*5c3b72c6SAyushi Smriti  *  @returns ipmi completion code plus response data
66*5c3b72c6SAyushi Smriti  *  - rspChannel - channel number for authentication algorithm.
67*5c3b72c6SAyushi Smriti  *  - rspRecords - cipher suite records.
68*5c3b72c6SAyushi Smriti  **/
69*5c3b72c6SAyushi Smriti ipmi::RspType<uint8_t,             // Channel Number
70*5c3b72c6SAyushi Smriti               std::vector<uint8_t> // Cipher Records
71*5c3b72c6SAyushi Smriti               >
72*5c3b72c6SAyushi Smriti     getChannelCipherSuites(ipmi::Context::ptr ctx, uint4_t channelNumber,
73*5c3b72c6SAyushi Smriti                            uint4_t reserved1, uint8_t payloadType,
74*5c3b72c6SAyushi Smriti                            uint6_t listIndex, uint1_t reserved2,
75*5c3b72c6SAyushi Smriti                            uint1_t algoSelectBit);
767cbe2286STom Joseph 
777cbe2286STom Joseph namespace cipher
787cbe2286STom Joseph {
797cbe2286STom Joseph 
807cbe2286STom Joseph static constexpr auto listCipherSuite = 0x80;
817cbe2286STom Joseph 
827cbe2286STom Joseph using Json = nlohmann::json;
830b02be92SPatrick Venture static constexpr auto configFile = "/usr/share/ipmi-providers/cipher_list.json";
847cbe2286STom Joseph static constexpr auto cipher = "cipher";
857cbe2286STom Joseph static constexpr auto stdCipherSuite = 0xC0;
867cbe2286STom Joseph static constexpr auto oemCipherSuite = 0xC1;
877cbe2286STom Joseph static constexpr auto oem = "oemiana";
887cbe2286STom Joseph static constexpr auto auth = "authentication";
897cbe2286STom Joseph static constexpr auto integrity = "integrity";
907cbe2286STom Joseph static constexpr auto integrityTag = 0x40;
917cbe2286STom Joseph static constexpr auto conf = "confidentiality";
927cbe2286STom Joseph static constexpr auto confTag = 0x80;
937cbe2286STom Joseph 
947cbe2286STom Joseph } // namespace cipher
95