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
常顺宇
OpenXG-RAN
Commits
fefb6148
Commit
fefb6148
authored
Sep 29, 2020
by
Xue Song
Committed by
yoshio.inoue
Oct 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify some warnings
Add nr_rrc_pdcp_config_security Delete ENABLE_SECURITY
parent
84579c5d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
152 additions
and
13 deletions
+152
-13
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+50
-1
openair2/RRC/NR/MESSAGES/asn1_msg.h
openair2/RRC/NR/MESSAGES/asn1_msg.h
+4
-0
openair2/RRC/NR/nr_rrc_defs.h
openair2/RRC/NR/nr_rrc_defs.h
+1
-4
openair2/RRC/NR/rrc_gNB.c
openair2/RRC/NR/rrc_gNB.c
+25
-6
openair2/RRC/NR/rrc_gNB_NGAP.c
openair2/RRC/NR/rrc_gNB_NGAP.c
+72
-2
No files found.
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
fefb6148
...
...
@@ -1016,7 +1016,7 @@ uint16_t do_RRCReconfiguration(
/******************** Secondary Cell Group ********************/
rrc_gNB_carrier_data_t
*
carrier
=
&
(
gnb_rrc_inst
->
carrier
);
fill_default_secondaryCellGroup
(
carrier
->
ServingCellConfigC
ommon
,
fill_default_secondaryCellGroup
(
carrier
->
servingcellconfigc
ommon
,
ue_context_pP
->
ue_context
.
secondaryCellGroup
,
1
,
1
,
...
...
@@ -1063,3 +1063,52 @@ uint16_t do_RRCReconfiguration(
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
uint8_t
do_RRCSetupRequest
(
uint8_t
Mod_id
,
uint8_t
*
buffer
,
uint8_t
*
rv
)
{
asn_enc_rval_t
enc_rval
;
uint8_t
buf
[
5
],
buf2
=
0
;
NR_UL_CCCH_Message_t
ul_ccch_msg
;
NR_RRCSetupRequest_t
*
rrcSetupRequest
;
memset
((
void
*
)
&
ul_ccch_msg
,
0
,
sizeof
(
NR_UL_CCCH_Message_t
));
ul_ccch_msg
.
message
.
present
=
NR_UL_CCCH_MessageType_PR_c1
;
ul_ccch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest
;
rrcSetupRequest
=
ul_ccch_msg
.
message
.
choice
.
c1
->
choice
.
rrcSetupRequest
;
if
(
1
)
{
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
present
=
NR_InitialUE_Identity_PR_randomValue
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
size
=
5
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
bits_unused
=
0
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
=
buf
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
0
]
=
rv
[
0
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
1
]
=
rv
[
1
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
2
]
=
rv
[
2
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
3
]
=
rv
[
3
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
4
]
=
rv
[
4
];
}
else
{
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
present
=
NR_InitialUE_Identity_PR_ng_5G_S_TMSI_Part1
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
size
=
1
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
bits_unused
=
0
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
buf
=
buf
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
buf
[
0
]
=
0x12
;
}
rrcSetupRequest
->
rrcSetupRequest
.
establishmentCause
=
NR_EstablishmentCause_mo_Signalling
;
//EstablishmentCause_mo_Data;
rrcSetupRequest
->
rrcSetupRequest
.
spare
.
buf
=
&
buf2
;
rrcSetupRequest
->
rrcSetupRequest
.
spare
.
size
=
1
;
rrcSetupRequest
->
rrcSetupRequest
.
spare
.
bits_unused
=
7
;
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_UL_CCCH_Message
,
(
void
*
)
&
ul_ccch_msg
);
}
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_UL_CCCH_Message
,
NULL
,
(
void
*
)
&
ul_ccch_msg
,
buffer
,
100
);
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
LOG_D
(
RRC
,
"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,
(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
openair2/RRC/NR/MESSAGES/asn1_msg.h
View file @
fefb6148
...
...
@@ -99,6 +99,10 @@ uint8_t do_NR_SecurityModeCommand(
const
uint8_t
cipheringAlgorithm
,
NR_IntegrityProtAlgorithm_t
*
integrityProtAlgorithm
);
uint8_t
do_NR_UECapabilityEnquiry_nr
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
uint8_t
*
const
buffer
,
const
uint8_t
Transaction_id
);
uint8_t
do_NR_RRCConnectionRelease
(
uint8_t
*
buffer
,
uint8_t
Transaction_id
);
uint16_t
do_RRCReconfiguration
(
...
...
openair2/RRC/NR/nr_rrc_defs.h
View file @
fefb6148
...
...
@@ -134,8 +134,6 @@ typedef enum UE_STATE_NR_e {
/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
#define NR_RRC_TRANSACTION_IDENTIFIER_NUMBER 3
#define ENABLE_SECURITY 1
typedef
struct
{
unsigned
short
transport_block_size
;
/*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
unsigned
short
max_transport_blocks
;
/*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */
...
...
@@ -289,13 +287,12 @@ typedef struct gNB_RRC_UE_s {
ImsiMobileIdentity_t
imsi
;
#if defined(ENABLE_SECURITY)
/* KgNB as derived from KASME received from EPC */
uint8_t
kgnb
[
32
];
int8_t
kgnb_ncc
;
uint8_t
nh
[
32
];
int8_t
nh_ncc
;
#endif
/* Used integrity/ciphering algorithms */
NR_CipheringAlgorithm_t
ciphering_algorithm
;
e_NR_IntegrityProtAlgorithm
integrity_algorithm
;
...
...
openair2/RRC/NR/rrc_gNB.c
View file @
fefb6148
...
...
@@ -68,9 +68,7 @@
#include "OCG.h"
#include "OCG_extern.h"
#if defined(ENABLE_SECURITY)
#include "UTIL/OSA/osa_defs.h"
#endif
#include "UTIL/OSA/osa_defs.h"
#include "rrc_eNB_S1AP.h"
#include "rrc_gNB_NGAP.h"
...
...
@@ -92,6 +90,28 @@
extern
RAN_CONTEXT_t
RC
;
extern
boolean_t
nr_rrc_pdcp_config_asn1_req
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
NR_SRB_ToAddModList_t
*
const
srb2add_list
,
NR_DRB_ToAddModList_t
*
const
drb2add_list
,
NR_DRB_ToReleaseList_t
*
const
drb2release_list
,
const
uint8_t
security_modeP
,
uint8_t
*
const
kRRCenc
,
uint8_t
*
const
kRRCint
,
uint8_t
*
const
kUPenc
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
,
LTE_PMCH_InfoList_r9_t
*
pmch_InfoList_r9
#endif
,
rb_id_t
*
const
defaultDRB
,
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
rlc_bearer2add_list
);
extern
rlc_op_status_t
nr_rrc_rlc_config_asn1_req
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
NR_SRB_ToAddModList_t
*
const
srb2add_listP
,
const
NR_DRB_ToAddModList_t
*
const
drb2add_listP
,
const
NR_DRB_ToReleaseList_t
*
const
drb2release_listP
,
const
LTE_PMCH_InfoList_r9_t
*
const
pmch_InfoList_r9_pP
,
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
rlc_bearer2add_list
);
mui_t
rrc_gNB_mui
=
0
;
///---------------------------------------------------------------------------------------------------------------///
...
...
@@ -570,6 +590,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
kRRCint
,
kUPenc
,
NULL
,
NULL
,
NULL
);
/* Refresh SRBs/DRBs */
nr_rrc_rlc_config_asn1_req
(
ctxt_pP
,
...
...
@@ -577,9 +598,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
DRB_configList
,
DRB_Release_configList2
,
NULL
,
0
,
0
);
NULL
);
/* Loop through DRBs and establish if necessary */
if
(
DRB_configList
!=
NULL
)
{
...
...
openair2/RRC/NR/rrc_gNB_NGAP.c
View file @
fefb6148
...
...
@@ -47,6 +47,7 @@
#include "S1AP_NAS-PDU.h"
#include "executables/softmodem-common.h"
#include "UTIL/OSA/osa_defs.h"
extern
RAN_CONTEXT_t
RC
;
...
...
@@ -115,6 +116,75 @@ rrc_gNB_get_ue_context_from_ngap_ids(
return
NULL
;
}
//------------------------------------------------------------------------------
void
nr_rrc_pdcp_config_security
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
rrc_gNB_ue_context_t
*
const
ue_context_pP
,
const
uint8_t
send_security_mode_command
)
//------------------------------------------------------------------------------
{
NR_SRB_ToAddModList_t
*
SRB_configList
=
ue_context_pP
->
ue_context
.
SRB_configList
;
uint8_t
*
kRRCenc
=
NULL
;
uint8_t
*
kRRCint
=
NULL
;
uint8_t
*
kUPenc
=
NULL
;
pdcp_t
*
pdcp_p
=
NULL
;
static
int
print_keys
=
1
;
hashtable_rc_t
h_rc
;
hash_key_t
key
;
/* Derive the keys from kgnb */
if
(
SRB_configList
!=
NULL
)
{
derive_key_up_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kUPenc
);
}
derive_key_rrc_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCenc
);
derive_key_rrc_int
(
ue_context_pP
->
ue_context
.
integrity_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCint
);
if
(
!
IS_SOFTMODEM_IQPLAYER
)
{
SET_LOG_DUMP
(
DEBUG_SECURITY
)
;
}
if
(
LOG_DUMPFLAG
(
DEBUG_SECURITY
)
)
{
if
(
print_keys
==
1
)
{
print_keys
=
0
;
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
ue_context_pP
->
ue_context
.
kgnb
,
32
,
"
\n
KgNB:"
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
kRRCenc
,
32
,
"
\n
KRRCenc:"
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
kRRCint
,
32
,
"
\n
KRRCint:"
);
}
}
key
=
PDCP_COLL_KEY_VALUE
(
ctxt_pP
->
module_id
,
ctxt_pP
->
rnti
,
ctxt_pP
->
enb_flag
,
DCCH
,
SRB_FLAG_YES
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
if
(
h_rc
==
HASH_TABLE_OK
)
{
pdcp_config_set_security
(
ctxt_pP
,
pdcp_p
,
DCCH
,
DCCH
+
2
,
(
send_security_mode_command
==
TRUE
)
?
0
|
(
ue_context_pP
->
ue_context
.
integrity_algorithm
<<
4
)
:
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
)
|
(
ue_context_pP
->
ue_context
.
integrity_algorithm
<<
4
),
kRRCenc
,
kRRCint
,
kUPenc
);
}
else
{
LOG_E
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
"Could not get PDCP instance for SRB DCCH %u
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
DCCH
);
}
}
//------------------------------------------------------------------------------
/*
* Initial UE NAS message on S1AP.
...
...
@@ -280,7 +350,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
uint8_t
send_security_mode_command
=
TRUE
;
rrc_pdcp_config_security
(
nr_
rrc_pdcp_config_security
(
&
ctxt
,
ue_context_p
,
send_security_mode_command
);
...
...
@@ -289,7 +359,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
rrc_gNB_generate_SecurityModeCommand
(
&
ctxt
,
ue_context_p
);
send_security_mode_command
=
FALSE
;
rrc_pdcp_config_security
(
nr_
rrc_pdcp_config_security
(
&
ctxt
,
ue_context_p
,
send_security_mode_command
);
...
...
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