From a9ee361f27e0439530387765924574e5358c8a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 10 Sep 2022 15:44:41 +0200 Subject: New upstream version 1.8.19 --- include/ipmitool/ipmi_channel.h | 94 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 11 deletions(-) (limited to 'include/ipmitool/ipmi_channel.h') diff --git a/include/ipmitool/ipmi_channel.h b/include/ipmitool/ipmi_channel.h index b138c26..d9be57e 100644 --- a/include/ipmitool/ipmi_channel.h +++ b/include/ipmitool/ipmi_channel.h @@ -30,13 +30,13 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_CHANNEL_H -#define IPMI_CHANNEL_H +#pragma once #if HAVE_CONFIG_H # include #endif #include +#include #define IPMI_GET_CHANNEL_AUTH_CAP 0x38 @@ -56,6 +56,28 @@ #define IPMI_CHANNEL_SESSION_MULTI 0x80 #define IPMI_CHANNEL_SESSION_BASED 0xC0 +/* Fixed channel numbers as per Table 6-1 */ +typedef enum { + CH_PRIMARY_IPMB, + CH_IMP_SPECIFIC_1, + CH_IMP_SPECIFIC_2, + CH_IMP_SPECIFIC_3, + CH_IMP_SPECIFIC_4, + CH_IMP_SPECIFIC_5, + CH_IMP_SPECIFIC_6, + CH_IMP_SPECIFIC_7, + CH_IMP_SPECIFIC_8, + CH_IMP_SPECIFIC_9, + CH_IMP_SPECIFIC_A, + CH_IMP_SPECIFIC_B, + CH_RSVD1, + CH_RSVD2, + CH_CURRENT, + CH_SYSTEM, + CH_TOTAL, + CH_UNKNOWN = UINT8_MAX +} ipmi_channel_num_t; + /* (22.24) Get Channel Info */ struct channel_info_t { uint8_t channel; @@ -77,6 +99,50 @@ struct channel_access_t { uint8_t user_level_auth; }; +/* + * The Cipher Suite Record Format from table 22-18 of the IPMI v2.0 spec + */ +enum cipher_suite_format_tag { + STANDARD_CIPHER_SUITE = 0xc0, + OEM_CIPHER_SUITE = 0xc1, +}; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct std_cipher_suite_record_t { + uint8_t start_of_record; + uint8_t cipher_suite_id; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; +} ATTRIBUTE_PACKING; +struct oem_cipher_suite_record_t { + uint8_t start_of_record; + uint8_t cipher_suite_id; + uint8_t iana[3]; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#define CIPHER_ALG_MASK 0x3f +#define MAX_CIPHER_SUITE_RECORD_OFFSET 0x40 +#define MAX_CIPHER_SUITE_DATA_LEN 0x10 +#define LIST_ALGORITHMS_BY_CIPHER_SUITE 0x80 + +/* Below is the theoretical maximum number of cipher suites that could be + * reported by a BMC. That is with the Get Channel Cipher Suites Command, at 16 + * bytes at a time and 0x40 requests, it can report 1024 bytes, which is about + * 204 standard records or 128 OEM records. Really, we probably don't need more + * than about 20, which is the full set of standard records plus a few OEM + * records. + */ +#define MAX_CIPHER_SUITE_COUNT (MAX_CIPHER_SUITE_RECORD_OFFSET * \ + MAX_CIPHER_SUITE_DATA_LEN / \ + sizeof(struct std_cipher_suite_record_t)) + /* * The Get Authentication Capabilities response structure * From table 22-15 of the IPMI v2.0 spec @@ -129,18 +195,24 @@ struct get_channel_auth_cap_rsp { #endif int _ipmi_get_channel_access(struct ipmi_intf *intf, - struct channel_access_t *channel_access, - uint8_t get_volatile_settings); + struct channel_access_t *channel_access, + uint8_t get_volatile_settings); +int ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, + const char *payload_type, + uint8_t channel, + struct cipher_suite_info *suites, + size_t *count); int _ipmi_get_channel_info(struct ipmi_intf *intf, - struct channel_info_t *channel_info); + struct channel_info_t *channel_info); int _ipmi_set_channel_access(struct ipmi_intf *intf, - struct channel_access_t channel_access, uint8_t access_option, - uint8_t privilege_option); + struct channel_access_t channel_access, + uint8_t access_option, + uint8_t privilege_option); uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel); -uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf); +void ipmi_current_channel_info(struct ipmi_intf *intf, + struct channel_info_t *chinfo); int ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv); -int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, uint8_t channel, uint8_t priv); +int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, + uint8_t channel, uint8_t priv); int ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel); - -#endif /*IPMI_CHANNEL_H*/ -- cgit v1.2.3