TrustCore SDK NanoSec API reference  version 7.0
EAP-PSK Functions

Provides EAP-PSK (EAP-Pre-Shared Key) authentication. More...

Functions

MOC_EXTERN MSTATUS EAP_PSKAuthRequestFirst (ubyte *eapPSKHdl, ubyte *rand_s, ubyte *id_s, ubyte2 id_s_len, ubyte **request, ubyte4 *requestLen)
 Forms the First Packet to be sent by the Authenticator. More...
 
MOC_EXTERN MSTATUS EAP_PSKAuthRequestThird (ubyte *eapPSKHdl, eapPSKResultInd resultInd, ubyte *ext, ubyte2 extLen, ubyte id, ubyte **request, ubyte4 *requestLen)
 Forms the third request packet to be sent by the Authenticator. More...
 
MOC_EXTERN MSTATUS EAP_PSKDeleteSession (ubyte *eapPSKHdl)
 Deletes the EAP PSK Session. More...
 
MOC_EXTERN MSTATUS EAP_PSKgetEXT (ubyte *eapPSKHdl, ubyte **ext, ubyte2 *extLen)
 Returns the EXTENSION data received. More...
 
MOC_EXTERN MSTATUS EAP_PSKgetID_P (ubyte *eapPSKHdl, ubyte **id_p, ubyte2 *id_p_len)
 Returns the ID_P received from the Peer. More...
 
MOC_EXTERN MSTATUS EAP_PSKgetID_S (ubyte *eapPSKHdl, ubyte **id_s, ubyte2 *id_s_len)
 Returns the ID_S received from the Authenticator. More...
 
MOC_EXTERN MSTATUS EAP_PSKgetKeys (ubyte *eapPSKHdl, ubyte **tek, ubyte **msk, ubyte **emsk)
 Returns the generated session keys. More...
 
MOC_EXTERN MSTATUS EAP_PSKgetResultInd (ubyte *eapPSKHdl, eapPSKResultInd *resInd)
 Returns the result indication received. More...
 
MOC_EXTERN MSTATUS EAP_PSKInitSession (ubyte *appSessionHdl, ubyte **eapPSKHdl, eapPSKConfig eapPSKCfg)
 Inits the EAP PSK Session. More...
 
MOC_EXTERN MSTATUS EAP_PSKKeySetup (ubyte *eapPSKHdl, ubyte *psk)
 Generates the AK/KDK Based upon PSK. More...
 
MOC_EXTERN MSTATUS EAP_PSKPeerReplyFourth (ubyte *eapPSKHdl, eapPSKResultInd resultInd, ubyte *ext, ubyte2 extLen, ubyte id, ubyte **reply, ubyte4 *replyLen)
 Forms the fourth reply packet to be sent by the Peer. More...
 
MOC_EXTERN MSTATUS EAP_PSKPeerReplySecond (ubyte *eapPSKHdl, ubyte *rand_p, ubyte *id_p, ubyte2 id_p_len, ubyte **reply, ubyte4 *replyLen)
 Forms the Second Packet to be sent by the Peer. More...
 
MOC_EXTERN MSTATUS EAP_PSKProcessMsg (ubyte *eapPSKHdl, ubyte *data, ubyte4 dataLen, ubyte id)
 Processes the incoming EAP PSK data message. More...
 

Detailed Description

Function Documentation

◆ EAP_PSKAuthRequestFirst()

MOC_EXTERN MSTATUS EAP_PSKAuthRequestFirst ( ubyte *  eapPSKHdl,
ubyte *  rand_s,
ubyte *  id_s,
ubyte2  id_s_len,
ubyte **  request,
ubyte4 *  requestLen 
)

Forms the First Packet to be sent by the Authenticator.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_PSK__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
rand_s16 Byte Rand Generated by the Authenticator.
id_sID of the Authenticator to be sent.
id_s_lenNumber of bytes in id_s.
requestPointer to the buffer where the request is stored. Application needs to delete it after use.
requestLenRequest buffer length (request).
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKAuthRequestThird()

MOC_EXTERN MSTATUS EAP_PSKAuthRequestThird ( ubyte *  eapPSKHdl,
eapPSKResultInd  resultInd,
ubyte *  ext,
ubyte2  extLen,
ubyte  id,
ubyte **  request,
ubyte4 *  requestLen 
)

Forms the Third request to be sent by the Authenticator after receving the second packet from the 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_PSK__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
resultIndResult indication to be sent to the Peer.
extAny EXTENSION data to be sent to the Peer.
extLenEXTENSION data Length (ext).
idEAP ID from the received EAP header for calculation of channel.
requestPointer to the buffer where the request is stored. Application needs to delete it after use.
requestLenRequest Buffer Length (request).
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKDeleteSession()

MOC_EXTERN MSTATUS EAP_PSKDeleteSession ( ubyte *  eapPSKHdl)

Deletes the EAP PSK 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_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlPointer to EAP PSK Session Handle.
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.
See also
EAP_PSKInitSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKgetEXT()

