fc_sp.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __FC_SP_H__
  18. #define __FC_SP_H__
  19. #include <protocol/types.h>
  20. #pragma pack(1)
  21. enum auth_els_flags{
  22. FC_AUTH_ELS_MORE_FRAGS_FLAG = 0x80, /*! bit-7. More Fragments
  23. * Follow
  24. */
  25. FC_AUTH_ELS_CONCAT_FLAG = 0x40, /*! bit-6. Concatenation Flag */
  26. FC_AUTH_ELS_SEQ_NUM_FLAG = 0x01 /*! bit-0. Sequence Number */
  27. };
  28. enum auth_msg_codes{
  29. FC_AUTH_MC_AUTH_RJT = 0x0A, /*! Auth Reject */
  30. FC_AUTH_MC_AUTH_NEG = 0x0B, /*! Auth Negotiate */
  31. FC_AUTH_MC_AUTH_DONE = 0x0C, /*! Auth Done */
  32. FC_AUTH_MC_DHCHAP_CHAL = 0x10, /*! DHCHAP Challenge */
  33. FC_AUTH_MC_DHCHAP_REPLY = 0x11, /*! DHCHAP Reply */
  34. FC_AUTH_MC_DHCHAP_SUCC = 0x12, /*! DHCHAP Success */
  35. FC_AUTH_MC_FCAP_REQ = 0x13, /*! FCAP Request */
  36. FC_AUTH_MC_FCAP_ACK = 0x14, /*! FCAP Acknowledge */
  37. FC_AUTH_MC_FCAP_CONF = 0x15, /*! FCAP Confirm */
  38. FC_AUTH_MC_FCPAP_INIT = 0x16, /*! FCPAP Init */
  39. FC_AUTH_MC_FCPAP_ACC = 0x17, /*! FCPAP Accept */
  40. FC_AUTH_MC_FCPAP_COMP = 0x18, /*! FCPAP Complete */
  41. FC_AUTH_MC_IKE_SA_INIT = 0x22, /*! IKE SA INIT */
  42. FC_AUTH_MC_IKE_SA_AUTH = 0x23, /*! IKE SA Auth */
  43. FC_AUTH_MC_IKE_CREATE_CHILD_SA = 0x24, /*! IKE Create Child SA */
  44. FC_AUTH_MC_IKE_INFO = 0x25, /*! IKE informational */
  45. };
  46. enum auth_proto_version{
  47. FC_AUTH_PROTO_VER_1 = 1, /*! Protocol Version 1 */
  48. };
  49. enum {
  50. FC_AUTH_ELS_COMMAND_CODE = 0x90,/*! Authentication ELS Command code */
  51. FC_AUTH_PROTO_PARAM_LEN_SZ = 4, /*! Size of Proto Parameter Len Field */
  52. FC_AUTH_PROTO_PARAM_VAL_SZ = 4, /*! Size of Proto Parameter Val Field */
  53. FC_MAX_AUTH_SECRET_LEN = 256,
  54. /*! Maximum secret string length */
  55. FC_AUTH_NUM_USABLE_PROTO_LEN_SZ = 4,
  56. /*! Size of usable protocols field */
  57. FC_AUTH_RESP_VALUE_LEN_SZ = 4,
  58. /*! Size of response value length */
  59. FC_MAX_CHAP_KEY_LEN = 256, /*! Maximum md5 digest length */
  60. FC_MAX_AUTH_RETRIES = 3, /*! Maximum number of retries */
  61. FC_MD5_DIGEST_LEN = 16, /*! MD5 digest length */
  62. FC_SHA1_DIGEST_LEN = 20, /*! SHA1 digest length */
  63. FC_MAX_DHG_SUPPORTED = 1, /*! Maximum DH Groups supported */
  64. FC_MAX_ALG_SUPPORTED = 1, /*! Maximum algorithms supported */
  65. FC_MAX_PROTO_SUPPORTED = 1, /*! Maximum protocols supported */
  66. FC_START_TXN_ID = 2, /*! Starting transaction ID */
  67. };
  68. enum auth_proto_id{
  69. FC_AUTH_PROTO_DHCHAP = 0x00000001,
  70. FC_AUTH_PROTO_FCAP = 0x00000002,
  71. FC_AUTH_PROTO_FCPAP = 0x00000003,
  72. FC_AUTH_PROTO_IKEv2 = 0x00000004,
  73. FC_AUTH_PROTO_IKEv2_AUTH = 0x00000005,
  74. };
  75. struct auth_name_s{
  76. u16 name_tag; /*! Name Tag = 1 for Authentication */
  77. u16 name_len; /*! Name Length = 8 for Authentication
  78. */
  79. wwn_t name; /*! Name. TODO - is this PWWN */
  80. };
  81. enum auth_hash_func{
  82. FC_AUTH_HASH_FUNC_MD5 = 0x00000005,
  83. FC_AUTH_HASH_FUNC_SHA_1 = 0x00000006,
  84. };
  85. enum auth_dh_gid{
  86. FC_AUTH_DH_GID_0_DHG_NULL = 0x00000000,
  87. FC_AUTH_DH_GID_1_DHG_1024 = 0x00000001,
  88. FC_AUTH_DH_GID_2_DHG_1280 = 0x00000002,
  89. FC_AUTH_DH_GID_3_DHG_1536 = 0x00000003,
  90. FC_AUTH_DH_GID_4_DHG_2048 = 0x00000004,
  91. FC_AUTH_DH_GID_6_DHG_3072 = 0x00000006,
  92. FC_AUTH_DH_GID_7_DHG_4096 = 0x00000007,
  93. FC_AUTH_DH_GID_8_DHG_6144 = 0x00000008,
  94. FC_AUTH_DH_GID_9_DHG_8192 = 0x00000009,
  95. };
  96. struct auth_els_msg_s {
  97. u8 auth_els_code; /* Authentication ELS Code (0x90) */
  98. u8 auth_els_flag; /* Authentication ELS Flags */
  99. u8 auth_msg_code; /* Authentication Message Code */
  100. u8 proto_version; /* Protocol Version */
  101. u32 msg_len; /* Message Length */
  102. u32 trans_id; /* Transaction Identifier (T_ID) */
  103. /* Msg payload follows... */
  104. };
  105. enum auth_neg_param_tags {
  106. FC_AUTH_NEG_DHCHAP_HASHLIST = 0x0001,
  107. FC_AUTH_NEG_DHCHAP_DHG_ID_LIST = 0x0002,
  108. };
  109. struct dhchap_param_format_s {
  110. u16 tag; /*! Parameter Tag. See
  111. * auth_neg_param_tags_t
  112. */
  113. u16 word_cnt;
  114. /* followed by variable length parameter value... */
  115. };
  116. struct auth_proto_params_s {
  117. u32 proto_param_len;
  118. u32 proto_id;
  119. /*
  120. * Followed by variable length Protocol specific parameters. DH-CHAP
  121. * uses dhchap_param_format_t
  122. */
  123. };
  124. struct auth_neg_msg_s {
  125. struct auth_name_s auth_ini_name;
  126. u32 usable_auth_protos;
  127. struct auth_proto_params_s proto_params[1]; /*! (1..usable_auth_proto)
  128. * protocol params
  129. */
  130. };
  131. struct auth_dh_val_s {
  132. u32 dh_val_len;
  133. u32 dh_val[1];
  134. };
  135. struct auth_dhchap_chal_msg_s {
  136. struct auth_els_msg_s hdr;
  137. struct auth_name_s auth_responder_name; /* TODO VRK - is auth_name_t
  138. * type OK?
  139. */
  140. u32 hash_id;
  141. u32 dh_grp_id;
  142. u32 chal_val_len;
  143. char chal_val[1];
  144. /* ...followed by variable Challenge length/value and DH length/value */
  145. };
  146. enum auth_rjt_codes {
  147. FC_AUTH_RJT_CODE_AUTH_FAILURE = 0x01,
  148. FC_AUTH_RJT_CODE_LOGICAL_ERR = 0x02,
  149. };
  150. enum auth_rjt_code_exps {
  151. FC_AUTH_CEXP_AUTH_MECH_NOT_USABLE = 0x01,
  152. FC_AUTH_CEXP_DH_GROUP_NOT_USABLE = 0x02,
  153. FC_AUTH_CEXP_HASH_FUNC_NOT_USABLE = 0x03,
  154. FC_AUTH_CEXP_AUTH_XACT_STARTED = 0x04,
  155. FC_AUTH_CEXP_AUTH_FAILED = 0x05,
  156. FC_AUTH_CEXP_INCORRECT_PLD = 0x06,
  157. FC_AUTH_CEXP_INCORRECT_PROTO_MSG = 0x07,
  158. FC_AUTH_CEXP_RESTART_AUTH_PROTO = 0x08,
  159. FC_AUTH_CEXP_AUTH_CONCAT_NOT_SUPP = 0x09,
  160. FC_AUTH_CEXP_PROTO_VER_NOT_SUPP = 0x0A,
  161. };
  162. enum auth_status {
  163. FC_AUTH_STATE_INPROGRESS = 0, /*! authentication in progress */
  164. FC_AUTH_STATE_FAILED = 1, /*! authentication failed */
  165. FC_AUTH_STATE_SUCCESS = 2 /*! authentication successful */
  166. };
  167. struct auth_rjt_msg_s {
  168. struct auth_els_msg_s hdr;
  169. u8 reason_code;
  170. u8 reason_code_exp;
  171. u8 rsvd[2];
  172. };
  173. struct auth_dhchap_neg_msg_s {
  174. struct auth_els_msg_s hdr;
  175. struct auth_neg_msg_s nego;
  176. };
  177. struct auth_dhchap_reply_msg_s {
  178. struct auth_els_msg_s hdr;
  179. /*
  180. * followed by response value length & Value + DH Value Length & Value
  181. */
  182. };
  183. #pragma pack()
  184. #endif /* __FC_SP_H__ */