Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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
Michael Black
OpenXG UE
Commits
01b993ee
Commit
01b993ee
authored
Sep 17, 2020
by
heshanyun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement SecurityModeCommand
parent
2fab6fb1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
0 deletions
+118
-0
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+60
-0
openair2/RRC/NR/MESSAGES/asn1_msg.h
openair2/RRC/NR/MESSAGES/asn1_msg.h
+6
-0
openair2/RRC/NR/rrc_gNB.c
openair2/RRC/NR/rrc_gNB.c
+52
-0
No files found.
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
01b993ee
...
...
@@ -43,6 +43,7 @@
#include "asn1_msg.h"
#include "RRC/NR/nr_rrc_extern.h"
#include "NR_DL-CCCH-Message.h"
#include "NR_DL-DCCH-Message.h"
#include "NR_RRCReject.h"
#include "NR_RejectWaitTime.h"
#include "NR_RRCSetup.h"
...
...
@@ -54,6 +55,8 @@
#include "NR_LogicalChannelConfig.h"
#include "NR_PDCP-Config.h"
#include "NR_MAC-CellGroupConfig.h"
#include "NR_SecurityModeCommand.h"
#include "NR_CipheringAlgorithm.h"
#if defined(NR_Rel16)
#include "NR_SCS-SpecificCarrier.h"
#include "NR_TDD-UL-DL-ConfigCommon.h"
...
...
@@ -769,3 +772,60 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
uint8_t
do_NR_SecurityModeCommand
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
uint8_t
*
const
buffer
,
const
uint8_t
Transaction_id
,
const
uint8_t
cipheringAlgorithm
,
NR_IntegrityProtAlgorithm_t
*
integrityProtAlgorithm
)
//------------------------------------------------------------------------------
{
NR_DL_DCCH_Message_t
dl_dcch_msg
;
asn_enc_rval_t
enc_rval
;
memset
(
&
dl_dcch_msg
,
0
,
sizeof
(
NR_DL_DCCH_Message_t
));
dl_dcch_msg
.
message
.
present
=
NR_DL_DCCH_MessageType_PR_c1
;
dl_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_DL_DCCH_MessageType__c1_PR_securityModeCommand
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
rrc_TransactionIdentifier
=
Transaction_id
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
criticalExtensions
.
present
=
NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand
;
// the two following information could be based on the mod_id
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
cipheringAlgorithm
=
(
NR_CipheringAlgorithm_t
)
cipheringAlgorithm
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
integrityProtAlgorithm
=
integrityProtAlgorithm
;
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_DL_DCCH_Message
,
(
void
*
)
&
dl_dcch_msg
);
}
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_DL_DCCH_Message
,
NULL
,
(
void
*
)
&
dl_dcch_msg
,
buffer
,
100
);
if
(
enc_rval
.
encoded
==
-
1
)
{
LOG_I
(
NR_RRC
,
"[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
-
1
;
}
LOG_D
(
NR_RRC
,
"[gNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
rnti
,
enc_rval
.
encoded
,
(
enc_rval
.
encoded
+
7
)
/
8
);
if
(
enc_rval
.
encoded
==-
1
)
{
LOG_E
(
NR_RRC
,
"[gNB %d] ASN1 : securityModeCommand encoding failed for UE %x
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
rnti
);
return
(
-
1
);
}
// rrc_ue_process_ueCapabilityEnquiry(0,1000,&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry,0);
// exit(-1);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
openair2/RRC/NR/MESSAGES/asn1_msg.h
View file @
01b993ee
...
...
@@ -92,3 +92,9 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
uint8_t
*
const
buffer
,
const
uint8_t
transaction_id
,
NR_SRB_ToAddModList_t
*
SRB_configList
);
uint8_t
do_NR_SecurityModeCommand
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
uint8_t
*
const
buffer
,
const
uint8_t
Transaction_id
,
const
uint8_t
cipheringAlgorithm
,
NR_IntegrityProtAlgorithm_t
*
integrityProtAlgorithm
);
openair2/RRC/NR/rrc_gNB.c
View file @
01b993ee
...
...
@@ -739,3 +739,55 @@ void *rrc_gnb_task(void *args_p) {
}
}
//-----------------------------------------------------------------------------
void
rrc_gNB_generate_SecurityModeCommand
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
rrc_gNB_ue_context_t
*
const
ue_context_pP
)
//-----------------------------------------------------------------------------
{
uint8_t
buffer
[
100
];
uint8_t
size
;
T
(
T_ENB_RRC_SECURITY_MODE_COMMAND
,
T_INT
(
ctxt_pP
->
module_id
),
T_INT
(
ctxt_pP
->
frame
),
T_INT
(
ctxt_pP
->
subframe
),
T_INT
(
ctxt_pP
->
rnti
));
NR_IntegrityProtAlgorithm_t
integrity_algorithm
=
(
NR_IntegrityProtAlgorithm_t
)
ue_context_pP
->
ue_context
.
integrity_algorithm
;
size
=
do_NR_SecurityModeCommand
(
ctxt_pP
,
buffer
,
rrc_eNB_get_next_transaction_identifier
(
ctxt_pP
->
module_id
),
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
&
integrity_algorithm
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,(
char
*
)
buffer
,
size
,
"[MSG] RRC Security Mode Command
\n
"
);
LOG_I
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
size
);
LOG_D
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
size
,
rrc_gNB_mui
,
DCCH
);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
buffer
,
size
,
MSC_AS_TIME_FMT
" securityModeCommand UE %x MUI %d size %u"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
->
ue_context
.
rnti
,
rrc_gNB_mui
,
size
);
LOG_I
(
NR_RRC
,
"calling rrc_data_req :securityModeCommand
\n
"
);
rrc_data_req
(
ctxt_pP
,
DCCH
,
rrc_gNB_mui
++
,
SDU_CONFIRM_NO
,
size
,
buffer
,
PDCP_TRANSMISSION_MODE_CONTROL
);
}
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