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
This commit is contained in:
Guido Casati
2025-05-26 17:05:00 +02:00
parent d405cbb77f
commit 16740e5eb0
+1 -1
View File
@@ -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++) {