xref: /onnv-gate/usr/src/uts/common/io/scsi/adapters/iscsi/iscsiAuthClient.h (revision 12546:b9d61378e1b8)
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 /*
227836SJohn.Forte@Sun.COM  * Copyright 2000 by Cisco Systems, Inc.  All rights reserved.
23*12546SBing.Zhao@Sun.COM  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
247836SJohn.Forte@Sun.COM  */
257836SJohn.Forte@Sun.COM 
267836SJohn.Forte@Sun.COM #ifndef	_ISCSIAUTHCLIENT_H
277836SJohn.Forte@Sun.COM #define	_ISCSIAUTHCLIENT_H
287836SJohn.Forte@Sun.COM 
297836SJohn.Forte@Sun.COM /*
307836SJohn.Forte@Sun.COM  * This file is the include file for for iscsiAuthClient.c
317836SJohn.Forte@Sun.COM  */
327836SJohn.Forte@Sun.COM 
337836SJohn.Forte@Sun.COM #ifdef __cplusplus
347836SJohn.Forte@Sun.COM extern "C" {
357836SJohn.Forte@Sun.COM #endif
367836SJohn.Forte@Sun.COM 
37*12546SBing.Zhao@Sun.COM enum { iscsiAuthStringMaxLength = 512 };
387836SJohn.Forte@Sun.COM enum { iscsiAuthStringBlockMaxLength = 1024 };
397836SJohn.Forte@Sun.COM enum { iscsiAuthLargeBinaryMaxLength = 1024 };
407836SJohn.Forte@Sun.COM 
417836SJohn.Forte@Sun.COM enum { iscsiAuthRecvEndMaxCount = 10 };
427836SJohn.Forte@Sun.COM 
437836SJohn.Forte@Sun.COM enum { iscsiAuthClientSignature = 0x5984B2E3 };
447836SJohn.Forte@Sun.COM 
457836SJohn.Forte@Sun.COM enum { iscsiAuthChapResponseLength = 16 };
467836SJohn.Forte@Sun.COM 
477836SJohn.Forte@Sun.COM /*
487836SJohn.Forte@Sun.COM  * Note: The ordering of these values are chosen to match
497836SJohn.Forte@Sun.COM  *       the ordering of the keys as shown in the iSCSI spec.
507836SJohn.Forte@Sun.COM  *       The table IscsiAuthClientKeyInfo in iscsiAuthClient.c
517836SJohn.Forte@Sun.COM  *       must also match this order.
527836SJohn.Forte@Sun.COM  */
537836SJohn.Forte@Sun.COM enum iscsiAuthKeyType_t {
547836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeNone = -1,
557836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeFirst = 0,
567836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeAuthMethod = iscsiAuthKeyTypeFirst,
577836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeChapAlgorithm,
587836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeChapUsername,
597836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeChapResponse,
607836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeChapIdentifier,
617836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeChapChallenge,
627836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeMaxCount,
637836SJohn.Forte@Sun.COM 	iscsiAuthKeyTypeLast = iscsiAuthKeyTypeMaxCount - 1
647836SJohn.Forte@Sun.COM };
657836SJohn.Forte@Sun.COM typedef enum iscsiAuthKeyType_t IscsiAuthKeyType;
667836SJohn.Forte@Sun.COM 
677836SJohn.Forte@Sun.COM enum {
687836SJohn.Forte@Sun.COM 	/*
697836SJohn.Forte@Sun.COM 	 * Common options for all keys.
707836SJohn.Forte@Sun.COM 	 */
717836SJohn.Forte@Sun.COM 	iscsiAuthOptionReject = -2,
727836SJohn.Forte@Sun.COM 	iscsiAuthOptionNotPresent = -1,
737836SJohn.Forte@Sun.COM 	iscsiAuthOptionNone = 1,
747836SJohn.Forte@Sun.COM 
757836SJohn.Forte@Sun.COM 	iscsiAuthMethodChap = 2,
767836SJohn.Forte@Sun.COM 	iscsiAuthMethodMaxCount = 2,
777836SJohn.Forte@Sun.COM 
787836SJohn.Forte@Sun.COM 	iscsiAuthChapAlgorithmMd5 = 5,
797836SJohn.Forte@Sun.COM 	iscsiAuthChapAlgorithmMaxCount = 2
807836SJohn.Forte@Sun.COM };
817836SJohn.Forte@Sun.COM 
827836SJohn.Forte@Sun.COM enum iscsiAuthNegRole_t {
837836SJohn.Forte@Sun.COM 	iscsiAuthNegRoleOriginator = 1,
847836SJohn.Forte@Sun.COM 	iscsiAuthNegRoleResponder = 2
857836SJohn.Forte@Sun.COM };
867836SJohn.Forte@Sun.COM typedef enum iscsiAuthNegRole_t IscsiAuthNegRole;
877836SJohn.Forte@Sun.COM 
887836SJohn.Forte@Sun.COM /*
897836SJohn.Forte@Sun.COM  * Note: These values are chosen to map to the values sent
907836SJohn.Forte@Sun.COM  *       in the iSCSI header.
917836SJohn.Forte@Sun.COM  */
927836SJohn.Forte@Sun.COM enum iscsiAuthVersion_t {
937836SJohn.Forte@Sun.COM 	iscsiAuthVersionDraft8 = 2,
947836SJohn.Forte@Sun.COM 	iscsiAuthVersionRfc = 0
957836SJohn.Forte@Sun.COM };
967836SJohn.Forte@Sun.COM typedef enum iscsiAuthVersion_t IscsiAuthVersion;
977836SJohn.Forte@Sun.COM 
987836SJohn.Forte@Sun.COM enum iscsiAuthStatus_t {
997836SJohn.Forte@Sun.COM 	iscsiAuthStatusNoError = 0,
1007836SJohn.Forte@Sun.COM 	iscsiAuthStatusError,
1017836SJohn.Forte@Sun.COM 	iscsiAuthStatusPass,
1027836SJohn.Forte@Sun.COM 	iscsiAuthStatusFail,
1037836SJohn.Forte@Sun.COM 	iscsiAuthStatusContinue,
1047836SJohn.Forte@Sun.COM 	iscsiAuthStatusInProgress
1057836SJohn.Forte@Sun.COM };
1067836SJohn.Forte@Sun.COM typedef enum iscsiAuthStatus_t IscsiAuthStatus;
1077836SJohn.Forte@Sun.COM 
1087836SJohn.Forte@Sun.COM enum iscsiAuthDebugStatus_t {
1097836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusNotSet = 0,
1107836SJohn.Forte@Sun.COM 
1117836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthPass,
1127836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthRemoteFalse,
1137836SJohn.Forte@Sun.COM 
1147836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthFail,
1157836SJohn.Forte@Sun.COM 
1167836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthMethodBad,
1177836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapAlgorithmBad,
1187836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusPasswordDecryptFailed,
1197836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusPasswordTooShortWithNoIpSec,
1207836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthServerError,
1217836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthStatusBad,
1227836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthPassNotValid,
1237836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusSendDuplicateSetKeyValue,
1247836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusSendStringTooLong,
1257836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusSendTooMuchData,
1267836SJohn.Forte@Sun.COM 
1277836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthMethodExpected,
1287836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapAlgorithmExpected,
1297836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapIdentifierExpected,
1307836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapChallengeExpected,
1317836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapResponseExpected,
1327836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapUsernameExpected,
1337836SJohn.Forte@Sun.COM 
1347836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthMethodNotPresent,
1357836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthMethodReject,
1367836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusAuthMethodNone,
1377836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapAlgorithmReject,
1387836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapChallengeReflected,
1397836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusPasswordIdentical,
1407836SJohn.Forte@Sun.COM 
1417836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusLocalPasswordNotSet,
1427836SJohn.Forte@Sun.COM 
1437836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapIdentifierBad,
1447836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapChallengeBad,
1457836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusChapResponseBad,
1467836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusUnexpectedKeyPresent,
1477836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusTbitSetIllegal,
1487836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusTbitSetPremature,
1497836SJohn.Forte@Sun.COM 
1507836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusRecvMessageCountLimit,
1517836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusRecvDuplicateSetKeyValue,
1527836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusRecvStringTooLong,
1537836SJohn.Forte@Sun.COM 	iscsiAuthDebugStatusRecvTooMuchData
1547836SJohn.Forte@Sun.COM };
1557836SJohn.Forte@Sun.COM typedef enum iscsiAuthDebugStatus_t IscsiAuthDebugStatus;
1567836SJohn.Forte@Sun.COM 
1577836SJohn.Forte@Sun.COM enum iscsiAuthNodeType_t {
1587836SJohn.Forte@Sun.COM 	iscsiAuthNodeTypeInitiator = 1,
1597836SJohn.Forte@Sun.COM 	iscsiAuthNodeTypeTarget = 2
1607836SJohn.Forte@Sun.COM };
1617836SJohn.Forte@Sun.COM typedef enum iscsiAuthNodeType_t IscsiAuthNodeType;
1627836SJohn.Forte@Sun.COM 
1637836SJohn.Forte@Sun.COM enum iscsiAuthPhase_t {
1647836SJohn.Forte@Sun.COM 	iscsiAuthPhaseConfigure = 1,
1657836SJohn.Forte@Sun.COM 	iscsiAuthPhaseNegotiate,		/* Negotiating */
1667836SJohn.Forte@Sun.COM 	iscsiAuthPhaseAuthenticate,		/* Authenticating */
1677836SJohn.Forte@Sun.COM 	iscsiAuthPhaseDone,			/* Authentication done */
1687836SJohn.Forte@Sun.COM 	iscsiAuthPhaseError
1697836SJohn.Forte@Sun.COM };
1707836SJohn.Forte@Sun.COM typedef enum iscsiAuthPhase_t IscsiAuthPhase;
1717836SJohn.Forte@Sun.COM 
1727836SJohn.Forte@Sun.COM enum iscsiAuthLocalState_t {
1737836SJohn.Forte@Sun.COM 	iscsiAuthLocalStateSendAlgorithm = 1,
1747836SJohn.Forte@Sun.COM 	iscsiAuthLocalStateRecvAlgorithm,
1757836SJohn.Forte@Sun.COM 	iscsiAuthLocalStateRecvChallenge,
1767836SJohn.Forte@Sun.COM 	iscsiAuthLocalStateDone,
1777836SJohn.Forte@Sun.COM 	iscsiAuthLocalStateError
1787836SJohn.Forte@Sun.COM };
1797836SJohn.Forte@Sun.COM typedef enum iscsiAuthLocalState_t IscsiAuthLocalState;
1807836SJohn.Forte@Sun.COM 
1817836SJohn.Forte@Sun.COM enum iscsiAuthRemoteState_t {
1827836SJohn.Forte@Sun.COM 	iscsiAuthRemoteStateSendAlgorithm = 1,
1837836SJohn.Forte@Sun.COM 	iscsiAuthRemoteStateSendChallenge,
1847836SJohn.Forte@Sun.COM 	iscsiAuthRemoteStateRecvResponse,
1857836SJohn.Forte@Sun.COM 	iscsiAuthRemoteStateAuthRequest,
1867836SJohn.Forte@Sun.COM 	iscsiAuthRemoteStateDone,
1877836SJohn.Forte@Sun.COM 	iscsiAuthRemoteStateError
1887836SJohn.Forte@Sun.COM };
1897836SJohn.Forte@Sun.COM typedef enum iscsiAuthRemoteState_t IscsiAuthRemoteState;
1907836SJohn.Forte@Sun.COM 
1917836SJohn.Forte@Sun.COM 
1927836SJohn.Forte@Sun.COM typedef void IscsiAuthClientCallback(void *, void *, int);
1937836SJohn.Forte@Sun.COM 
1947836SJohn.Forte@Sun.COM 
1957836SJohn.Forte@Sun.COM struct iscsiAuthClientGlobalStats_t {
1967836SJohn.Forte@Sun.COM 	unsigned long requestSent;
1977836SJohn.Forte@Sun.COM 	unsigned long responseReceived;
1987836SJohn.Forte@Sun.COM };
1997836SJohn.Forte@Sun.COM typedef struct iscsiAuthClientGlobalStats_t IscsiAuthClientGlobalStats;
2007836SJohn.Forte@Sun.COM 
2017836SJohn.Forte@Sun.COM struct iscsiAuthBufferDesc_t {
2027836SJohn.Forte@Sun.COM 	unsigned int length;
2037836SJohn.Forte@Sun.COM 	void *address;
2047836SJohn.Forte@Sun.COM };
2057836SJohn.Forte@Sun.COM typedef struct iscsiAuthBufferDesc_t IscsiAuthBufferDesc;
2067836SJohn.Forte@Sun.COM 
2077836SJohn.Forte@Sun.COM struct iscsiAuthKey_t {
2087836SJohn.Forte@Sun.COM 	unsigned int present:1;
2097836SJohn.Forte@Sun.COM 	unsigned int processed:1;
2107836SJohn.Forte@Sun.COM 	unsigned int valueSet:1;	/* 1 if the value is set to be valid */
2117836SJohn.Forte@Sun.COM 	char *string;
2127836SJohn.Forte@Sun.COM };
2137836SJohn.Forte@Sun.COM typedef struct iscsiAuthKey_t IscsiAuthKey;
2147836SJohn.Forte@Sun.COM 
2157836SJohn.Forte@Sun.COM struct iscsiAuthLargeBinaryKey_t {
2167836SJohn.Forte@Sun.COM 	unsigned int length;
2177836SJohn.Forte@Sun.COM 	unsigned char *largeBinary;
2187836SJohn.Forte@Sun.COM 	};
2197836SJohn.Forte@Sun.COM typedef struct iscsiAuthLargeBinaryKey_t IscsiAuthLargeBinaryKey;
2207836SJohn.Forte@Sun.COM 
2217836SJohn.Forte@Sun.COM struct iscsiAuthKeyBlock_t {
2227836SJohn.Forte@Sun.COM 	unsigned int transitBit:1;	/* To transit: TRUE or FALSE */
2237836SJohn.Forte@Sun.COM 	unsigned int duplicateSet:1;	/* Set the value more than once */
2247836SJohn.Forte@Sun.COM 	unsigned int stringTooLong:1;	/* Key value too long */
2257836SJohn.Forte@Sun.COM 	unsigned int tooMuchData:1;	/* The keypair data blk overflows */
2267836SJohn.Forte@Sun.COM 	unsigned int blockLength:16;	/* The length of the keypair data blk */
2277836SJohn.Forte@Sun.COM 	char *stringBlock;
2287836SJohn.Forte@Sun.COM 	IscsiAuthKey key[iscsiAuthKeyTypeMaxCount];
2297836SJohn.Forte@Sun.COM };
2307836SJohn.Forte@Sun.COM typedef struct iscsiAuthKeyBlock_t IscsiAuthKeyBlock;
2317836SJohn.Forte@Sun.COM 
2327836SJohn.Forte@Sun.COM struct iscsiAuthStringBlock_t {
2337836SJohn.Forte@Sun.COM 	char stringBlock[iscsiAuthStringBlockMaxLength];
2347836SJohn.Forte@Sun.COM };
2357836SJohn.Forte@Sun.COM typedef struct iscsiAuthStringBlock_t IscsiAuthStringBlock;
2367836SJohn.Forte@Sun.COM 
2377836SJohn.Forte@Sun.COM struct iscsiAuthLargeBinary_t {
2387836SJohn.Forte@Sun.COM 	unsigned char largeBinary[iscsiAuthLargeBinaryMaxLength];
2397836SJohn.Forte@Sun.COM };
2407836SJohn.Forte@Sun.COM typedef struct iscsiAuthLargeBinary_t IscsiAuthLargeBinary;
2417836SJohn.Forte@Sun.COM 
2427836SJohn.Forte@Sun.COM struct iscsiAuthClient_t {
2437836SJohn.Forte@Sun.COM 	unsigned long signature;
2447836SJohn.Forte@Sun.COM 
2457836SJohn.Forte@Sun.COM 	void *glueHandle;
2467836SJohn.Forte@Sun.COM 	struct iscsiAuthClient_t *next;
2477836SJohn.Forte@Sun.COM 	unsigned int authRequestId;
2487836SJohn.Forte@Sun.COM 
2497836SJohn.Forte@Sun.COM 	IscsiAuthNodeType nodeType;
2507836SJohn.Forte@Sun.COM 	unsigned int authMethodCount;
2517836SJohn.Forte@Sun.COM 	int authMethodList[iscsiAuthMethodMaxCount];
2527836SJohn.Forte@Sun.COM 	IscsiAuthNegRole authMethodNegRole;
2537836SJohn.Forte@Sun.COM 	unsigned int chapAlgorithmCount;
2547836SJohn.Forte@Sun.COM 	int chapAlgorithmList[iscsiAuthChapAlgorithmMaxCount];
2557836SJohn.Forte@Sun.COM 
2567836SJohn.Forte@Sun.COM 	/*
2577836SJohn.Forte@Sun.COM 	 * To indicate if remote authentication is enabled (0 = no 1 = yes)
2587836SJohn.Forte@Sun.COM 	 * For the case of initiator, remote authentication enabled means
2597836SJohn.Forte@Sun.COM 	 * enabling target authentication.
2607836SJohn.Forte@Sun.COM 	 */
2617836SJohn.Forte@Sun.COM 	int authRemote;
2627836SJohn.Forte@Sun.COM 
2637836SJohn.Forte@Sun.COM 	char username[iscsiAuthStringMaxLength];
2647836SJohn.Forte@Sun.COM 	int passwordPresent;
2657836SJohn.Forte@Sun.COM 	unsigned int passwordLength;
2667836SJohn.Forte@Sun.COM 	unsigned char passwordData[iscsiAuthStringMaxLength];
2677836SJohn.Forte@Sun.COM 	char methodListName[iscsiAuthStringMaxLength];
2687836SJohn.Forte@Sun.COM 	IscsiAuthVersion version;
2697836SJohn.Forte@Sun.COM 	unsigned int chapChallengeLength;
2707836SJohn.Forte@Sun.COM 	int ipSec;
2717836SJohn.Forte@Sun.COM 	int base64;
2727836SJohn.Forte@Sun.COM 
2737836SJohn.Forte@Sun.COM 	unsigned int authMethodValidCount;
2747836SJohn.Forte@Sun.COM 	int authMethodValidList[iscsiAuthMethodMaxCount];
2757836SJohn.Forte@Sun.COM 	int authMethodValidNegRole;
2767836SJohn.Forte@Sun.COM 	const char *rejectOptionName;
2777836SJohn.Forte@Sun.COM 	const char *noneOptionName;
2787836SJohn.Forte@Sun.COM 
2797836SJohn.Forte@Sun.COM 	int recvInProgressFlag;
2807836SJohn.Forte@Sun.COM 	int recvEndCount;
2817836SJohn.Forte@Sun.COM 	IscsiAuthClientCallback *callback;
2827836SJohn.Forte@Sun.COM 	void *userHandle;
2837836SJohn.Forte@Sun.COM 	void *messageHandle;
2847836SJohn.Forte@Sun.COM 
2857836SJohn.Forte@Sun.COM 	IscsiAuthPhase phase;
2867836SJohn.Forte@Sun.COM 	IscsiAuthLocalState localState;
2877836SJohn.Forte@Sun.COM 	IscsiAuthRemoteState remoteState;
2887836SJohn.Forte@Sun.COM 	IscsiAuthStatus remoteAuthStatus;
2897836SJohn.Forte@Sun.COM 	IscsiAuthDebugStatus debugStatus;
2907836SJohn.Forte@Sun.COM 	int negotiatedAuthMethod;
2917836SJohn.Forte@Sun.COM 	int negotiatedChapAlgorithm;
2927836SJohn.Forte@Sun.COM 	int authResponseFlag;
2937836SJohn.Forte@Sun.COM 	int authServerErrorFlag;
2947836SJohn.Forte@Sun.COM 	int transitBitSentFlag;
2957836SJohn.Forte@Sun.COM 
2967836SJohn.Forte@Sun.COM 	unsigned int sendChapIdentifier;
2977836SJohn.Forte@Sun.COM 	IscsiAuthLargeBinaryKey sendChapChallenge;
2987836SJohn.Forte@Sun.COM 	char chapUsername[iscsiAuthStringMaxLength];
2997836SJohn.Forte@Sun.COM 
3007836SJohn.Forte@Sun.COM 	int recvChapChallengeStatus;
3017836SJohn.Forte@Sun.COM 	IscsiAuthLargeBinaryKey recvChapChallenge;
3027836SJohn.Forte@Sun.COM 
3037836SJohn.Forte@Sun.COM 	char scratchKeyValue[iscsiAuthStringMaxLength];
3047836SJohn.Forte@Sun.COM 
3057836SJohn.Forte@Sun.COM 	IscsiAuthKeyBlock recvKeyBlock;		/* Received keypair data */
3067836SJohn.Forte@Sun.COM 	IscsiAuthKeyBlock sendKeyBlock;		/* Keypair data to be sent */
3077836SJohn.Forte@Sun.COM };
3087836SJohn.Forte@Sun.COM typedef struct iscsiAuthClient_t IscsiAuthClient;
3097836SJohn.Forte@Sun.COM 
3107836SJohn.Forte@Sun.COM 
3117836SJohn.Forte@Sun.COM #ifdef __cplusplus
3127836SJohn.Forte@Sun.COM }
3137836SJohn.Forte@Sun.COM #endif
3147836SJohn.Forte@Sun.COM #include <iscsiAuthClientGlue.h>
3157836SJohn.Forte@Sun.COM #ifdef __cplusplus
3167836SJohn.Forte@Sun.COM extern "C" {
3177836SJohn.Forte@Sun.COM #endif
3187836SJohn.Forte@Sun.COM 
3197836SJohn.Forte@Sun.COM 
3207836SJohn.Forte@Sun.COM extern IscsiAuthClientGlobalStats iscsiAuthClientGlobalStats;
3217836SJohn.Forte@Sun.COM 
3227836SJohn.Forte@Sun.COM 
3237836SJohn.Forte@Sun.COM extern int iscsiAuthClientInit(int, int, IscsiAuthBufferDesc *);
3247836SJohn.Forte@Sun.COM extern int iscsiAuthClientFinish(IscsiAuthClient *);
3257836SJohn.Forte@Sun.COM 
3267836SJohn.Forte@Sun.COM extern int iscsiAuthClientRecvBegin(IscsiAuthClient *);
3277836SJohn.Forte@Sun.COM extern int iscsiAuthClientRecvEnd(IscsiAuthClient *,
3287836SJohn.Forte@Sun.COM     IscsiAuthClientCallback *, void *, void *);
3297836SJohn.Forte@Sun.COM 
3307836SJohn.Forte@Sun.COM extern const char *iscsiAuthClientGetKeyName(int);
3317836SJohn.Forte@Sun.COM extern int iscsiAuthClientGetNextKeyType(int *);
3327836SJohn.Forte@Sun.COM extern int iscsiAuthClientKeyNameToKeyType(const char *);
3337836SJohn.Forte@Sun.COM extern int iscsiAuthClientRecvKeyValue(IscsiAuthClient *, int, const char *);
3347836SJohn.Forte@Sun.COM extern int iscsiAuthClientSendKeyValue(IscsiAuthClient *, int, int *, char *,
3357836SJohn.Forte@Sun.COM     unsigned int);
3367836SJohn.Forte@Sun.COM extern int iscsiAuthClientRecvTransitBit(IscsiAuthClient *, int);
3377836SJohn.Forte@Sun.COM extern int iscsiAuthClientSendTransitBit(IscsiAuthClient *, int *);
3387836SJohn.Forte@Sun.COM 
3397836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetAuthMethodList(IscsiAuthClient *, unsigned int,
3407836SJohn.Forte@Sun.COM     const int *);
3417836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetAuthMethodNegRole(IscsiAuthClient *, int);
3427836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetChapAlgorithmList(IscsiAuthClient *, unsigned int,
3437836SJohn.Forte@Sun.COM     const int *);
3447836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetUsername(IscsiAuthClient *, const char *);
3457836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetPassword(IscsiAuthClient *, const unsigned char *,
3467836SJohn.Forte@Sun.COM     unsigned int);
3477836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetAuthRemote(IscsiAuthClient *, int);
3487836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetGlueHandle(IscsiAuthClient *, void *);
3497836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetMethodListName(IscsiAuthClient *, const char *);
3507836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetIpSec(IscsiAuthClient *, int);
3517836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetBase64(IscsiAuthClient *, int);
3527836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetChapChallengeLength(IscsiAuthClient *,
3537836SJohn.Forte@Sun.COM     unsigned int);
3547836SJohn.Forte@Sun.COM extern int iscsiAuthClientSetVersion(IscsiAuthClient *, int);
3557836SJohn.Forte@Sun.COM extern int iscsiAuthClientCheckPasswordNeeded(IscsiAuthClient *, int *);
3567836SJohn.Forte@Sun.COM 
3577836SJohn.Forte@Sun.COM extern int iscsiAuthClientGetAuthPhase(IscsiAuthClient *, int *);
3587836SJohn.Forte@Sun.COM extern int iscsiAuthClientGetAuthStatus(IscsiAuthClient *, int *);
3597836SJohn.Forte@Sun.COM extern int iscsiAuthClientAuthStatusPass(int);
3607836SJohn.Forte@Sun.COM extern int iscsiAuthClientGetAuthMethod(IscsiAuthClient *, int *);
3617836SJohn.Forte@Sun.COM extern int iscsiAuthClientGetChapAlgorithm(IscsiAuthClient *, int *);
3627836SJohn.Forte@Sun.COM extern int iscsiAuthClientGetChapUsername(IscsiAuthClient *, char *,
3637836SJohn.Forte@Sun.COM     unsigned int);
3647836SJohn.Forte@Sun.COM 
3657836SJohn.Forte@Sun.COM extern int iscsiAuthClientSendStatusCode(IscsiAuthClient *, int *);
3667836SJohn.Forte@Sun.COM extern int iscsiAuthClientGetDebugStatus(IscsiAuthClient *, int *);
3677836SJohn.Forte@Sun.COM extern const char *iscsiAuthClientDebugStatusToText(int);
3687836SJohn.Forte@Sun.COM 
3697836SJohn.Forte@Sun.COM /*
3707836SJohn.Forte@Sun.COM  * The following is called by platform dependent code.
3717836SJohn.Forte@Sun.COM  */
3727836SJohn.Forte@Sun.COM extern void iscsiAuthClientAuthResponse(IscsiAuthClient *, int);
3737836SJohn.Forte@Sun.COM 
3747836SJohn.Forte@Sun.COM /*
3757836SJohn.Forte@Sun.COM  * The following routines are considered platform dependent,
3767836SJohn.Forte@Sun.COM  * and need to be implemented for use by iscsiAuthClient.c.
3777836SJohn.Forte@Sun.COM  */
3787836SJohn.Forte@Sun.COM 
3797836SJohn.Forte@Sun.COM extern int iscsiAuthClientChapAuthRequest(IscsiAuthClient *, char *,
3807836SJohn.Forte@Sun.COM     unsigned int,
3817836SJohn.Forte@Sun.COM     unsigned char *, unsigned int, unsigned char *, unsigned int);
3827836SJohn.Forte@Sun.COM extern void iscsiAuthClientChapAuthCancel(IscsiAuthClient *);
3837836SJohn.Forte@Sun.COM 
3847836SJohn.Forte@Sun.COM extern int iscsiAuthClientTextToNumber(const char *, unsigned long *);
3857836SJohn.Forte@Sun.COM extern void iscsiAuthClientNumberToText(unsigned long, char *, unsigned int);
3867836SJohn.Forte@Sun.COM 
3877836SJohn.Forte@Sun.COM extern void iscsiAuthRandomSetData(unsigned char *, unsigned int);
3887836SJohn.Forte@Sun.COM extern void iscsiAuthMd5Init(IscsiAuthMd5Context *);
3897836SJohn.Forte@Sun.COM extern void iscsiAuthMd5Update(IscsiAuthMd5Context *, unsigned char *,
3907836SJohn.Forte@Sun.COM     unsigned int);
3917836SJohn.Forte@Sun.COM extern void iscsiAuthMd5Final(unsigned char *, IscsiAuthMd5Context *);
3927836SJohn.Forte@Sun.COM 
3937836SJohn.Forte@Sun.COM extern int iscsiAuthClientData(unsigned char *, unsigned int *, unsigned char *,
3947836SJohn.Forte@Sun.COM     unsigned int);
3957836SJohn.Forte@Sun.COM 
3967836SJohn.Forte@Sun.COM #ifdef __cplusplus
3977836SJohn.Forte@Sun.COM }
3987836SJohn.Forte@Sun.COM #endif
3997836SJohn.Forte@Sun.COM 
4007836SJohn.Forte@Sun.COM #endif	/* _ISCSIAUTHCLIENT_H */
401