mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-01 21:00:19 +00:00
[MME] Gn: Introduce initial support for 4G->2G cell reselection
In an Inter-RAT setup a UE could perform a RAU coming from a 4G network. In that case the UE/MS is unknown to the SGSN and it should request the SGSN context (MM, PDP) from the MME. This is done through the following GTPv1C message exchange on the Gn interface of SGSN and MME: SGSN -> MME: SGSN Context Request SGSN <- MME: SGSN Context Response SGSN -> MME: SGSN Context Acknowledge This commit doesn't aim to be a complete implementation of the mentioned procedure, since it's quite a complex one, with lots of fields and logic required. This so far only implements in general the minimally successful case by filling as much as possible the required set of fields. This will allow for a base onto which do incremental improvements and fixes while testing against UEs and SGSNs (such as osmo-sgsn, which doesn't yet support this procedure but will potentially earn it soon). This commit doesn't implement the reverse direction, aka UE issuing cell reselection 2G->4G. Initial support for this scenario will hopefully be added soon as a follow-up patch, similar to this one. Related: https://osmocom.org/issues/6294
This commit is contained in:
parent
080f5bfd70
commit
3d693da73e
21 changed files with 1072 additions and 2 deletions
|
|
@ -34,6 +34,9 @@
|
|||
#define FC_FOR_KENB_DERIVATION 0x11
|
||||
#define FC_FOR_NH_ENB_DERIVATION 0x12
|
||||
#define FC_FOR_EPS_ALGORITHM_KEY_DERIVATION 0x15
|
||||
#define FC_FOR_CK_IK_DERIVATION_HANDOVER 0x16
|
||||
#define FC_FOR_NAS_TOKEN_DERIVATION 0x17
|
||||
#define FC_FOR_CK_IK_DERIVATION_IDLE_MOBILITY 0x1B
|
||||
|
||||
typedef struct kdf_param_s {
|
||||
const uint8_t *buf;
|
||||
|
|
@ -379,6 +382,56 @@ void ogs_kdf_nas_eps(uint8_t algorithm_type_distinguishers,
|
|||
memcpy(knas, output+16, 16);
|
||||
}
|
||||
|
||||
/* TS33.401 Annex A.8: KASME to CK', IK' derivation at handover */
|
||||
void ogs_kdf_ck_ik_handover(
|
||||
uint32_t dl_count, const uint8_t *kasme, uint8_t *ck, uint8_t *ik)
|
||||
{
|
||||
kdf_param_t param;
|
||||
uint8_t output[OGS_SHA256_DIGEST_SIZE];
|
||||
|
||||
memset(param, 0, sizeof(param));
|
||||
param[0].buf = (uint8_t *)&dl_count;
|
||||
param[0].len = 4;
|
||||
|
||||
ogs_kdf_common(kasme, OGS_SHA256_DIGEST_SIZE,
|
||||
FC_FOR_CK_IK_DERIVATION_HANDOVER, param, output);
|
||||
memcpy(ck, output, 16);
|
||||
memcpy(ik, output+16, 16);
|
||||
}
|
||||
|
||||
/* TS33.401 Annex A.9: NAS token derivation for inter-RAT mobility */
|
||||
void ogs_kdf_nas_token(
|
||||
uint32_t ul_count, const uint8_t *kasme, uint8_t *nas_token)
|
||||
{
|
||||
kdf_param_t param;
|
||||
uint8_t output[OGS_SHA256_DIGEST_SIZE];
|
||||
|
||||
memset(param, 0, sizeof(param));
|
||||
param[0].buf = (uint8_t *)&ul_count;
|
||||
param[0].len = 4;
|
||||
|
||||
ogs_kdf_common(kasme, OGS_SHA256_DIGEST_SIZE,
|
||||
FC_FOR_NAS_TOKEN_DERIVATION, param, output);
|
||||
memcpy(nas_token, output, 2);
|
||||
}
|
||||
|
||||
/* TS33.401 Annex A.13: KASME to CK', IK' derivation at idle mobility */
|
||||
void ogs_kdf_ck_ik_idle_mobility(
|
||||
uint32_t ul_count, const uint8_t *kasme, uint8_t *ck, uint8_t *ik)
|
||||
{
|
||||
kdf_param_t param;
|
||||
uint8_t output[OGS_SHA256_DIGEST_SIZE];
|
||||
|
||||
memset(param, 0, sizeof(param));
|
||||
param[0].buf = (uint8_t *)&ul_count;
|
||||
param[0].len = 4;
|
||||
|
||||
ogs_kdf_common(kasme, OGS_SHA256_DIGEST_SIZE,
|
||||
FC_FOR_CK_IK_DERIVATION_IDLE_MOBILITY, param, output);
|
||||
memcpy(ck, output, 16);
|
||||
memcpy(ik, output+16, 16);
|
||||
}
|
||||
|
||||
/*
|
||||
* TS33.401 Annex I Hash Functions
|
||||
* Use the KDF given in TS33.220
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue