Commit 9e815444 authored by Vaibhav Shrivastava's avatar Vaibhav Shrivastava

AS Security, PDCP Count and Enquire Timing Porting Changes

parent c804d7d0
...@@ -2747,7 +2747,7 @@ target_link_libraries (lte-uesoftmodem ...@@ -2747,7 +2747,7 @@ target_link_libraries (lte-uesoftmodem
-Wl,--start-group -Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB
SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB ${NFAPI_STATIC_LIB} NFAPI_USER_LIB MISC_NFAPI_LTE_LIB PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES}
-Wl,--end-group z dl) -Wl,--end-group z dl)
......
...@@ -1239,6 +1239,62 @@ void pdcp_update_stats(const protocol_ctxt_t *const ctxt_pP) { ...@@ -1239,6 +1239,62 @@ void pdcp_update_stats(const protocol_ctxt_t *const ctxt_pP) {
} }
int pdcp_fill_ss_pdcp_cnt (
pdcp_t *pdcp_p,
uint32_t rb_id,
ss_get_pdcp_cnt_t *pc
)
{
LOG_D (PDCP, "Fill PDCPCount for pdcp_p->rb_id : %ld is_srb? : %d \n",
pdcp_p->rb_id, pdcp_p->is_srb);
if (NULL == pc) return -1;
pc->size += 1;
if (pdcp_p->is_srb) {
pc->rb_info[rb_id].rb_id = pdcp_p->rb_id;;
pc->rb_info[rb_id].is_srb = true;
pc->rb_info[rb_id].ul_format = E_PdcpCount_Srb;
pc->rb_info[rb_id].dl_format = E_PdcpCount_Srb;
pc->rb_info[rb_id].ul_count = pdcp_get_next_count_rx(pdcp_p, 1, pdcp_p->rx_hfn, pdcp_p->next_pdcp_rx_sn - 1);
pc->rb_info[rb_id].dl_count = pdcp_get_next_count_tx(pdcp_p, 1, pdcp_p->next_pdcp_tx_sn - 1);
LOG_D (PDCP, "SRB DL Count (dec): %d UL Count (dec): %d \n \
RX_HFN: %d TX_HFN: %d \n \
RX Seq Num: %d TX Seq Num: %d \n",
pc->rb_info[rb_id].dl_count,
pc->rb_info[rb_id].ul_count,
pdcp_p->rx_hfn, pdcp_p->tx_hfn,
pdcp_p->next_pdcp_rx_sn - 1,
pdcp_p->next_pdcp_tx_sn - 1);
} else {
pc->rb_info[rb_id].rb_id = pdcp_p->rb_id + 3;
LOG_D(PDCP, "Updated rb_id for DRB: %d (+3)\n", pc->rb_info[rb_id].rb_id);
pc->rb_info[rb_id].is_srb = false;
if (pdcp_p->seq_num_size == 7) {
pc->rb_info[rb_id].ul_format = E_PdcpCount_DrbShortSQN;
pc->rb_info[rb_id].dl_format = E_PdcpCount_DrbShortSQN;
LOG_D (PDCP, "DRB Short SQN\n");
} else {
pc->rb_info[rb_id].ul_format = E_PdcpCount_DrbLongSQN;
pc->rb_info[rb_id].dl_format = E_PdcpCount_DrbLongSQN;
LOG_D (PDCP, "DRB Long SQN\n");
}
pc->rb_info[rb_id].ul_count = pdcp_get_next_count_rx(pdcp_p, 0, pdcp_p->rx_hfn, pdcp_p->next_pdcp_rx_sn - 1);
pc->rb_info[rb_id].dl_count = pdcp_get_next_count_tx(pdcp_p, 0, pdcp_p->next_pdcp_tx_sn - 1);
LOG_D (PDCP, "DRB DL Count (dec): %d UL Count (dec): %d \n \
RX_HFN: %d TX_HFN: %d \n \
RX Seq Num: %d TX Seq Num: %d \n",
pc->rb_info[rb_id].dl_count,
pc->rb_info[rb_id].ul_count,
pdcp_p->rx_hfn, pdcp_p->tx_hfn,
pdcp_p->next_pdcp_rx_sn - 1,
pdcp_p->next_pdcp_tx_sn - 1);
}
return 0;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
pdcp_run ( pdcp_run (
...@@ -1321,6 +1377,100 @@ pdcp_run ( ...@@ -1321,6 +1377,100 @@ pdcp_run (
} }
break; break;
case SS_SET_PDCP_CNT:
LOG_D(PDCP, "PDCP Received SS_SET_PDCP_CNT");
break;
case SS_REQ_PDCP_CNT:
LOG_D(PDCP, "PDCP Received SS_GET_PDCP_CNT \n");
pdcp_t *pdcp_p = NULL;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc;
MessageDef *message_p;
uint8_t rbid_;
rnti_t ue_rnti;
if (NULL == ctxt_pP) {
LOG_E(PDCP, "No context to get PdcpCount\n");
break;
}
message_p = itti_alloc_new_message (TASK_PDCP_ENB, ctxt_pP->module_id, SS_GET_PDCP_CNT);
SS_GET_PDCP_CNT(message_p).size = 0;
ue_rnti = SS_REQ_PDCP_CNT(msg_p).rnti;
uint8_t rb_idx = 0;
if (SS_REQ_PDCP_CNT(msg_p).rb_id == 0xFF)
{
LOG_D(PDCP, "PDCP Received request PDCP COUNT for all RB's\n");
for (int i = 0; i < MAX_RBS; i++)
{
if (i < 3)
{
rbid_ = i;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ue_rnti, ctxt_pP->enb_flag, rbid_, 1);
}
else
{
rbid_ = i - 3;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ue_rnti, ctxt_pP->enb_flag, rbid_, 0);
}
h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p);
if (h_rc == HASH_TABLE_OK)
{
/** Fill response */
LOG_D (PDCP, "Found entry on hastable for rbid_ : %d ctxt module_id %d rnti %d enb_flag %d\n",
rbid_, ctxt_pP->module_id, ue_rnti, ctxt_pP->enb_flag);
pdcp_fill_ss_pdcp_cnt(pdcp_p, rb_idx, &(SS_GET_PDCP_CNT(message_p)));
/** Increase the array index for next RB IDX */
rb_idx ++;
}
else
{
LOG_D (PDCP, "No entry on hastable for rbid_: %d ctxt module_id %d rnti %d enb_flag %d\n",
rbid_, ctxt_pP->module_id, ue_rnti, ctxt_pP->enb_flag);
}
}
}
else
{
rb_idx = SS_REQ_PDCP_CNT(msg_p).rb_id;
LOG_A(PDCP, "PDCP Received request PDCP COUNT for Single RB:%d\n",
SS_REQ_PDCP_CNT(message_p).rb_id);
if (rb_idx < 3)
{
rbid_ = rb_idx;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ue_rnti, ctxt_pP->enb_flag, rbid_, 1);
}
else
{
rbid_ = rb_idx - 3;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ue_rnti, ctxt_pP->enb_flag, rbid_, 0);
}
h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p);
if (h_rc == HASH_TABLE_OK)
{
if (SS_REQ_PDCP_CNT(message_p).rb_id <= MAX_RBS)
{
/** For single RB always updating at the 0th index only */
pdcp_fill_ss_pdcp_cnt(pdcp_p, 0, &(SS_GET_PDCP_CNT(message_p)));
}
}
else
{
LOG_D (PDCP, "No entry for single RB on hastable for rbid_: %d\n", rbid_);
}
}
itti_send_msg_to_task (TASK_SYS, ctxt_pP->module_id, message_p);
break;
default: default:
LOG_E(PDCP, "Received unexpected message %s\n", ITTI_MSG_NAME (msg_p)); LOG_E(PDCP, "Received unexpected message %s\n", ITTI_MSG_NAME (msg_p));
break; break;
...@@ -2191,6 +2341,18 @@ pdcp_config_req_asn1 ( ...@@ -2191,6 +2341,18 @@ pdcp_config_req_asn1 (
return 0; return 0;
} }
//-----------------------------------------------------------------------------
void
pdcp_config_set_security_cipher(
pdcp_t *pdcp_pP,
uint8_t security_modeP)
//-----------------------------------------------------------------------------
{
DevAssert(pdcp_pP != NULL);
pdcp_pP->cipheringAlgorithm = security_modeP;
pdcp_pP->security_activated = 1;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
pdcp_config_set_security( pdcp_config_set_security(
......
...@@ -435,6 +435,18 @@ rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt_pP, ...@@ -435,6 +435,18 @@ rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt_pP,
const rb_id_t rb_idP, const mui_t muiP, const rb_id_t rb_idP, const mui_t muiP,
confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP, const uint32_t *const, const uint32_t *const); confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP, const uint32_t *const, const uint32_t *const);
uint32_t pdcp_get_next_count_tx(
pdcp_t * const pdcp_pP,
const srb_flag_t srb_flagP,
const uint16_t pdcp_sn
);
uint32_t pdcp_get_next_count_rx(
pdcp_t * const pdcp_pP,
const srb_flag_t srb_flagP,
const uint32_t hfn,
const int sn
);
/* /*
* Following two types are utilized between NAS driver and PDCP * Following two types are utilized between NAS driver and PDCP
*/ */
......
...@@ -173,6 +173,8 @@ int pdcp_netlink_dequeue_element(const protocol_ctxt_t* const ctxt_pP, ...@@ -173,6 +173,8 @@ int pdcp_netlink_dequeue_element(const protocol_ctxt_t* const ctxt_pP,
void pdcp_config_set_security(const protocol_ctxt_t* const ctxt_pP, pdcp_t *pdcp_pP, rb_id_t rb_idP, void pdcp_config_set_security(const protocol_ctxt_t* const ctxt_pP, pdcp_t *pdcp_pP, rb_id_t rb_idP,
uint16_t lc_idP, uint8_t security_modeP, uint8_t *kRRCenc_pP, uint8_t *kRRCint_pP, uint8_t *kUPenc_pP); uint16_t lc_idP, uint8_t security_modeP, uint8_t *kRRCenc_pP, uint8_t *kRRCint_pP, uint8_t *kUPenc_pP);
void pdcp_config_set_security_cipher(pdcp_t *pdcp_pP,uint8_t security_modeP);
int pdcp_apply_security(const protocol_ctxt_t* const ctxt_pP, int pdcp_apply_security(const protocol_ctxt_t* const ctxt_pP,
pdcp_t *pdcp_entity, pdcp_t *pdcp_entity,
srb_flag_t srb_flagP, srb_flag_t srb_flagP,
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "pdcp_primitives.h" #include "pdcp_primitives.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static //static
uint32_t pdcp_get_next_count_tx( uint32_t pdcp_get_next_count_tx(
pdcp_t * const pdcp_pP, pdcp_t * const pdcp_pP,
const srb_flag_t srb_flagP, const srb_flag_t srb_flagP,
...@@ -67,7 +67,7 @@ uint32_t pdcp_get_next_count_tx( ...@@ -67,7 +67,7 @@ uint32_t pdcp_get_next_count_tx(
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static //static
uint32_t pdcp_get_next_count_rx( uint32_t pdcp_get_next_count_rx(
pdcp_t * const pdcp_pP, pdcp_t * const pdcp_pP,
const srb_flag_t srb_flagP, const srb_flag_t srb_flagP,
...@@ -151,7 +151,7 @@ pdcp_apply_security( ...@@ -151,7 +151,7 @@ pdcp_apply_security(
} }
encrypt_params.message = &pdcp_pdu_buffer[pdcp_header_len]; encrypt_params.message = &pdcp_pdu_buffer[pdcp_header_len];
encrypt_params.blength = sdu_buffer_size << 3; encrypt_params.blength = (sdu_buffer_size + 4)<< 3;
buffer_encrypted = &pdcp_pdu_buffer[pdcp_header_len]; buffer_encrypted = &pdcp_pdu_buffer[pdcp_header_len];
...@@ -195,7 +195,7 @@ pdcp_validate_security( ...@@ -195,7 +195,7 @@ pdcp_validate_security(
decrypt_params.bearer = rb_id - 1; decrypt_params.bearer = rb_id - 1;
decrypt_params.count = pdcp_get_next_count_rx(pdcp_pP, srb_flagP, hfn, sn); decrypt_params.count = pdcp_get_next_count_rx(pdcp_pP, srb_flagP, hfn, sn);
decrypt_params.message = &pdcp_pdu_buffer[pdcp_header_len]; decrypt_params.message = &pdcp_pdu_buffer[pdcp_header_len];
decrypt_params.blength = (sdu_buffer_size - pdcp_header_len) << 3; decrypt_params.blength = ((sdu_buffer_size + 4) - pdcp_header_len) << 3;
decrypt_params.key_length = 16; decrypt_params.key_length = 16;
if (srb_flagP) { if (srb_flagP) {
......
...@@ -122,6 +122,11 @@ pthread_mutex_t rrc_release_freelist; ...@@ -122,6 +122,11 @@ pthread_mutex_t rrc_release_freelist;
RRC_release_list_t rrc_release_info; RRC_release_list_t rrc_release_info;
pthread_mutex_t lock_ue_freelist; pthread_mutex_t lock_ue_freelist;
uint8_t security_mode_command_send = TRUE;
uint8_t as_security_conf_ciphering;
LTE_CipheringAlgorithm_r12_t ciphering_algorithm;
uint8_t ul_sqn,dl_sqn;
void void
openair_rrc_on( openair_rrc_on(
const protocol_ctxt_t *const ctxt_pP const protocol_ctxt_t *const ctxt_pP
...@@ -3648,13 +3653,22 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t ...@@ -3648,13 +3653,22 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
rrc_eNB_mui, rrc_eNB_mui,
ctxt_pP->module_id, ctxt_pP->module_id,
DCCH); DCCH);
rrc_data_req(ctxt_pP,
DCCH, uint8_t *kRRCenc = NULL;
rrc_eNB_mui++, uint8_t *kRRCint = NULL;
SDU_CONFIRM_NO, uint8_t *kUPenc = NULL;
size, int8_t security_modeP = 0xff;
buffer, if (RC.mode == SS_ENB)
PDCP_TRANSMISSION_MODE_CONTROL); {
rrc_data_req(ctxt_pP,
DCCH,
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
/* Refresh SRBs/DRBs */ /* Refresh SRBs/DRBs */
rrc_pdcp_config_asn1_req(ctxt_pP, rrc_pdcp_config_asn1_req(ctxt_pP,
*SRB_configList2, // NULL, *SRB_configList2, // NULL,
...@@ -3679,6 +3693,55 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t ...@@ -3679,6 +3693,55 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
); );
} }
if (RC.mode > SS_ENB)
{
pdcp_t *pdcp_p = NULL;
rb_id_t rbid_ = 1;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rbid_, 1);
int8_t h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
if (h_rc == HASH_TABLE_OK)
{
kRRCenc = MALLOC(16);
kRRCint = MALLOC(32);
kUPenc = MALLOC(16);
memcpy(kRRCenc, pdcp_p->kRRCenc, 16);
memcpy(kRRCint, pdcp_p->kRRCint, 32);
memcpy(kUPenc, pdcp_p->kUPenc, 16);
security_modeP = (pdcp_p->cipheringAlgorithm |(pdcp_p->integrityProtAlgorithm << 4) );
LOG_A(RRC, "OSA Reconfig for SRB2 %d rnti \n", ctxt_pP->rnti);
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH1, SRB_FLAG_YES);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
if (h_rc == HASH_TABLE_OK)
{
LOG_A(RRC, "OSA Setting security for SRB2 %d rnti \n", ctxt_pP->rnti);
pdcp_config_set_security(
ctxt_pP,
pdcp_p,
DCCH1,
DCCH1 + 2,
security_modeP,
kRRCenc,
kRRCint,
kUPenc);
}
else
{
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT "Could not get PDCP instance for SRB DCCH %u\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH);
}
}
else
{
LOG_A(RRC, "OSA Can't find Hash of UE rnti %x\n", rnti);
}
}
free(Sparams); free(Sparams);
Sparams = NULL; Sparams = NULL;
free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP); free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP);
...@@ -6526,26 +6589,32 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ...@@ -6526,26 +6589,32 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
T_INT(ctxt_pP->frame), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->subframe),
T_INT(ctxt_pP->rnti)); T_INT(ctxt_pP->rnti));
int8_t security_modeP = 0xff;
if (RC.mode == SS_ENB)
{
/* Derive the keys from kenb */
if (DRB_configList != NULL)
{
derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
ue_context_pP->ue_context.kenb,
&kUPenc);
}
/* Derive the keys from kenb */ derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm,
if (DRB_configList != NULL) { ue_context_pP->ue_context.kenb,
derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, &kRRCenc);
ue_context_pP->ue_context.kenb, derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
&kUPenc); ue_context_pP->ue_context.kenb,
} &kRRCint);
security_modeP = 0xff;
}
derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm,
ue_context_pP->ue_context.kenb,
&kRRCenc);
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
ue_context_pP->ue_context.kenb,
&kRRCint);
/* Refresh SRBs/DRBs */ /* Refresh SRBs/DRBs */
rrc_pdcp_config_asn1_req(ctxt_pP, rrc_pdcp_config_asn1_req(ctxt_pP,
SRB_configList, // NULL, SRB_configList, // NULL,
DRB_configList, DRB_configList,
DRB_Release_configList2, DRB_Release_configList2,
0xff, // already configured during the securitymodecommand security_modeP, // already configured during the securitymodecommand
kRRCenc, kRRCenc,
kRRCint, kRRCint,
kUPenc, kUPenc,
...@@ -7341,6 +7410,71 @@ char rrc_eNB_rblist_configuration( ...@@ -7341,6 +7410,71 @@ char rrc_eNB_rblist_configuration(
return 0; return 0;
} }
//-----------------------------------------------------------------------------
char rrc_eNB_as_security_configuration_req(
const protocol_ctxt_t *const ctxt_pP,
const module_id_t enb_mod_idP,
RrcAsSecurityConfigReq *ASSecConfReq
)
//-----------------------------------------------------------------------------
{
pdcp_t *pdcp_p = NULL;
hashtable_rc_t h_rc;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
ss_get_pdcp_cnt_t pc;
uint8_t rb_idx = 0;
uint8_t rbid_;
if (NULL == ctxt_pP) {
LOG_A(RRC, "No context to get PdcpCount\n");
}
LOG_A(RRC,"Inside rrc_eNB_as_security_configuration_req \n");
AssertFatal(ASSecConfReq!=NULL,"AS Security Config Request is NULL \n");
ciphering_algorithm = ASSecConfReq->Ciphering.ciphering_algorithm;
for (int i = 0; i < MAX_RBS; i++)
{
if (i < 3)
{
rbid_ = i;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ASSecConfReq->rnti, ctxt_pP->enb_flag, rbid_, 1);
}
else
{
rbid_ = i - 3;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ASSecConfReq->rnti, ctxt_pP->enb_flag, rbid_, 0);
}
h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p);
if (h_rc == HASH_TABLE_OK)
{
pdcp_fill_ss_pdcp_cnt(pdcp_p, rb_idx, &pc);
ul_sqn = ASSecConfReq->Ciphering.ActTimeList.SecurityActTime[rb_idx].UL.sqn;
dl_sqn = ASSecConfReq->Ciphering.ActTimeList.SecurityActTime[rb_idx].DL.sqn;
if(((pc.rb_info[rb_idx].ul_count+1) == ASSecConfReq->Ciphering.ActTimeList.SecurityActTime[rb_idx].UL.sqn) || ((pc.rb_info[rb_idx].dl_count+1) == ASSecConfReq->Ciphering.ActTimeList.SecurityActTime[rb_idx].DL.sqn))
{
pdcp_config_set_security(
ctxt_pP,
pdcp_p,
DCCH,
DCCH+2,
(security_mode_command_send == TRUE) ?
0 | (ASSecConfReq->Integrity.integrity_algorithm << 4) :
(ASSecConfReq->Ciphering.ciphering_algorithm ) |
(ASSecConfReq->Integrity.integrity_algorithm << 4),
ASSecConfReq->Ciphering.kRRCenc,
ASSecConfReq->Integrity.kRRCint,
ASSecConfReq->Ciphering.kUPenc);
security_mode_command_send = FALSE;
as_security_conf_ciphering = ASSecConfReq->Ciphering.ciphering_algorithm;
rb_idx++;
} else {
LOG_A(RRC,"AS Security configuration received from TTCN didn't applied \n");
}
} else {
LOG_A (PDCP, "No entry on hastable for rbid_: %d ctxt module_id %d rnti %d enb_flag %d\n",
rbid_, ctxt_pP->module_id, ASSecConfReq->rnti, ctxt_pP->enb_flag);
}
}
}
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
int int
rrc_eNB_decode_ccch( rrc_eNB_decode_ccch(
...@@ -9976,14 +10110,12 @@ void *rrc_enb_process_itti_msg(void *notUsed) { ...@@ -9976,14 +10110,12 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
case SS_RRC_PDU_REQ: case SS_RRC_PDU_REQ:
if (RC.mode >= SS_SOFTMODEM) if (RC.mode >= SS_SOFTMODEM)
{ {
#if 0
pdcp_t *pdcp_p = NULL; pdcp_t *pdcp_p = NULL;
hashtable_rc_t h_rc; hashtable_rc_t h_rc;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
uint8_t rb_idx = 0; uint8_t rb_idx = 0;
uint8_t rbid_; uint8_t rbid_;
ss_get_pdcp_cnt_t pc; ss_get_pdcp_cnt_t pc;
#endif
LOG_A(RRC,"RRC received SS_RRC_PDU_REQ SRB_ID:%d SDU_SIZE:%d\n", SS_RRC_PDU_REQ (msg_p).srb_id, SS_RRC_PDU_REQ (msg_p).sdu_size); LOG_A(RRC,"RRC received SS_RRC_PDU_REQ SRB_ID:%d SDU_SIZE:%d\n", SS_RRC_PDU_REQ (msg_p).srb_id, SS_RRC_PDU_REQ (msg_p).sdu_size);
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
...@@ -10017,7 +10149,6 @@ void *rrc_enb_process_itti_msg(void *notUsed) { ...@@ -10017,7 +10149,6 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
{ {
xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)dl_dcch_msg); xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)dl_dcch_msg);
} }
#if 0
if (dl_dcch_msg->message.choice.c1.present == LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry && as_security_conf_ciphering) if (dl_dcch_msg->message.choice.c1.present == LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry && as_security_conf_ciphering)
{ {
for (int i = 0; i < MAX_RBS; i++) for (int i = 0; i < MAX_RBS; i++)
...@@ -10070,7 +10201,6 @@ void *rrc_enb_process_itti_msg(void *notUsed) { ...@@ -10070,7 +10201,6 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt, ue_context_p, 0); rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt, ue_context_p, 0);
} }
} }
#endif
rrc_data_req(&ctxt, rrc_data_req(&ctxt,
DCCH, DCCH,
rrc_eNB_mui++, rrc_eNB_mui++,
...@@ -10100,10 +10230,8 @@ void *rrc_enb_process_itti_msg(void *notUsed) { ...@@ -10100,10 +10230,8 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
ue_context_pP->ue_context.ue_release_timer_rrc = 0; ue_context_pP->ue_context.ue_release_timer_rrc = 0;
ue_context_pP->ue_context.ue_release_timer_thres_rrc = 0; ue_context_pP->ue_context.ue_release_timer_thres_rrc = 0;
#if 0
security_mode_command_send = TRUE; security_mode_command_send = TRUE;
as_security_conf_ciphering = FALSE; as_security_conf_ciphering = FALSE;
#endif
} }
} }
} }
...@@ -10111,6 +10239,29 @@ void *rrc_enb_process_itti_msg(void *notUsed) { ...@@ -10111,6 +10239,29 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
break; break;
//#endif //#endif
case RRC_AS_SECURITY_CONFIG_REQ:
LOG_A(RRC,"[eNB %d] Received %s : %p, Integrity_Algo: %d, Ciphering_Algo: %d \n",instance, msg_name_p, &RRC_AS_SECURITY_CONFIG_REQ(msg_p),RRC_AS_SECURITY_CONFIG_REQ(msg_p).Integrity.integrity_algorithm,RRC_AS_SECURITY_CONFIG_REQ(msg_p).Ciphering.ciphering_algorithm);
for(int i=16;i<32;i++)
{
LOG_D(RRC,"kRRCint in RRC: %02x",RRC_AS_SECURITY_CONFIG_REQ(msg_p).Integrity.kRRCint[i]);
}
for(int j=0;j<16;j++)
{
LOG_D(RRC,"kRRCenc in RRC: %02x",RRC_AS_SECURITY_CONFIG_REQ(msg_p).Ciphering.kRRCenc[j]);
}
for(int k=0;k<16;k++)
{
LOG_D(RRC,"kUPenc in RRC: %02x",RRC_AS_SECURITY_CONFIG_REQ(msg_p).Ciphering.kUPenc[k]);
}
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
instance,
ENB_FLAG_YES,
RRC_AS_SECURITY_CONFIG_REQ(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
rrc_eNB_as_security_configuration_req(&ctxt, ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_AS_SECURITY_CONFIG_REQ(msg_p));
break;
case RRC_RBLIST_CFG_REQ: case RRC_RBLIST_CFG_REQ:
LOG_A(RRC, "[eNB %d] Received %s : %p, RB Count:%d\n", instance, msg_name_p, &RRC_RBLIST_CFG_REQ(msg_p),RRC_RBLIST_CFG_REQ(msg_p).rb_count); LOG_A(RRC, "[eNB %d] Received %s : %p, RB Count:%d\n", instance, msg_name_p, &RRC_RBLIST_CFG_REQ(msg_p),RRC_RBLIST_CFG_REQ(msg_p).rb_count);
rrc_eNB_rblist_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_RBLIST_CFG_REQ(msg_p)); rrc_eNB_rblist_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_RBLIST_CFG_REQ(msg_p));
......
...@@ -216,6 +216,9 @@ int stream_compute_integrity_eia1(stream_cipher_t *stream_cipher, uint8_t out[4] ...@@ -216,6 +216,9 @@ int stream_compute_integrity_eia1(stream_cipher_t *stream_cipher, uint8_t out[4]
//printf ("MAC_I:%16X\n",MAC_I); //printf ("MAC_I:%16X\n",MAC_I);
MAC_I = hton_int32(MAC_I); MAC_I = hton_int32(MAC_I);
memcpy(out, &MAC_I, 4); memcpy(out, &MAC_I, 4);
LOG_A(OSA, "MAC-I Calculated for algorithm,\n"
"\tMAC-I %02x.%02x.%02x.%02x\n",
out[0], out[1], out[2], out[3]);
return 0; return 0;
} }
......
...@@ -258,7 +258,32 @@ static inline int rxtx(PHY_VARS_eNB *eNB, ...@@ -258,7 +258,32 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
eNB->UL_INFO.subframe = proc->subframe_rx; eNB->UL_INFO.subframe = proc->subframe_rx;
eNB->UL_INFO.module_id = eNB->Mod_id; eNB->UL_INFO.module_id = eNB->Mod_id;
eNB->UL_INFO.CC_id = eNB->CC_id; eNB->UL_INFO.CC_id = eNB->CC_id;
eNB->if_inst->UL_indication(&eNB->UL_INFO, (void*)proc); eNB->if_inst->UL_indication(&eNB->UL_INFO, proc);
//#ifdef ENB_SS
if (RC.mode >= SS_SOFTMODEM)
{
MessageDef *message_p = itti_alloc_new_message(TASK_SYS, INSTANCE_DEFAULT, SS_UPD_TIM_INFO);
if (message_p)
{
SS_UPD_TIM_INFO(message_p).sf = eNB->UL_INFO.subframe;
SS_UPD_TIM_INFO(message_p).sfn = eNB->UL_INFO.frame;
int send_res = itti_send_msg_to_task(TASK_SYS, INSTANCE_DEFAULT, message_p);
if (send_res < 0)
{
printf("Error in itti_send_msg_to_task");
// LOG_E( PHY, "[SS] Error in L1_Thread itti_send_msg_to_task"); /** TODO: Need separate logging for SS */
}
LOG_D(PHY, "[SS] SS_UPD_TIM_INFO from L1_Thread to SYS task itti_send_msg_to_task sfn %d sf %d",
eNB->UL_INFO.subframe, eNB->UL_INFO.frame); /** TODO: Need separate logging for SS */
}
#endif
}
//#endif /** ENB_SS */
AssertFatal((ret= pthread_mutex_unlock(&eNB->UL_INFO_mutex))==0,"error unlocking UL_INFO_mutex, return %d\n",ret); AssertFatal((ret= pthread_mutex_unlock(&eNB->UL_INFO_mutex))==0,"error unlocking UL_INFO_mutex, return %d\n",ret);
/* this conflict resolution may be totally wrong, to be tested */ /* this conflict resolution may be totally wrong, to be tested */
/* CONFLICT RESOLUTION: BEGIN */ /* CONFLICT RESOLUTION: BEGIN */
......
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