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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
wangwenhui
OpenXG-RAN
Commits
7bef73bf
Commit
7bef73bf
authored
4 years ago
by
Xue Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set nas message container for security mode complete
parent
1a9fd602
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
147 additions
and
17 deletions
+147
-17
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+1
-0
openair2/RRC/NR/rrc_gNB.c
openair2/RRC/NR/rrc_gNB.c
+1
-0
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c
+18
-9
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h
+8
-7
openair3/NAS/COMMON/IES/FGCNasMessageContainer.c
openair3/NAS/COMMON/IES/FGCNasMessageContainer.c
+77
-0
openair3/NAS/COMMON/IES/FGCNasMessageContainer.h
openair3/NAS/COMMON/IES/FGCNasMessageContainer.h
+33
-0
openair3/NAS/NR_UE/nr_nas_msg_sim.c
openair3/NAS/NR_UE/nr_nas_msg_sim.c
+9
-1
No files found.
cmake_targets/CMakeLists.txt
View file @
7bef73bf
...
...
@@ -2468,6 +2468,7 @@ if(ITTI_SIM)
${
NAS_SRC
}
COMMON/IES/FGSRegistrationResult.c
${
NAS_SRC
}
COMMON/IES/FGMMCapability.c
${
NAS_SRC
}
COMMON/IES/NrUESecurityCapability.c
${
NAS_SRC
}
COMMON/IES/FGCNasMessageContainer.c
)
add_library
(
LIB_NAS_SIMUE
...
...
This diff is collapsed.
Click to expand it.
openair2/RRC/NR/rrc_gNB.c
View file @
7bef73bf
...
...
@@ -974,6 +974,7 @@ rrc_gNB_decode_dcch(
break
;
case
NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete
:
LOG_I
(
NR_RRC
,
"Receive RRC Reconfiguration Complete message UE %x
\n
"
,
ctxt_pP
->
rnti
);
if
(
!
ue_context_p
)
{
LOG_I
(
NR_RRC
,
"Processing NR_RRCReconfigurationComplete UE %x, ue_context_p is NULL
\n
"
,
ctxt_pP
->
rnti
);
break
;
...
...
This diff is collapsed.
Click to expand it.
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c
View file @
7bef73bf
...
...
@@ -16,20 +16,29 @@
#include "FGSNASSecurityModeComplete.h"
#include "FGSMobileIdentity.h"
#include "FGCNasMessageContainer.h"
int
encode_fgs_security_mode_complete
(
fgs_security_mode_complete_msg
*
fgs_security_mode_comp
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
encoded
=
0
;
int
encode_result
=
0
;
int
encoded
=
0
;
int
encode_result
=
0
;
if
((
encode_result
=
if
((
encode_result
=
encode_5gs_mobile_identity
(
&
fgs_security_mode_comp
->
fgsmobileidentity
,
0x77
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//Return in case of error
return
encode_result
;
else
encoded
+=
encode_result
;
return
encoded
;
encoded
,
len
-
encoded
))
<
0
)
{
//Return in case of error
return
encode_result
;
}
else
{
encoded
+=
encode_result
;
if
((
encode_result
=
encode_fgc_nas_message_container
(
&
fgs_security_mode_comp
->
fgsnasmessagecontainer
,
0x71
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
{
return
encode_result
;
}
else
{
encoded
+=
encode_result
;
}
}
return
encoded
;
}
...
...
This diff is collapsed.
Click to expand it.
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h
View file @
7bef73bf
...
...
@@ -16,6 +16,7 @@
#include "SpareHalfOctet.h"
#include "FGSMobileIdentity.h"
#include "MessageType.h"
#include "FGCNasMessageContainer.h"
#ifndef FGS_NAS_SECURITY_MODE_COMPLETE_H_
#define FGS_NAS_SECURITY_MODE_COMPLETE_H_
...
...
@@ -28,13 +29,13 @@
*/
typedef
struct
fgs_security_mode_complete_msg_tag
{
/* Mandatory fields */
ExtendedProtocolDiscriminator
protocoldiscriminator
;
SecurityHeaderType
securityheadertype
:
4
;
SpareHalfOctet
sparehalfoctet
:
4
;
MessageType
messagetype
;
FGSMobileIdentity
fgsmobileidentity
;
/* Mandatory fields */
ExtendedProtocolDiscriminator
protocoldiscriminator
;
SecurityHeaderType
securityheadertype
:
4
;
SpareHalfOctet
sparehalfoctet
:
4
;
MessageType
messagetype
;
FGSMobileIdentity
fgsmobileidentity
;
FGCNasMessageContainer
fgsnasmessagecontainer
;
}
fgs_security_mode_complete_msg
;
int
encode_fgs_security_mode_complete
(
fgs_security_mode_complete_msg
*
fgs_security_mode_comp
,
uint8_t
*
buffer
,
uint32_t
len
);
...
...
This diff is collapsed.
Click to expand it.
openair3/NAS/COMMON/IES/FGCNasMessageContainer.c
0 → 100644
View file @
7bef73bf
/*! \file FGCNasMessageContainer.c
\brief security mode complete procedures for gNB
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "FGCNasMessageContainer.h"
int
decode_fgc_nas_message_container
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded
=
0
;
uint8_t
ielen
=
0
;
int
decode_result
;
if
(
iei
>
0
)
{
CHECK_IEI_DECODER
(
iei
,
*
buffer
);
decoded
++
;
}
ielen
=
*
(
buffer
+
decoded
);
decoded
+=
2
;
CHECK_LENGTH_DECODER
(
len
-
decoded
,
ielen
);
if
((
decode_result
=
decode_octet_string
(
&
nasmessagecontainer
->
nasmessagecontainercontents
,
ielen
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
return
decode_result
;
else
decoded
+=
decode_result
;
return
decoded
;
}
int
encode_fgc_nas_message_container
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
encoded
=
0
;
int
encode_result
;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
FGC_NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH
,
len
);
if
(
iei
>
0
)
{
*
buffer
=
iei
;
encoded
++
;
}
encoded
+=
2
;
if
((
encode_result
=
encode_octet_string
(
&
nasmessagecontainer
->
nasmessagecontainercontents
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
{
return
encode_result
;
}
else
{
*
(
uint16_t
*
)
(
buffer
+
1
)
=
htons
(
encoded
+
encode_result
-
3
);
encoded
+=
encode_result
;
}
return
encoded
;
}
void
dump_fgc_nas_message_container_xml
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
)
{
printf
(
"<Nas Message Container>
\n
"
);
if
(
iei
>
0
)
/* Don't display IEI if = 0 */
printf
(
" <IEI>0x%X</IEI>
\n
"
,
iei
);
printf
(
"%s"
,
dump_octet_string_xml
(
&
nasmessagecontainer
->
nasmessagecontainercontents
));
printf
(
"</Nas Message Container>
\n
"
);
}
This diff is collapsed.
Click to expand it.
openair3/NAS/COMMON/IES/FGCNasMessageContainer.h
0 → 100644
View file @
7bef73bf
/*! \file FGCNasMessageContainer.h
\brief security mode complete procedures for gNB
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "OctetString.h"
#ifndef FGC_NAS_MESSAGE_CONTAINER_H_
#define FGC_NAS_MESSAGE_CONTAINER_H_
#define FGC_NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH 4
#define FGC_NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH 65535
typedef
struct
FGCNasMessageContainer_tag
{
OctetString
nasmessagecontainercontents
;
}
FGCNasMessageContainer
;
int
encode_fgc_nas_message_container
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
int
decode_fgc_nas_message_container
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
void
dump_fgc_nas_message_container_xml
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
);
#endif
/* FGC NAS MESSAGE CONTAINER_H_ */
This diff is collapsed.
Click to expand it.
openair3/NAS/NR_UE/nr_nas_msg_sim.c
View file @
7bef73bf
...
...
@@ -24,6 +24,9 @@ uint8_t k[16] = {0x51, 0x22, 0x25, 0x02, 0x14,0xc3, 0x3e, 0x72, 0x3a, 0x5d, 0xd5
// OPC: 981d464c7c52eb6e5036234984ad0bcf
const
uint8_t
opc
[
16
]
=
{
0x98
,
0x1d
,
0x46
,
0x4c
,
0x7c
,
0x52
,
0xeb
,
0x6e
,
0x50
,
0x36
,
0x23
,
0x49
,
0x84
,
0xad
,
0x0b
,
0xcf
};
uint8_t
*
registration_request_buf
;
uint32_t
registration_request_len
;
static
int
nas_protected_security_header_encode
(
char
*
buffer
,
const
fgs_nas_message_security_header_t
*
header
,
...
...
@@ -291,9 +294,10 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
// encode the message
initialNasMsg
->
data
=
(
Byte_t
*
)
malloc
(
size
*
sizeof
(
Byte_t
));
registration_request_buf
=
initialNasMsg
->
data
;
initialNasMsg
->
length
=
mm_msg_encode
(
mm_msg
,
(
uint8_t
*
)(
initialNasMsg
->
data
),
size
);
registration_request_len
=
initialNasMsg
->
length
;
}
...
...
@@ -465,6 +469,10 @@ void generateSecurityModeComplete(as_nas_info_t *initialNasMsg)
mm_msg
->
fgs_security_mode_complete
.
fgsmobileidentity
.
imeisv
.
oddeven
=
0
;
size
+=
5
;
mm_msg
->
fgs_security_mode_complete
.
fgsnasmessagecontainer
.
nasmessagecontainercontents
.
value
=
registration_request_buf
;
mm_msg
->
fgs_security_mode_complete
.
fgsnasmessagecontainer
.
nasmessagecontainercontents
.
length
=
registration_request_len
;
size
+=
(
registration_request_len
+
2
);
// encode the message
initialNasMsg
->
data
=
(
Byte_t
*
)
malloc
(
size
*
sizeof
(
Byte_t
));
...
...
This diff is collapsed.
Click to expand it.
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