TrustCore SDK NanoSec API reference  version 7.0
EAP-PEAP Functions

Provides EAP-PEAP (EAP-protected EAP) authentication. More...

Functions

MOC_EXTERN MSTATUS EAP_PEAPdeleteSession (void *eapPEAPSession)
 Delete an EAP-PEAP session. More...
 
MOC_EXTERN MSTATUS EAP_PEAPFormSendPacket (void *eapPEAPCb, ubyte *pkt, ubyte4 pktLen, ubyte **eapResponse, ubyte4 *eapRespLen)
 Build a PEAP packet. More...
 
MOC_EXTERN MSTATUS EAP_PEAPgetKey (void *eapCb, ubyte *key, ubyte2 keyLen)
 Generate and return a session's authentication keys. More...
 
MOC_EXTERN MSTATUS EAP_PEAPgetSessionStatus (void *eapPEAPCb, ubyte *eapSessionStatus)
 Get a session's current status. More...
 
MOC_EXTERN MSTATUS EAP_PEAPinitSession (ubyte *appSessionCB, ubyte **eapPEAPSession, EAP_PEAP_params *eapPEAPparams)
 Create and initialize an EAP-PEAP session. More...
 
MOC_EXTERN MSTATUS EAP_PEAPreceiveLLPacket (void *eapPEAPCb, ubyte *pkt, ubyte4 pktLen)
 Process an encrypted PEAP payload. More...
 
MOC_EXTERN MSTATUS EAP_PEAPSendResultTlv (ubyte *eapHdl, ubyte2 intResult)
 Build and send a result TLV packet. More...
 
MOC_EXTERN MSTATUS EAP_PEAPSetEapHdr (void *eapCB, eapCode code, ubyte id)
 Assign the code and ID values to an inner EAP header. More...
 
MOC_EXTERN MSTATUS EAP_PEAPulAuthTransmit (ubyte *eapSessionHdl, ubyte4 instanceId, eapMethodType methodType, eapCode code, eapMethodDecision methodDecision, eapMethodState methodState, ubyte *eap_data, ubyte4 eap_data_len)
 Transmit packets from the authenticator to the peer through the second stage EAP stack. More...
 
MOC_EXTERN MSTATUS EAP_PEAPulPeerTransmit (ubyte *eapSessionHdl, ubyte4 instanceId, eapMethodType methodType, eapCode code, eapMethodDecision methodDecision, eapMethodState methodState, ubyte *eap_data, ubyte4 eap_data_len)
 Transmit packets from the peer to the authenticator through the second stage EAP stack. More...
 

Detailed Description

Function Documentation

◆ EAP_PEAPdeleteSession()

MOC_EXTERN MSTATUS EAP_PEAPdeleteSession ( void *  eapPEAPSession)

This function deletes an EAP-PEAP session.

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEAP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_peap.h

Parameters
eapPEAPSessionEAP-PEAP session handle returned from EAP_PEAPinitSession.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPFormSendPacket()

MOC_EXTERN MSTATUS EAP_PEAPFormSendPacket ( void *  eapPEAPCb,
ubyte *  pkt,
ubyte4  pktLen,
ubyte **  eapResponse,
ubyte4 *  eapRespLen 
)

This function builds a PEAP packet from the specified encrypted second stage payload, prepending the header and performing any required fragmentation, and returns the resultant packet through the eapResponse parameter. Typically your application passes the resulting packet to EAP for transmission from authenticator to peer or from peer to authenticator.

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEAP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_peap.h

Parameters
eapPEAPCbEAP-PEAP session handle returned from EAP_PEAPinitSession.
pktPointer to payload to include in the PEAP packet.
pktLenNumber of bytes of payload data (pkt).
eapResponseOn return, pointer to resultant PEAP response packet.
eapRespLenOn return, number of bytes in EAP response payload (eapResponse).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPgetKey()

MOC_EXTERN MSTATUS EAP_PEAPgetKey ( void *  eapCb,
ubyte *  key,
ubyte2  keyLen 
)

This function generates and returns a session's authentication keys.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEAP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_peap.h

Parameters
eapCbEAP-PEAP session handle returned from EAP_PEAPinitSession.
keyOn return, pointer to authentication keys.
keyLenNumber of bytes desired in the authentication key.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPgetSessionStatus()

MOC_EXTERN MSTATUS EAP_PEAPgetSessionStatus ( void *  eapPEAPCb,
ubyte *  eapSessionStatus 
)

This function returns (through the eapSessionStatus parameter) a session's status.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEAP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_peap.h

Parameters
eapPEAPCbEAP-PEAP session handle returned from EAP_PEAPinitSession.
eapSessionStatusOn return, pointer to session status structure.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPinitSession()

