Commit 89ca89ea authored by Guido Casati's avatar Guido Casati

Address integrity failure after UE reconnects from RRC IDLE

After a new connection from RRC IDLE, an integrity failure occurs. This
commit is addressing this issue to pass the integrity check.

* Reset ciphering and integrity algorithms when going into RRC IDLE

* Use uplink NAS COUNT in Registration Request for initial KgNB derivation
  * Temporarily deriving UP protection keys in Registration Request
  * Note: AS SMC handling should be done according to 33.501 §6.8.1.1.2.2
parent 48a307e1
......@@ -2562,6 +2562,8 @@ void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc,
// discard the keys (only kgnb is stored)
memset(rrc->kgnb, 0, sizeof(rrc->kgnb));
rrc->integrityProtAlgorithm = 0;
rrc->cipheringAlgorithm = 0;
// release all radio resources, including release of the RLC entity,
// the MAC configuration and the associated PDCP entity
......
......@@ -663,6 +663,12 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas,
nasmessagecontainercontents->length = mm_msg_encode(&full_mm, nasmessagecontainercontents->value, size_nct);
size += (nasmessagecontainercontents->length + 2);
rr->presencemask |= REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT;
// Workaround to pass integrity in RRC_IDLE
uint8_t *kamf = nas->security.kamf;
uint8_t *kgnb = nas->security.kgnb;
derive_kgnb(kamf, nas->security.nas_count_ul, kgnb);
int nas_itti_kgnb_refresh_req(instance_t instance, const uint8_t kgnb[32]);
nas_itti_kgnb_refresh_req(nas->UE_id, nas->security.kgnb);
}
// Allocate buffer (including NAS message container size)
initialNasMsg->nas_data = malloc_or_fail(size * sizeof(*initialNasMsg->nas_data));
......
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