Tom Joseph | 8bb10b7 | 2016-12-06 17:47:56 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Tom Joseph | 8bb10b7 | 2016-12-06 17:47:56 +0530 | [diff] [blame] | 3 | #include "comm_module.hpp" |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 4 | #include "message_handler.hpp" |
| 5 | |
| 6 | #include <vector> |
Tom Joseph | 8bb10b7 | 2016-12-06 17:47:56 +0530 | [diff] [blame] | 7 | |
| 8 | namespace command |
| 9 | { |
| 10 | |
Tom Joseph | 56527b9 | 2018-03-21 19:31:58 +0530 | [diff] [blame] | 11 | constexpr size_t userNameMaxLen = 16; |
| 12 | |
Richard Marian Thomaiyar | 127748a | 2018-09-06 07:08:51 +0530 | [diff] [blame] | 13 | constexpr uint8_t userNameOnlyLookupMask = 0x10; |
| 14 | constexpr uint8_t userNameOnlyLookup = 0x10; |
Richard Marian Thomaiyar | d91fd9d | 2018-12-06 12:03:50 +0530 | [diff] [blame] | 15 | constexpr uint8_t userNamePrivLookup = 0x0; |
Richard Marian Thomaiyar | 127748a | 2018-09-06 07:08:51 +0530 | [diff] [blame] | 16 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 17 | /** |
Tom Joseph | 8bb10b7 | 2016-12-06 17:47:56 +0530 | [diff] [blame] | 18 | * @struct RAKP1request |
| 19 | * |
| 20 | * IPMI Payload for RAKP Message 1 |
| 21 | */ |
| 22 | struct RAKP1request |
| 23 | { |
| 24 | uint8_t messageTag; |
| 25 | uint8_t reserved1; |
| 26 | uint16_t reserved2; |
| 27 | uint32_t managedSystemSessionID; |
| 28 | uint8_t remote_console_random_number[16]; |
| 29 | uint8_t req_max_privilege_level; |
| 30 | uint16_t reserved3; |
| 31 | uint8_t user_name_len; |
Tom Joseph | 56527b9 | 2018-03-21 19:31:58 +0530 | [diff] [blame] | 32 | char user_name[userNameMaxLen]; |
Tom Joseph | 8bb10b7 | 2016-12-06 17:47:56 +0530 | [diff] [blame] | 33 | } __attribute__((packed)); |
| 34 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 35 | /** |
Tom Joseph | 8bb10b7 | 2016-12-06 17:47:56 +0530 | [diff] [blame] | 36 | * @struct RAKP2response |
| 37 | * |
| 38 | * IPMI Payload for RAKP Message 2 |
| 39 | */ |
| 40 | struct RAKP2response |
| 41 | { |
| 42 | uint8_t messageTag; |
| 43 | uint8_t rmcpStatusCode; |
| 44 | uint16_t reserved; |
| 45 | uint32_t remoteConsoleSessionID; |
| 46 | uint8_t managed_system_random_number[16]; |
| 47 | uint8_t managed_system_guid[16]; |
| 48 | } __attribute__((packed)); |
| 49 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 50 | /** |
Tom Joseph | 8bb10b7 | 2016-12-06 17:47:56 +0530 | [diff] [blame] | 51 | * @brief RAKP Message 1, RAKP Message 2 |
| 52 | * |
| 53 | * These messages are used to exchange random number and identification |
| 54 | * information between the BMC and the remote console that are, in effect, |
| 55 | * mutual challenges for a challenge/response. (Unlike IPMI v1.5, the v2.0/RMCP+ |
| 56 | * challenge/response is symmetric. I.e. the remote console and BMC both issues |
| 57 | * challenges,and both need to provide valid responses for the session to be |
| 58 | * activated.) |
| 59 | * |
| 60 | * The remote console request (RAKP Message 1) passes a random number and |
| 61 | * username/privilege information that the BMC will later use to ‘sign’ a |
| 62 | * response message based on key information associated with the user and the |
| 63 | * Authentication Algorithm negotiated in the Open Session Request/Response |
| 64 | * exchange. The BMC responds with RAKP Message 2 and passes a random number and |
| 65 | * GUID (globally unique ID) for the managed system that the remote console |
| 66 | * uses according the Authentication Algorithm to sign a response back to the |
| 67 | * BMC. |
| 68 | * |
| 69 | * @param[in] inPayload - Request Data for the command |
| 70 | * @param[in] handler - Reference to the Message Handler |
| 71 | * |
| 72 | * @return Response data for the command |
| 73 | */ |
Tom Joseph | 18a45e9 | 2017-04-11 11:30:44 +0530 | [diff] [blame] | 74 | std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload, |
Tom Joseph | 8bb10b7 | 2016-12-06 17:47:56 +0530 | [diff] [blame] | 75 | const message::Handler& handler); |
| 76 | |
| 77 | } // namespace command |