MOC_EXTERN MSTATUS EAP_PEAPinitSession ( ubyte *  appSessionCB,
ubyte **  eapPEAPSession,
EAP_PEAP_params eapPEAPparams 
)

This function creates and initializes an EAP-PEAP session based on the specified parameters, returning the resultant session handle through the eapPEAPSession parameter.

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEAP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_peap.h

Parameters
appSessionCBApplication session handle (cookie given by the application to identify the session).
eapPEAPSessionOn return, pointer to EAP-PEAP session handle.
eapPEAPparamsPointer to desired PEAP session parameters.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPreceiveLLPacket()

MOC_EXTERN MSTATUS EAP_PEAPreceiveLLPacket ( void *  eapPEAPCb,
ubyte *  pkt,
ubyte4  pktLen 
)

This function processes an encrypted PEAP payload (in the form of TLVs — type-length-values), performs any required fragmentation, and passes the packet to the second phase of the PEAP stack.

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEAP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_peap.h

Parameters
eapPEAPCbEAP-PEAP session handle returned from EAP_PEAPinitSession.
pktPointer to encrypted PEAP packet.
pktLenNumber of bytes of encrypted PEAP data (pkt).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPSendResultTlv()

MOC_EXTERN MSTATUS EAP_PEAPSendResultTlv ( ubyte *  eapHdl,
ubyte2  intResult 
)

This function builds a result TLV packet based on the specified intResult value and sends it to a peer.

Since
1.41
Version
1.41 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__
  • __ENABLE_MOCANA_EAP_PEAP__

eap_peap.h

Parameters
eapHdlEAP-PEAP session handle returned from EAP_PEAPinitSession.
intResult1 to specify a success TLV; any other value to specify a failure TLV.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPSetEapHdr()

MOC_EXTERN MSTATUS EAP_PEAPSetEapHdr ( void *  eapCB,
eapCode  code,
ubyte  id 
)

This function assigns the specified code and ID values to an inner EAP header. Typically this is used in PEAP v0 when the authenticator or peer has not sent the inner header information, which is required by the inner (second stage) EAP state machine for packet processing.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEAP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_peap.h

Parameters
eapCBEAP-PEAP session handle returned from EAP_PEAPinitSession.
codeAny of the eapCode enumerated values (defined in eap_proto.h).
idEAP request header ID (unique to this session).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPulAuthTransmit()

MOC_EXTERN MSTATUS EAP_PEAPulAuthTransmit ( ubyte *  eapSessionHdl,
ubyte4  instanceId,
eapMethodType  methodType,
eapCode  code,
eapMethodDecision  methodDecision,
eapMethodState  methodState,
ubyte *  eap_data,
ubyte4  eap_data_len 
)

This function (called by the second stage authenticator processing) transmits packets from the authenticator to the peer through the second stage EAP stack.

Since
1.41
Version
1.41 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__
  • __ENABLE_MOCANA_EAP_PEAP__

eap_peap.h

Parameters
eapSessionHdlEAP-PEAP session handle returned from EAP_PEAPinitSession.
instanceIdEAP instance ID returned from EAP_initInstance.
methodTypeeapMethodType enumerated value for the second phase (refer to eap_proto.h).
codeAny of the following eapCode enumerated values (see eap_proto.h):
  • EAP_CODE_REQUEST
  • EAP_CODE_SUCCESS
  • EAP_CODE_FAILURE
methodDecisioneapMethodDecision enumerated value (refer to eap_proto.h)
methodStateeapMethodState enumerated value (refer to eap_proto.h)
eap_dataPointer to EAP packet to be transmitted.
eap_data_lenNumber of bytes in EAP packet to be transmitted (eap_data).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h

◆ EAP_PEAPulPeerTransmit()

MOC_EXTERN MSTATUS EAP_PEAPulPeerTransmit ( ubyte *  eapSessionHdl,
ubyte4  instanceId,
eapMethodType  methodType,
eapCode  code,
eapMethodDecision  methodDecision,
eapMethodState  methodState,
ubyte *  eap_data,
ubyte4  eap_data_len 
)

This function (called by the second stage peer processing) transmits packets from the peer to the authenticator through the second stage EAP stack.

Since
1.41
Version
1.41 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_PEAP__

eap_peap.h

Parameters
eapSessionHdlEAP-PEAP session handle returned from EAP_PEAPinitSession.
instanceIdEAP instance ID returned from EAP_initInstance.
methodTypeeapMethodType enumerated value for the second phase (refer to eap_proto.h).
codeEAP_CODE_RESPONSE (an eapCode enumerated value, defined in eap_proto.h).
methodDecisioneapMethodDecision enumerated value (refer to eap_proto.h)
methodStateeapMethodState enumerated value (refer to eap_proto.h)
eap_dataPointer to EAP packet to be transmitted.
eap_data_lenNumber of bytes in EAP packet to be transmitted (eap_data).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap_peap.h