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