summaryrefslogtreecommitdiff
path: root/include/ipmitool/ipmi_channel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ipmitool/ipmi_channel.h')
-rw-r--r--include/ipmitool/ipmi_channel.h94
1 files changed, 83 insertions, 11 deletions
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 <config.h>
#endif
#include <ipmitool/ipmi.h>
+#include <ipmitool/ipmi_intf.h>
#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;
@@ -78,6 +100,50 @@ struct channel_access_t {
};
/*
+ * 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*/