17836SJohn.Forte@Sun.COM /* 27836SJohn.Forte@Sun.COM * CDDL HEADER START 37836SJohn.Forte@Sun.COM * 47836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 57836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 67836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 77836SJohn.Forte@Sun.COM * 87836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 107836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 117836SJohn.Forte@Sun.COM * and limitations under the License. 127836SJohn.Forte@Sun.COM * 137836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 147836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 167836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 177836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 187836SJohn.Forte@Sun.COM * 197836SJohn.Forte@Sun.COM * CDDL HEADER END 207836SJohn.Forte@Sun.COM */ 217836SJohn.Forte@Sun.COM /* 22*9414SBing.Zhao@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237836SJohn.Forte@Sun.COM * Use is subject to license terms. 247836SJohn.Forte@Sun.COM */ 257836SJohn.Forte@Sun.COM 267836SJohn.Forte@Sun.COM #ifndef _CHAP_H 277836SJohn.Forte@Sun.COM #define _CHAP_H 287836SJohn.Forte@Sun.COM 297836SJohn.Forte@Sun.COM #ifdef __cplusplus 307836SJohn.Forte@Sun.COM extern "C" { 317836SJohn.Forte@Sun.COM #endif 327836SJohn.Forte@Sun.COM 337836SJohn.Forte@Sun.COM #include <netinet/in.h> 347836SJohn.Forte@Sun.COM #include <sys/int_types.h> 357836SJohn.Forte@Sun.COM 367836SJohn.Forte@Sun.COM #include <sys/scsi/adapters/iscsi_if.h> 377836SJohn.Forte@Sun.COM #include <radius_protocol.h> 387836SJohn.Forte@Sun.COM 397836SJohn.Forte@Sun.COM typedef enum chap_validation_status_type { 407836SJohn.Forte@Sun.COM CHAP_VALIDATION_PASSED, /* CHAP validation passed */ 417836SJohn.Forte@Sun.COM CHAP_VALIDATION_INVALID_RESPONSE, /* Invalid CHAP response */ 427836SJohn.Forte@Sun.COM CHAP_VALIDATION_DUP_SECRET, /* Same CHAP secret used */ 437836SJohn.Forte@Sun.COM /* for authentication in the */ 447836SJohn.Forte@Sun.COM /* other direction */ 457836SJohn.Forte@Sun.COM CHAP_VALIDATION_UNKNOWN_AUTH_METHOD, /* Unknown authentication */ 467836SJohn.Forte@Sun.COM /* method */ 477836SJohn.Forte@Sun.COM CHAP_VALIDATION_INTERNAL_ERROR, /* MISC internal error */ 487836SJohn.Forte@Sun.COM CHAP_VALIDATION_RADIUS_ACCESS_ERROR, /* Problem accessing RADIUS */ 497836SJohn.Forte@Sun.COM CHAP_VALIDATION_BAD_RADIUS_SECRET, /* Invalid RADIUS shared */ 507836SJohn.Forte@Sun.COM /* secret */ 517836SJohn.Forte@Sun.COM CHAP_VALIDATION_UNKNOWN_RADIUS_CODE /* Irrelevant or unknown */ 527836SJohn.Forte@Sun.COM /* RADIUS packet code */ 537836SJohn.Forte@Sun.COM /* returned */ 547836SJohn.Forte@Sun.COM } chap_validation_status_type; 557836SJohn.Forte@Sun.COM 567836SJohn.Forte@Sun.COM typedef enum authentication_method_type { 577836SJohn.Forte@Sun.COM RADIUS_AUTHENTICATION, 587836SJohn.Forte@Sun.COM DIRECT_AUTHENTICATION 597836SJohn.Forte@Sun.COM } authentication_method_type; 607836SJohn.Forte@Sun.COM 617836SJohn.Forte@Sun.COM typedef struct radius_config { 627836SJohn.Forte@Sun.COM iscsi_ipaddr_t rad_svr_addr; /* IPv6 enabled */ 637836SJohn.Forte@Sun.COM uint32_t rad_svr_port; 647836SJohn.Forte@Sun.COM uint8_t rad_svr_shared_secret[MAX_RAD_SHARED_SECRET_LEN]; 657836SJohn.Forte@Sun.COM uint32_t rad_svr_shared_secret_len; 667836SJohn.Forte@Sun.COM } RADIUS_CONFIG; 677836SJohn.Forte@Sun.COM 687836SJohn.Forte@Sun.COM /* 697836SJohn.Forte@Sun.COM * To validate a target CHAP response given the associated challenge. 707836SJohn.Forte@Sun.COM * 717836SJohn.Forte@Sun.COM * target_chap_name - The CHAP name of the target being authenticated. 727836SJohn.Forte@Sun.COM * initiator_chap_name - The CHAP name of the authenticating initiator. 737836SJohn.Forte@Sun.COM * challenge - The CHAP challenge to which the target responded. 74*9414SBing.Zhao@Sun.COM * challeng_length - The length of CHAP challenge. 757836SJohn.Forte@Sun.COM * target_response - The target's CHAP response to be validated. 76*9414SBing.Zhao@Sun.COM * response_length - The length of target's CHAP response. 777836SJohn.Forte@Sun.COM * identifier - The identifier associated with the CHAP challenge. 787836SJohn.Forte@Sun.COM * auth_method - The authentication method to be used. 797836SJohn.Forte@Sun.COM * auth_config_data - Any required configuration data to support the 807836SJohn.Forte@Sun.COM * specified authentication method. 817836SJohn.Forte@Sun.COM */ 827836SJohn.Forte@Sun.COM chap_validation_status_type 83*9414SBing.Zhao@Sun.COM chap_validate_tgt( 847836SJohn.Forte@Sun.COM char *target_chap_name, 857836SJohn.Forte@Sun.COM char *initiator_chap_name, 867836SJohn.Forte@Sun.COM uint8_t *challenge, 87*9414SBing.Zhao@Sun.COM uint32_t challenge_length, 887836SJohn.Forte@Sun.COM uint8_t *target_response, 89*9414SBing.Zhao@Sun.COM uint32_t response_length, 907836SJohn.Forte@Sun.COM uint8_t identifier, 917836SJohn.Forte@Sun.COM authentication_method_type auth_method, 927836SJohn.Forte@Sun.COM void *auth_config_data); 937836SJohn.Forte@Sun.COM 947836SJohn.Forte@Sun.COM #ifdef __cplusplus 957836SJohn.Forte@Sun.COM } 967836SJohn.Forte@Sun.COM #endif 977836SJohn.Forte@Sun.COM 987836SJohn.Forte@Sun.COM #endif /* _CHAP_H */ 99