Commit f79434c0 authored by Cedric Roux's avatar Cedric Roux

- VCD signals for PDCP security

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4162 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 4669980f
......@@ -37,6 +37,7 @@
#include "UTIL/LOG/log.h"
#include "platform_types.h"
#include "platform_constants.h"
#include "pdcp.h"
#include "pdcp_primitives.h"
extern BOOL util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
......
......@@ -38,6 +38,8 @@
#include "UTIL/LOG/log.h"
#include "UTIL/OSA/osa_defs.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "LAYER2/MAC/extern.h"
#include "pdcp.h"
......@@ -95,6 +97,8 @@ int pdcp_apply_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
DevAssert(pdcp_pdu_buffer != NULL);
DevCheck(rb_id < NB_RB_MAX && rb_id >= 0, rb_id, NB_RB_MAX, 0);
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY, VCD_FUNCTION_IN);
encrypt_params.direction = (pdcp_entity->is_ue == 1) ? SECU_DIRECTION_UPLINK : SECU_DIRECTION_DOWNLINK;
encrypt_params.bearer = rb_id;
encrypt_params.count = pdcp_get_next_count_tx(pdcp_entity, pdcp_header_len, current_sn);
......@@ -135,6 +139,8 @@ int pdcp_apply_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
stream_encrypt(pdcp_entity->cipheringAlgorithm, &encrypt_params,
&buffer_encrypted);
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY, VCD_FUNCTION_OUT);
return 0;
}
......@@ -150,6 +156,8 @@ int pdcp_validate_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
DevAssert(pdcp_pdu_buffer != NULL);
DevCheck(rb_id < NB_RB_MAX && rb_id >= 0, rb_id, NB_RB_MAX, 0);
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_IN);
buffer_decrypted = (u8*)&pdcp_pdu_buffer[pdcp_header_len];
decrypt_params.direction = (pdcp_entity->is_ue == 1) ? SECU_DIRECTION_DOWNLINK : SECU_DIRECTION_UPLINK ;
......@@ -179,11 +187,16 @@ int pdcp_validate_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
decrypt_params.key = pdcp_entity->kRRCint;
if (stream_check_integrity(pdcp_entity->integrityProtAlgorithm,
&decrypt_params, &pdcp_pdu_buffer[sdu_buffer_size]) != 0) {
&decrypt_params, &pdcp_pdu_buffer[sdu_buffer_size]) != 0)
{
LOG_E(PDCP, "[OSA] failed to validate MAC-I of incoming PDU\n");
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
return -1;
}
}
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
return 0;
}
......
......@@ -148,6 +148,8 @@ const char* eurecomFunctionsNames[] = {
"phy_enb_ulsch_decoding",
"phy_ue_ulsch_modulation",
"phy_ue_ulsch_encoding",
"pdcp_apply_security",
"pdcp_validate_security",
"test"
};
......
......@@ -120,6 +120,8 @@ typedef enum
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_TEST,
VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
......
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