Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
345bd9cc
Commit
345bd9cc
authored
Oct 22, 2024
by
Laurent THOMAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove duplicated code, add registration reject cause
parent
21a7f994
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
102 additions
and
535 deletions
+102
-535
CMakeLists.txt
CMakeLists.txt
+1
-3
common/utils/ocp_itti/intertask_interface.h
common/utils/ocp_itti/intertask_interface.h
+0
-2
doc/Doxyfile
doc/Doxyfile
+2
-4
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+2
-2
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+1
-1
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c
+1
-1
openair3/NAS/COMMON/NR_NAS_defs.h
openair3/NAS/COMMON/NR_NAS_defs.h
+54
-54
openair3/NAS/NR_UE/nr_nas_msg.c
openair3/NAS/NR_UE/nr_nas_msg.c
+11
-11
openair3/NAS/NR_UE/nr_nas_msg.h
openair3/NAS/NR_UE/nr_nas_msg.h
+30
-65
openair3/NAS/NR_UE/ue_process_nas.c
openair3/NAS/NR_UE/ue_process_nas.c
+0
-178
openair3/NAS/gNB/network_process_nas.c
openair3/NAS/gNB/network_process_nas.c
+0
-214
No files found.
CMakeLists.txt
View file @
345bd9cc
...
@@ -1781,7 +1781,7 @@ add_library(LIB_NAS_SIMUE
...
@@ -1781,7 +1781,7 @@ add_library(LIB_NAS_SIMUE
${
NAS_SRC
}
UE/nas_parser.c
${
NAS_SRC
}
UE/nas_parser.c
${
NAS_SRC
}
UE/nas_proc.c
${
NAS_SRC
}
UE/nas_proc.c
${
NAS_SRC
}
UE/nas_user.c
${
NAS_SRC
}
UE/nas_user.c
${
NAS_SRC
}
NR_UE/nr_nas_msg
_sim
.c
${
NAS_SRC
}
NR_UE/nr_nas_msg.c
${
libnas_api_OBJS
}
${
libnas_api_OBJS
}
${
libnas_ue_api_OBJS
}
${
libnas_ue_api_OBJS
}
${
libnas_emm_msg_OBJS
}
${
libnas_emm_msg_OBJS
}
...
@@ -1844,8 +1844,6 @@ add_library(NB_IoT MODULE ${NBIOT_SOURCES} )
...
@@ -1844,8 +1844,6 @@ add_library(NB_IoT MODULE ${NBIOT_SOURCES} )
add_library
(
LIB_5GNAS_GNB
add_library
(
LIB_5GNAS_GNB
${
NAS_SRC
}
/COMMON/nr_common.c
${
NAS_SRC
}
/COMMON/nr_common.c
${
NAS_SRC
}
/gNB/network_process_nas.c
${
NAS_SRC
}
/NR_UE/ue_process_nas.c
${
OPENAIR3_DIR
}
//UICC/usim_interface.c
${
OPENAIR3_DIR
}
//UICC/usim_interface.c
)
)
...
...
common/utils/ocp_itti/intertask_interface.h
View file @
345bd9cc
...
@@ -321,8 +321,6 @@ typedef struct {
...
@@ -321,8 +321,6 @@ typedef struct {
TASK_DEF(TASK_DU_F1, 200) \
TASK_DEF(TASK_DU_F1, 200) \
TASK_DEF(TASK_CUCP_E1, 200) \
TASK_DEF(TASK_CUCP_E1, 200) \
TASK_DEF(TASK_CUUP_E1, 200) \
TASK_DEF(TASK_CUUP_E1, 200) \
TASK_DEF(TASK_RRC_UE_SIM, 200) \
TASK_DEF(TASK_RRC_GNB_SIM, 200) \
TASK_DEF(TASK_RRC_NSA_UE, 200) \
TASK_DEF(TASK_RRC_NSA_UE, 200) \
TASK_DEF(TASK_RRC_NSA_NRUE, 200) \
TASK_DEF(TASK_RRC_NSA_NRUE, 200) \
TASK_DEF(TASK_NAS_NRUE, 200) \
TASK_DEF(TASK_NAS_NRUE, 200) \
...
...
doc/Doxyfile
View file @
345bd9cc
...
@@ -1133,9 +1133,8 @@ INPUT = \
...
@@ -1133,9 +1133,8 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/UICC/usim_interface.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/UICC/usim_interface.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/UICC/usim_interface.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/UICC/usim_interface.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/ocp-gtpu/gtp_itf.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/ocp-gtpu/gtp_itf.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/nr_nas_msg_sim.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/nr_nas_msg.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/ue_process_nas.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/nr_nas_msgc \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/nr_nas_msg_sim.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/nas_itti_messaging.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/nas_itti_messaging.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/user_defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/user_defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/EMM/emm_proc.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/EMM/emm_proc.h \
...
@@ -1584,7 +1583,6 @@ INPUT = \
...
@@ -1584,7 +1583,6 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/userDef.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/userDef.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/nr_common.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/nr_common.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/gNB/network_process_nas.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/UTILS/conversions.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair3/UTILS/conversions.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/X2AP/x2ap_eNB_encoder.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/X2AP/x2ap_eNB_encoder.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/X2AP/x2ap_eNB_management_procedures.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/X2AP/x2ap_eNB_management_procedures.c \
...
...
executables/nr-uesoftmodem.c
View file @
345bd9cc
...
@@ -84,7 +84,7 @@ unsigned short config_frames[4] = {2,9,11,13};
...
@@ -84,7 +84,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "executables/softmodem-common.h"
#include "executables/softmodem-common.h"
#include "executables/thread-common.h"
#include "executables/thread-common.h"
#include "nr_nas_msg
_sim
.h"
#include "nr_nas_msg.h"
#include <openair1/PHY/MODULATION/nr_modulation.h>
#include <openair1/PHY/MODULATION/nr_modulation.h>
#include "openair2/GNB_APP/gnb_paramdef.h"
#include "openair2/GNB_APP/gnb_paramdef.h"
...
@@ -335,7 +335,7 @@ static void trigger_stop(int sig)
...
@@ -335,7 +335,7 @@ static void trigger_stop(int sig)
static
void
trigger_deregistration
(
int
sig
)
static
void
trigger_deregistration
(
int
sig
)
{
{
if
(
!
stop_immediately
)
{
if
(
!
stop_immediately
)
{
MessageDef
*
msg
=
itti_alloc_new_message
(
TASK_
RRC_UE_SIM
,
0
,
NAS_DEREGISTRATION_REQ
);
MessageDef
*
msg
=
itti_alloc_new_message
(
TASK_
NAS_NRUE
,
0
,
NAS_DEREGISTRATION_REQ
);
NAS_DEREGISTRATION_REQ
(
msg
).
cause
=
AS_DETACH
;
NAS_DEREGISTRATION_REQ
(
msg
).
cause
=
AS_DETACH
;
itti_send_msg_to_task
(
TASK_NAS_NRUE
,
0
,
msg
);
itti_send_msg_to_task
(
TASK_NAS_NRUE
,
0
,
msg
);
stop_immediately
=
true
;
stop_immediately
=
true
;
...
...
openair2/RRC/NR_UE/rrc_UE.c
View file @
345bd9cc
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
#include "SIMULATION/TOOLS/sim.h" // for taus
#include "SIMULATION/TOOLS/sim.h" // for taus
#include "nr_nas_msg
_sim
.h"
#include "nr_nas_msg.h"
#include "openair2/SDAP/nr_sdap/nr_sdap_entity.h"
#include "openair2/SDAP/nr_sdap/nr_sdap_entity.h"
static
NR_UE_RRC_INST_t
*
NR_UE_rrc_inst
;
static
NR_UE_RRC_INST_t
*
NR_UE_rrc_inst
;
...
...
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c
View file @
345bd9cc
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#include "PduSessionEstablishmentAccept.h"
#include "PduSessionEstablishmentAccept.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/log.h"
#include "nr_nas_msg
_sim
.h"
#include "nr_nas_msg.h"
#include "common/utils/tun_if.h"
#include "common/utils/tun_if.h"
#include "openair2/SDAP/nr_sdap/nr_sdap.h"
#include "openair2/SDAP/nr_sdap/nr_sdap.h"
...
...
openair3/NAS/COMMON/NR_NAS_defs.h
View file @
345bd9cc
...
@@ -63,55 +63,55 @@ typedef enum {
...
@@ -63,55 +63,55 @@ typedef enum {
SGSmobilitymanagementmessages
=
0x7e
,
SGSmobilitymanagementmessages
=
0x7e
,
}
Extendedprotocoldiscriminator_t
;
}
Extendedprotocoldiscriminator_t
;
#define FOREACH_TYPE(TYPE_DEF) \
#define FOREACH_TYPE(TYPE_DEF)
\
TYPE_DEF(
Registrationrequest,0x41 )
\
TYPE_DEF(
REGISTRATION_REQUEST, 0x41)
\
TYPE_DEF( Registrationaccept,0x42 )
\
TYPE_DEF(REGISTRATION_ACCEPT, 0x42)
\
TYPE_DEF( Registrationcomplete,0x43 )
\
TYPE_DEF(REGISTRATION_COMPLETE, 0x43)
\
TYPE_DEF( Registrationreject,0x44 )
\
TYPE_DEF(REGISTRATION_REJECT, 0x44)
\
TYPE_DEF( DeregistrationrequestUEoriginating,0x45 )
\
TYPE_DEF(FGS_DEREGISTRATION_REQUEST_UE_ORIGINATING, 0x45)
\
TYPE_DEF( DeregistrationacceptUEoriginating,0x46 )
\
TYPE_DEF(FGS_DEREGISTRATION_ACCEPT_UE_ORIGINATING, 0x46)
\
TYPE_DEF( DeregistrationrequestUEterminated,0x47 )
\
TYPE_DEF(DeregistrationrequestUEterminated, 0x47)
\
TYPE_DEF( DeregistrationacceptUEterminated,0x48 )
\
TYPE_DEF(DeregistrationacceptUEterminated, 0x48)
\
TYPE_DEF( Servicerequest,0x4c )
\
TYPE_DEF(Servicerequest, 0x4c)
\
TYPE_DEF( Servicereject,0x4d )
\
TYPE_DEF(Servicereject, 0x4d)
\
TYPE_DEF( Serviceaccept,0x4e )
\
TYPE_DEF(Serviceaccept, 0x4e)
\
TYPE_DEF( Controlplaneservicerequest,0x4f )
\
TYPE_DEF(Controlplaneservicerequest, 0x4f)
\
TYPE_DEF( Networkslicespecificauthenticationcommand,0x50 )
\
TYPE_DEF(Networkslicespecificauthenticationcommand, 0x50)
\
TYPE_DEF( Networkslicespecificauthenticationcomplete,0x51 )
\
TYPE_DEF(Networkslicespecificauthenticationcomplete, 0x51)
\
TYPE_DEF( Networkslicespecificauthenticationresult,0x52 )
\
TYPE_DEF(Networkslicespecificauthenticationresult, 0x52)
\
TYPE_DEF( Configurationupdatecommand,0x54 )
\
TYPE_DEF(Configurationupdatecommand, 0x54)
\
TYPE_DEF( Configurationupdatecomplete,0x55 )
\
TYPE_DEF(Configurationupdatecomplete, 0x55)
\
TYPE_DEF( Authenticationrequest,0x56 )
\
TYPE_DEF(FGS_AUTHENTICATION_REQUEST, 0x56)
\
TYPE_DEF( Authenticationresponse,0x57 )
\
TYPE_DEF(FGS_AUTHENTICATION_RESPONSE, 0x57)
\
TYPE_DEF( Authenticationreject,0x58 )
\
TYPE_DEF(Authenticationreject, 0x58)
\
TYPE_DEF( Authenticationfailure,0x59 )
\
TYPE_DEF(Authenticationfailure, 0x59)
\
TYPE_DEF( Authenticationresult,0x5a )
\
TYPE_DEF(Authenticationresult, 0x5a)
\
TYPE_DEF( Identityrequest,0x5b )
\
TYPE_DEF(FGS_IDENTITY_REQUEST, 0x5b)
\
TYPE_DEF( Identityresponse,0x5c )
\
TYPE_DEF(FGS_IDENTITY_RESPONSE, 0x5c)
\
TYPE_DEF( Securitymodecommand,0x5d )
\
TYPE_DEF(FGS_SECURITY_MODE_COMMAND, 0x5d)
\
TYPE_DEF( Securitymodecomplete,0x5e )
\
TYPE_DEF(FGS_SECURITY_MODE_COMPLETE, 0x5e)
\
TYPE_DEF( Securitymodereject,0x5f )
\
TYPE_DEF(Securitymodereject, 0x5f)
\
TYPE_DEF( SGMMstatus,0x64 )
\
TYPE_DEF(SGMMstatus, 0x64)
\
TYPE_DEF( Notification,0x65 )
\
TYPE_DEF(Notification, 0x65)
\
TYPE_DEF( Notificationresponse,0x66 )
\
TYPE_DEF(Notificationresponse, 0x66)
\
TYPE_DEF( ULNAStransport,0x67 )
\
TYPE_DEF(FGS_UPLINK_NAS_TRANSPORT, 0x67)
\
TYPE_DEF( DLNAStransport,0x68 )
\
TYPE_DEF(FGS_DOWNLINK_NAS_TRANSPORT, 0x68)
\
TYPE_DEF( PDUsessionestablishmentrequest,0xc1 )
\
TYPE_DEF(FGS_PDU_SESSION_ESTABLISHMENT_REQ, 0xc1)
\
TYPE_DEF( PDUsessionestablishmentaccept,0xc2 )
\
TYPE_DEF(FGS_PDU_SESSION_ESTABLISHMENT_ACC, 0xc2)
\
TYPE_DEF( PDUsessionestablishmentreject,0xc3 )
\
TYPE_DEF(FGS_PDU_SESSION_ESTABLISHMENT_REJ, 0xc3)
\
TYPE_DEF( PDUsessionauthenticationcommand,0xc5 )
\
TYPE_DEF(PDUsessionauthenticationcommand, 0xc5)
\
TYPE_DEF( PDUsessionauthenticationcomplete,0xc6 )
\
TYPE_DEF(PDUsessionauthenticationcomplete, 0xc6)
\
TYPE_DEF( PDUsessionauthenticationresult,0xc7 )
\
TYPE_DEF(PDUsessionauthenticationresult, 0xc7)
\
TYPE_DEF( PDUsessionmodificationrequest,0xc9 )
\
TYPE_DEF(PDUsessionmodificationrequest, 0xc9)
\
TYPE_DEF( PDUsessionmodificationreject,0xca )
\
TYPE_DEF(PDUsessionmodificationreject, 0xca)
\
TYPE_DEF( PDUsessionmodificationcommand,0xcb )
\
TYPE_DEF(PDUsessionmodificationcommand, 0xcb)
\
TYPE_DEF( PDUsessionmodificationcomplete,0xcc )
\
TYPE_DEF(PDUsessionmodificationcomplete, 0xcc)
\
TYPE_DEF( PDUsessionmodificationcommandreject,0xcd )
\
TYPE_DEF(PDUsessionmodificationcommandreject, 0xcd)
\
TYPE_DEF( PDUsessionreleaserequest,0xd1 )
\
TYPE_DEF(PDUsessionreleaserequest, 0xd1)
\
TYPE_DEF( PDUsessionreleasereject,0xd2 )
\
TYPE_DEF(PDUsessionreleasereject, 0xd2)
\
TYPE_DEF( PDUsessionreleasecommand,0xd3 )
\
TYPE_DEF(PDUsessionreleasecommand, 0xd3)
\
TYPE_DEF( PDUsessionreleasecomplete,0xd4 )
\
TYPE_DEF(PDUsessionreleasecomplete, 0xd4)
\
TYPE_DEF( SGSMstatus,0xd6 )\
TYPE_DEF(SGSMstatus, 0xd6)
static
const
text_info_t
message_text_info
[]
=
{
static
const
text_info_t
message_text_info
[]
=
{
FOREACH_TYPE
(
TO_TEXT
)
FOREACH_TYPE
(
TO_TEXT
)
...
@@ -124,11 +124,11 @@ typedef enum {
...
@@ -124,11 +124,11 @@ typedef enum {
// TS 24.501
// TS 24.501
typedef
enum
{
typedef
enum
{
notsecurityprotected
=
0
,
PLAIN_5GS_MSG
=
0
,
I
ntegrityprotected
=
1
,
I
NTEGRITY_PROTECTED
=
1
,
I
ntegrityprotectedandciphered
=
2
,
I
NTEGRITY_PROTECTED_AND_CIPHERED
=
2
,
I
ntegrityprotectedwithnew5GNASsecuritycontext
=
3
,
I
NTEGRITY_PROTECTED_WITH_NEW_SECU_CTX
=
3
,
I
ntegrityprotectedandcipheredwithnew5GNASsecuritycontext
=
4
,
I
NTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX
=
4
,
}
Security_header_t
;
}
Security_header_t
;
typedef
enum
{
typedef
enum
{
...
...
openair3/NAS/NR_UE/nr_nas_msg
_sim
.c
→
openair3/NAS/NR_UE/nr_nas_msg.c
View file @
345bd9cc
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*! \file nr_nas_msg
_sim
.c
/*! \file nr_nas_msg.c
* \brief simulator for nr nas message
* \brief simulator for nr nas message
* \author Yoshio INOUE, Masayuki HARADA
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#include "nas_log.h"
#include "nas_log.h"
#include "TLVDecoder.h"
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#include "TLVEncoder.h"
#include "nr_nas_msg
_sim
.h"
#include "nr_nas_msg.h"
#include "aka_functions.h"
#include "aka_functions.h"
#include "secu_defs.h"
#include "secu_defs.h"
#include "kdf.h"
#include "kdf.h"
...
@@ -1393,7 +1393,7 @@ void *nas_nrue(void *args_p)
...
@@ -1393,7 +1393,7 @@ void *nas_nrue(void *args_p)
if
(
security_state
==
NAS_SECURITY_UNPROTECTED
)
{
if
(
security_state
==
NAS_SECURITY_UNPROTECTED
)
{
int
msg_type
=
get_msg_type
(
pdu_buffer
,
pdu_length
);
int
msg_type
=
get_msg_type
(
pdu_buffer
,
pdu_length
);
/* for the moment, only FGS_DEREGISTRATION_ACCEPT is accepted */
/* for the moment, only FGS_DEREGISTRATION_ACCEPT is accepted */
if
(
msg_type
==
FGS_DEREGISTRATION_ACCEPT
)
if
(
msg_type
==
FGS_DEREGISTRATION_ACCEPT
_UE_ORIGINATING
)
security_state
=
NAS_SECURITY_INTEGRITY_PASSED
;
security_state
=
NAS_SECURITY_INTEGRITY_PASSED
;
}
}
...
@@ -1420,7 +1420,7 @@ void *nas_nrue(void *args_p)
...
@@ -1420,7 +1420,7 @@ void *nas_nrue(void *args_p)
case
REGISTRATION_ACCEPT
:
case
REGISTRATION_ACCEPT
:
handle_registration_accept
(
nas
,
pdu_buffer
,
pdu_length
);
handle_registration_accept
(
nas
,
pdu_buffer
,
pdu_length
);
break
;
break
;
case
FGS_DEREGISTRATION_ACCEPT
:
case
FGS_DEREGISTRATION_ACCEPT
_UE_ORIGINATING
:
LOG_I
(
NAS
,
"received deregistration accept
\n
"
);
LOG_I
(
NAS
,
"received deregistration accept
\n
"
);
break
;
break
;
case
FGS_PDU_SESSION_ESTABLISHMENT_ACC
:
{
case
FGS_PDU_SESSION_ESTABLISHMENT_ACC
:
{
...
@@ -1449,13 +1449,13 @@ void *nas_nrue(void *args_p)
...
@@ -1449,13 +1449,13 @@ void *nas_nrue(void *args_p)
offset
++
;
offset
++
;
}
}
}
break
;
}
break
;
case
FGS_PDU_SESSION_ESTABLISHMENT_REJ
:
case
FGS_PDU_SESSION_ESTABLISHMENT_REJ
:
LOG_E
(
NAS
,
"Received PDU Session Establishment reject
\n
"
);
LOG_E
(
NAS
,
"Received PDU Session Establishment reject
\n
"
);
break
;
break
;
case
REGISTRATION_REJECT
:
case
REGISTRATION_REJECT
:
LOG_E
(
NAS
,
"Received Registration reject
\n
"
);
LOG_E
(
NAS
,
"Received Registration reject cause: %s
\n
"
,
cause_text_info
[
pdu_buffer
[
17
]].
text
);
exit
(
1
);
exit
(
1
);
break
;
break
;
default:
default:
LOG_W
(
NR_RRC
,
"unknown message type %d
\n
"
,
msg_type
);
LOG_W
(
NR_RRC
,
"unknown message type %d
\n
"
,
msg_type
);
break
;
break
;
...
...
openair3/NAS/NR_UE/nr_nas_msg
_sim
.h
→
openair3/NAS/NR_UE/nr_nas_msg.h
View file @
345bd9cc
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*! \file nr_nas_msg
_sim
.h
/*! \file nr_nas_msg.h
* \brief simulator for nr nas message
* \brief simulator for nr nas message
* \author Yoshio INOUE, Masayuki HARADA
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
...
@@ -27,8 +27,6 @@
...
@@ -27,8 +27,6 @@
* \version 0.1
* \version 0.1
*/
*/
#ifndef __NR_NAS_MSG_SIM_H__
#ifndef __NR_NAS_MSG_SIM_H__
#define __NR_NAS_MSG_SIM_H__
#define __NR_NAS_MSG_SIM_H__
...
@@ -43,38 +41,12 @@
...
@@ -43,38 +41,12 @@
#include <openair3/UICC/usim_interface.h>
#include <openair3/UICC/usim_interface.h>
#include "secu_defs.h"
#include "secu_defs.h"
#define PLAIN_5GS_MSG 0b0000
#define INITIAL_REGISTRATION 0b001
#define INTEGRITY_PROTECTED 0b0001
#define INTEGRITY_PROTECTED_AND_CIPHERED 0b0010
#define PLAIN_5GS_NAS_MESSAGE_HEADER_LENGTH 3
#define INTEGRITY_PROTECTED_WITH_NEW_SECU_CTX 0b0011 // only for SECURITY MODE COMMAND
#define SECURITY_PROTECTED_5GS_NAS_MESSAGE_HEADER_LENGTH 7
#define INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX 0b0100 // only for SECURITY MODE COMPLETE
#define PAYLOAD_CONTAINER_LENGTH_MIN 3
#define PAYLOAD_CONTAINER_LENGTH_MAX 65537
#define REGISTRATION_REQUEST 0b01000001
/* 65 = 0x41 */
#define REGISTRATION_ACCEPT 0b01000010
/* 66 = 0x42 */
#define REGISTRATION_COMPLETE 0b01000011
/* 67 = 0x43 */
#define REGISTRATION_REJECT 68
#define FGS_DEREGISTRATION_REQUEST_UE_ORIGINATING 0b01000101
#define FGS_DEREGISTRATION_ACCEPT 0b01000110
#define FGS_AUTHENTICATION_REQUEST 0b01010110
/* 86 = 0x56 */
#define FGS_AUTHENTICATION_RESPONSE 0b01010111
/* 87 = 0x57 */
#define FGS_IDENTITY_REQUEST 0b01011011
/* 91 = 0x5b */
#define FGS_IDENTITY_RESPONSE 0b01011100
/* 92 = 0x5c */
#define FGS_SECURITY_MODE_COMMAND 0b01011101
/* 93 = 0x5d */
#define FGS_SECURITY_MODE_COMPLETE 0b01011110
/* 94 = 0x5e */
#define FGS_UPLINK_NAS_TRANSPORT 0b01100111
/* 103= 0x67 */
#define FGS_DOWNLINK_NAS_TRANSPORT 0b01101000
/* 104= 0x68 */
// message type for 5GS session management
#define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001
/* 193= 0xc1 */
#define FGS_PDU_SESSION_ESTABLISHMENT_ACC 0b11000010
/* 194= 0xc2 */
#define FGS_PDU_SESSION_ESTABLISHMENT_REJ 0b11000011
/* 195= 0xc3 */
#define INITIAL_REGISTRATION 0b001
#define PLAIN_5GS_NAS_MESSAGE_HEADER_LENGTH 3
#define SECURITY_PROTECTED_5GS_NAS_MESSAGE_HEADER_LENGTH 7
#define PAYLOAD_CONTAINER_LENGTH_MIN 3
#define PAYLOAD_CONTAINER_LENGTH_MAX 65537
/* List of allowed NSSAI from NAS messaging. */
/* List of allowed NSSAI from NAS messaging. */
typedef
struct
{
typedef
struct
{
...
@@ -104,20 +76,19 @@ typedef struct {
...
@@ -104,20 +76,19 @@ typedef struct {
stream_security_container_t
*
security_container
;
stream_security_container_t
*
security_container
;
Guti5GSMobileIdentity_t
*
guti
;
Guti5GSMobileIdentity_t
*
guti
;
bool
termination_procedure
;
bool
termination_procedure
;
uint8_t
*
registration_request_buf
;
uint8_t
*
registration_request_buf
;
uint32_t
registration_request_len
;
uint32_t
registration_request_len
;
instance_t
UE_id
;
instance_t
UE_id
;
}
nr_ue_nas_t
;
}
nr_ue_nas_t
;
typedef
enum
fgs_protocol_discriminator_e
{
typedef
enum
fgs_protocol_discriminator_e
{
/* Protocol discriminator identifier for 5GS Mobility Management */
/* Protocol discriminator identifier for 5GS Mobility Management */
FGS_MOBILITY_MANAGEMENT_MESSAGE
=
0x7E
,
FGS_MOBILITY_MANAGEMENT_MESSAGE
=
0x7E
,
/* Protocol discriminator identifier for 5GS Session Management */
/* Protocol discriminator identifier for 5GS Session Management */
FGS_SESSION_MANAGEMENT_MESSAGE
=
0x2E
,
FGS_SESSION_MANAGEMENT_MESSAGE
=
0x2E
,
}
fgs_protocol_discriminator_t
;
}
fgs_protocol_discriminator_t
;
typedef
struct
{
typedef
struct
{
uint8_t
ex_protocol_discriminator
;
uint8_t
ex_protocol_discriminator
;
uint8_t
security_header_type
;
uint8_t
security_header_type
;
...
@@ -126,27 +97,25 @@ typedef struct {
...
@@ -126,27 +97,25 @@ typedef struct {
/* Structure of security protected header */
/* Structure of security protected header */
typedef
struct
{
typedef
struct
{
fgs_protocol_discriminator_t
protocol_discriminator
;
fgs_protocol_discriminator_t
protocol_discriminator
;
uint8_t
security_header_type
;
uint8_t
security_header_type
;
uint32_t
message_authentication_code
;
uint32_t
message_authentication_code
;
uint8_t
sequence_number
;
uint8_t
sequence_number
;
}
fgs_nas_message_security_header_t
;
}
fgs_nas_message_security_header_t
;
typedef
union
{
typedef
union
{
mm_msg_header_t
header
;
mm_msg_header_t
header
;
registration_request_msg
registration_request
;
registration_request_msg
registration_request
;
fgs_identiy_response_msg
fgs_identity_response
;
fgs_identiy_response_msg
fgs_identity_response
;
fgs_authentication_response_msg
fgs_auth_response
;
fgs_authentication_response_msg
fgs_auth_response
;
fgs_deregistration_request_ue_originating_msg
fgs_deregistration_request_ue_originating
;
fgs_deregistration_request_ue_originating_msg
fgs_deregistration_request_ue_originating
;
fgs_security_mode_complete_msg
fgs_security_mode_complete
;
fgs_security_mode_complete_msg
fgs_security_mode_complete
;
registration_complete_msg
registration_complete
;
registration_complete_msg
registration_complete
;
fgs_uplink_nas_transport_msg
uplink_nas_transport
;
fgs_uplink_nas_transport_msg
uplink_nas_transport
;
}
MM_msg
;
}
MM_msg
;
typedef
struct
{
typedef
struct
{
MM_msg
mm_msg
;
/* 5GS Mobility Management messages */
MM_msg
mm_msg
;
/* 5GS Mobility Management messages */
}
fgs_nas_message_plain_t
;
}
fgs_nas_message_plain_t
;
typedef
struct
{
typedef
struct
{
...
@@ -154,7 +123,6 @@ typedef struct {
...
@@ -154,7 +123,6 @@ typedef struct {
fgs_nas_message_plain_t
plain
;
fgs_nas_message_plain_t
plain
;
}
fgs_nas_message_security_protected_t
;
}
fgs_nas_message_security_protected_t
;
typedef
union
{
typedef
union
{
fgs_nas_message_security_header_t
header
;
fgs_nas_message_security_header_t
header
;
fgs_nas_message_security_protected_t
security_protected
;
fgs_nas_message_security_protected_t
security_protected
;
...
@@ -165,11 +133,11 @@ typedef struct {
...
@@ -165,11 +133,11 @@ typedef struct {
union
{
union
{
mm_msg_header_t
plain_nas_msg_header
;
mm_msg_header_t
plain_nas_msg_header
;
struct
security_protected_nas_msg_header_s
{
struct
security_protected_nas_msg_header_s
{
uint8_t
ex_protocol_discriminator
;
uint8_t
ex_protocol_discriminator
;
uint8_t
security_header_type
;
uint8_t
security_header_type
;
uint16_t
message_authentication_code1
;
uint16_t
message_authentication_code1
;
uint16_t
message_authentication_code2
;
uint16_t
message_authentication_code2
;
uint8_t
sequence_number
;
uint8_t
sequence_number
;
}
security_protected_nas_msg_header_t
;
}
security_protected_nas_msg_header_t
;
}
choice
;
}
choice
;
}
nas_msg_header_t
;
}
nas_msg_header_t
;
...
@@ -182,10 +150,10 @@ typedef struct {
...
@@ -182,10 +150,10 @@ typedef struct {
}
fgs_sm_nas_msg_header_t
;
}
fgs_sm_nas_msg_header_t
;
typedef
struct
{
typedef
struct
{
mm_msg_header_t
plain_nas_msg_header
;
mm_msg_header_t
plain_nas_msg_header
;
uint8_t
payload_container_type
;
uint8_t
payload_container_type
;
uint16_t
payload_container_length
;
uint16_t
payload_container_length
;
fgs_sm_nas_msg_header_t
sm_nas_msg_header
;
fgs_sm_nas_msg_header_t
sm_nas_msg_header
;
}
dl_nas_transport_t
;
}
dl_nas_transport_t
;
nr_ue_nas_t
*
get_ue_nas_info
(
module_id_t
module_id
);
nr_ue_nas_t
*
get_ue_nas_info
(
module_id_t
module_id
);
...
@@ -194,6 +162,3 @@ void *nas_nrue_task(void *args_p);
...
@@ -194,6 +162,3 @@ void *nas_nrue_task(void *args_p);
void
*
nas_nrue
(
void
*
args_p
);
void
*
nas_nrue
(
void
*
args_p
);
#endif
/* __NR_NAS_MSG_SIM_H__*/
#endif
/* __NR_NAS_MSG_SIM_H__*/
openair3/NAS/NR_UE/ue_process_nas.c
deleted
100644 → 0
View file @
21a7f994
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Author and copyright: Laurent Thomas, open-cells.com
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <openair3/NAS/COMMON/NR_NAS_defs.h>
#include <openair3/SECU/secu_defs.h>
void
SGSabortNet
(
void
*
msg
,
nr_user_nas_t
*
UE
)
{
}
void
ue_nas_schedule
(
void
)
{
}
/*
*Message reception
*/
void
SGSauthenticationReq
(
void
*
msg
,
nr_user_nas_t
*
UE
)
{
authenticationrequestHeader_t
*
amsg
=
(
authenticationrequestHeader_t
*
)
msg
;
arrayCpy
(
UE
->
uicc
->
rand
,
amsg
->
RAND
);
arrayCpy
(
UE
->
uicc
->
autn
,
amsg
->
AUTN
);
// AUTHENTICATION REQUEST message that contains a valid ngKSI, SQN and MAC is received
// TBD verify ngKSI (we set it as '2', see gNB code)
// SQN and MAC are tested in auth resp processing
ue_nas_schedule
();
}
void
SGSidentityReq
(
void
*
msg
,
nr_user_nas_t
*
UE
)
{
Identityrequest_t
*
idmsg
=
(
Identityrequest_t
*
)
msg
;
if
(
idmsg
->
it
==
SUCI
)
{
LOG_I
(
NAS
,
"Received Identity request, scheduling answer
\n
"
);
ue_nas_schedule
();
}
else
LOG_E
(
NAS
,
"Not developped: identity request for %d
\n
"
,
idmsg
->
it
);
}
void
SGSsecurityModeCommand
(
void
*
msg
,
nr_user_nas_t
*
UE
)
{
}
void
UEprocessNAS
(
void
*
msg
,
nr_user_nas_t
*
UE
)
{
SGScommonHeader_t
*
header
=
(
SGScommonHeader_t
*
)
msg
;
if
(
header
->
sh
>
4
)
SGSabortNet
(
msg
,
UE
);
else
{
switch
(
header
->
epd
)
{
case
SGSmobilitymanagementmessages
:
LOG_I
(
NAS
,
"Received message: %s
\n
"
,
idStr
(
message_text_info
,
header
->
mt
));
switch
(
header
->
mt
)
{
case
Authenticationrequest
:
SGSauthenticationReq
(
msg
,
UE
);
break
;
case
Identityrequest
:
SGSidentityReq
(
msg
,
UE
);
break
;
case
Securitymodecommand
:
SGSsecurityModeCommand
(
msg
,
UE
);
break
;
default:
SGSabortNet
(
msg
,
UE
);
}
break
;
case
SGSsessionmanagementmessages
:
SGSabortNet
(
msg
,
UE
);
break
;
default:
SGSabortNet
(
msg
,
UE
);
}
}
}
/*
* Messages emission
*/
int
identityResponse
(
void
**
msg
,
nr_user_nas_t
*
UE
)
{
if
(
UE
->
uicc
==
NULL
)
// config file section hardcoded as "uicc", nevertheless it opens to manage several UEs or a multi SIM UE
UE
->
uicc
=
init_uicc
(
"uicc"
);
// TS 24.501 9.11.3.4
int
imsiL
=
strlen
(
UE
->
uicc
->
imsiStr
);
int
msinL
=
imsiL
-
3
-
UE
->
uicc
->
nmc_size
;
int
respSize
=
sizeof
(
IdentityresponseIMSI_t
)
+
(
msinL
+
1
)
/
2
;
IdentityresponseIMSI_t
*
resp
=
(
IdentityresponseIMSI_t
*
)
calloc
(
respSize
,
1
);
resp
->
common
.
epd
=
SGSmobilitymanagementmessages
;
resp
->
common
.
sh
=
0
;
resp
->
common
.
mt
=
Identityresponse
;
resp
->
common
.
len
=
htons
(
respSize
-
sizeof
(
Identityresponse_t
));
resp
->
mi
=
SUCI
;
resp
->
mcc1
=
UE
->
uicc
->
imsiStr
[
0
]
-
'0'
;
resp
->
mcc2
=
UE
->
uicc
->
imsiStr
[
1
]
-
'0'
;
resp
->
mcc3
=
UE
->
uicc
->
imsiStr
[
2
]
-
'0'
;
resp
->
mnc1
=
UE
->
uicc
->
imsiStr
[
3
]
-
'0'
;
resp
->
mnc2
=
UE
->
uicc
->
imsiStr
[
4
]
-
'0'
;
resp
->
mnc3
=
UE
->
uicc
->
nmc_size
==
2
?
0xF
:
UE
->
uicc
->
imsiStr
[
3
]
-
'0'
;
// TBD: routing to fill (FF ?)
char
*
out
=
(
char
*
)(
resp
+
1
);
char
*
ptr
=
UE
->
uicc
->
imsiStr
+
3
+
UE
->
uicc
->
nmc_size
;
while
(
ptr
<
UE
->
uicc
->
imsiStr
+
strlen
(
UE
->
uicc
->
imsiStr
)
)
{
*
out
=
((
*
(
ptr
+
1
)
-
'0'
)
<<
4
)
|
(
*
(
ptr
)
-
'0'
);
out
++
;
ptr
+=
2
;
}
if
(
msinL
%
2
==
1
)
*
out
=
((
*
(
ptr
-
1
)
-
'0'
))
|
0xF0
;
*
msg
=
resp
;
return
respSize
;
}
int
authenticationResponse
(
void
**
msg
,
nr_user_nas_t
*
UE
)
{
if
(
UE
->
uicc
==
NULL
)
// config file section hardcoded as "uicc", nevertheless it opens to manage several UEs or a multi SIM UE
UE
->
uicc
=
init_uicc
(
"uicc"
);
myCalloc
(
resp
,
authenticationresponse_t
);
resp
->
epd
=
SGSmobilitymanagementmessages
;
resp
->
sh
=
0
;
resp
->
mt
=
Authenticationresponse
;
resp
->
iei
=
IEI_AuthenticationResponse
;
resp
->
RESlen
=
sizeof
(
resp
->
RES
);
// always 16 see TS 24.501 Table 8.2.2.1.1
// Verify the AUTN
// a full implementation need to test several SQN
// as the last 5bits can be any value
// and the value can also be greater and accepted (if it is in the accepted window)
uint8_t
AUTN
[
16
];
uicc_milenage_generate
(
AUTN
,
UE
->
uicc
);
if
(
memcmp
(
UE
->
uicc
->
autn
,
AUTN
,
sizeof
(
AUTN
))
==
0
)
{
// prepare and send good answer
resToresStar
(
resp
->
RES
,
UE
->
uicc
);
}
else
{
// prepare and send autn is not compatible with our data
abort
();
}
*
msg
=
resp
;
return
sizeof
(
authenticationresponse_t
);
}
int
securityModeComplete
(
void
**
msg
,
nr_user_nas_t
*
UE
)
{
return
-
1
;
}
int
registrationComplete
(
void
**
msg
,
nr_user_nas_t
*
UE
)
{
return
-
1
;
}
openair3/NAS/gNB/network_process_nas.c
deleted
100644 → 0
View file @
21a7f994
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Author and copyright: Laurent Thomas, open-cells.com
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <openair3/NAS/COMMON/NR_NAS_defs.h>
void
SGSabortUE
(
void
*
msg
,
NRUEcontext_t
*
UE
)
{
}
void
nas_schedule
(
void
)
{
}
/*
*Message reception
*/
void
SGSregistrationReq
(
void
*
msg
,
NRUEcontext_t
*
UE
)
{
}
void
SGSderegistrationUEReq
(
void
*
msg
,
NRUEcontext_t
*
UE
)
{
}
void
SGSidentityResp
(
void
*
msg
,
NRUEcontext_t
*
UE
)
{
// use the UE SUPI to load the USIM
IdentityresponseIMSI_t
*
resp
=
(
IdentityresponseIMSI_t
*
)
msg
;
char
configName
[
100
]
=
{
0
};
char
*
ptr
=
stpcpy
(
configName
,
"uicc"
);
*
ptr
++=
resp
->
mcc1
+
'0'
;
*
ptr
++=
resp
->
mcc2
+
'0'
;
*
ptr
++=
resp
->
mcc3
+
'0'
;
*
ptr
++=
resp
->
mnc1
+
'0'
;
*
ptr
++=
resp
->
mnc2
+
'0'
;
if
(
resp
->
mnc3
!=
0xF
)
*
ptr
++=
resp
->
mnc3
+
'0'
;
int
respSize
=
ntohs
(
resp
->
common
.
len
);
int
msinByteSize
=
respSize
-
sizeof
(
IdentityresponseIMSI_t
);
uint8_t
*
msin
=
(
uint8_t
*
)
(
resp
+
1
);
for
(
int
i
=
3
;
i
<
msinByteSize
;
i
++
)
{
char
digit1
=
(
msin
[
i
]
>>
4
)
;
*
ptr
++=
(
msin
[
i
]
&
0xf
)
+
'0'
;
if
(
digit1
!=
0xf
)
*
ptr
++=
digit1
+
'0'
;
}
*
ptr
=
0
;
if
(
UE
->
uicc
==
NULL
)
// config file section hardcoded as "uicc", nevertheless it opens to manage several UEs or a multi SIM UE
UE
->
uicc
=
init_uicc
(
configName
);
//We schedule Authentication request
nas_schedule
();
}
void
SGSauthenticationResp
(
void
*
msg
,
NRUEcontext_t
*
UE
)
{
// Let's check the answer
authenticationresponse_t
*
resp
=
(
authenticationresponse_t
*
)
msg
;
uint8_t
resStarLocal
[
16
];
resToresStar
(
resStarLocal
,
UE
->
uicc
);
if
(
memcmp
(
resStarLocal
,
resp
->
RES
,
sizeof
(
resStarLocal
))
==
0
)
{
LOG_I
(
NAS
,
"UE answer to authentication resquest is correct
\n
"
);
// we will send securityModeCommand
nas_schedule
();
}
else
{
LOG_E
(
NAS
,
"UE authentication response not good
\n
"
);
// To be implemented ?
}
}
void
SGSsecurityModeComplete
(
void
*
msg
,
NRUEcontext_t
*
UE
)
{
}
void
SGSregistrationComplete
(
void
*
msg
,
NRUEcontext_t
*
UE
)
{
}
void
processNAS
(
void
*
msg
,
NRUEcontext_t
*
UE
)
{
SGScommonHeader_t
*
header
=
(
SGScommonHeader_t
*
)
msg
;
if
(
header
->
sh
>
4
)
SGSabortUE
(
msg
,
UE
);
else
{
switch
(
header
->
epd
)
{
case
SGSmobilitymanagementmessages
:
LOG_I
(
NAS
,
"Received message: %s
\n
"
,
idStr
(
message_text_info
,
header
->
mt
));
switch
(
header
->
mt
)
{
case
Registrationrequest
:
SGSregistrationReq
(
msg
,
UE
);
break
;
case
DeregistrationrequestUEoriginating
:
SGSderegistrationUEReq
(
msg
,
UE
);
break
;
case
Authenticationresponse
:
SGSauthenticationResp
(
msg
,
UE
);
break
;
case
Identityresponse
:
SGSidentityResp
(
msg
,
UE
);
break
;
case
Securitymodecomplete
:
SGSsecurityModeComplete
(
msg
,
UE
);
break
;
case
Registrationcomplete
:
SGSregistrationComplete
(
msg
,
UE
);
break
;
default:
SGSabortUE
(
msg
,
UE
);
}
break
;
case
SGSsessionmanagementmessages
:
SGSabortUE
(
msg
,
UE
);
break
;
default:
SGSabortUE
(
msg
,
UE
);
}
}
}
/*
* Messages emission
*/
int
identityRequest
(
void
**
msg
,
NRUEcontext_t
*
UE
)
{
myCalloc
(
req
,
Identityrequest_t
);
req
->
epd
=
SGSmobilitymanagementmessages
;
req
->
sh
=
0
;
req
->
mt
=
Identityrequest
;
req
->
it
=
SUCI
;
*
msg
=
req
;
return
sizeof
(
Identityrequest_t
);
}
int
authenticationRequest
(
void
**
msg
,
NRUEcontext_t
*
UE
)
{
myCalloc
(
req
,
authenticationrequestHeader_t
);
req
->
epd
=
SGSmobilitymanagementmessages
;
req
->
sh
=
0
;
req
->
mt
=
Authenticationrequest
;
// native security context => bit 4 to 0
// probably from TS 33.501, table A-8.1
// N-NAS-int-alg (Native NAS integrity)
/*
N-NAS-enc-alg 0x01
N-NAS-int-alg 0x02
N-RRC-enc-alg 0x03
N-RRC-int-alg 0x04
N-UP-enc-alg 0x05
N-UP-int-alg 0x06
*/
req
->
ngKSI
=
2
;
// TS 33.501, Annex A.7.1: Initial set of security features defined for 5GS.
req
->
ABBALen
=
2
;
req
->
ABBA
=
0
;
//rand (TV)
req
->
ieiRAND
=
IEI_RAND
;
FILE
*
h
=
fopen
(
"/dev/random"
,
"r"
);
if
(
sizeof
(
req
->
RAND
)
!=
fread
(
req
->
RAND
,
1
,
sizeof
(
req
->
RAND
),
h
)
)
LOG_E
(
NAS
,
"can't read /dev/random
\n
"
);
fclose
(
h
);
memcpy
(
UE
->
uicc
->
rand
,
req
->
RAND
,
sizeof
(
UE
->
uicc
->
rand
));
// challenge/AUTN (TLV)
req
->
ieiAUTN
=
IEI_AUTN
;
req
->
AUTNlen
=
sizeof
(
req
->
AUTN
);
uicc_milenage_generate
(
req
->
AUTN
,
UE
->
uicc
);
// EAP message (TLV-E)
// not developped
*
msg
=
req
;
return
sizeof
(
authenticationrequestHeader_t
);
}
int
securityModeCommand
(
void
**
msg
,
NRUEcontext_t
*
UE
)
{
*
msg
=
NULL
;
myCalloc
(
req
,
securityModeCommand_t
);
req
->
epd
=
SGSmobilitymanagementmessages
;
req
->
sh
=
0
;
req
->
mt
=
Securitymodecommand
;
// integrity algo from 5G-IA0 (null algo) to 5G-IA7 in first 4 bits
unsigned
int
ia
=
0
;
// cyphering algo from 5G-EA0 (null algo) to 5G-IA7 in MSB 4 bits
unsigned
int
ea
=
0
;
// trace from commercial: 5G-IA0 (0) 128-5G-IA2 (2)
req
->
selectedNASsecurityalgorithms
=
ea
<<
4
|
ia
;
// KSI: N-NAS-int-alg 0x02
req
->
ngKSI
=
2
;
*
msg
=
req
;
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment