Commit 212192cb authored by Cedric Roux's avatar Cedric Roux
Browse files

- Added new feature: Oaisim Security Algorithms (see README in openair2/UTIL/OSA/README

- Fix uint64_t formatting in openair_proc.c
- Removed duplicate call to pdcp_fifo_read_input_sdus

pre-ci tests passed

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4158 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 15e4d364
...@@ -26,6 +26,7 @@ SOURCES_L2 += $(PDCP_DIR)/pdcp_fifo.c ...@@ -26,6 +26,7 @@ SOURCES_L2 += $(PDCP_DIR)/pdcp_fifo.c
SOURCES_L2 += $(PDCP_DIR)/pdcp_sequence_manager.c SOURCES_L2 += $(PDCP_DIR)/pdcp_sequence_manager.c
SOURCES_L2 += $(PDCP_DIR)/pdcp_primitives.c SOURCES_L2 += $(PDCP_DIR)/pdcp_primitives.c
SOURCES_L2 += $(PDCP_DIR)/pdcp_util.c SOURCES_L2 += $(PDCP_DIR)/pdcp_util.c
SOURCES_L2 += $(PDCP_DIR)/pdcp_security.c
SOURCES_L2 += $(RLC_AM_DIR)/rlc_am.c SOURCES_L2 += $(RLC_AM_DIR)/rlc_am.c
SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_init.c SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_init.c
......
...@@ -52,6 +52,10 @@ ...@@ -52,6 +52,10 @@
#include "platform_constants.h" #include "platform_constants.h"
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
#if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h"
#endif
#define PDCP_DATA_REQ_DEBUG 0 #define PDCP_DATA_REQ_DEBUG 0
#define PDCP_DATA_IND_DEBUG 0 #define PDCP_DATA_IND_DEBUG 0
...@@ -94,7 +98,7 @@ BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb ...@@ -94,7 +98,7 @@ BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
mem_block_t* pdcp_pdu = NULL; mem_block_t* pdcp_pdu = NULL;
rlc_op_status_t rlc_status; rlc_op_status_t rlc_status;
if ((pdcp->instanciated_instance == 0) && (mode != PDCP_TM)) { if ((pdcp->instanciated_instance == 0) && (mode != PDCP_TM)) {
LOG_W(PDCP, "Instance is not configured, Ignoring SDU...\n"); LOG_W(PDCP, "Instance is not configured, Ignoring SDU...\n");
return FALSE; return FALSE;
} }
...@@ -178,16 +182,28 @@ BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb ...@@ -178,16 +182,28 @@ BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
free_mem_block(pdcp_pdu); free_mem_block(pdcp_pdu);
return FALSE; return FALSE;
} }
LOG_D(PDCP, "Sequence number %d is assigned to current PDU\n", current_sn); LOG_D(PDCP, "Sequence number %d is assigned to current PDU\n", current_sn);
/* Then append data... */ /* Then append data... */
memcpy(&pdcp_pdu->data[pdcp_header_len], sdu_buffer, sdu_buffer_size); memcpy(&pdcp_pdu->data[pdcp_header_len], sdu_buffer, sdu_buffer_size);
//For control plane data that are not integrity protected, //For control plane data that are not integrity protected,
// the MAC-I field is still present and should be padded with padding bits set to 0. // the MAC-I field is still present and should be padded with padding bits set to 0.
// NOTE: user-plane data are never integrity protected
for (i=0;i<pdcp_tailer_len;i++) for (i=0;i<pdcp_tailer_len;i++)
pdcp_pdu->data[pdcp_header_len + sdu_buffer_size + i] = 0x00;// pdu_header.mac_i[i]; pdcp_pdu->data[pdcp_header_len + sdu_buffer_size + i] = 0x00;// pdu_header.mac_i[i];
#if defined(ENABLE_SECURITY)
if ((pdcp->security_activated != 0) &&
((pdcp->cipheringAlgorithm) != 0) &&
((pdcp->integrityProtAlgorithm) != 0)) {
pdcp_apply_security(pdcp, rb_id % NB_RB_MAX,
pdcp_header_len, current_sn, pdcp_pdu->data,
sdu_buffer_size);
}
#endif
/* Print octets of outgoing data in hexadecimal form */ /* Print octets of outgoing data in hexadecimal form */
LOG_D(PDCP, "Following content with size %d will be sent over RLC (PDCP PDU header is the first two bytes)\n", LOG_D(PDCP, "Following content with size %d will be sent over RLC (PDCP PDU header is the first two bytes)\n",
pdcp_pdu_size); pdcp_pdu_size);
...@@ -275,7 +291,8 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb ...@@ -275,7 +291,8 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
u16 sequence_number; u16 sequence_number;
u8 payload_offset=0; u8 payload_offset=0;
LOG_I(PDCP,"Data indication notification for PDCP entity with module ID %d and radio bearer ID %d rlc sdu size %d\n", module_id, rb_id, sdu_buffer_size); LOG_I(PDCP,"Data indication notification for PDCP entity with module "
"ID %d and radio bearer ID %d rlc sdu size %d eNB_flag %d\n", module_id, rb_id, sdu_buffer_size, eNB_flag);
if (sdu_buffer_size == 0) { if (sdu_buffer_size == 0) {
LOG_W(PDCP, "SDU buffer size is zero! Ignoring this chunk!"); LOG_W(PDCP, "SDU buffer size is zero! Ignoring this chunk!");
...@@ -335,18 +352,13 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb ...@@ -335,18 +352,13 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
} }
// SRB1/2: control-plane data // SRB1/2: control-plane data
if ( (rb_id % NB_RB_MAX) < DTCH ){ if ( (rb_id % NB_RB_MAX) < DTCH ){
/*new_sdu = get_free_mem_block(sdu_buffer_size - pdcp_header_len - pdcp_tailer_len); #if defined(ENABLE_SECURITY)
if (new_sdu) { if (pdcp->security_activated == 1) {
memcpy(new_sdu->data, pdcp_validate_security(pdcp, rb_id % NB_RB_MAX, pdcp_header_len,
&sdu_buffer->data[pdcp_header_len], sequence_number, sdu_buffer->data,
sdu_buffer_size - pdcp_header_len - pdcp_tailer_len); sdu_buffer_size - pdcp_tailer_len);
rrc_lite_data_ind(module_id, }
frame, #endif
eNB_flag,
rb_id,
sdu_buffer_size - pdcp_header_len - pdcp_tailer_len,
new_sdu->data);
}*/
//rrc_lite_data_ind(module_id, //Modified MW - L2 Interface //rrc_lite_data_ind(module_id, //Modified MW - L2 Interface
pdcp_rrc_data_ind(module_id, pdcp_rrc_data_ind(module_id,
frame, frame,
...@@ -359,6 +371,13 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb ...@@ -359,6 +371,13 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
return TRUE; return TRUE;
} }
payload_offset=PDCP_USER_PLANE_DATA_PDU_LONG_SN_HEADER_SIZE; payload_offset=PDCP_USER_PLANE_DATA_PDU_LONG_SN_HEADER_SIZE;
#if defined(ENABLE_SECURITY)
if (pdcp->security_activated == 1) {
pdcp_validate_security(pdcp, rb_id % NB_RB_MAX, pdcp_header_len,
sequence_number, sdu_buffer->data,
sdu_buffer_size - pdcp_tailer_len);
}
#endif
} else { } else {
payload_offset=0; payload_offset=0;
} }
...@@ -493,9 +512,6 @@ void ...@@ -493,9 +512,6 @@ void
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer // IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
pdcp_fifo_read_input_sdus(frame,eNB_flag); pdcp_fifo_read_input_sdus(frame,eNB_flag);
// NAS -> PDCP traffic
pdcp_fifo_read_input_sdus(frame,eNB_flag);
// PDCP -> NAS/IP traffic: RX // PDCP -> NAS/IP traffic: RX
pdcp_fifo_flush_sdus(frame,eNB_flag); pdcp_fifo_flush_sdus(frame,eNB_flag);
...@@ -505,9 +521,13 @@ void ...@@ -505,9 +521,13 @@ void
BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, u32_t index, BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, u32_t index,
SRB_ToAddModList_t* srb2add_list, SRB_ToAddModList_t* srb2add_list,
DRB_ToAddModList_t* drb2add_list, DRB_ToAddModList_t* drb2add_list,
DRB_ToReleaseList_t* drb2release_list DRB_ToReleaseList_t* drb2release_list,
u8 security_mode,
u8 *kRRCenc,
u8 *kRRCint,
u8 *kUPenc
#ifdef Rel10 #ifdef Rel10
,PMCH_InfoList_r9_t* pmch_InfoList_r9 ,PMCH_InfoList_r9_t* pmch_InfoList_r9
#endif #endif
){ ){
...@@ -537,7 +557,6 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag ...@@ -537,7 +557,6 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
(eNB_flag == 1)? "eNB": "UE", index); (eNB_flag == 1)? "eNB": "UE", index);
// srb2add_list does not define pdcp config, we use rlc info to setup the pdcp dcch0 and dcch1 channels // srb2add_list does not define pdcp config, we use rlc info to setup the pdcp dcch0 and dcch1 channels
if (srb2add_list != NULL) { if (srb2add_list != NULL) {
for (cnt=0;cnt<srb2add_list->list.count;cnt++) { for (cnt=0;cnt<srb2add_list->list.count;cnt++) {
srb_id = srb2add_list->list.array[cnt]->srb_Identity; srb_id = srb2add_list->list.array[cnt]->srb_Identity;
...@@ -570,7 +589,10 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag ...@@ -570,7 +589,10 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
srb_sn, srb_sn,
0, // drb_report 0, // drb_report
0, // header compression 0, // header compression
0xff); //UNDEF_SECURITY_MODE security_mode,
kRRCenc,
kRRCint,
kUPenc);
break; break;
} }
break; break;
...@@ -659,7 +681,10 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag ...@@ -659,7 +681,10 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
drb_sn, drb_sn,
drb_report, drb_report,
header_compression_profile, header_compression_profile,
0xff); security_mode,
kRRCenc,
kRRCint,
kUPenc);
} }
} }
} }
...@@ -681,7 +706,10 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag ...@@ -681,7 +706,10 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
0, 0,
0, 0,
0, 0,
0xff); security_mode,
kRRCenc,
kRRCint,
kUPenc);
} }
} }
...@@ -717,7 +745,10 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag ...@@ -717,7 +745,10 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
0, // set to deafult 0, // set to deafult
0, 0,
0, 0,
0xff); security_mode,
kRRCenc,
kRRCint,
kUPenc);
} }
} }
} }
...@@ -727,18 +758,19 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag ...@@ -727,18 +758,19 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
} }
BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 index, BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 index,
rlc_mode_t rlc_mode, u32 action, u16 lc_id,u16 mch_id, rb_id_t rb_id, rlc_mode_t rlc_mode, u32 action, u16 lc_id,u16 mch_id, rb_id_t rb_id,
u8 rb_sn, u8 rb_report, u16 header_compression_profile, u8 rb_sn, u8 rb_report, u16 header_compression_profile,
u8 security_mode){ u8 security_mode,
u8 *kRRCenc,
u8 *kRRCint,
u8 *kUPenc){
switch (action) { switch (action) {
case ACTION_ADD: case ACTION_ADD:
pdcp_array[module_id][lc_id].instanciated_instance = module_id + 1; pdcp_array[module_id][lc_id].instanciated_instance = module_id + 1;
pdcp_array[module_id][lc_id].is_ue = (eNB_flag == 0) ? 1 : 0;
pdcp_array[module_id][lc_id].lcid = lc_id; pdcp_array[module_id][lc_id].lcid = lc_id;
pdcp_array[module_id][lc_id].header_compression_profile=header_compression_profile; pdcp_array[module_id][lc_id].header_compression_profile=header_compression_profile;
pdcp_array[module_id][lc_id].cipheringAlgorithm=security_mode & 0x0f;
pdcp_array[module_id][lc_id].integrityProtAlgorithm=(security_mode>>4) & 0xf;
pdcp_array[module_id][lc_id].status_report = rb_report; pdcp_array[module_id][lc_id].status_report = rb_report;
if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits)
pdcp_array[module_id][lc_id].seq_num_size = 7; pdcp_array[module_id][lc_id].seq_num_size = 7;
...@@ -761,16 +793,24 @@ BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 ...@@ -761,16 +793,24 @@ BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16
frame, lc_id, rb_id, pdcp_array[module_id][lc_id].seq_num_size, frame, lc_id, rb_id, pdcp_array[module_id][lc_id].seq_num_size,
(rlc_mode == 1) ? "AM" : (rlc_mode == 2) ? "TM" : "UM"); (rlc_mode == 1) ? "AM" : (rlc_mode == 2) ? "TM" : "UM");
/* Setup security */
if (security_mode != 0xff) {
pdcp_config_set_security(module_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
}
LOG_D(PDCP, "[MSC_NEW][FRAME %05d][PDCP][MOD %02d][RB %02d]\n", frame, module_id,rb_id); LOG_D(PDCP, "[MSC_NEW][FRAME %05d][PDCP][MOD %02d][RB %02d]\n", frame, module_id,rb_id);
break; break;
case ACTION_MODIFY: case ACTION_MODIFY:
pdcp_array[module_id][lc_id].header_compression_profile=header_compression_profile; pdcp_array[module_id][lc_id].header_compression_profile=header_compression_profile;
pdcp_array[module_id][lc_id].cipheringAlgorithm=security_mode & 0x0f;
pdcp_array[module_id][lc_id].integrityProtAlgorithm=(security_mode>>4) & 0xf;
pdcp_array[module_id][lc_id].status_report = rb_report; pdcp_array[module_id][lc_id].status_report = rb_report;
pdcp_array[module_id][lc_id].rlc_mode = rlc_mode; pdcp_array[module_id][lc_id].rlc_mode = rlc_mode;
/* Setup security */
if (security_mode != 0xff) {
pdcp_config_set_security(module_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
}
if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits)
pdcp_array[module_id][lc_id].seq_num_size = 7; pdcp_array[module_id][lc_id].seq_num_size = 7;
else if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) else if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits)
...@@ -800,8 +840,21 @@ BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 ...@@ -800,8 +840,21 @@ BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16
pdcp_array[module_id][lc_id].last_submitted_pdcp_rx_sn = 4095; pdcp_array[module_id][lc_id].last_submitted_pdcp_rx_sn = 4095;
pdcp_array[module_id][lc_id].seq_num_size = 0; pdcp_array[module_id][lc_id].seq_num_size = 0;
pdcp_array[module_id][lc_id].first_missing_pdu = -1; pdcp_array[module_id][lc_id].first_missing_pdu = -1;
pdcp_array[module_id][lc_id].security_activated = 0;
LOG_I(PDCP,"[%s %d] Config request : ACTION_REMOVE: Frame %d LCID %d RBID %d configured\n", LOG_I(PDCP,"[%s %d] Config request : ACTION_REMOVE: Frame %d LCID %d RBID %d configured\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame, lc_id,rb_id); (eNB_flag) ? "eNB" : "UE", module_id, frame, lc_id, rb_id);
/* Security keys */
if (pdcp_array[module_id][lc_id].kUPenc != NULL) {
free(pdcp_array[module_id][lc_id].kUPenc);
}
if (pdcp_array[module_id][lc_id].kRRCint != NULL) {
free(pdcp_array[module_id][lc_id].kRRCint);
}
if (pdcp_array[module_id][lc_id].kRRCenc != NULL) {
free(pdcp_array[module_id][lc_id].kRRCenc);
}
break; break;
case ACTION_MBMS_ADD: case ACTION_MBMS_ADD:
...@@ -814,23 +867,37 @@ BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 ...@@ -814,23 +867,37 @@ BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16
(eNB_flag == 1) ? "eNB" : "UE", module_id, frame, mch_id, lc_id, rb_id); (eNB_flag == 1) ? "eNB" : "UE", module_id, frame, mch_id, lc_id, rb_id);
break; break;
case ACTION_SET_SECURITY_MODE: case ACTION_SET_SECURITY_MODE:
if ((security_mode >= 0 ) && (security_mode <=0x77)) { pdcp_config_set_security(module_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
pdcp_array[module_id][lc_id].cipheringAlgorithm= security_mode & 0x0f; break;
pdcp_array[module_id][lc_id].integrityProtAlgorithm = (security_mode>>4) & 0xf;
LOG_D(PDCP,"[%s %d] Set security mode : ACTION_SET_SECURITY_MODE: Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame,
pdcp_array[module_id][lc_id].cipheringAlgorithm,
pdcp_array[module_id][lc_id].integrityProtAlgorithm );
}else
LOG_D(PDCP,"[%s %d] bad security mode %d", security_mode);
break;
default: default:
LOG_W(PDCP,"unknown action %d for the config request\n",action); LOG_W(PDCP,"unknown action %d for the config request\n",action);
break; break;
} }
return 0; return 0;
} }
void pdcp_config_set_security(module_id_t module_id, u32 frame, u8 eNB_flag, rb_id_t rb_id,
u16 lc_id, u8 security_mode, u8 *kRRCenc, u8 *kRRCint, u8 *kUPenc)
{
if ((security_mode >= 0) && (security_mode <= 0x77)) {
pdcp_array[module_id][lc_id].cipheringAlgorithm = security_mode & 0x0f;
pdcp_array[module_id][lc_id].integrityProtAlgorithm = (security_mode>>4) & 0xf;
LOG_D(PDCP,"[%s %d][RB %02d] Set security mode : ACTION_SET_SECURITY_MODE: "
"Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
(eNB_flag) ? "eNB" : "UE", module_id, rb_id, frame,
pdcp_array[module_id][lc_id].cipheringAlgorithm,
pdcp_array[module_id][lc_id].integrityProtAlgorithm);
pdcp_array[module_id][lc_id].kRRCenc = kRRCenc;
pdcp_array[module_id][lc_id].kRRCint = kRRCint;
pdcp_array[module_id][lc_id].kUPenc = kUPenc;
/* Activate security */
pdcp_array[module_id][lc_id].security_activated = 1;
} else {
LOG_D(PDCP,"[%s %d] bad security mode %d", security_mode);
}
}
void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rb_id, u8 security_mode){ void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rb_id, u8 security_mode){
/* /*
...@@ -867,6 +934,7 @@ void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 ...@@ -867,6 +934,7 @@ void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB_flag, u32
pdcp_array[module_id][rb_id%NB_RB_MAX].last_submitted_pdcp_rx_sn = 4095; pdcp_array[module_id][rb_id%NB_RB_MAX].last_submitted_pdcp_rx_sn = 4095;
pdcp_array[module_id][rb_id%NB_RB_MAX].seq_num_size = 0; pdcp_array[module_id][rb_id%NB_RB_MAX].seq_num_size = 0;
pdcp_array[module_id][rb_id%NB_RB_MAX].first_missing_pdu = -1; pdcp_array[module_id][rb_id%NB_RB_MAX].first_missing_pdu = -1;
pdcp_array[module_id][rb_id].security_activated = 0;
LOG_D(PDCP,"[%s %d] Config request : ACTION_REMOVE: Frame %d radio bearer id %d configured\n", LOG_D(PDCP,"[%s %d] Config request : ACTION_REMOVE: Frame %d radio bearer id %d configured\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame, rb_id); (eNB_flag) ? "eNB" : "UE", module_id, frame, rb_id);
......
...@@ -110,9 +110,26 @@ typedef struct pdcp_t { ...@@ -110,9 +110,26 @@ typedef struct pdcp_t {
BOOL instanciated_instance; BOOL instanciated_instance;
u16 header_compression_profile; u16 header_compression_profile;
/* SR: added this flag to distinguish UE/eNB instance as pdcp_run for virtual
* mode can receive data on NETLINK for eNB while eNB_flag = 0 and for UE when eNB_flag = 1
*/
u8 is_ue;
/* Configured security algorithms */
u8 cipheringAlgorithm; u8 cipheringAlgorithm;
u8 integrityProtAlgorithm; u8 integrityProtAlgorithm;
/* User-Plane encryption key
* Control-Plane RRC encryption key
* Control-Plane RRC integrity key
* These keys are configured by RRC layer
*/
u8 *kUPenc;
u8 *kRRCint;
u8 *kRRCenc;
u8 security_activated;
u8 rlc_mode; u8 rlc_mode;
u8 status_report; u8 status_report;
u8 seq_num_size; u8 seq_num_size;
...@@ -260,14 +277,25 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB ...@@ -260,14 +277,25 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB
* \param[in] srb2add_list SRB configuration list to be created. * \param[in] srb2add_list SRB configuration list to be created.
* \param[in] drb2add_list DRB configuration list to be created. * \param[in] drb2add_list DRB configuration list to be created.
* \param[in] drb2release_list DRB configuration list to be released. * \param[in] drb2release_list DRB configuration list to be released.
* \param[in] security_mode Security algorithm to apply for integrity/ciphering
* \param[in] kRRCenc RRC encryption key
* \param[in] kRRCint RRC integrity key
* \param[in] kUPenc User-Plane encryption key
* \return A status about the processing, OK or error code. * \return A status about the processing, OK or error code.
*/ */
public_pdcp(
BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, u32_t index,
SRB_ToAddModList_t* srb2add_list,
DRB_ToAddModList_t* drb2add_list,
DRB_ToReleaseList_t* drb2release_list,
u8 security_mode,
u8 *kRRCenc,
u8 *kRRCint,
u8 *kUPenc
#ifdef Rel10 #ifdef Rel10
public_pdcp(BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, u32_t index, SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list,PMCH_InfoList_r9_t* pmch_InfoList_r9);) ,PMCH_InfoList_r9_t* pmch_InfoList_r9
#else
public_pdcp(BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, u32_t index, SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list);)
#endif #endif
));
/*! \fn BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rb_id, u8 rb_sn, u8 rb_report, u16 header_compression_profile, u8 security_mode) /*! \fn BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rb_id, u8 rb_sn, u8 rb_report, u16 header_compression_profile, u8 security_mode)
* \brief Function for RRC to configure a Radio Bearer. * \brief Function for RRC to configure a Radio Bearer.
...@@ -280,10 +308,18 @@ public_pdcp(BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u ...@@ -280,10 +308,18 @@ public_pdcp(BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u
* \param[in] drb_report set a pdcp report for this drb * \param[in] drb_report set a pdcp report for this drb
* \param[in] header_compression set the rohc profile * \param[in] header_compression set the rohc profile
* \param[in] security_mode set the integrity and ciphering algs * \param[in] security_mode set the integrity and ciphering algs
* \param[in] kRRCenc RRC encryption key
* \param[in] kRRCint RRC integrity key
* \param[in] kUPenc User-Plane encryption key
* \return A status about the processing, OK or error code. * \return A status about the processing, OK or error code.
*/ */
public_pdcp(BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 index, rlc_mode_t rlc_mode, u32 action, u16 lc_id, u16 mch_id, rb_id_t rb_id, u8 rb_sn, u8 rb_report, u16 header_compression_profile, u8 security_mode);) public_pdcp(BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 index,
rlc_mode_t rlc_mode, u32 action, u16 lc_id,u16 mch_id, rb_id_t rb_id,
u8 rb_sn, u8 rb_report, u16 header_compression_profile,
u8 security_mode,
u8 *kRRCenc,
u8 *kRRCint,
u8 *kUPenc));
/*! \fn void rrc_pdcp_config_release(module_id_t, rb_id_t) /*! \fn void rrc_pdcp_config_release(module_id_t, rb_id_t)
* \brief This functions is unused * \brief This functions is unused
* \param[in] module_id Module ID of relevant PDCP entity * \param[in] module_id Module ID of relevant PDCP entity
......
...@@ -153,4 +153,17 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b ...@@ -153,4 +153,17 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \ BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu); u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu);
void pdcp_config_set_security(module_id_t module_id, u32 frame, u8 eNB_flag, rb_id_t rb_id,
u16 lc_id, u8 security_mode, u8 *kRRCenc, u8 *kRRCint, u8 *kUPenc);
#if defined(ENABLE_SECURITY)
int pdcp_apply_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
u8 pdcp_header_len, u16 current_sn, u8 *pdcp_pdu_buffer,
u16 sdu_buffer_size);
int pdcp_validate_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
u8 pdcp_header_len, u16 current_sn, u8 *pdcp_pdu_buffer,
u16 sdu_buffer_size);
#endif /* defined(ENABLE_SECURITY) */
#endif #endif
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
/*! \file pdcp_security.c
* \brief PDCP Security Methods
* \author ROUX Sebastien
* \date 2013
*/
#include <stdint.h>
#include "assertions.h"
#include "UTIL/LOG/log.h"
#include "UTIL/OSA/osa_defs.h"
#include "LAYER2/MAC/extern.h"
#include "pdcp.h"
#include "pdcp_primitives.h"
#if defined(ENABLE_SECURITY)
static
u32 pdcp_get_next_count_tx(pdcp_t *pdcp_entity, u8 pdcp_header_len, u16 pdcp_sn);
static
u32 pdcp_get_next_count_rx(pdcp_t *pdcp_entity, u8 pdcp_header_len, u16 pdcp_sn);
static
u32 pdcp_get_next_count_tx(pdcp_t *pdcp_entity, u8 pdcp_header_len, u16 pdcp_sn)