From 181762978c4025a8111e01cb7592a15ef9a84bbf Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Wed, 22 Jan 2025 16:11:00 +0100 Subject: [PATCH] e1: change security settings only if parameters present If the Bearer Context Modification Request does not contain security information, the PDCP entity shall keep the currently configured security settings. Passing -1 for ciphering_algorithm and integrity_algorithm is the way to implement this logic. --- openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c index 1d3394e7888..147bb325a5c 100644 --- a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c +++ b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c @@ -274,10 +274,16 @@ void e1_bearer_context_modif(const e1ap_bearer_mod_req_t *req) if (to_modif->pdcp_config.pDCP_Reestablishment) { nr_pdcp_entity_security_keys_and_algos_t security_parameters; - security_parameters.ciphering_algorithm = req->cipheringAlgorithm; - security_parameters.integrity_algorithm = req->integrityProtectionAlgorithm; - memcpy(security_parameters.ciphering_key, req->encryptionKey, NR_K_KEY_SIZE); - memcpy(security_parameters.integrity_key, req->integrityProtectionKey, NR_K_KEY_SIZE); + if (req->has_security_information) { + security_parameters.ciphering_algorithm = req->cipheringAlgorithm; + security_parameters.integrity_algorithm = req->integrityProtectionAlgorithm; + memcpy(security_parameters.ciphering_key, req->encryptionKey, NR_K_KEY_SIZE); + memcpy(security_parameters.integrity_key, req->integrityProtectionKey, NR_K_KEY_SIZE); + } else { + /* don't change security settings if not present in the Bearer Context Modification Request */ + security_parameters.ciphering_algorithm = -1; + security_parameters.integrity_algorithm = -1; + } nr_pdcp_reestablishment(req->gNB_cu_up_ue_id, to_modif->id, false, -- GitLab