diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c index f6350b05bf01b9aeec4c23767f5fb511420ef80c..9873685e360db5f61f3c918fc7416b5441e1e94d 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c @@ -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); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c index 88cc5c72e98691594e044cc375f481070b3093c6..dbb42f5e42a4d185b378b34a57393a3dab4e138a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c @@ -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; } diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index 23bf82cd6d8d7e9c5c372df16f519e04c2a07581..ed7410fd94dae527681d69586798fa817755715e 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.c +++ b/openair2/UTIL/LOG/vcd_signal_dumper.c @@ -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" }; diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index 09d8b31f20193fe3047bdb79b41377b5f9fd22f7..0b9d883d2d6737adfca04909b310c00a55a2515f 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -120,7 +120,9 @@ 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_TEST, + 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, } vcd_signal_dump_functions;