bfa_defs_auth.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 __BFA_DEFS_AUTH_H__
  18. #define __BFA_DEFS_AUTH_H__
  19. #include <defs/bfa_defs_types.h>
  20. #define PUBLIC_KEY 15409
  21. #define PRIVATE_KEY 19009
  22. #define KEY_LEN 32399
  23. #define BFA_AUTH_SECRET_STRING_LEN 256
  24. #define BFA_AUTH_FAIL_NO_PASSWORD 0xFE
  25. #define BFA_AUTH_FAIL_TIMEOUT 0xFF
  26. /**
  27. * Authentication status
  28. */
  29. enum bfa_auth_status {
  30. BFA_AUTH_STATUS_NONE = 0, /* no authentication */
  31. BFA_AUTH_UNINIT = 1, /* state - uninit */
  32. BFA_AUTH_NEG_SEND = 2, /* state - negotiate send */
  33. BFA_AUTH_CHAL_WAIT = 3, /* state - challenge wait */
  34. BFA_AUTH_NEG_RETRY = 4, /* state - negotiate retry */
  35. BFA_AUTH_REPLY_SEND = 5, /* state - reply send */
  36. BFA_AUTH_STATUS_WAIT = 6, /* state - status wait */
  37. BFA_AUTH_SUCCESS = 7, /* state - success */
  38. BFA_AUTH_FAILED = 8, /* state - failed */
  39. BFA_AUTH_STATUS_UNKNOWN = 9, /* authentication status unknown */
  40. };
  41. enum bfa_auth_rej_code {
  42. BFA_AUTH_RJT_CODE_AUTH_FAILURE = 1, /* auth failure */
  43. BFA_AUTH_RJT_CODE_LOGICAL_ERR = 2, /* logical error */
  44. };
  45. /**
  46. * Authentication reject codes
  47. */
  48. enum bfa_auth_rej_code_exp {
  49. BFA_AUTH_MECH_NOT_USABLE = 1, /* auth. mechanism not usable */
  50. BFA_AUTH_DH_GROUP_NOT_USABLE = 2, /* DH Group not usable */
  51. BFA_AUTH_HASH_FUNC_NOT_USABLE = 3, /* hash Function not usable */
  52. BFA_AUTH_AUTH_XACT_STARTED = 4, /* auth xact started */
  53. BFA_AUTH_AUTH_FAILED = 5, /* auth failed */
  54. BFA_AUTH_INCORRECT_PLD = 6, /* incorrect payload */
  55. BFA_AUTH_INCORRECT_PROTO_MSG = 7, /* incorrect proto msg */
  56. BFA_AUTH_RESTART_AUTH_PROTO = 8, /* restart auth protocol */
  57. BFA_AUTH_AUTH_CONCAT_NOT_SUPP = 9, /* auth concat not supported */
  58. BFA_AUTH_PROTO_VER_NOT_SUPP = 10,/* proto version not supported */
  59. };
  60. struct auth_proto_stats_s {
  61. u32 auth_rjts;
  62. u32 auth_negs;
  63. u32 auth_dones;
  64. u32 dhchap_challenges;
  65. u32 dhchap_replies;
  66. u32 dhchap_successes;
  67. };
  68. /**
  69. * Authentication related statistics
  70. */
  71. struct bfa_auth_stats_s {
  72. u32 auth_failures; /* authentication failures */
  73. u32 auth_successes; /* authentication successes*/
  74. struct auth_proto_stats_s auth_rx_stats; /* Rx protocol stats */
  75. struct auth_proto_stats_s auth_tx_stats; /* Tx protocol stats */
  76. };
  77. /**
  78. * Authentication hash function algorithms
  79. */
  80. enum bfa_auth_algo {
  81. BFA_AUTH_ALGO_MD5 = 1, /* Message-Digest algorithm 5 */
  82. BFA_AUTH_ALGO_SHA1 = 2, /* Secure Hash Algorithm 1 */
  83. BFA_AUTH_ALGO_MS = 3, /* MD5, then SHA-1 */
  84. BFA_AUTH_ALGO_SM = 4, /* SHA-1, then MD5 */
  85. };
  86. /**
  87. * DH Groups
  88. *
  89. * Current value could be combination of one or more of the following values
  90. */
  91. enum bfa_auth_group {
  92. BFA_AUTH_GROUP_DHNULL = 0, /* DH NULL (value == 0) */
  93. BFA_AUTH_GROUP_DH768 = 1, /* DH group 768 (value == 1) */
  94. BFA_AUTH_GROUP_DH1024 = 2, /* DH group 1024 (value == 2) */
  95. BFA_AUTH_GROUP_DH1280 = 4, /* DH group 1280 (value == 3) */
  96. BFA_AUTH_GROUP_DH1536 = 8, /* DH group 1536 (value == 4) */
  97. BFA_AUTH_GROUP_ALL = 256 /* Use default DH group order
  98. * 0, 1, 2, 3, 4 */
  99. };
  100. /**
  101. * Authentication secret sources
  102. */
  103. enum bfa_auth_secretsource {
  104. BFA_AUTH_SECSRC_LOCAL = 1, /* locally configured */
  105. BFA_AUTH_SECSRC_RADIUS = 2, /* use radius server */
  106. BFA_AUTH_SECSRC_TACACS = 3, /* TACACS server */
  107. };
  108. /**
  109. * Authentication attributes
  110. */
  111. struct bfa_auth_attr_s {
  112. enum bfa_auth_status status;
  113. enum bfa_auth_algo algo;
  114. enum bfa_auth_group dh_grp;
  115. enum bfa_auth_rej_code rjt_code;
  116. enum bfa_auth_rej_code_exp rjt_code_exp;
  117. u8 secret_set;
  118. u8 resv[3];
  119. };
  120. #endif /* __BFA_DEFS_AUTH_H__ */