xref: /onnv-gate/usr/src/uts/common/sys/iscsit/chap.h (revision 7978:4559e57ec313)
1*7978SPeter.Dunlap@Sun.COM /*
2*7978SPeter.Dunlap@Sun.COM  * CDDL HEADER START
3*7978SPeter.Dunlap@Sun.COM  *
4*7978SPeter.Dunlap@Sun.COM  * The contents of this file are subject to the terms of the
5*7978SPeter.Dunlap@Sun.COM  * Common Development and Distribution License (the "License").
6*7978SPeter.Dunlap@Sun.COM  * You may not use this file except in compliance with the License.
7*7978SPeter.Dunlap@Sun.COM  *
8*7978SPeter.Dunlap@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7978SPeter.Dunlap@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*7978SPeter.Dunlap@Sun.COM  * See the License for the specific language governing permissions
11*7978SPeter.Dunlap@Sun.COM  * and limitations under the License.
12*7978SPeter.Dunlap@Sun.COM  *
13*7978SPeter.Dunlap@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*7978SPeter.Dunlap@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7978SPeter.Dunlap@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*7978SPeter.Dunlap@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*7978SPeter.Dunlap@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7978SPeter.Dunlap@Sun.COM  *
19*7978SPeter.Dunlap@Sun.COM  * CDDL HEADER END
20*7978SPeter.Dunlap@Sun.COM  */
21*7978SPeter.Dunlap@Sun.COM /*
22*7978SPeter.Dunlap@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*7978SPeter.Dunlap@Sun.COM  * Use is subject to license terms.
24*7978SPeter.Dunlap@Sun.COM  */
25*7978SPeter.Dunlap@Sun.COM 
26*7978SPeter.Dunlap@Sun.COM #ifndef	_CHAP_H
27*7978SPeter.Dunlap@Sun.COM #define	_CHAP_H
28*7978SPeter.Dunlap@Sun.COM 
29*7978SPeter.Dunlap@Sun.COM #ifdef __cplusplus
30*7978SPeter.Dunlap@Sun.COM extern "C" {
31*7978SPeter.Dunlap@Sun.COM #endif
32*7978SPeter.Dunlap@Sun.COM 
33*7978SPeter.Dunlap@Sun.COM #include <netinet/in.h>
34*7978SPeter.Dunlap@Sun.COM #include <sys/int_types.h>
35*7978SPeter.Dunlap@Sun.COM 
36*7978SPeter.Dunlap@Sun.COM #include <sys/iscsit/iscsi_if.h>
37*7978SPeter.Dunlap@Sun.COM #include <sys/iscsit/radius_protocol.h>
38*7978SPeter.Dunlap@Sun.COM 
39*7978SPeter.Dunlap@Sun.COM typedef enum chap_validation_status_type {
40*7978SPeter.Dunlap@Sun.COM 	CHAP_VALIDATION_PASSED,			/* CHAP validation passed */
41*7978SPeter.Dunlap@Sun.COM 	CHAP_VALIDATION_INVALID_RESPONSE,	/* Invalid CHAP response */
42*7978SPeter.Dunlap@Sun.COM 	CHAP_VALIDATION_DUP_SECRET,		/* Same CHAP secret used */
43*7978SPeter.Dunlap@Sun.COM 						/* for authentication in the */
44*7978SPeter.Dunlap@Sun.COM 						/* other direction */
45*7978SPeter.Dunlap@Sun.COM 	CHAP_VALIDATION_UNKNOWN_AUTH_METHOD,	/* Unknown authentication */
46*7978SPeter.Dunlap@Sun.COM 						/*   method */
47*7978SPeter.Dunlap@Sun.COM 	CHAP_VALIDATION_INTERNAL_ERROR,		/* MISC internal error */
48*7978SPeter.Dunlap@Sun.COM 	CHAP_VALIDATION_RADIUS_ACCESS_ERROR,	/* Problem accessing RADIUS */
49*7978SPeter.Dunlap@Sun.COM 	CHAP_VALIDATION_BAD_RADIUS_SECRET,	/* Invalid RADIUS shared */
50*7978SPeter.Dunlap@Sun.COM 						/*   secret */
51*7978SPeter.Dunlap@Sun.COM 	CHAP_VALIDATION_UNKNOWN_RADIUS_CODE	/* Irrelevant or unknown */
52*7978SPeter.Dunlap@Sun.COM 						/*   RADIUS packet code */
53*7978SPeter.Dunlap@Sun.COM 						/*   returned */
54*7978SPeter.Dunlap@Sun.COM } chap_validation_status_type;
55*7978SPeter.Dunlap@Sun.COM 
56*7978SPeter.Dunlap@Sun.COM typedef enum authentication_method_type {
57*7978SPeter.Dunlap@Sun.COM 	RADIUS_AUTHENTICATION,
58*7978SPeter.Dunlap@Sun.COM 	DIRECT_AUTHENTICATION
59*7978SPeter.Dunlap@Sun.COM } authentication_method_type;
60*7978SPeter.Dunlap@Sun.COM 
61*7978SPeter.Dunlap@Sun.COM typedef struct radius_config {
62*7978SPeter.Dunlap@Sun.COM 	iscsi_ipaddr_t	rad_svr_addr;	/* IPv6 enabled */
63*7978SPeter.Dunlap@Sun.COM 	uint32_t	rad_svr_port;
64*7978SPeter.Dunlap@Sun.COM 	uint8_t		rad_svr_shared_secret[MAX_RAD_SHARED_SECRET_LEN];
65*7978SPeter.Dunlap@Sun.COM 	uint32_t	rad_svr_shared_secret_len;
66*7978SPeter.Dunlap@Sun.COM } RADIUS_CONFIG;
67*7978SPeter.Dunlap@Sun.COM 
68*7978SPeter.Dunlap@Sun.COM /*
69*7978SPeter.Dunlap@Sun.COM  * To validate a target CHAP response given the associated challenge.
70*7978SPeter.Dunlap@Sun.COM  *
71*7978SPeter.Dunlap@Sun.COM  * target_chap_name - The CHAP name of the target being authenticated.
72*7978SPeter.Dunlap@Sun.COM  * initiator_chap_name - The CHAP name of the authenticating initiator.
73*7978SPeter.Dunlap@Sun.COM  * challenge - The CHAP challenge to which the target responded.
74*7978SPeter.Dunlap@Sun.COM  * target_response - The target's CHAP response to be validated.
75*7978SPeter.Dunlap@Sun.COM  * identifier - The identifier associated with the CHAP challenge.
76*7978SPeter.Dunlap@Sun.COM  * auth_method - The authentication method to be used.
77*7978SPeter.Dunlap@Sun.COM  * auth_config_data - Any required configuration data to support the
78*7978SPeter.Dunlap@Sun.COM  *                    specified authentication method.
79*7978SPeter.Dunlap@Sun.COM  */
80*7978SPeter.Dunlap@Sun.COM chap_validation_status_type
81*7978SPeter.Dunlap@Sun.COM chap_validate(
82*7978SPeter.Dunlap@Sun.COM 	char *target_chap_name,
83*7978SPeter.Dunlap@Sun.COM 	char *initiator_chap_name,
84*7978SPeter.Dunlap@Sun.COM 	uint8_t *challenge,
85*7978SPeter.Dunlap@Sun.COM 	uint8_t *target_response,
86*7978SPeter.Dunlap@Sun.COM 	uint8_t identifier,
87*7978SPeter.Dunlap@Sun.COM 	authentication_method_type auth_method,
88*7978SPeter.Dunlap@Sun.COM 	void *auth_config_data);
89*7978SPeter.Dunlap@Sun.COM 
90*7978SPeter.Dunlap@Sun.COM #ifdef __cplusplus
91*7978SPeter.Dunlap@Sun.COM }
92*7978SPeter.Dunlap@Sun.COM #endif
93*7978SPeter.Dunlap@Sun.COM 
94*7978SPeter.Dunlap@Sun.COM #endif /* _CHAP_H */
95