TrustCore SDK NanoSec API reference  version 7.0
eap_srp.h
Go to the documentation of this file.
1 /*
2  * eap_srp.h
3  *
4  * EAP SRP Helper Functions
5  *
6  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
7  * Proprietary and Confidential Material.
8  *
9  */
10 
32 #ifndef __EAP_SRP_H__
33 #define __EAP_SRP_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 EAP_SRP_CHALLENGE 1
42 #define EAP_SRP_CLIENT_KEY 1
43 #define EAP_SRP_SERVER_KEY 2
44 #define EAP_SRP_CLIENT_VALIDATOR 2
45 #define EAP_SRP_SERVER_VALIDATOR 3
46 #define EAP_SRP_SUBTYPE3_RESPONSE 3
47 #define EAP_SRP_LIGHTWEIGHT_RECHALLENGE 4
48 
49 #define EAP_SRP_SALTLEN 10
50 #define EAP_SRP_RECHALLENGE_LEN 10
51 
52 
53 /*------------------------------------------------------------------*/
54 
56 typedef enum eapSrpAuthState_e
57 {
58  EAPSRP_AUTH_STATE_NONE,
59  EAPSRP_AUTH_STATE_CHALLENGE,
60  EAPSRP_AUTH_STATE_SERVER_KEY,
61  EAPSRP_AUTH_STATE_SERVER_VALIDATOR,
62  EAPSRP_AUTH_STATE_SUCCESS,
63  EAPSRP_AUTH_STATE_FAILURE,
64  EAPSRP_AUTH_STATE_RECHALLENGE
65 
66 } eapSrpAuthState_t;
67 
69 typedef enum eapSrpPeerState_e
70 {
71  EAPSRP_PEER_STATE_NONE,
72  EAPSRP_PEER_STATE_CLIENT_KEY,
73  EAPSRP_PEER_STATE_CLIENT_VALIDATOR,
74  EAPSRP_PEER_STATE_SUBTYPE3_RESPONSE
75 
76 } eapSrpPeerState_t;
77 
78 
79 /*------------------------------------------------------------------*/
80 
123 MOC_EXTERN MSTATUS EAP_SRPprocessPeer(ubyte *appSessionHdl, ubyte *eapSessionHdl, ubyte4 instanceId, ubyte id, ubyte *data, ubyte4 len, ubyte *username, ubyte4 usernameLen, ubyte *passwordString, ubyte4 passLen, ubyte **eapRespData, ubyte4 *eapRespLen);
124 
171 MOC_EXTERN MSTATUS EAP_SRPprocessAuth(ubyte *appSessionHdl, ubyte *eapSessionHdl, ubyte4 instanceId, ubyte id, ubyte *data, ubyte4 len, ubyte *passwordString,ubyte4 passLen, ubyte **eapRespData, ubyte4 *eapRespLen, ubyte *code);
172 
215 MOC_EXTERN MSTATUS EAP_SRPbuildChallenge(ubyte *eapSessionHdl, ubyte4 instanceId, ubyte *username, ubyte4 usernameLen, ubyte *password, ubyte4 passwordLen, eapMethodType *method_type, ubyte **reqData, ubyte4 *reqLen);
216 
255 MOC_EXTERN MSTATUS EAP_SRPbuildLightweightChallenge(ubyte *eapSessionHdl, ubyte4 instanceId, eapMethodType *method_type, ubyte **reqData, ubyte4 *reqLen);
256 
257 #endif /* ((defined(__ENABLE_MOCANA_EAP_PEER__) || defined(__ENABLE_MOCANA_EAP_AUTH__)) */
258 
259 #ifdef __cplusplus
260 }
261 #endif
262 
263 #endif /* __EAP_SRP_H__ */
264 
MOC_EXTERN MSTATUS EAP_SRPbuildChallenge(ubyte *eapSessionHdl, ubyte4 instanceId, ubyte *username, ubyte4 usernameLen, ubyte *password, ubyte4 passwordLen, eapMethodType *method_type, ubyte **reqData, ubyte4 *reqLen)
Generate an SRP challenge packet.
MOC_EXTERN MSTATUS EAP_SRPprocessAuth(ubyte *appSessionHdl, ubyte *eapSessionHdl, ubyte4 instanceId, ubyte id, ubyte *data, ubyte4 len, ubyte *passwordString, ubyte4 passLen, ubyte **eapRespData, ubyte4 *eapRespLen, ubyte *code)
Get the EAP payload from a message received by an SRP authenticator.
MOC_EXTERN MSTATUS EAP_SRPbuildLightweightChallenge(ubyte *eapSessionHdl, ubyte4 instanceId, eapMethodType *method_type, ubyte **reqData, ubyte4 *reqLen)
Build an EAP-SRP lightweight challenge packet for reauthentication.
MOC_EXTERN MSTATUS EAP_SRPprocessPeer(ubyte *appSessionHdl, ubyte *eapSessionHdl, ubyte4 instanceId, ubyte id, ubyte *data, ubyte4 len, ubyte *username, ubyte4 usernameLen, ubyte *passwordString, ubyte4 passLen, ubyte **eapRespData, ubyte4 *eapRespLen)
Get the EAP payload from an SRP-SHA1 message received by an SRP peer.