MOC_EXTERN MSTATUS EAP_PSKgetEXT ( ubyte *  eapPSKHdl,
ubyte **  ext,
ubyte2 *  extLen 
)

Returns the EXTENSION data received.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
extOn return, pointer to the EXTENSION data.
extLenOn return, pointer to the length of ext.
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKgetID_P()

MOC_EXTERN MSTATUS EAP_PSKgetID_P ( ubyte *  eapPSKHdl,
ubyte **  id_p,
ubyte2 *  id_p_len 
)

Returns the ID_P received from the Peer.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
id_pOn return, pointer to the ID_P.
id_p_lenOn return, pointer to the length of id_p.
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKgetID_S()

MOC_EXTERN MSTATUS EAP_PSKgetID_S ( ubyte *  eapPSKHdl,
ubyte **  id_s,
ubyte2 *  id_s_len 
)

Returns the ID_S received from the 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_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
id_sOn return, pointer to the ID_S.
id_s_lenOn return, pointer to the length of id_s.
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKgetKeys()

MOC_EXTERN MSTATUS EAP_PSKgetKeys ( ubyte *  eapPSKHdl,
ubyte **  tek,
ubyte **  msk,
ubyte **  emsk 
)

Returns the generated keys for the 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_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
tekOn return, pointer to the TEK (16 bytes).
mskOn return, pointer to the MSK (64 Bytes).
emskOn return, pointer to the EMSK (64bytes).
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKgetResultInd()

MOC_EXTERN MSTATUS EAP_PSKgetResultInd ( ubyte *  eapPSKHdl,
eapPSKResultInd *  resInd 
)

Returns the result indication received.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
resIndOn return, pointer to the result indication.
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKInitSession()

MOC_EXTERN MSTATUS EAP_PSKInitSession ( ubyte *  appSessionHdl,
ubyte **  eapPSKHdl,
eapPSKConfig  eapPSKCfg 
)

Inititializes the EAP PSK Session and Returns the EAP PSK Handle.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
appSessionHdlApplication Session Handle.
eapPSKHdlPointer to EAP PSK Session Handle.
eapPSKCfgEAP PSK Config params, such as session type, callback function pointer.
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.
See also
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKKeySetup()

MOC_EXTERN MSTATUS EAP_PSKKeySetup ( ubyte *  eapPSKHdl,
ubyte *  psk 
)

Generate AK and KDK based upon PSK for the 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_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
pskPointer to the 16 Byte PSK.
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKPeerReplyFourth()

MOC_EXTERN MSTATUS EAP_PSKPeerReplyFourth ( ubyte *  eapPSKHdl,
eapPSKResultInd  resultInd,
ubyte *  ext,
ubyte2  extLen,
ubyte  id,
ubyte **  reply,
ubyte4 *  replyLen 
)

Forms the fourth reply to be sent by the Peer after receving the third Packet from the Authenticator.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_PSK__
  • __ENABLE_MOCANA_EAP_PEER__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
resultIndResult Indication to be sent to the Authenticator.
extAny EXTENSION data to be sent to the Authenticator.
extLenEXTENSION data Length (ext).
idEAP ID from the received EAP header for calculation of channel.
replyPointer to the buffer where the reply is stored. Application needs to delete it after use.
replyLenReply buffer length (reply).
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKPeerReplySecond()

MOC_EXTERN MSTATUS EAP_PSKPeerReplySecond ( ubyte *  eapPSKHdl,
ubyte *  rand_p,
ubyte *  id_p,
ubyte2  id_p_len,
ubyte **  reply,
ubyte4 *  replyLen 
)

Forms the Second Reply to be sent by the Peer after receving the first request from the Authenticator.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_PSK__
  • __ENABLE_MOCANA_EAP_PEER__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
rand_p16 Byte random number generated by the Peer.
id_pID of the Peer to be sent.
id_p_lenNumber of bytes in id_p.
replyPointer to the buffer where the reply is stored. Application needs to delete it after use.
replyLenReply buffer length (reply).
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKAuthRequestFirst
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h

◆ EAP_PSKProcessMsg()

MOC_EXTERN MSTATUS EAP_PSKProcessMsg ( ubyte *  eapPSKHdl,
ubyte *  data,
ubyte4  dataLen,
ubyte  id 
)

Processes the incoming EAP PSK message and verifies the responses and informs the application about the state change and status.

Since
1.41
Version
1.41 and later

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

  • __ENABLE_MOCANA_EAP_PSK__

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

  • __ENABLE_MOCANA_EAP_PEER__
  • __ENABLE_MOCANA_EAP_AUTH__

eap_psk.h

Parameters
eapPSKHdlEAP PSK Session Handle.
dataIncoming PSK data.
dataLenNumber of bytes in data.
idEAP ID from the received EAP header for calculation of channel.
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.
See also
EAP_PSKInitSession
EAP_PSKDeleteSession
EAP_PSKPeerReplySecond
EAP_PSKAuthRequestThird
EAP_PSKPeerReplyFourth

eap_psk.h