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