6 * Implementation of the Server State Machine (SSM)
9 * Copyright (C) France Télécom R&D (DR&D/MAPS/NSS)
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 * Copyright 2006 The FreeRADIUS server project
29 #ifndef _EAP_PSK_SSM_H
30 #define _EAP_PSK_SSM_H
32 #include <freeradius-devel/ident.h>
33 RCSIDH(eap_psk_ssm_h, "$Id$")
38 #if defined(__cplusplus)
46 INIT, // the server state machine starts in the INIT state
52 // information which must be kept during the EAP-PSK session
53 typedef struct psk_session_t {
54 PSK_STATE state; // state of the server state machine
55 unsigned char rand_s[PSK_RANDOM_NUMBER_SIZE]; // random number generated by the server
56 unsigned char *id_p; // peer identity
57 unsigned char ak[PSK_AK_SIZE]; // authentication key
58 unsigned char kdk[PSK_KDK_SIZE]; // derivation key
59 unsigned char tek[PSK_TEK_SIZE]; // TEK key
60 unsigned char msk[PSK_MSK_SIZE]; // MSK key
61 unsigned char emsk[PSK_EMSK_SIZE]; // EMSK key
62 unsigned int nbRetry; // the current number of request re emissions
63 unsigned long int pChannelReplayCounter; // the p-channel replay counter
64 unsigned char extType; // the extension type if evolved authentication is used, else 0
65 unsigned char authStatus; // the latest R flag sent by the server
66 unsigned char isSupportedExt; // 0 if the peer doesn't support the specified extension
71 *@memo this function is the entry point of the server state machine
72 *@param conf, pointer to the current configuration of EAP-PSK
73 *@param session, pointer to a structure which contains information session
74 *@param recvPacket, pointer to a received EAP_PACKET
75 *@param sentPacket, pointer to the EAP_PACKET to send
76 *@return 0 if an error has occured
78 int pskProcess(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP_PACKET *sentPacket);
82 *@memo this function corresponds to the first state of the server state machine
83 *@param conf, pointer to the current configuration of EAP-PSK
84 *@param session, pointer to a structure which contains information session
85 *@param sentPacket, pointer to the EAP_PACKET to send
86 *@return 0 if an error has occured
88 int pskInit(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *sentPacket);
92 *@memo this function corresponds to the second state of the server state machine
93 *@param conf, pointer to the current configuration of EAP-PSK
94 *@param session, pointer to a structure which contains information session
95 *@param recvPacket, pointer to a received EAP_PACKET
96 *@param sentPacket, pointer to the EAP_PACKET to send
97 *@return 0 if an error has occured
99 int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP_PACKET *sentPacket);
103 *@memo this function corresponds to the third state of the server state machine
104 *@param conf, pointer to the current configuration of EAP-PSK
105 *@param session, pointer to a structure which contains information session
106 *@param recvPacket, pointer to a received EAP_PACKET
107 *@param sentPacket, pointer to the EAP_PACKET to send
108 *@return 0 if no error has occured
110 int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP_PACKET *sentPacket);
114 *@memo this function contains the extension to EAP-PSK
115 *@param conf, pointer to the current configuration of EAP-PSK
116 *@param session, pointer to a structure which contains information session
117 *@param receivedStatus, the latest R flag sent by the peer
118 *@param dataIn, pointer to the received data
119 *@param sizeDataIn, size of the received data
120 *@param dataOut, pointer to a pointer that points data to send
121 *@param sizeDataOut, pointer to the size of data to be sent (sizeDataOut must be at most equal to EXT_PAYLAOD_MAX_LEN)
122 *@return 0 if an error has occured
124 int pskExtension(PSK_CONF *conf, PSK_SESSION *session, unsigned short receivedStatus, void *dataIn, int sizeDataIn, void **dataOut, int *sizeDataOut);
128 *@memo this function frees an existing session from memory
129 *@param opaque, pointer to a structure which contains information session
131 void pskFreeSession(void *opaque);
135 #if defined(__cplusplus)
139 #endif /*_EAP_PSK_SSM_H*/