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.
This commit is contained in:
Jaroslava Fiedlerova
2025-11-25 14:01:40 +01:00
4 changed files with 11 additions and 12 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
ciphering_algorithms = ( "nea2", "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
@@ -63,7 +63,7 @@ security = {
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
drb_integrity = "yes";
};
log_config :
@@ -209,7 +209,7 @@ security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
ciphering_algorithms = ( "nea2", "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
@@ -219,7 +219,7 @@ security = {
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
drb_integrity = "yes";
};
log_config :
+2 -7
View File
@@ -1063,15 +1063,10 @@ static void cuup_notify_reestablishment(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p)
}
}
#if 0
/* According to current understanding of E1 specifications, it is not needed
* 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
/* During reestablishment, for DRB integrity protection security keys change (KgNB* is derived),
* so security information MUST be sent to CU-UP to update DRB security keys. */
req.secInfo = malloc_or_fail(sizeof(*req.secInfo));
fill_security_info(rrc, ue_p, req.secInfo);
#endif
/* Send E1 Bearer Context Modification Request (3GPP TS 38.463) */
sctp_assoc_t assoc_id = get_existing_cuup_for_ue(rrc, ue_p);
+5 -1
View File
@@ -1192,7 +1192,11 @@ int rrc_gNB_process_Handover_Request(gNB_RRC_INST *rrc, instance_t instance, nga
// Activate SRBs
activate_srb(UE, SRB1);
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
DevAssert(msg->nb_of_pdusessions <= NGAP_MAX_PDU_SESSION);