fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2000 by Cisco Systems, Inc. All rights reserved.
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing China * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This file is the include file for for iscsiAuthClient.c
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing Chinaenum { iscsiAuthStringMaxLength = 512 };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: The ordering of these values are chosen to match
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the ordering of the keys as shown in the iSCSI spec.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The table IscsiAuthClientKeyInfo in iscsiAuthClient.c
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * must also match this order.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeAuthMethod = iscsiAuthKeyTypeFirst,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeLast = iscsiAuthKeyTypeMaxCount - 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common options for all keys.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: These values are chosen to map to the values sent
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in the iSCSI header.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthDebugStatus_t IscsiAuthDebugStatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthNodeType_t IscsiAuthNodeType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthLocalState_t IscsiAuthLocalState;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthRemoteState_t IscsiAuthRemoteState;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef void IscsiAuthClientCallback(void *, void *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthClientGlobalStats_t IscsiAuthClientGlobalStats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthBufferDesc_t IscsiAuthBufferDesc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int valueSet:1; /* 1 if the value is set to be valid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthLargeBinaryKey_t IscsiAuthLargeBinaryKey;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int transitBit:1; /* To transit: TRUE or FALSE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int duplicateSet:1; /* Set the value more than once */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int stringTooLong:1; /* Key value too long */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int tooMuchData:1; /* The keypair data blk overflows */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int blockLength:16; /* The length of the keypair data blk */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthKeyBlock_t IscsiAuthKeyBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthStringBlock_t IscsiAuthStringBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char largeBinary[iscsiAuthLargeBinaryMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthLargeBinary_t IscsiAuthLargeBinary;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int chapAlgorithmList[iscsiAuthChapAlgorithmMaxCount];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * To indicate if remote authentication is enabled (0 = no 1 = yes)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For the case of initiator, remote authentication enabled means
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enabling target authentication.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char passwordData[iscsiAuthStringMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int authMethodValidList[iscsiAuthMethodMaxCount];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthKeyBlock recvKeyBlock; /* Received keypair data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthKeyBlock sendKeyBlock; /* Keypair data to be sent */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern IscsiAuthClientGlobalStats iscsiAuthClientGlobalStats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientInit(int, int, IscsiAuthBufferDesc *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientFinish(IscsiAuthClient *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientRecvBegin(IscsiAuthClient *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientRecvEnd(IscsiAuthClient *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthClientCallback *, void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const char *iscsiAuthClientGetKeyName(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientKeyNameToKeyType(const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientRecvKeyValue(IscsiAuthClient *, int, const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSendKeyValue(IscsiAuthClient *, int, int *, char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientRecvTransitBit(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSendTransitBit(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetAuthMethodList(IscsiAuthClient *, unsigned int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetAuthMethodNegRole(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetChapAlgorithmList(IscsiAuthClient *, unsigned int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetUsername(IscsiAuthClient *, const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetPassword(IscsiAuthClient *, const unsigned char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetAuthRemote(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetGlueHandle(IscsiAuthClient *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetMethodListName(IscsiAuthClient *, const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetIpSec(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetBase64(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetChapChallengeLength(IscsiAuthClient *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetVersion(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientCheckPasswordNeeded(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetAuthPhase(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetAuthStatus(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetAuthMethod(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetChapAlgorithm(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetChapUsername(IscsiAuthClient *, char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSendStatusCode(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetDebugStatus(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const char *iscsiAuthClientDebugStatusToText(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The following is called by platform dependent code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthClientAuthResponse(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The following routines are considered platform dependent,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and need to be implemented for use by iscsiAuthClient.c.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientChapAuthRequest(IscsiAuthClient *, char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char *, unsigned int, unsigned char *, unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthClientChapAuthCancel(IscsiAuthClient *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientTextToNumber(const char *, unsigned long *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthClientNumberToText(unsigned long, char *, unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthRandomSetData(unsigned char *, unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthMd5Init(IscsiAuthMd5Context *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthMd5Update(IscsiAuthMd5Context *, unsigned char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthMd5Final(unsigned char *, IscsiAuthMd5Context *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientData(unsigned char *, unsigned int *, unsigned char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _ISCSIAUTHCLIENT_H */