TrustCore SDK NanoSec API reference  version 7.0
EAP-LEAP Functions

Provides EAP-LEAP (EAP-lightweight EAP) authentication. More...

Functions

MOC_EXTERN MSTATUS EAP_LEAP_buildChallenge (eapLeapCb_t *leapCb, ubyte sessionType, ubyte *identity, ubyte2 identityLen, ubyte **eapRespData, ubyte4 *eapRespLen)
 Generate a LEAP challenge packet. More...
 
MOC_EXTERN MSTATUS EAP_LEAP_getKey (void *eapLeapCb, ubyte *key, ubyte4 keyLen)
 Get EAP-LEAP session's shared key. More...
 
MOC_EXTERN MSTATUS EAP_LEAP_processAuth (void *eapLeapCb, ubyte code, ubyte *data, ubyte4 len, ubyte *passwd, ubyte2 passwdLen, eapCode *p_sendCode, ubyte **eapRespData, ubyte4 *eapRespLen)
 Process a LEAP packet received by an authenticator. More...
 
MOC_EXTERN MSTATUS EAP_LEAP_processPeer (void *eapLeapCb, ubyte code, ubyte *data, ubyte4 len, ubyte *passwd, ubyte2 passwdLen, ubyte *identity, ubyte2 identityLen, eapCode *p_sendCode, ubyte **pKey, ubyte **eapRespData, ubyte4 *eapRespLen)
 Process a LEAP packet received by a peer. More...
 
MOC_EXTERN MSTATUS EAP_LEAPdeleteSession (void *p_eapLeapCb)
 Delete an EAP-LEAP session. More...
 
MOC_EXTERN MSTATUS EAP_LEAPinitSession (void *appCb, void **p_eapLeapCb, ubyte sessionType)
 Create and initialize an EAP-LEAP session. More...
 

Detailed Description

Function Documentation

◆ EAP_LEAP_buildChallenge()

MOC_EXTERN MSTATUS EAP_LEAP_buildChallenge ( eapLeapCb_t *  leapCb,
ubyte  sessionType,
ubyte *  identity,
ubyte2  identityLen,
ubyte **  eapRespData,
ubyte4 *  eapRespLen 
)

This function (which can be called by the authenticator or peer) builds the initial LEAP challenge, returning it through the eapRespData parameter. Additionally, this function updates the session handle's state (to LEAP_AUTH_CHALLENGE_SENT or LEAP_PEER_CHALLENGE_SENT), eliminating the need to call an additional function to manage the state flag.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_LEAP__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_leap.h

Parameters
leapCbEAP-LEAP session handle returned from EAP_LEAPinitSession.
sessionTypeOne of the following eapSessionType enumerated values: EAP_SESSION_TYPE_PEER or EAP_SESSION_TYPE_AUTHENTICATOR (see eap_proto.h).
identityPointer to peer identity (sent during identity request/response).
identityLenNumber of bytes in peer identity string (identity).
eapRespDataOn return, pointer to response packet.
eapRespLenOn return, pointer to number of bytes in response packet (eapRespData).
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_leap.h

◆ EAP_LEAP_getKey()

MOC_EXTERN MSTATUS EAP_LEAP_getKey ( void *  eapLeapCb,
ubyte *  key,
ubyte4  keyLen 
)

This function retrieves the EAP-LEAP session's shared key.

Warning
Before calling this function, be sure that the buffer pointed to by the key parameter is at least LEAP_KEY_LEN bytes (see eap_leap.h); otherwise buffer overflow may occur.
Since
2.45
Version
2.45 and later

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

  • __ENABLE_MOCANA_EAP_LEAP__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_leap.h

Parameters
eapLeapCbEAP-LEAP session handle returned from EAP_LEAPinitSession.
keyPointer to allocated buffer that on return contains the shared key. (The allocated buffer must contain at least LEAP_KEY_LEN bytes; otherwise buffer overflow may occur.)
keyLen(Reserved for future use.)
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_leap.h

◆ EAP_LEAP_processAuth()

