From 16740e5eb076d94fe66366ca2ca1f1e81361fa1a Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 5 May 2025 09:43:22 +0200 Subject: [PATCH] Use UL NAS Count to derive KgNB (6.8 of 3GPP TS 33.501) The UE shall use the currently stored UL NAS count to derive the KgNB. Hardcoding the UL count to 0 is wrong, if there is a reset to be done it should be explicitly done elsewhere. Closes #832 --- openair3/NAS/NR_UE/nr_nas_msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/NAS/NR_UE/nr_nas_msg.c b/openair3/NAS/NR_UE/nr_nas_msg.c index e5fea020c7..d152a5d4a3 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.c +++ b/openair3/NAS/NR_UE/nr_nas_msg.c @@ -510,7 +510,7 @@ static void derive_ue_keys(uint8_t *buf, nr_ue_nas_t *nas) derive_kausf(ck, ik, sqn, kausf, nas->uicc); derive_kseaf(kausf, kseaf, nas->uicc); derive_kamf(kseaf, kamf, 0x0000, nas->uicc); - derive_kgnb(kamf, 0, kgnb); + derive_kgnb(kamf, nas->security.nas_count_ul, kgnb); printf("kausf:"); for (int i = 0; i < 32; i++) {