TrustCore SDK NanoSec API reference  version 7.0
eap_ttls.h
Go to the documentation of this file.
1 /*
2  * eap_ttls.h
3  *
4  * EAP TTLS Helper Functions
5  *
6  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
7  * Proprietary and Confidential Material.
8  *
9  */
10 
36 #ifndef __EAP_TTLS_H__
37 #define __EAP_TTLS_H__
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #if (defined(__ENABLE_MOCANA_EAP_PEER__) || defined(__ENABLE_MOCANA_EAP_AUTH__))
44 #if (defined(__ENABLE_MOCANA_EAP_TTLS__))
45 
47 typedef enum eapTTLSMethodType_e
48 {
49  EAP_METHOD_TYPE_PAP,
50  EAP_METHOD_TYPE_CHAP,
51  EAP_METHOD_TYPE_MSCHAP,
52  EAP_METHOD_TYPE_MSCHAPV2,
53  EAP_METHOD_TYPE_EAP
54 
55 } eapTTLSMethodType;
56 
57 
58 /*------------------------------------------------------------------*/
59 
80 typedef struct eap_ttls_params
81 {
119  MSTATUS (*ulTransmit)(ubyte * appSessionCB,ubyte * eapPkt,ubyte4 eapPktLen,
120  intBoolean encrypted);
121 
159  MSTATUS (*ul2ndStageReceive)(ubyte * app_session_handle, eapMethodType type,
160  eapCode code, ubyte id, ubyte * eap_data,
161  ubyte4 eap_data_len, ubyte * opaque_data);
162 
192  MSTATUS (*ulAuthTransmit)(ubyte *appSessionCB,
193  ubyte *eapTTLSCb, ubyte *pkt, ubyte4 pktLen);
194 
226  MSTATUS (*ulAuthResultTransmit)(ubyte * appSessionCB, eapAuthStatus authStatus);
227 
234  ubyte UserName[EAP_MAX_USER_LEN];
239  ubyte2 UserNameLen;
240 
247  ubyte Password[EAP_MAX_PASS_LEN];
252  ubyte2 PasswordLen;
253 
260  ubyte radiusSecret[EAP_MAX_PASS_LEN];
267 
272  ubyte4 instanceId; /* Phase 1 Instance Id */
273 
284  eapSessionType sessionType; /* (PEER/AUTH) */
285 
291  eapTTLSMethodType methodType; /* (PAP/CHAP/MSCHAP/MSCHAPv2/EAP) */
292 
299  sbyte4 connectionInstance; /* TLS COnnection INstance */
300 
308  ubyte* tls_con; /* TLS Connection INstance */
309 
316  ubyte4 authServerId; /* Radius Server Id */
317 
323  MOC_IP_ADDRESS myaddr; /* For Radius Request */
324 
330  ubyte version; /* ttls Version 0,1 */
335  ubyte pad2[3];
336 
338 
339 
340 /*------------------------------------------------------------------*/
341 
385 MOC_EXTERN MSTATUS EAP_TTLSinitSession(ubyte *appSessionCB,ubyte **eapTTLSSession, EAP_TTLS_params *eapTTLSparams);
386 
424 MOC_EXTERN MSTATUS EAP_TTLSdeleteSession(void *eapTTLSSession);
425 
426 #if (defined(__ENABLE_MOCANA_EAP_AUTH__))
427 
466 MOC_EXTERN MSTATUS EAP_TTLSProcessRadiusAuthResponse(void *eapCb,RADIUS_RqstRecord *pRadiusResp);
467 #endif
468 
512 MOC_EXTERN MSTATUS EAP_TTLSFormSendPacket(void *eapTTLSCb, ubyte *pkt, ubyte4 pktLen, ubyte **eapResponse, ubyte4 *eapRespLen);
513 
554 MOC_EXTERN MSTATUS EAP_TTLSreceiveLLPacket(void * eapTTLSCb,ubyte *pkt,ubyte4 pktLen);
555 
592 MOC_EXTERN MSTATUS EAP_TTLSgetSessionStatus(void * eapTTLSCb,ubyte *eapSessionStatus);
593 
634 MOC_EXTERN MSTATUS EAP_TTLSgetKey(void *eapCb,ubyte *key,ubyte2 keyLen);
635 
676 MOC_EXTERN MSTATUS EAP_TTLSulPeerTransmit(ubyte * eapSessionHdl, ubyte4 instanceId, eapMethodType methodType, eapCode code, eapMethodDecision methodDecision, eapMethodState methodState, ubyte * eap_data, ubyte4 eap_data_len);
677 
678 #if (defined(__ENABLE_MOCANA_INNER_APP__))
679 
718 MOC_EXTERN MSTATUS EAP_TTLSsendAlert(ubyte * eapSessionHdl,sbyte4 alertClass,sbyte4 alertId);
719 
763 MOC_EXTERN MSTATUS EAP_TTLSSendData(ubyte *ttls_connection,
764  ubyte *data, ubyte4 len,
765  InnerAppType innerApp,ubyte **eapRespData, ubyte4 *eapRespLen);
766 #endif /*(defined(__ENABLE_MOCANA_INNER_APP__)) */
767 
768 #endif /* ((defined(__ENABLE_MOCANA_EAP_TTLS__) */
769 #endif /* ((defined(__ENABLE_MOCANA_EAP_PEER__) || defined(__ENABLE_MOCANA_EAP_AUTH__)) */
770 
771 #ifdef __cplusplus
772 }
773 #endif
774 
775 #endif /* __EAP_TTLS_H__ */
sbyte4 connectionInstance
TLS connection's session ID.
Definition: eap_ttls.h:299
MOC_EXTERN MSTATUS EAP_TTLSulPeerTransmit(ubyte *eapSessionHdl, ubyte4 instanceId, eapMethodType methodType, eapCode code, eapMethodDecision methodDecision, eapMethodState methodState, ubyte *eap_data, ubyte4 eap_data_len)
Transmit (send) an EAP response to the authenticator.
MOC_EXTERN MSTATUS EAP_TTLSProcessRadiusAuthResponse(void *eapCb, RADIUS_RqstRecord *pRadiusResp)
Process a received RADIUS packet and respond appropriately.
MOC_EXTERN MSTATUS EAP_TTLSsendAlert(ubyte *eapSessionHdl, sbyte4 alertClass, sbyte4 alertId)
Build a TLS Alert Message to be sent over EAP.
ubyte2 PasswordLen
Number of bytes in the inner method password (Password).
Definition: eap_ttls.h:252
MOC_IP_ADDRESS myaddr
NAS (network authentication server) IP address.
Definition: eap_ttls.h:323
ubyte * tls_con
EAP_TLS connection control block.
Definition: eap_ttls.h:308
ubyte4 authServerId
RADIUS server ID; used by the authenticator to send a RADIUS packet to the RADIUS server...
Definition: eap_ttls.h:316
MOC_EXTERN MSTATUS EAP_TTLSSendData(ubyte *ttls_connection, ubyte *data, ubyte4 len, InnerAppType innerApp, ubyte **eapRespData, ubyte4 *eapRespLen)
Send data using the TLS inner application extension.
ubyte4 instanceId
Phase 1 instance ID.
Definition: eap_ttls.h:272
MOC_EXTERN MSTATUS EAP_TTLSgetSessionStatus(void *eapTTLSCb, ubyte *eapSessionStatus)
Get an EAP-TTLS session's session status.
eapSessionType sessionType
Type of session: EAP_SESSION_TYPE_PEER or EAP_SESSION_TYPE_AUTHENTICATOR.
Definition: eap_ttls.h:284
MOC_EXTERN MSTATUS EAP_TTLSFormSendPacket(void *eapTTLSCb, ubyte *pkt, ubyte4 pktLen, ubyte **eapResponse, ubyte4 *eapRespLen)
Build the second stage payload.
MOC_EXTERN MSTATUS EAP_TTLSreceiveLLPacket(void *eapTTLSCb, ubyte *pkt, ubyte4 pktLen)
Process second stage packets.
ubyte2 UserNameLen
Number of bytes in the inner method user name (UserName).
Definition: eap_ttls.h:239
MOC_EXTERN MSTATUS EAP_TTLSinitSession(ubyte *appSessionCB, ubyte **eapTTLSSession, EAP_TTLS_params *eapTTLSparams)
Create and initialize a second stage TTLS session as a peer or passthrough authenticator.
ubyte version
TTLS version: 0 or 1.
Definition: eap_ttls.h:330
Configuration settings and callback function pointers for EAP-TTLS sessions.
Definition: eap_ttls.h:80
MOC_EXTERN MSTATUS EAP_TTLSgetKey(void *eapCb, ubyte *key, ubyte2 keyLen)
Generate a session key.
ubyte2 radiusSecretLen
Number of bytes in the RADIUS shared secret (radiusSecret).
Definition: eap_ttls.h:266
MOC_EXTERN MSTATUS EAP_TTLSdeleteSession(void *eapTTLSSession)
Delete a second (upper) stage EAP TTLS session.
eapTTLSMethodType methodType
Method type used by a peer.
Definition: eap_ttls.h:291