MOC_EXTERN MSTATUS EAP_LEAP_processAuth ( void *  eapLeapCb,
ubyte  code,
ubyte *  data,
ubyte4  len,
ubyte *  passwd,
ubyte2  passwdLen,
eapCode *  p_sendCode,
ubyte **  eapRespData,
ubyte4 *  eapRespLen 
)

This function processes a LEAP packet received by an authenticator, and returns the EAP code to be sent in reply through the p_sendCode parameter, and the response packet through the eapRespData parameter. (The response packet can subsequently be transmitted by calling EAP_ulTransmit.)

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_LEAP__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_leap.h

Parameters
eapLeapCbEAP-LEAP session handle returned from EAP_LEAPinitSession.
codeAny of the eapCode enumerated values (see eap_proto.h).
dataPointer to payload to process, in the format <Type, LEAP packet>
lenNumber of bytes in payload to process (data).
passwdPointer to password of the identity (EAP-LEAP session) being authenticated.
passwdLenNumber of bytes in password (passwd).
p_sendCodeOn return, pointer to EAP code to send in EAP response packet.
eapRespDataOn return, pointer to LEAP response data packet.
eapRespLenOn return, pointer to number of bytes in LEAP response packet (eapRespData).
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_leap.h

◆ EAP_LEAP_processPeer()

MOC_EXTERN MSTATUS EAP_LEAP_processPeer ( void *  eapLeapCb,
ubyte  code,
ubyte *  data,
ubyte4  len,
ubyte *  passwd,
ubyte2  passwdLen,
ubyte *  identity,
ubyte2  identityLen,
eapCode *  p_sendCode,
ubyte **  pKey,
ubyte **  eapRespData,
ubyte4 *  eapRespLen 
)

This function processes a LEAP packet received by a peer, and returns the EAP code to be sent in reply through the p_sendCode parameter, the key (if any) through the pKey parameter, and the response packet through the eapRespData parameter. (The response packet can subsequently be transmitted by calling EAP_ulTransmit.)

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_LEAP__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_leap.h

Parameters
eapLeapCbEAP-LEAP session handle returned from EAP_LEAPinitSession.
codeAny of the eapCode enumerated values (see eap_proto.h).
dataPointer to payload to process, in the format <Type, LEAP packet>
lenNumber of bytes in payload to process (data).
passwdPointer to password of the identity (EAP-LEAP session) being authenticated.
passwdLenNumber of bytes in password (passwd).
identityPointer to peer identity (sent during identity request/response).
identityLenNumber of bytes in peer identity string (identity).
p_sendCodeOn return, pointer to EAP code to send in EAP response packet.
pKeyOn return, pointer to generated session key (if any) based on MSCHAP encryption.
eapRespDataOn return, pointer to LEAP response data packet.
eapRespLenOn return, pointer to number of bytes in LEAP response packet (eapRespData).
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_leap.h

◆ EAP_LEAPdeleteSession()

MOC_EXTERN MSTATUS EAP_LEAPdeleteSession ( void *  p_eapLeapCb)

This function frees (releases) EAP LEAP resources and deletes an EAP-LEAP session.

Since
2.45
Version
2.45 and later

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

  • __ENABLE_MOCANA_EAP_LEAP__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_leap.h

Parameters
p_eapLeapCbEAP-LEAP session handle returned from EAP_LEAPinitSession.
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_leap.h

◆ EAP_LEAPinitSession()

MOC_EXTERN MSTATUS EAP_LEAPinitSession ( void *  appCb,
void **  p_eapLeapCb,
ubyte  sessionType 
)

This function creates and initializes an EAP-LEAP session using the specified parameters. The session handle is returned through the p_eapLeapCb parameter, and should be passed in all subsequent function calls for the EAP-LEAP 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_LEAP__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_leap.h

Parameters
appCbApplication session handle (cookie given by the application to identify the session).
p_eapLeapCbOn return, pointer to EAP-LEAP session handle.
sessionTypeEither of the following eapSessionType enumerated values (defined in eap_proto.h):

  • EAP_SESSION_TYPE_PEER
  • EAP_SESSION_TYPE_AUTHENTICATOR
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_leap.h