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