xref: /openbmc/phosphor-net-ipmid/command/channel_auth.hpp (revision 33503e2a90d5615a11ec2d27961ffdefc3a5cd10)
14a8f34dcSTom Joseph #pragma once
24a8f34dcSTom Joseph 
34a8f34dcSTom Joseph #include "message_handler.hpp"
44a8f34dcSTom Joseph 
59e801a2bSVernon Mauery #include <vector>
69e801a2bSVernon Mauery 
74a8f34dcSTom Joseph namespace command
84a8f34dcSTom Joseph {
94a8f34dcSTom Joseph 
103563f8feSTom Joseph /**
114a8f34dcSTom Joseph  * @struct GetChannelCapabilitiesReq
124a8f34dcSTom Joseph  *
134a8f34dcSTom Joseph  * IPMI Request data for Get Channel Authentication Capabilities command
144a8f34dcSTom Joseph  */
154a8f34dcSTom Joseph struct GetChannelCapabilitiesReq
164a8f34dcSTom Joseph {
174a8f34dcSTom Joseph     uint8_t channelNumber;
184a8f34dcSTom Joseph     uint8_t reqMaxPrivLevel;
194a8f34dcSTom Joseph } __attribute__((packed));
204a8f34dcSTom Joseph 
213563f8feSTom Joseph /**
224a8f34dcSTom Joseph  * @struct GetChannelCapabilitiesResp
234a8f34dcSTom Joseph  *
244a8f34dcSTom Joseph  * IPMI Response data for Get Channel Authentication Capabilities command
254a8f34dcSTom Joseph  */
264a8f34dcSTom Joseph struct GetChannelCapabilitiesResp
274a8f34dcSTom Joseph {
284a8f34dcSTom Joseph     uint8_t completionCode; // Completion Code
294a8f34dcSTom Joseph 
304a8f34dcSTom Joseph     uint8_t channelNumber;  // Channel number that the request was
314a8f34dcSTom Joseph     // received on
324a8f34dcSTom Joseph 
334a8f34dcSTom Joseph #if BYTE_ORDER == LITTLE_ENDIAN
344a8f34dcSTom Joseph     uint8_t none:1;
354a8f34dcSTom Joseph     uint8_t md2:1;
364a8f34dcSTom Joseph     uint8_t md5:1;
374a8f34dcSTom Joseph     uint8_t reserved2:1;
384a8f34dcSTom Joseph     uint8_t straightKey:1; // Straight password/key support
394a8f34dcSTom Joseph     // Support OEM identified by the IANA OEM ID in RMCP+ ping response
404a8f34dcSTom Joseph     uint8_t oem:1;
414a8f34dcSTom Joseph     uint8_t reserved1:1;
424a8f34dcSTom Joseph     uint8_t ipmiVersion:1; // 0b = IPMIV1.5 support only, 1B = IPMI V2.0
434a8f34dcSTom Joseph     // support
444a8f34dcSTom Joseph #endif
454a8f34dcSTom Joseph 
464a8f34dcSTom Joseph #if BYTE_ORDER == BIG_ENDIAN
474a8f34dcSTom Joseph     uint8_t ipmiVersion:1; // 0b = IPMIV1.5 support only, 1B = IPMI V2.0
484a8f34dcSTom Joseph     // support
494a8f34dcSTom Joseph     uint8_t reserved1:1;
504a8f34dcSTom Joseph     // Support OEM identified by the IANA OEM ID in RMCP+ ping response
514a8f34dcSTom Joseph     uint8_t oem:1;
524a8f34dcSTom Joseph     uint8_t straightKey:1; // Straight password/key support
534a8f34dcSTom Joseph     uint8_t reserved2:1;
544a8f34dcSTom Joseph     uint8_t md5:1;
554a8f34dcSTom Joseph     uint8_t md2:1;
564a8f34dcSTom Joseph     uint8_t none:1;
574a8f34dcSTom Joseph #endif
584a8f34dcSTom Joseph 
594a8f34dcSTom Joseph #if BYTE_ORDER == LITTLE_ENDIAN
604a8f34dcSTom Joseph     // Anonymous login status for anonymous login enabled/disabled
614a8f34dcSTom Joseph     uint8_t anonymousLogin:1;
62dc3e8b92STom Joseph     // Anonymous login status for null usernames enabled/disabled
63dc3e8b92STom Joseph     uint8_t nullUsers:1;
64dc3e8b92STom Joseph     // Anonymous login status for non-null usernames enabled/disabled
65dc3e8b92STom Joseph     uint8_t nonNullUsers:1;
66dc3e8b92STom Joseph     uint8_t userAuth:1;       // User level authentication status
67dc3e8b92STom Joseph     uint8_t perMessageAuth:1; // Per-message authentication support
68dc3e8b92STom Joseph     // Two key login status . only for IPMI V2.0 RMCP+ RAKP
69dc3e8b92STom Joseph     uint8_t KGStatus:1;
704a8f34dcSTom Joseph     uint8_t reserved3:2;
714a8f34dcSTom Joseph #endif
724a8f34dcSTom Joseph 
734a8f34dcSTom Joseph #if BYTE_ORDER == BIG_ENDIAN
744a8f34dcSTom Joseph     uint8_t reserved3:2;
754a8f34dcSTom Joseph     // Two key login status . only for IPMI V2.0 RMCP+ RAKP
764a8f34dcSTom Joseph     uint8_t KGStatus:1;
77dc3e8b92STom Joseph     uint8_t perMessageAuth:1; // Per-message authentication support
78dc3e8b92STom Joseph     uint8_t userAuth:1;       // User level authentication status
79dc3e8b92STom Joseph     // Anonymous login status for non-null usernames enabled/disabled
80dc3e8b92STom Joseph     uint8_t nonNullUsers:1;
81dc3e8b92STom Joseph     // Anonymous login status for null usernames enabled/disabled
82dc3e8b92STom Joseph     uint8_t nullUsers:1;
83dc3e8b92STom Joseph     // Anonymous login status for anonymous login enabled/disabled
84dc3e8b92STom Joseph     uint8_t anonymousLogin:1;
854a8f34dcSTom Joseph #endif
864a8f34dcSTom Joseph 
874a8f34dcSTom Joseph #if BYTE_ORDER == LITTLE_ENDIAN
884a8f34dcSTom Joseph     // Extended capabilities will be present only if IPMI version is V2.0
894a8f34dcSTom Joseph     uint8_t extCapabilities:2; // Channel support for IPMI V2.0 connections
904a8f34dcSTom Joseph     uint8_t reserved4:6;
914a8f34dcSTom Joseph #endif
924a8f34dcSTom Joseph 
934a8f34dcSTom Joseph #if BYTE_ORDER == BIG_ENDIAN
944a8f34dcSTom Joseph     // Extended capabilities will be present only if IPMI version is V2.0
954a8f34dcSTom Joseph     uint8_t reserved4:6;
964a8f34dcSTom Joseph     uint8_t extCapabilities:2; // Channel support for IPMI V2.0 connections
974a8f34dcSTom Joseph #endif
984a8f34dcSTom Joseph 
994a8f34dcSTom Joseph     // Below 4 bytes will all the 0's if no OEM authentication type available.
1004a8f34dcSTom Joseph     uint8_t oemID[3];     // IANA enterprise number for OEM/organization
1014a8f34dcSTom Joseph     uint8_t oemAuxillary; // Addition OEM specific information..
1024a8f34dcSTom Joseph } __attribute__((packed));
1034a8f34dcSTom Joseph 
1043563f8feSTom Joseph /**
1054a8f34dcSTom Joseph  * @brief Get Channel Authentication Capabilities
1064a8f34dcSTom Joseph  *
1074a8f34dcSTom Joseph  * This message exchange provides a way for a remote console to discover what
1084a8f34dcSTom Joseph  * IPMI version is supported i.e. whether or not the BMC supports the IPMI
1094a8f34dcSTom Joseph  * v2.0 / RMCP+ packet format. It also provides information that the remote
1104a8f34dcSTom Joseph  * console can use to determine whether anonymous, “one-key”, or “two-key”
1114a8f34dcSTom Joseph  * logins are used.This information can guide a remote console in how it
1124a8f34dcSTom Joseph  * presents queries to users for username and password information. This is a
1134a8f34dcSTom Joseph  * ‘session-less’ command that the BMC accepts in both IPMI v1.5 and v2.0/RMCP+
1144a8f34dcSTom Joseph  * packet formats.
1154a8f34dcSTom Joseph  *
1164a8f34dcSTom Joseph  * @param[in] inPayload - Request Data for the command
1174a8f34dcSTom Joseph  * @param[in] handler - Reference to the Message Handler
1184a8f34dcSTom Joseph  *
1194a8f34dcSTom Joseph  * @return Response data for the command
1204a8f34dcSTom Joseph  */
121*33503e2aSPatrick Williams std::vector<uint8_t> GetChannelCapabilities(
122*33503e2aSPatrick Williams     const std::vector<uint8_t>& inPayload,
12341ff9b51SVernon Mauery     std::shared_ptr<message::Handler>& handler);
1244a8f34dcSTom Joseph 
12560d6e4edSVernon Mauery /**
12660d6e4edSVernon Mauery  * @brief Get Channel Cipher Suites
12760d6e4edSVernon Mauery  *
12860d6e4edSVernon Mauery  * This command is used to look up what authentication, integrity, and
12960d6e4edSVernon Mauery  * confidentiality algorithms are supported. The algorithms are used in
13060d6e4edSVernon Mauery  * combination as ‘Cipher Suites’. This command only applies to implementations
13160d6e4edSVernon Mauery  * that support IPMI v2.0/RMCP+ sessions. This command can be executed prior to
13260d6e4edSVernon Mauery  * establishing a session with the BMC.
13360d6e4edSVernon Mauery  *
13460d6e4edSVernon Mauery  * @param[in] inPayload - Request Data for the command
13560d6e4edSVernon Mauery  * @param[in] handler - Reference to the Message Handler
13660d6e4edSVernon Mauery  *
13760d6e4edSVernon Mauery  * @return Response data for the command
13860d6e4edSVernon Mauery  */
139*33503e2aSPatrick Williams std::vector<uint8_t> getChannelCipherSuites(
140*33503e2aSPatrick Williams     const std::vector<uint8_t>& inPayload,
14160d6e4edSVernon Mauery     std::shared_ptr<message::Handler>& handler);
14260d6e4edSVernon Mauery 
1434a8f34dcSTom Joseph } // namespace command
144