TrustCore SDK NanoSec API reference  version 7.0
eap_leap.h
Go to the documentation of this file.
1 /*
2  * eap_leap.h
3  *
4  * EAP LEAP Helper Functions
5  *
6  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
7  * Proprietary and Confidential Material.
8  *
9  */
10 
32 #ifndef __EAP_LEAP_H__
33 #define __EAP_LEAP_H__
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #if (defined(__ENABLE_MOCANA_EAP_PEER__) || defined(__ENABLE_MOCANA_EAP_AUTH__))
40 
41 #define LEAP_CHALLENGE_LEN (8)
42 #define LEAP_PW_HASH_HASH_LEN (16)
43 #define LEAP_KEY_LEN (16)
44 #define LEAP_CHALLENGE_RESPONSE_LEN (24)
45 #define LEAP_HDR_LEN (3)
46 #define LEAP_VERSION (0x01)
47 
48 
49 /*------------------------------------------------------------------*/
50 
52 typedef enum eapLeapState_e
53 {
54  /* Peer States */
55  LEAP_PEER_INIT,
56  LEAP_PEER_WAIT_SUCCESS,
57  LEAP_PEER_CHALLENGE_SENT,
58  LEAP_PEER_DONE,
59 
60  /* Auth State */
61  LEAP_AUTH_INIT,
62  LEAP_AUTH_CHALLENGE_SENT,
63  LEAP_AUTH_WAIT_CHALLENGE,
64  LEAP_AUTH_DONE
65 
66 } eapLeapState;
67 
69 typedef struct eapLeapCb_s
70 {
71  void *appSessionHdl;
72  ubyte pw_hash_hash[LEAP_PW_HASH_HASH_LEN];
73  ubyte peerChallenge[LEAP_CHALLENGE_LEN];
74  ubyte authChallenge[LEAP_CHALLENGE_LEN];
75  ubyte peerResponse[LEAP_CHALLENGE_RESPONSE_LEN];
76  ubyte authResponse[LEAP_CHALLENGE_RESPONSE_LEN];
77  eapLeapState state;
78 
79 } eapLeapCb_t;
80 
81 
82 /*------------------------------------------------------------------*/
83 
122 MOC_EXTERN MSTATUS EAP_LEAPinitSession(void *appCb, void **p_eapLeapCb, ubyte sessionType);
123 
166 MOC_EXTERN MSTATUS EAP_LEAP_buildChallenge(eapLeapCb_t *leapCb, ubyte sessionType, ubyte *identity, ubyte2 identityLen, ubyte **eapRespData, ubyte4 *eapRespLen);
167 
218 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);
219 
265 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);
266 
303 MOC_EXTERN MSTATUS EAP_LEAP_getKey (void *eapLeapCb,
304  ubyte *key, ubyte4 keyLen /* 16 Bytes */);
305 
335 MOC_EXTERN MSTATUS EAP_LEAPdeleteSession(void *p_eapLeapCb);
336 
337 #endif /* ((defined(__ENABLE_MOCANA_EAP_PEER__) || defined(__ENABLE_MOCANA_EAP_AUTH__)) */
338 
339 #ifdef __cplusplus
340 }
341 #endif
342 
343 #endif /* __EAP_LEAP_H__ */
344 
MOC_EXTERN MSTATUS EAP_LEAPdeleteSession(void *p_eapLeapCb)
Delete an EAP-LEAP session.
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.
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.
MOC_EXTERN MSTATUS EAP_LEAP_buildChallenge(eapLeapCb_t *leapCb, ubyte sessionType, ubyte *identity, ubyte2 identityLen, ubyte **eapRespData, ubyte4 *eapRespLen)
Generate a LEAP challenge packet.
MOC_EXTERN MSTATUS EAP_LEAP_getKey(void *eapLeapCb, ubyte *key, ubyte4 keyLen)
Get EAP-LEAP session's shared key.
MOC_EXTERN MSTATUS EAP_LEAPinitSession(void *appCb, void **p_eapLeapCb, ubyte sessionType)
Create and initialize an EAP-LEAP session.