Commit c87a6ecf authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/fix-drb-integrity' into integration_2025_w48 (!3767)

Fix DRB integrity failures during handover and re-establishment

This MR fixes DRB integrity protection failures that occur during N2 handover
and connection re-establishment scenarios. The issues were caused by incorrect
security key handling and ciphering configuration during these procedures with
DRB integity enabled.

See merge request !3767 for more details.
parents 0c488294 b7454cf5
...@@ -53,7 +53,7 @@ security = { ...@@ -53,7 +53,7 @@ security = {
# preferred ciphering algorithms # preferred ciphering algorithms
# the first one of the list that an UE supports in chosen # the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3 # valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" ); ciphering_algorithms = ( "nea2", "nea0" );
# preferred integrity algorithms # preferred integrity algorithms
# the first one of the list that an UE supports in chosen # the first one of the list that an UE supports in chosen
...@@ -63,7 +63,7 @@ security = { ...@@ -63,7 +63,7 @@ security = {
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity' # what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes"; drb_ciphering = "yes";
drb_integrity = "no"; drb_integrity = "yes";
}; };
log_config : log_config :
......
...@@ -209,7 +209,7 @@ security = { ...@@ -209,7 +209,7 @@ security = {
# preferred ciphering algorithms # preferred ciphering algorithms
# the first one of the list that an UE supports in chosen # the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3 # valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" ); ciphering_algorithms = ( "nea2", "nea0" );
# preferred integrity algorithms # preferred integrity algorithms
# the first one of the list that an UE supports in chosen # the first one of the list that an UE supports in chosen
...@@ -219,7 +219,7 @@ security = { ...@@ -219,7 +219,7 @@ security = {
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity' # what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes"; drb_ciphering = "yes";
drb_integrity = "no"; drb_integrity = "yes";
}; };
log_config : log_config :
......
...@@ -1063,15 +1063,10 @@ static void cuup_notify_reestablishment(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p) ...@@ -1063,15 +1063,10 @@ static void cuup_notify_reestablishment(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p)
} }
} }
#if 0 /* During reestablishment, for DRB integrity protection security keys change (KgNB* is derived),
/* According to current understanding of E1 specifications, it is not needed * so security information MUST be sent to CU-UP to update DRB security keys. */
* to send security information because this does not change.
* But let's keep the code here in case it's needed.
*/
// Always send security information
req.secInfo = malloc_or_fail(sizeof(*req.secInfo)); req.secInfo = malloc_or_fail(sizeof(*req.secInfo));
fill_security_info(rrc, ue_p, req.secInfo); fill_security_info(rrc, ue_p, req.secInfo);
#endif
/* Send E1 Bearer Context Modification Request (3GPP TS 38.463) */ /* Send E1 Bearer Context Modification Request (3GPP TS 38.463) */
sctp_assoc_t assoc_id = get_existing_cuup_for_ue(rrc, ue_p); sctp_assoc_t assoc_id = get_existing_cuup_for_ue(rrc, ue_p);
......
...@@ -1192,7 +1192,11 @@ int rrc_gNB_process_Handover_Request(gNB_RRC_INST *rrc, instance_t instance, nga ...@@ -1192,7 +1192,11 @@ int rrc_gNB_process_Handover_Request(gNB_RRC_INST *rrc, instance_t instance, nga
// Activate SRBs // Activate SRBs
activate_srb(UE, SRB1); activate_srb(UE, SRB1);
activate_srb(UE, SRB2); activate_srb(UE, SRB2);
nr_rrc_pdcp_config_security(UE, false); // During N2 handover, the UE continues using the old security context from the source gNB
// until it receives and processes the RRC Reconfiguration with masterKeyUpdate. The first
// PDUs sent after CFRA are still ciphered with the old keys. The target gNB must enable
// ciphering during handover setup to correctly decipher and verify integrity of these PDUs.
nr_rrc_pdcp_config_security(UE, true);
// Process all PDU Session Resource Setup items from handover request // Process all PDU Session Resource Setup items from handover request
DevAssert(msg->nb_of_pdusessions <= NGAP_MAX_PDU_SESSION); DevAssert(msg->nb_of_pdusessions <= NGAP_MAX_PDU_SESSION);
......
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