Commit 118ac391 authored by Xue Song's avatar Xue Song

Modify some warnings

Add nr_rrc_pdcp_config_security
Delete ENABLE_SECURITY
parent 685837f8
...@@ -1017,7 +1017,7 @@ uint16_t do_RRCReconfiguration( ...@@ -1017,7 +1017,7 @@ uint16_t do_RRCReconfiguration(
/******************** Secondary Cell Group ********************/ /******************** Secondary Cell Group ********************/
rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier); rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier);
fill_default_secondaryCellGroup( carrier->ServingCellConfigCommon, fill_default_secondaryCellGroup( carrier->servingcellconfigcommon,
ue_context_pP->ue_context.secondaryCellGroup, ue_context_pP->ue_context.secondaryCellGroup,
1, 1,
1, 1,
...@@ -1074,7 +1074,7 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) { ...@@ -1074,7 +1074,7 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
memset((void *)&ul_ccch_msg,0,sizeof(NR_UL_CCCH_Message_t)); 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.present = NR_UL_CCCH_MessageType_PR_c1;
ul_ccch_msg.message.choice.c1->present = NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest; ul_ccch_msg.message.choice.c1->present = NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest;
rrcSetupRequest = &ul_ccch_msg.message.choice.c1->choice.rrcSetupRequest; rrcSetupRequest = ul_ccch_msg.message.choice.c1->choice.rrcSetupRequest;
if (1) { if (1) {
......
...@@ -99,6 +99,10 @@ uint8_t do_NR_SecurityModeCommand( ...@@ -99,6 +99,10 @@ uint8_t do_NR_SecurityModeCommand(
const uint8_t cipheringAlgorithm, const uint8_t cipheringAlgorithm,
NR_IntegrityProtAlgorithm_t *integrityProtAlgorithm); 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 do_NR_RRCConnectionRelease(uint8_t *buffer,
uint8_t Transaction_id); uint8_t Transaction_id);
uint16_t do_RRCReconfiguration( uint16_t do_RRCReconfiguration(
......
...@@ -134,8 +134,6 @@ typedef enum UE_STATE_NR_e { ...@@ -134,8 +134,6 @@ typedef enum UE_STATE_NR_e {
/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */ /* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
#define NR_RRC_TRANSACTION_IDENTIFIER_NUMBER 3 #define NR_RRC_TRANSACTION_IDENTIFIER_NUMBER 3
#define ENABLE_SECURITY 1
typedef struct { typedef struct {
unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ 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 */ 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 { ...@@ -289,13 +287,12 @@ typedef struct gNB_RRC_UE_s {
ImsiMobileIdentity_t imsi; ImsiMobileIdentity_t imsi;
#if defined(ENABLE_SECURITY)
/* KgNB as derived from KASME received from EPC */ /* KgNB as derived from KASME received from EPC */
uint8_t kgnb[32]; uint8_t kgnb[32];
int8_t kgnb_ncc; int8_t kgnb_ncc;
uint8_t nh[32]; uint8_t nh[32];
int8_t nh_ncc; int8_t nh_ncc;
#endif
/* Used integrity/ciphering algorithms */ /* Used integrity/ciphering algorithms */
NR_CipheringAlgorithm_t ciphering_algorithm; NR_CipheringAlgorithm_t ciphering_algorithm;
e_NR_IntegrityProtAlgorithm integrity_algorithm; e_NR_IntegrityProtAlgorithm integrity_algorithm;
......
...@@ -68,9 +68,7 @@ ...@@ -68,9 +68,7 @@
#include "OCG.h" #include "OCG.h"
#include "OCG_extern.h" #include "OCG_extern.h"
#if defined(ENABLE_SECURITY) #include "UTIL/OSA/osa_defs.h"
#include "UTIL/OSA/osa_defs.h"
#endif
#include "rrc_eNB_S1AP.h" #include "rrc_eNB_S1AP.h"
#include "rrc_gNB_NGAP.h" #include "rrc_gNB_NGAP.h"
...@@ -92,6 +90,28 @@ ...@@ -92,6 +90,28 @@
extern RAN_CONTEXT_t RC; 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; mui_t rrc_gNB_mui = 0;
///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------///
...@@ -570,6 +590,7 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -570,6 +590,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
kRRCint, kRRCint,
kUPenc, kUPenc,
NULL, NULL,
NULL,
NULL); NULL);
/* Refresh SRBs/DRBs */ /* Refresh SRBs/DRBs */
nr_rrc_rlc_config_asn1_req(ctxt_pP, nr_rrc_rlc_config_asn1_req(ctxt_pP,
...@@ -577,9 +598,7 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -577,9 +598,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
DRB_configList, DRB_configList,
DRB_Release_configList2, DRB_Release_configList2,
NULL, NULL,
0, NULL);
0
);
/* Loop through DRBs and establish if necessary */ /* Loop through DRBs and establish if necessary */
if (DRB_configList != NULL) { if (DRB_configList != NULL) {
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "S1AP_NAS-PDU.h" #include "S1AP_NAS-PDU.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "UTIL/OSA/osa_defs.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
...@@ -115,6 +116,75 @@ rrc_gNB_get_ue_context_from_ngap_ids( ...@@ -115,6 +116,75 @@ rrc_gNB_get_ue_context_from_ngap_ids(
return NULL; 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,"\nKgNB:" );
LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCenc, 32,"\nKRRCenc:" );
LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCint, 32,"\nKRRCint:" );
}
}
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. * Initial UE NAS message on S1AP.
...@@ -280,7 +350,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( ...@@ -280,7 +350,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
uint8_t send_security_mode_command = TRUE; uint8_t send_security_mode_command = TRUE;
rrc_pdcp_config_security( nr_rrc_pdcp_config_security(
&ctxt, &ctxt,
ue_context_p, ue_context_p,
send_security_mode_command); send_security_mode_command);
...@@ -289,7 +359,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( ...@@ -289,7 +359,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
rrc_gNB_generate_SecurityModeCommand (&ctxt, ue_context_p); rrc_gNB_generate_SecurityModeCommand (&ctxt, ue_context_p);
send_security_mode_command = FALSE; send_security_mode_command = FALSE;
rrc_pdcp_config_security( nr_rrc_pdcp_config_security(
&ctxt, &ctxt,
ue_context_p, ue_context_p,
send_security_mode_command); send_security_mode_command);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment