diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c index 97c7082be0d02f5290f2128c90d40154cc582036..36c90c4ab0b6e10fd148495bbac9f0f228b531de 100644 --- a/openair3/NAS/UE/EMM/Authentication.c +++ b/openair3/NAS/UE/EMM/Authentication.c @@ -180,13 +180,14 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, OctetString res = {AUTH_RES_SIZE, authentication_data->res}; if ((memcmp(authentication_data->rand, rand->value, AUTH_CK_SIZE) != 0) || - (memcmp(nullRand,authentication_data->rand, AUTH_CK_SIZE) == 0)) { + (authentication_data->auth_process_started == FALSE)) { /* * There is no valid stored RAND in the ME or the stored RAND is * different from the new received value in the AUTHENTICATION - * REQUEST message OR the received RAND is all "0" or "NULL" - * process the new received AUTHENTICATIOn REQUEST message + * REQUEST message OR if this is first time UE starting the + * Authentication process */ + authentication_data->auth_process_started = TRUE; OctetString auts; auts.length = 0; auts.value = (uint8_t *)malloc(AUTH_AUTS_SIZE); diff --git a/openair3/NAS/UE/EMM/Authentication.h b/openair3/NAS/UE/EMM/Authentication.h index 50b2d990aa5ba8628a19550bc393b8b0a88604c2..466d3256f380371dbce17cc5360dfd821dd7fb7d 100644 --- a/openair3/NAS/UE/EMM/Authentication.h +++ b/openair3/NAS/UE/EMM/Authentication.h @@ -18,6 +18,8 @@ typedef struct { 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) */ + unsigned char auth_process_started:1; /* Authentication started */ + unsigned char reserve:1; /* For future use, byte aligned */ } authentication_data_t; #endif