/usr/include/freeipmi/interface/ipmi-rmcpplus-interface.h is in libfreeipmi-dev 0.8.12-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | /*
Copyright (C) 2003-2010 FreeIPMI Core Team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _IPMI_RMCPPLUS_INTERFACE_H
#define _IPMI_RMCPPLUS_INTERFACE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <freeipmi/fiid/fiid.h>
/**************************
* IPMI 2.0 Payload Types *
**************************/
#define IPMI_PAYLOAD_TYPE_IPMI 0x00
#define IPMI_PAYLOAD_TYPE_SOL 0x01
#define IPMI_PAYLOAD_TYPE_OEM_EXPLICIT 0x02
#define IPMI_PAYLOAD_TYPE_RMCPPLUS_OPEN_SESSION_REQUEST 0x10
#define IPMI_PAYLOAD_TYPE_RMCPPLUS_OPEN_SESSION_RESPONSE 0x11
#define IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_1 0x12
#define IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_2 0x13
#define IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_3 0x14
#define IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_4 0x15
/* 20h - 27h - OEM */
/* all other reserved */
#define IPMI_PAYLOAD_TYPE_VALID(__payload_type) \
(((__payload_type) == IPMI_PAYLOAD_TYPE_IPMI \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_SOL \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_OEM_EXPLICIT \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RMCPPLUS_OPEN_SESSION_REQUEST \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RMCPPLUS_OPEN_SESSION_RESPONSE \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_1 \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_2 \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_3 \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_4) ? 1 : 0)
#define IPMI_PAYLOAD_TYPE_SESSION_SETUP(__payload_type) \
(((__payload_type) == IPMI_PAYLOAD_TYPE_RMCPPLUS_OPEN_SESSION_REQUEST \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RMCPPLUS_OPEN_SESSION_RESPONSE \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_1 \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_2 \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_3 \
|| (__payload_type) == IPMI_PAYLOAD_TYPE_RAKP_MESSAGE_4) ? 1 : 0)
/**************************
* IPMI 2.0 Payload Flags *
**************************/
#define IPMI_PAYLOAD_FLAG_UNENCRYPTED 0x0
#define IPMI_PAYLOAD_FLAG_ENCRYPTED 0x1
#define IPMI_PAYLOAD_FLAG_UNAUTHENTICATED 0x0
#define IPMI_PAYLOAD_FLAG_AUTHENTICATED 0x1
#define IPMI_PAYLOAD_ENCRYPTED_FLAG_VALID(__payload_flag) \
(((__payload_flag) == IPMI_PAYLOAD_FLAG_UNENCRYPTED \
|| (__payload_flag) == IPMI_PAYLOAD_FLAG_ENCRYPTED) ? 1 : 0)
#define IPMI_PAYLOAD_AUTHENTICATED_FLAG_VALID(__payload_flag) \
(((__payload_flag) == IPMI_PAYLOAD_FLAG_UNENCRYPTED \
|| (__payload_flag) == IPMI_PAYLOAD_FLAG_ENCRYPTED) ? 1 : 0)
/*********************************************
* IPMI 2.0 Authentication Algorithm Numbers *
*********************************************/
#define IPMI_AUTHENTICATION_ALGORITHM_RAKP_NONE 0x00
#define IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1 0x01
#define IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 0x02
#define IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA256 0x03
/* C0h - FFh - OEM */
/* all other reserved */
#define IPMI_AUTHENTICATION_ALGORITHM_VALID(__algorithm) \
(((__algorithm) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_NONE \
|| (__algorithm) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1 \
|| (__algorithm) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 \
|| (__algorithm) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA256) ? 1 : 0)
#define IPMI_AUTHENTICATION_ALGORITHM_SUPPORTED(__algorithm) \
(((__algorithm) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_NONE \
|| (__algorithm) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA1 \
|| (__algorithm) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_MD5 \
|| (__algorithm) == IPMI_AUTHENTICATION_ALGORITHM_RAKP_HMAC_SHA256) ? 1 : 0)
/****************************************
* IPMI 2.0 Integrity Algorithm Numbers *
****************************************/
#define IPMI_INTEGRITY_ALGORITHM_NONE 0x00
#define IPMI_INTEGRITY_ALGORITHM_HMAC_SHA1_96 0x01
#define IPMI_INTEGRITY_ALGORITHM_HMAC_MD5_128 0x02
#define IPMI_INTEGRITY_ALGORITHM_MD5_128 0x03
#define IPMI_INTEGRITY_ALGORITHM_HMAC_SHA256_128 0x04
/* C0h - FFh - OEM */
/* all other reserved */
#define IPMI_INTEGRITY_ALGORITHM_VALID(__algorithm) \
(((__algorithm) == IPMI_INTEGRITY_ALGORITHM_NONE \
|| (__algorithm) == IPMI_INTEGRITY_ALGORITHM_HMAC_SHA1_96 \
|| (__algorithm) == IPMI_INTEGRITY_ALGORITHM_HMAC_MD5_128 \
|| (__algorithm) == IPMI_INTEGRITY_ALGORITHM_MD5_128 \
|| (__algorithm) == IPMI_INTEGRITY_ALGORITHM_HMAC_SHA256_128) ? 1 : 0)
#define IPMI_INTEGRITY_ALGORITHM_SUPPORTED(__algorithm) \
(((__algorithm) == IPMI_INTEGRITY_ALGORITHM_NONE \
|| (__algorithm) == IPMI_INTEGRITY_ALGORITHM_HMAC_SHA1_96 \
|| (__algorithm) == IPMI_INTEGRITY_ALGORITHM_HMAC_MD5_128 \
|| (__algorithm) == IPMI_INTEGRITY_ALGORITHM_MD5_128 \
|| (__algorithm) == IPMI_INTEGRITY_ALGORITHM_HMAC_SHA256_128) ? 1 : 0)
/**********************************************
* IPMI 2.0 Confidentiality Algorithm Numbers *
**********************************************/
#define IPMI_CONFIDENTIALITY_ALGORITHM_NONE 0x00
#define IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128 0x01
#define IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_128 0x02
#define IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_40 0x03
/* 30h - 3Fh - OEM */
/* all other reserved */
#define IPMI_CONFIDENTIALITY_ALGORITHM_VALID(__algorithm) \
(((__algorithm) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|| (__algorithm) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128 \
|| (__algorithm) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_128 \
|| (__algorithm) == IPMI_CONFIDENTIALITY_ALGORITHM_XRC4_40) ? 1 : 0)
#define IPMI_CONFIDENTIALITY_ALGORITHM_SUPPORTED(__algorithm) \
(((__algorithm) == IPMI_CONFIDENTIALITY_ALGORITHM_NONE \
|| (__algorithm) == IPMI_CONFIDENTIALITY_ALGORITHM_AES_CBC_128) ? 1 : 0)
/***************************************
* IPMI 2.0 Misc Flags and Definitions *
***************************************/
#define IPMI_AUTHENTICATION_PAYLOAD_TYPE 0x00
#define IPMI_AUTHENTICATION_PAYLOAD_LENGTH 0x08
#define IPMI_INTEGRITY_PAYLOAD_TYPE 0x01
#define IPMI_INTEGRITY_PAYLOAD_LENGTH 0x08
#define IPMI_CONFIDENTIALITY_PAYLOAD_TYPE 0x02
#define IPMI_CONFIDENTIALITY_PAYLOAD_LENGTH 0x08
#define IPMI_USER_NAME_PRIVILEGE_LOOKUP 0x0
#define IPMI_NAME_ONLY_LOOKUP 0x1
#define IPMI_USER_NAME_LOOKUP_VALID(__username_lookup_flag) \
(((__username_lookup_flag) == IPMI_USER_NAME_PRIVILEGE_LOOKUP \
|| (__username_lookup_flag) == IPMI_NAME_ONLY_LOOKUP) ? 1 : 0)
#define IPMI_REMOTE_CONSOLE_RANDOM_NUMBER_LENGTH 16
#define IPMI_MANAGED_SYSTEM_RANDOM_NUMBER_LENGTH 16
#define IPMI_MANAGED_SYSTEM_GUID_LENGTH 16
#define IPMI_NEXT_HEADER 0x07
#define IPMI_INTEGRITY_PAD_MULTIPLE 4
#define IPMI_INTEGRITY_PAD_DATA 0xFF
#define IPMI_MAX_PAYLOAD_LENGTH 65536
/* achu: b/c ipmi_msg_len is 2 bytes */
#define IPMI_HMAC_SHA1_DIGEST_LENGTH 20
#define IPMI_HMAC_MD5_DIGEST_LENGTH 16
#define IPMI_MD5_DIGEST_LENGTH 16
#define IPMI_HMAC_SHA1_96_DIGEST_LENGTH 12
#define IPMI_HMAC_SHA256_DIGEST_LENGTH 32
#define IPMI_HMAC_SHA1_96_AUTHENTICATION_CODE_LENGTH 12
#define IPMI_HMAC_MD5_128_AUTHENTICATION_CODE_LENGTH 16
#define IPMI_MD5_128_AUTHENTICATION_CODE_LENGTH 16
#define IPMI_HMAC_SHA256_128_AUTHENTICATION_CODE_LENGTH 16
/* Refer to table 22-19 */
/* XXX - Errata 4 defines SHA256 but not cipher suite IDs */
/* Cipher Suite 17 confirmed via DCMI 1.1 specification */
#define IPMI_CIPHER_SUITE_ID_MIN 0
#define IPMI_CIPHER_SUITE_ID_MAX 17
/*
* fill* functions return 0 on success, -1 on error.
*
* object must be for the fill function's respective fiid
* template.
*
* assemble/unassemble functions must be passed fiid objects of the
* respective expected header/trailer templates.
*
* see freeipmi/templates/ for template definitions
*/
extern fiid_template_t tmpl_rmcpplus_session_hdr;
extern fiid_template_t tmpl_rmcpplus_session_trlr;
extern fiid_template_t tmpl_rmcpplus_payload;
extern fiid_template_t tmpl_rmcpplus_open_session_request;
extern fiid_template_t tmpl_rmcpplus_open_session_response;
extern fiid_template_t tmpl_rmcpplus_rakp_message_1;
extern fiid_template_t tmpl_rmcpplus_rakp_message_2;
extern fiid_template_t tmpl_rmcpplus_rakp_message_3;
extern fiid_template_t tmpl_rmcpplus_rakp_message_4;
/* ipmi_rmcpplus_init
*
* Must be called first to initialize crypt libs. In threaded
* programs, must be called before threads are created.
*
* If errno returned == EPERM, underlying crypt library incompatible.
*
* Returns 0 on success, -1 on error.
*/
int ipmi_rmcpplus_init (void);
int fill_rmcpplus_session_hdr (uint8_t payload_type,
uint8_t payload_authenticated,
uint8_t payload_encrypted,
uint32_t oem_iana,
uint16_t oem_payload_id,
uint32_t session_id,
uint32_t session_sequence_number,
fiid_obj_t obj_rmcpplus_session_hdr);
int fill_rmcpplus_session_trlr (fiid_obj_t obj_rmcpplus_session_trlr);
int fill_rmcpplus_payload (const void *confidentiality_header,
unsigned int confidentiality_header_len,
const void *payload_data,
unsigned int payload_data_len,
const void *confidentiality_trailer,
unsigned int confidentiality_trailer_len,
fiid_obj_t obj_cmd_rq);
int fill_rmcpplus_open_session (uint8_t message_tag,
uint8_t requested_maximum_privilege_level,
uint32_t remote_console_session_id,
uint8_t authentication_algorithm,
uint8_t integrity_algorithm,
uint8_t confidentiality_algorithm,
fiid_obj_t obj_cmd_rq);
int fill_rmcpplus_rakp_message_1 (uint8_t message_tag,
uint32_t managed_system_session_id,
const void *remote_console_random_number,
unsigned int remote_console_random_number_len,
uint8_t requested_maximum_privilege_level,
uint8_t name_only_lookup_flag,
const char *username,
unsigned int username_len,
fiid_obj_t obj_cmd_rq);
int fill_rmcpplus_rakp_message_3 (uint8_t message_tag,
uint8_t rmcpplus_status_code,
uint32_t managed_system_session_id,
const void *key_exchange_authentication_code,
unsigned int key_exchange_authentication_code_len,
fiid_obj_t obj_cmd_rq);
/* returns length written to pkt on success, -1 on error */
int assemble_ipmi_rmcpplus_pkt (uint8_t authentication_algorithm,
uint8_t integrity_algorithm,
uint8_t confidentiality_algorithm,
const void *integrity_key,
unsigned int integrity_key_len,
const void *confidentiality_key,
unsigned int confidentiality_key_len,
const void *authentication_code_data,
unsigned int authentication_code_data_len,
fiid_obj_t obj_rmcp_hdr,
fiid_obj_t obj_rmcpplus_session_hdr,
fiid_obj_t obj_lan_msg_hdr,
fiid_obj_t obj_cmd,
fiid_obj_t obj_rmcpplus_session_trlr,
void *pkt,
unsigned int pkt_len);
/* returns 1 if fully unparsed, 0 if not, -1 on error */
int unassemble_ipmi_rmcpplus_pkt (uint8_t authentication_algorithm,
uint8_t integrity_algorithm,
uint8_t confidentiality_algorithm,
const void *integrity_key,
unsigned int integrity_key_len,
const void *confidentiality_key,
unsigned int confidentiality_key_len,
const void *pkt,
unsigned int pkt_len,
fiid_obj_t obj_rmcp_hdr,
fiid_obj_t obj_rmcpplus_session_hdr,
fiid_obj_t obj_rmcpplus_payload,
fiid_obj_t obj_lan_msg_hdr,
fiid_obj_t obj_cmd,
fiid_obj_t obj_lan_msg_trlr,
fiid_obj_t obj_rmcpplus_session_trlr);
#ifdef __cplusplus
}
#endif
#endif
|