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