From f79434c0b07aea8693ae8a7b4ab816aa5a694b4b Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Tue, 24 Sep 2013 08:15:11 +0000 Subject: [PATCH] - VCD signals for PDCP security git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4162 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c | 1 + openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c | 15 ++++++++++++++- openair2/UTIL/LOG/vcd_signal_dumper.c | 2 ++ openair2/UTIL/LOG/vcd_signal_dumper.h | 4 +++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c index f6350b05bf..9873685e36 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 88cc5c72e9..dbb42f5e42 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 23bf82cd6d..ed7410fd94 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 09d8b31f20..0b9d883d2d 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; -- GitLab