本文整理汇总了C++中ANI_IS_STATUS_SUCCESS函数的典型用法代码示例。如果您正苦于以下问题:C++ ANI_IS_STATUS_SUCCESS函数的具体用法?C++ ANI_IS_STATUS_SUCCESS怎么用?C++ ANI_IS_STATUS_SUCCESS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ANI_IS_STATUS_SUCCESS函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: aniEapolParseKey
/**
* aniEapolParseKey
*
* Parses and verifies a complete EAPOL-Key frame. The key descriptor
* type is returned and so is a newly allocated key descriptor structure
* that is appropriate for the type.
*
* NOTE: This is a non-destructive read. That is, the packet headers
* will be unchanged at the end of this read operation. This is so
* that a followup MIC check may be done on the complete packet. If
* the packet parsing fails, the packet headers are not guaranteed to
* be unchanged.
*
* @param packet the packet to read from. Note that the frame is not
* expected to contain any additional padding at the end other than
* the exact number of key bytes. (The aniEapolParse function will
* ensure this.)
* @param descType is set to the key descriptor type
* (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or
* ANI_EAPOL_KEY_DESC_TYPE_RSN).
* @param keyDescData is set to a newly allocated key descriptor
* corresponding to the above descType. The signature field is
* verified. The key bytes will be returned encrypted. It is the
* responsibility of the caller to free this structure and the data
* contained therein.
*
* @return ANI_OK if the operation succeeds
*/
int
aniEapolParseKey(tAniPacket *packet,
int *descType,
void **keyDescData)
{
int retVal;
v_U8_t *bytes;
v_U32_t eapolFrameLen;
if (packet == NULL)
return ANI_E_NULL_VALUE;
do
{
eapolFrameLen = aniAsfPacketGetLen(packet);
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "Supp parsing EAPOL-Key frame of len %d\n",
eapolFrameLen);
retVal = aniAsfPacketTruncateFromFront(packet, EAPOL_RX_HEADER_SIZE);
if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
retVal = aniAsfPacketGetBytes(packet, &bytes);
if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
if (*bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN ||
*bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW)
{
tAniEapolRsnKeyDesc *rsnDesc = NULL;
//*descType = ANI_EAPOL_KEY_DESC_TYPE_RSN;
*descType = (*bytes == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW ?
ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW : ANI_EAPOL_KEY_DESC_TYPE_RSN) ;
retVal = parseRsnKeyDesc(packet, &rsnDesc);
if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
*keyDescData = rsnDesc;
}
else
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Supp received unknown EAPOL-Key descriptor: %d\n",
*bytes);
retVal = ANI_E_ILLEGAL_ARG;
break;
}
aniAsfPacketMoveLeft(packet, eapolFrameLen);
}while( 0 );
return retVal;
}
开发者ID:handelxh,项目名称:ONEPLUS2RAZOR,代码行数:79,代码来源:bapRsnSsmEapol.c
示例2: aniEapolWriteKey
/**
* aniEapolWriteKey
*
* Writes out a complete EAPOL-Key frame. The key descriptor is
* appended to the packet and the EAPOL header is prepended to it. If
* a micKey is passed in, then a MIC is calculated and inserted into
* the frame.
*
* @param packet the packet to write to
* @param dstMac the destination MAC address
* @param srcMac the source MAC address
* @param descType the key descriptor type
* (ANI_EAPOL_KEY_DESC_TYPE_LEGACY_RC4 or
* ANI_EAPOL_KEY_DESC_TYPE_RSN).
* @param keyDescData the key descriptor data corresponding to the
* above descType. The signature field is ignored and will be
* generated in the packet. The key bytes are expected to be encrypted
* if they need to be encrypted.
* @param micKey the MIC key
* @param micKeyLen the number of bytes in the MIC key
*
* @return ANI_OK if the operation succeeds
*
*/
int
aniEapolWriteKey(v_U32_t cryptHandle,
tAniPacket *packet,
tAniMacAddr dstMac,
tAniMacAddr srcMac,
int descType,
void *keyDescData,
v_U8_t *micKey,
v_U32_t micKeyLen)
{
int retVal;
if (packet == NULL)
return ANI_E_NULL_VALUE;
do
{
if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW)
|| (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN))
{
retVal = writeRsnKeyDesc(packet,
(tAniEapolRsnKeyDesc *) keyDescData,
// Indicate
// ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW
// or ANI_EAPOL_KEY_DESC_TYPE_RSN
descType);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
break;
}
retVal = addEapolHeaders(packet, dstMac, srcMac, ANI_EAPOL_TYPE_KEY);
if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
retVal = writeRsnKeyMic(cryptHandle,
packet,
(tAniEapolRsnKeyDesc *) keyDescData,
micKey, micKeyLen);
if( !ANI_IS_STATUS_SUCCESS(retVal) ) break;
}
else {
VOS_ASSERT( 0 );
return ANI_E_ILLEGAL_ARG;
}
}while( 0 );
return retVal;
}
开发者ID:handelxh,项目名称:ONEPLUS2RAZOR,代码行数:74,代码来源:bapRsnSsmEapol.c
示例3: checkInfoElement
static int checkInfoElement(tAuthRsnFsm *fsm,
tAniEapolKeyAvailEventData *data)
{
tAniEapolRsnKeyDesc *desc;
v_U8_t *ieStaBytes;
int ieStaLen;
desc = (tAniEapolRsnKeyDesc *) data->keyDesc;
if( desc )
{
ieStaLen = aniAsfPacketGetBytes(fsm->staCtx->ieSta, &ieStaBytes);
if( !ANI_IS_STATUS_SUCCESS( ieStaLen ) )
{
return ieStaLen;
}
if ((desc->keyDataLen != ieStaLen) ||
( !vos_mem_compare(desc->keyData, ieStaBytes, ieStaLen-2) ))
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Auth STA sent inconsistent RSN IE!\n");
return ANI_E_FAILED;
}
// Copy RSN IE
//vos_mem_copy(fsm->advertizedRsnIe, desc->keyData, ieStaLen);
vos_mem_copy(fsm->advertizedRsnIe, ieStaBytes, ieStaLen);
return ANI_OK;
}
else
{
return ANI_E_NULL_VALUE;
}
}
开发者ID:Abhinav1997,项目名称:android_kernel_lge_msm8226,代码行数:35,代码来源:bapRsn8021xAuthFsm.c
示例4: checkInfoElement
static int checkInfoElement(tSuppRsnFsm *fsm,
tAniEapolKeyAvailEventData *data)
{
tAniEapolRsnKeyDesc *desc;
v_U8_t *ieApBytes;
int ieApLen;
desc = (tAniEapolRsnKeyDesc *) data->keyDesc;
if( NULL == desc )
{
return ANI_E_NULL_VALUE;
}
ieApLen = aniAsfPacketGetBytes(fsm->suppCtx->ieAp, &ieApBytes);
if( ANI_IS_STATUS_SUCCESS( ieApLen ) )
{
if ((desc->keyDataLen != ieApLen) ||
( vos_mem_compare(desc->keyData, ieApBytes, ieApLen) ))
{
// TODO: Send a fault here
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Supp AP sent inconsistent RSN IE!\n" );
return ANI_E_FAILED;
}
}
return ANI_OK;
}
开发者ID:supercairos,项目名称:android_kernel_doro_msm8916_2,代码行数:29,代码来源:bapRsn8021xSuppRsnFsm.c
示例5: checkRsnKeyMic
static int
checkRsnKeyMic(v_U32_t cryptHandle,
tAniPacket *eapolFrame,
tAniEapolRsnKeyDesc *rsnDesc,
v_U8_t *micKey,
v_U32_t micKeyLen)
{
int retVal = ANI_ERROR;
int len;
v_U8_t *ptr = NULL;
v_U8_t *micPos = NULL;
v_U8_t result[VOS_DIGEST_SHA1_SIZE]; // Larger of the two
v_U8_t incomingMic[ANI_EAPOL_KEY_RSN_MIC_SIZE];
if (!rsnDesc->info.micFlag)
{
VOS_ASSERT( 0 );
return ANI_E_ILLEGAL_ARG;
}
len = aniAsfPacketGetBytes(eapolFrame, &ptr);
if( ANI_IS_STATUS_SUCCESS( len ) )
{
micPos = ptr + ANI_SSM_RSN_KEY_MIC_OFFSET;
// Skip to the EAPOL version field for MIC computation
ptr += EAPOL_VERSION_POS;
len -= EAPOL_VERSION_POS;
// Copy existing MIC to temporary location and zero it out
vos_mem_copy( incomingMic, micPos, ANI_EAPOL_KEY_RSN_MIC_SIZE );
vos_mem_zero( micPos, ANI_EAPOL_KEY_RSN_MIC_SIZE );
if (rsnDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES)
{
if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, ptr, len, micKey, micKeyLen, result) ) )
{
retVal = ANI_OK;
}
}
else {
VOS_ASSERT( 0 );
retVal = ANI_E_ILLEGAL_ARG;
}
if (retVal == ANI_OK)
{
if ( !vos_mem_compare(incomingMic, result, ANI_EAPOL_KEY_RSN_MIC_SIZE))
{
retVal = ANI_E_MIC_FAILED;
}
}
}
return retVal;
}
开发者ID:handelxh,项目名称:ONEPLUS2RAZOR,代码行数:58,代码来源:bapRsnSsmEapol.c
示例6: authRsnRxFrameHandler
//
//This function alwasy assume the incoming vos_packet is 802_3 frame.
static int authRsnRxFrameHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket )
{
int retVal = ANI_ERROR;
tAniPacket *pAniPacket;
tBtampContext *ctx;
tAuthRsnFsm *fsm;
/* Validate params */
if ((pvosGCtx == NULL) || (NULL == pPacket))
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"param is NULL in %s", __func__);
return retVal;
}
ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx );
if (NULL == ctx)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"ctx is NULL in %s", __func__);
return retVal;
}
fsm = &ctx->uFsm.authFsm;
if (NULL == fsm)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"fsm is NULL in %s", __func__);
return retVal;
}
do
{
//ToDO: We need to synchronize this. For now, use the simplest form, drop the packet comes later.
if( fsm->fReceiving )
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
" ******authRsnRxFrameHandler receive eapol packet while processing. Drop the new comer\n" );
break;
}
fsm->fReceiving = VOS_TRUE;
retVal = bapRsnFormPktFromVosPkt( &pAniPacket, pPacket );
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
//Now we can process the eapol frame
//handler will free the pAniPacket
bapRsnEapolHandler( fsm, pAniPacket, VOS_TRUE );
}while( 0 );
fsm->fReceiving = VOS_FALSE;
vos_pkt_return_packet( pPacket );
return retVal;
}
开发者ID:Abhinav1997,项目名称:android_kernel_lge_msm8226,代码行数:58,代码来源:bapRsn8021xAuthFsm.c
示例7: aagPtkPrf
int
aagPtkPrf(v_U32_t cryptHandle,
v_U8_t result[AAG_PRF_MAX_OUTPUT_SIZE],
v_U32_t prfLen,
tAniPacket *pmk,
tAniMacAddr authAddr,
tAniMacAddr suppAddr,
v_U8_t aNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE],
v_U8_t sNonce[ANI_EAPOL_KEY_RSN_NONCE_SIZE])
{
v_U8_t *lowMac;
v_U8_t *highMac;
v_U8_t *lowNonce;
v_U8_t *highNonce;
v_U8_t *keyBytes;
int keyLen;
v_U8_t text[AAG_PTK_PRF_TEXT_LEN];
if (vos_mem_compare2(authAddr, suppAddr, sizeof(tAniMacAddr)) < 0) {
lowMac = authAddr;
highMac = suppAddr;
} else {
lowMac = suppAddr;
highMac = authAddr;
}
if (vos_mem_compare2(aNonce, sNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE) < 0) {
lowNonce = aNonce;
highNonce = sNonce;
} else {
lowNonce = sNonce;
highNonce = aNonce;
}
vos_mem_copy(text + AAG_PTK_PRF_LM_POS, lowMac, sizeof(tAniMacAddr));
vos_mem_copy(text + AAG_PTK_PRF_HM_POS, highMac, sizeof(tAniMacAddr));
vos_mem_copy(text + AAG_PTK_PRF_LN_POS, lowNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE);
vos_mem_copy(text + AAG_PTK_PRF_HN_POS, highNonce, ANI_EAPOL_KEY_RSN_NONCE_SIZE);
keyLen = aniAsfPacketGetBytes(pmk, &keyBytes);
if( !ANI_IS_STATUS_SUCCESS( keyLen ) )
{
return keyLen;
}
return aagPrf(cryptHandle,
result,
keyBytes, keyLen,
(v_U8_t *)AAG_PTK_PRF_CONST, AAG_PTK_PRF_CONST_LEN,
text, sizeof(text),
prfLen);
}
开发者ID:Alex-V2,项目名称:One_M8_4.4.3_kernel,代码行数:55,代码来源:bapRsn8021xPrf.c
示例8: aniEapolParse
int
aniEapolParse(tAniPacket *packet,
v_U8_t **dstMac,
v_U8_t **srcMac,
v_U8_t **type)
{
v_U16_t frameType;
v_U8_t *ptr;
int retVal;
int tmp;
if (aniAsfPacketGetLen(packet) < EAPOL_BODY_POS)
return ANI_E_ILLEGAL_ARG;
retVal = aniAsfPacketGetBytes(packet, &ptr);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
return retVal;
}
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
"Supp parsing EAPOL packet of len %d: \n",
retVal);
frameType = (ptr[ETHER_PROTO_POS] << 8) + ptr[ETHER_PROTO_POS+1];
if (frameType != ANI_ETH_P_EAPOL)
return ANI_E_ILLEGAL_ARG;
*dstMac = ptr + DST_MAC_POS;
*srcMac = ptr + SRC_MAC_POS;
*type = ptr + ANI_EAPOL_TYPE_POS;
retVal = (ptr[EAPOL_BODY_LEN_POS] << 8) + ptr[EAPOL_BODY_LEN_POS + 1];
tmp = aniAsfPacketGetLen(packet) - EAPOL_RX_HEADER_SIZE;
if (retVal > tmp)
{
retVal = ANI_E_ILLEGAL_ARG;
}
else {
if (retVal < tmp)
{
retVal = aniAsfPacketTruncateFromRear(packet, tmp - retVal);
}
}
return retVal;
}
开发者ID:Alex-V2,项目名称:One_M8_4.4.3_kernel,代码行数:53,代码来源:bapRsnSsmEapol.c
示例9: addEapolHeaders
static int
addEapolHeaders(tAniPacket *packet,
tAniMacAddr dstMac,
tAniMacAddr srcMac,
v_U8_t eapolType)
{
int retVal;
v_U16_t len;
do
{
retVal = aniAsfPacketGetLen(packet);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
len = retVal;
retVal = aniAsfPacketPrepend16(packet, len);
retVal = aniAsfPacketPrepend8(packet, eapolType);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, EAPOL_VERSION_BYTES, 1);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, ANI_ETH_P_EAPOL_BYTES, 2);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, BAP_RSN_LLC_HEADER, sizeof(BAP_RSN_LLC_HEADER));
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
len += 6 + sizeof(BAP_RSN_LLC_HEADER);
retVal = aniAsfPacketPrepend16(packet, len);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, srcMac, sizeof(tAniMacAddr));
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, dstMac, sizeof(tAniMacAddr));
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
}while( 0 );
return retVal;
}
开发者ID:Alex-V2,项目名称:One_M8_4.4.3_kernel,代码行数:44,代码来源:bapRsnSsmEapol.c
示例10: addEapolHeaders
/**
* addEapolHeaders
*
* FUNCTION:
* Prepends the EAPOL header to a packet.
*
* ASSUMPTIONS:
* The packet has enough space available for prepending the EAPOL
* header.
*
* @param packet the packet to prepend to
* @param dstMac the MAC address of the destination (authenticator)
* @param srcMac the MAC address of the source (supplicant)
* @param eapolType the EAPOL-Type field
*
* @return ANI_OK if the operation succeeds
*/
static int
addEapolHeaders(tAniPacket *packet,
tAniMacAddr dstMac,
tAniMacAddr srcMac,
v_U8_t eapolType)
{
int retVal;
v_U16_t len;
do
{
retVal = aniAsfPacketGetLen(packet);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
len = retVal;
retVal = aniAsfPacketPrepend16(packet, len);
retVal = aniAsfPacketPrepend8(packet, eapolType);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, EAPOL_VERSION_BYTES, 1);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, ANI_ETH_P_EAPOL_BYTES, 2);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
//Since TL expects SNAP header in all packets we send, put it in
retVal = aniAsfPacketPrependBuffer(packet, BAP_RSN_LLC_HEADER, sizeof(BAP_RSN_LLC_HEADER));
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
//packet length
len += 6/*length + eapolType+version + eth_type*/ + sizeof(BAP_RSN_LLC_HEADER);
retVal = aniAsfPacketPrepend16(packet, len);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, srcMac, sizeof(tAniMacAddr));
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
retVal = aniAsfPacketPrependBuffer(packet, dstMac, sizeof(tAniMacAddr));
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
}while( 0 );
return retVal;
}
开发者ID:handelxh,项目名称:ONEPLUS2RAZOR,代码行数:61,代码来源:bapRsnSsmEapol.c
示例11: authEapolKeyHandler
static int
authEapolKeyHandler( tAuthRsnFsm *fsm, tAniPacket *eapolFrame, tAniMacAddr staMac )
{
int retVal;
int descType;
void *keyDesc;
tAniEapolRsnKeyDesc *rsnDesc;
tAniEapolKeyAvailEventData data;
do
{
retVal = aniEapolParseKey(eapolFrame, &descType, &keyDesc);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW)
|| (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN))
{
rsnDesc = (tAniEapolRsnKeyDesc *) keyDesc;
data.keyDesc = keyDesc;
data.eapolFrame = eapolFrame;
// Pass on the event to the RSN FSM only if it is for a pairwise key
if (rsnDesc->info.unicastFlag)
{
retVal = authRsnFsmProcessEvent(fsm,
RSN_FSM_EAPOL_FRAME_AVAILABLE,
&data);
}
else {
//Not worry about GTK stuff
}
}
else {
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Got unexpected legacy 802.1x RC4 Key message \n" );
retVal = ANI_E_FAILED;
break;
}
}while( 0 );
aniEapolKeyFreeDesc(descType, keyDesc);
return retVal;
}
开发者ID:Abhinav1997,项目名称:android_kernel_lge_msm8226,代码行数:44,代码来源:bapRsn8021xAuthFsm.c
示例12: suppEapolKeyHandler
static int
suppEapolKeyHandler( tSuppRsnFsm *fsm,
tAniPacket *eapolFrame,
tAniMacAddr suppMac)
{
int retVal;
int descType;
void *keyDesc;
tAniEapolRsnKeyDesc *rsnDesc;
tAniEapolKeyAvailEventData data;
do
{
retVal = aniEapolParseKey(eapolFrame, &descType, &keyDesc);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
return retVal;
}
if (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW)
{
rsnDesc = (tAniEapolRsnKeyDesc *) keyDesc;
/*
* Pass on the event to the RSN FSM irrespective if it is
* pairwise or not.
*/
data.keyDesc = keyDesc;
data.eapolFrame = eapolFrame;
retVal = suppRsnFsmProcessEvent(fsm,
RSN_FSM_EAPOL_FRAME_AVAILABLE,
&data);
}
else {
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Supp: Got unexpected 802.1x RC4 Key message \n" );
retVal = ANI_E_FAILED;
break;
}
}while( 0 );
aniEapolKeyFreeDesc(descType, keyDesc);
return retVal;
}
开发者ID:supercairos,项目名称:android_kernel_doro_msm8916_2,代码行数:44,代码来源:bapRsn8021xSuppRsnFsm.c
示例13: parseRsnKeyInfo
static int
parseRsnKeyInfo(tAniPacket *packet,
tAniRsnKeyInfo *info)
{
v_U16_t tmp;
int retVal;
retVal = aniAsfPacketGet16(packet, &tmp);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
return retVal;
}
info->keyDescVers = (tmp & ANI_SSM_RSN_KEY_DESC_VERS_MASK)
>> ANI_SSM_RSN_KEY_DESC_VERS_OFFSET;
if (info->keyDescVers != ANI_EAPOL_KEY_DESC_VERS_RC4 &&
info->keyDescVers != ANI_EAPOL_KEY_DESC_VERS_AES)
return ANI_E_ILLEGAL_ARG;
info->unicastFlag = (tmp & ANI_SSM_RSN_UNICAST_MASK) ?
eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
info->keyId = (tmp & ANI_SSM_RSN_KEY_INDEX_MASK)
>> ANI_SSM_RSN_KEY_INDEX_OFFSET;
info->installFlag = (tmp & ANI_SSM_RSN_INSTALL_MASK) ?
eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
info->ackFlag = (tmp & ANI_SSM_RSN_ACK_MASK) ?
eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
info->micFlag = (tmp & ANI_SSM_RSN_MIC_MASK) ?
eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
info->secureFlag = (tmp & ANI_SSM_RSN_SECURE_MASK) ?
eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
info->errorFlag = (tmp & ANI_SSM_RSN_ERROR_MASK) ?
eANI_BOOLEAN_TRUE: eANI_BOOLEAN_FALSE;
info->requestFlag = (tmp & ANI_SSM_RSN_REQUEST_MASK) ?
eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
info->encKeyDataFlag = (tmp & ANI_SSM_RSN_ENC_KEY_DATA_MASK) ?
eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE;
return ANI_OK;
}
开发者ID:handelxh,项目名称:ONEPLUS2RAZOR,代码行数:40,代码来源:bapRsnSsmEapol.c
示例14: checkTransition
//.........这里部分代码省略.........
else {
retVal = checkMic(fsm, data, rxDesc->info.unicastFlag);
if (retVal != ANI_OK)
{
bapSuppDisconnect( fsm->ctx );
return retVal;
}
aniSsmReplayCtrUpdate(fsm->peerReplayCtr,
rxDesc->replayCounter);
gotoStateStaKeySet(fsm, data, eANI_BOOLEAN_FALSE);
}
}
}
break;
case STA_KEY_SET:
if (fsm->eapolAvail)
{
fsm->eapolAvail = eANI_BOOLEAN_FALSE;
data = (tAniEapolKeyAvailEventData *) arg;
rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
retVal = checkPeerReplayCounter(
fsm,
data,
&retransmit,
rxDesc->info.micFlag,
1); // MIC set means check for re-Tx M3.
if (retVal != ANI_OK)
return ANI_OK; // Caller should not fail
if (!retransmit)
{
retVal = checkMic(fsm, data, rxDesc->info.unicastFlag);
if (retVal != ANI_OK)
{
bapSuppDisconnect( fsm->ctx );
return retVal;
}
aniSsmReplayCtrUpdate(fsm->peerReplayCtr,
rxDesc->replayCounter);
}
if (rxDesc->info.unicastFlag)
{
/*
* Handle pairwise key message...in this state
* pairwise key messages can only be for retransmissions.
*/
if (retransmit)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Resending EAPOL-Key Msg4 from "
"supplicant \n" );
retVal = gotoStateStaKeySet(fsm, data, eANI_BOOLEAN_TRUE);
}
}
else
{
/*
* Handle group key message...with group key messages,
* the replay counter has to change on
* retransmissions.
*/
if (!retransmit)
{
retVal = gotoStateGroupKeySet(fsm, data);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
bapSuppDisconnect( fsm->ctx );
return retVal;
}
}
}
}
else {
if (fsm->integFailed)
{
gotoStateKeyUpdate(fsm, arg);
}
}
break;
case GROUP_KEY_SET:
gotoStateStaKeySet(fsm, NULL, eANI_BOOLEAN_FALSE);
break;
case KEY_UPDATE:
gotoStateRekeyMsg(fsm, arg);
break;
default:
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Illegal state for SuppRsnFsm: %d",
fsm->currentState);
VOS_ASSERT( 0 );
return ANI_E_FAILED;
}
return ANI_OK;
}
开发者ID:supercairos,项目名称:android_kernel_doro_msm8916_2,代码行数:101,代码来源:bapRsn8021xSuppRsnFsm.c
示例15: checkTransition
static
int checkTransition(tAuthRsnFsm *fsm, void *arg)
{
int retVal;
tAniEapolKeyAvailEventData *data;
tAniEapolRsnKeyDesc *rxDesc;
tSirMicFailureInfo *micFailureInfo;
if (fsm->disconnect)
{
stopAllTimers(fsm);
gotoStateDisconnect(fsm);
return ANI_OK;
}
if (fsm->authReq)
{
stopAllTimers(fsm);
gotoStateAuthentication(fsm);
return ANI_OK;
}
switch (fsm->currentState)
{
case INITIALIZE:
break;
case AUTHENTICATION:
gotoStateAuthentication2(fsm);
break;
case AUTHENTICATION_2:
gotoStateGetPsk( fsm );
break;
case GET_PSK:
//We always have PMK otherwise BAP won't let us here
gotoStatePtkStart(fsm);
break;
case PTK_START:
if ( fsm->eapolAvail )
{
fsm->eapolAvail = eANI_BOOLEAN_FALSE;
if (NULL == arg)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"arg is NULL, exiting checkTransition()");
return ANI_E_FAILED;
}
data = (tAniEapolKeyAvailEventData *) arg;
retVal = checkLocalReplayCounter(fsm, data);
if (retVal != ANI_OK)
return ANI_OK; // Caller should not fail
retVal = derivePtk(fsm, data);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Auth derivePtk failed with code %d!\n", retVal);
return retVal;
}
retVal = checkMic(fsm, data);
if (retVal != ANI_OK)
{
bapAuthDisconnect( fsm->ctx );
return retVal;
}
retVal = gotoStatePtkInitNego(fsm, arg);
}
else if ( fsm->msg2TimeOut )
{
if (fsm->numTries <= authConsts.maxTries)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Auth Retransmitting EAPOL-Key Msg1\n");
// Stay in the same state but repeat actions
gotoStatePtkStart(fsm);
}
else {
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Auth failed to recv EAPOL-Key Msg2 "
"Disconnecting...\n");
gotoStateDisconnect(fsm);
}
}
break;
case PTK_INIT_NEGO:
if (NULL == arg)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"arg is NULL, exiting checkTransition()");
return ANI_E_FAILED;
}
data = (tAniEapolKeyAvailEventData *) arg;
retVal = checkInfoElement(fsm, data);
if (retVal != ANI_OK)
{
gotoStateDisconnect(fsm);
}
else {
gotoStatePtkInitNegoTx(fsm);
}
break;
//.........这里部分代码省略.........
开发者ID:Abhinav1997,项目名称:android_kernel_lge_msm8226,代码行数:101,代码来源:bapRsn8021xAuthFsm.c
示例16: gotoStateGroupKeySet
static int
gotoStateGroupKeySet(tSuppRsnFsm *fsm,
tAniEapolKeyAvailEventData *data)
{
int retVal;
tAniEapolRsnKeyDesc txDesc;
tAniEapolRsnKeyDesc *rxDesc;
int groupKeyLen;
fsm->currentState = GROUP_KEY_SET;
do
{
rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc;
if( NULL == rxDesc)
{
retVal = ANI_E_NULL_VALUE;
break;
}
if (rxDesc->keyDataLen == 0 || rxDesc->keyData == NULL)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Supp: AP sent no group key in group EAPOL-Key message!\n" );
retVal = ANI_E_ILLEGAL_ARG;
break;
}
if ( rxDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES )
{
groupKeyLen = rxDesc->keyDataLen - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE;
if( groupKeyLen <= 0 )
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Supp: AP sent GTK too short\n" );
retVal = ANI_E_ILLEGAL_ARG;
break;
}
}
else
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Supp: AP sent unsupported keyDescVer %d!\n", rxDesc->info.keyDescVers );
retVal = ANI_E_ILLEGAL_ARG;
break;
}
// Always create a new EAPOL frame
aniAsfPacketEmptyExplicit( fsm->lastEapol,
EAPOL_TX_HEADER_SIZE );
vos_mem_zero( &txDesc, sizeof(txDesc) );
// The Key Information bits...
if (fsm->suppCtx->grpCipherType == eCSR_ENCRYPT_TYPE_AES)
{
txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
}
txDesc.info.unicastFlag = eANI_BOOLEAN_FALSE;
txDesc.info.keyId = rxDesc->info.keyId;
txDesc.info.micFlag = eANI_BOOLEAN_TRUE;
txDesc.info.secureFlag = eANI_BOOLEAN_TRUE;
txDesc.keyLen = RSN_80211_KEY_LEN;
// Send back the same replayCtr that the authenticator sent
vos_mem_copy(txDesc.replayCounter,
rxDesc->replayCounter,
sizeof(txDesc.replayCounter));
retVal = aniEapolWriteKey(fsm->cryptHandle,
fsm->lastEapol,
fsm->suppCtx->authMac,
fsm->suppCtx->suppMac,
ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
&txDesc,
fsm->suppCtx->ptk,
CSR_AES_KEY_LEN);
if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break;
if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
{
retVal = ANI_ERROR;
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp could not send eapol. Disconnect\n" );
break;
}
//FIX_RSN there is no need to set GTK retVal = setGtk(fsm->suppCtx, rxDesc->keyRecvSeqCounter);
// This is never retransmitted
aniAsfPacketEmptyExplicit( fsm->lastEapol,
EAPOL_TX_HEADER_SIZE );
checkTransition(fsm, NULL); // UCT rule
}while( 0 );
return retVal;
}
开发者ID:supercairos,项目名称:android_kernel_doro_msm8916_2,代码行数:100,代码来源:bapRsn8021xSuppRsnFsm.c
示例17: gotoStatePtkStart
static int
gotoStatePtkStart(tAuthRsnFsm *fsm)
{
tAniEapolRsnKeyDesc txDesc;
int retVal;
fsm->msg2TimeOut = VOS_FALSE;
fsm->currentState = PTK_START;
// Create a new packet if we don't have one to retransmit
//if (aniAsfPacketGetLen(fsm->lastEapol) == 0)
#if 0
if( fsm->lastEapol )
{
aniAsfPacketFree( fsm->lastEapol );
fsm->lastEapol = NULL;
retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol,
RSN_MAX_PACKET_SIZE,
EAPOL_TX_HEADER_SIZE );
#endif
aniAsfPacketEmptyExplicit(fsm->lastEapol,
EAPOL_TX_HEADER_SIZE);
//}
// if (1)
//{
vos_mem_zero( &txDesc, sizeof(txDesc) );
// The Key Information bits...
if (fsm->staCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES)
{
txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
}
else {
return ANI_E_ILLEGAL_ARG;
}
txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE;
txDesc.info.ackFlag = eANI_BOOLEAN_TRUE;
// The other fields...
txDesc.keyLen = aagGetKeyMaterialLen(fsm->staCtx->pwCipherType);
aniSsmReplayCtrNext(fsm->staCtx->localReplayCtr, txDesc.replayCounter);
vos_mem_copy(txDesc.keyNonce, fsm->aNonce, sizeof(txDesc.keyNonce));
retVal = aniEapolWriteKey(fsm->cryptHandle,
fsm->lastEapol,
fsm->staCtx->suppMac,
fsm->staCtx->authMac,
ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
&txDesc,
NULL, 0);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
return retVal;
}
#if 0
}
else {
retransmit = eANI_BOOLEAN_TRUE;
}
#endif
if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
{
retVal = ANI_OK;
}
else
{
//we fail to send the eapol frame disconnect
bapAuthDisconnect( fsm->ctx );
retVal = ANI_ERROR;
}
return retVal;
}
开发者ID:Abhinav1997,项目名称:android_kernel_lge_msm8226,代码行数:76,代码来源:bapRsn8021xAuthFsm.c
示例18: gotoStateStaKeyStart
static int
gotoStateStaKeyStart(tSuppRsnFsm *fsm,
tAniEapolKeyAvailEventData *data,
v_BOOL_t retransmit)
{
int retVal;
tAniEapolRsnKeyDesc txDesc;
tAniEapolRsnKeyDesc *rxDesc;
static v_U8_t btampRSNIE[] = {0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00,
0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00 };
fsm->currentState = STA_KEY_START;
// Create a new EAPOL frame if we don't have to retransmit
// if (!retransmit)
//{
rxDesc = data->keyDesc;
if( NULL == rxDesc)
{
return ANI_E_NULL_VALUE;
}
aniAsfPacketEmptyExplicit( fsm->lastEapol, EAPOL_TX_HEADER_SIZE );
retVal = derivePtk(fsm, data);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"Supp derivePtk failed with code %d!\n", retVal);
return retVal;
}
vos_mem_zero( &txDesc, sizeof(txDesc) );
// The Key Information bits...
if (fsm->suppCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES)
{
txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
}
txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE;
txDesc.info.micFlag = eANI_BOOLEAN_TRUE;
txDesc.keyLen = 0; //RSN_80211_KEY_LEN;
// Send back the same replayCtr that the authenticator sent
vos_mem_copy(txDesc.replayCounter,
rxDesc->replayCounter,
sizeof(txDesc.replayCounter));
vos_mem_copy(txDesc.keyNonce, fsm->sNonce, sizeof(txDesc.keyNonce));
txDesc.keyDataLen = sizeof(btampRSNIE);//aniAsfPacketGetBytes(fsm->suppCtx->ieBp,
//&txDesc.keyData);
txDesc.keyData = btampRSNIE;
retVal = aniEapolWriteKey(fsm->cryptHandle,
fsm->lastEapol,
fsm->suppCtx->authMac,
fsm->suppCtx->suppMac,
ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW,
&txDesc,
fsm->suppCtx->ptk,
CSR_AES_KEY_LEN);
if( !ANI_IS_STATUS_SUCCESS( retVal ) )
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp gotoStateStaKeyStart fail to write key %d\n",
retVal);
return retVal;
}
//}
if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) )
{
retVal = ANI_OK;
}
else
{
retVal = ANI_ERROR;
}
return retVal;
}
开发者ID:supercairos,项目名称:android_kernel_doro_msm8916_2,代码行数:78,代码来源:bapRsn8021xSuppRsnFsm.c
示例19: gotoStateStaKeySet
static int
gotoStateStaKeySet(tSuppRsnFsm *fsm,
tAniEapolKeyAvailEventData *data,
v_BOOL_t retransmit)
{
int retVal=0;
tAniEapolRsnKeyDesc txDesc;
tAniEapolRsnKeyDesc *rxDesc = NULL;
fsm->currentState = STA_KEY_SET;
if (data == NULL)
{
// We don't need to do anything
return ANI_OK;
}
// Create a new EAPOL frame if we don't have to retransmit
if (!retransmit)
{
// First check the IE that the AP sent
retVal = checkInfoElement(fsm, data);
if (retVal != ANI_OK)
{
//FIX_RSN aagSetSuppFailureAndCleanup(fsm->suppCtx);
// FSM does not exist after this...
return retVal;
}
// Create a new EAPOL frame
rxDesc = data->keyDesc;
if( NULL == rxDesc )
return ANI_E_NULL_VALUE;
aniAsfPacketEmptyExplicit(fsm->lastEapol,
EAPOL_TX_HEADER_SIZE );
vos_mem_zero( &txDesc, sizeof(txDesc) );
// The Key Information bits...
if (fsm->suppCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES)
{
txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES;
}
txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE;
txDesc.info.micFlag = eANI_BOOLEAN_TRUE;
txDesc.info.secureFlag = eANI_BOOLEAN_TRUE;
txDesc.keyLen = 0; //RSN_80211_KEY_LEN;
// Send back the same replayCtr that the authenticator sent
vos_mem_copy(txDesc.replayCounter,
rxDesc->replayCounter,
sizeof(txDesc.replayCounter));
retVal = aniEapolWriteKey(fsm->cryptHandle,
|
请发表评论