Commit 8230f94f authored by Frédéric Leroy's avatar Frédéric Leroy

UE/EMM: move _authentication_data to nas_user_t

parent c56d7c9b
This diff is collapsed.
#ifndef _AUTHENTICATION_H
#define _AUTHENTICATION_H
/*
* Internal data used for authentication procedure
*/
typedef struct {
uint8_t rand[AUTH_RAND_SIZE]; /* Random challenge number */
uint8_t res[AUTH_RES_SIZE]; /* Authentication response */
uint8_t ck[AUTH_CK_SIZE]; /* Ciphering key */
uint8_t ik[AUTH_IK_SIZE]; /* Integrity key */
#define AUTHENTICATION_T3410 0x01
#define AUTHENTICATION_T3417 0x02
#define AUTHENTICATION_T3421 0x04
#define AUTHENTICATION_T3430 0x08
unsigned char timers; /* Timer restart bitmap */
#define AUTHENTICATION_COUNTER_MAX 3
unsigned char mac_count:2; /* MAC failure counter (#20) */
unsigned char umts_count:2; /* UMTS challenge failure counter (#26) */
unsigned char sync_count:2; /* Sync failure counter (#21) */
} authentication_data_t;
#endif
......@@ -98,7 +98,7 @@ int EmmDeregistered(nas_user_t *user, const emm_reg_t *evt)
/* Delete the authentication data RAND and RES */
// FIXME REVIEW
rc = emm_proc_authentication_delete();
rc = emm_proc_authentication_delete(user);
if (rc != RETURNok) {
LOG_FUNC_RETURN (rc);
......
......@@ -86,7 +86,7 @@ int EmmNull(nas_user_t *user, const emm_reg_t *evt)
assert(emm_fsm_get_status(user) == EMM_NULL);
/* Delete the authentication data RAND and RES */
rc = emm_proc_authentication_delete();
rc = emm_proc_authentication_delete(user);
if (rc != RETURNok) {
LOG_FUNC_RETURN (rc);
......
......@@ -158,7 +158,7 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
ksi);
/* Delete any previously stored RAND and RES and stop timer T3416 */
(void) emm_proc_authentication_delete();
(void) emm_proc_authentication_delete(user);
/*
* Check the replayed UE security capabilities
......
......@@ -352,6 +352,7 @@ typedef struct emm_data_s {
#define T3430_DEFAULT_VALUE 15 /* 15 seconds */
#define T3440_DEFAULT_VALUE 10 /* 10 seconds */
// FIXME put in another structure
struct nas_timer_t T3402; /* attach failure timer */
struct nas_timer_t T3410; /* attach timer */
struct nas_timer_t T3411; /* attach restart timer */
......
......@@ -167,7 +167,7 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t
int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
const OctetString *rand, const OctetString *autn);
int emm_proc_authentication_reject(nas_user_t *user);
int emm_proc_authentication_delete(void);
int emm_proc_authentication_delete(nas_user_t *user);
/*
......
......@@ -97,6 +97,11 @@ void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
user->proc.rsrq = NAS_PROC_RSRQ_UNKNOWN;
user->proc.rsrp = NAS_PROC_RSRP_UNKNOWN;
user->authentication_data = calloc(1, sizeof(authentication_data_t));
if ( user->authentication_data == NULL ) {
LOG_TRACE(ERROR, "NAS-PROC - Failed to alloc authentication_data");
// FIXME stop here
}
/* Initialize the EMM procedure manager */
emm_main_initialize(user, emm_cb, imei);
......
......@@ -50,18 +50,23 @@ Description NAS type definition to manage a user equipment
#include "esm_pt_defs.h"
#include "EMM/emm_fsm_defs.h"
#include "EMM/emmData.h"
#include "EMM/Authentication.h"
#include "EMM/IdleMode_defs.h"
#include "API/USIM/usim_api.h"
typedef struct {
int fd;
proc_data_t proc;
// Eps Session Management
esm_data_t *esm_data; // ESM internal data (used within ESM only)
esm_pt_data_t *esm_pt_data;
esm_ebr_data_t *esm_ebr_data; // EPS bearer contexts
// Eps Mobility Management
emm_fsm_state_t emm_fsm_status; // Current EPS Mobility Management status
emm_data_t *emm_data; // EPS mobility management data
emm_plmn_list_t *emm_plmn_list; // list of PLMN identities
authentication_data_t *authentication_data;
// Hardware persistent storage
usim_data_t usim_data; // USIM application data
} nas_user_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment