handle security in re-establishment

This commit is contained in:
Cedric Roux
2024-07-05 12:38:19 +02:00
parent 93f595828d
commit 2db259984f
6 changed files with 107 additions and 32 deletions
+7 -1
View File
@@ -255,7 +255,13 @@ void e1_bearer_context_modif(const e1ap_bearer_mod_req_t *req)
modified->id = to_modif->id;
if (to_modif->pdcp_config.pDCP_Reestablishment) {
nr_pdcp_reestablishment(req->gNB_cu_up_ue_id, to_modif->id, false);
nr_pdcp_reestablishment(req->gNB_cu_up_ue_id,
to_modif->id,
false,
req->integrityProtectionAlgorithm,
(uint8_t *)req->integrityProtectionKey,
req->cipheringAlgorithm,
(uint8_t *)req->encryptionKey);
}
if (f1inst < 0) // no F1-U?
+26 -9
View File
@@ -515,23 +515,33 @@ static void free_rx_list(nr_pdcp_entity_t *entity)
* @brief PDCP entity re-establishment according to 5.1.2 of 3GPP TS 38.323
* @todo deal with ciphering/integrity algos and keys for transmitting/receiving entity procedures
*/
static void nr_pdcp_entity_reestablish_drb_am(nr_pdcp_entity_t *entity)
static void nr_pdcp_entity_reestablish_drb_am(nr_pdcp_entity_t *entity,
int integrity_algorithm,
const uint8_t *integrity_key,
int ciphering_algorithm,
const uint8_t *ciphering_key)
{
/* transmitting entity procedures */
/* todo: deal with ciphering/integrity algos and keys */
/* do nothing */
/* receiving entity procedures */
/* todo: deal with ciphering/integrity algos and keys */
/* do nothing */
/* ciphering and integrity: common for both tx and rx entities */
entity->set_security(entity, integrity_algorithm, integrity_key, ciphering_algorithm, ciphering_key);
/* Flag PDCP entity as re-established */
entity->entity_suspended = false;
}
static void nr_pdcp_entity_reestablish_drb_um(nr_pdcp_entity_t *entity)
static void nr_pdcp_entity_reestablish_drb_um(nr_pdcp_entity_t *entity,
int integrity_algorithm,
const uint8_t *integrity_key,
int ciphering_algorithm,
const uint8_t *ciphering_key)
{
/* transmitting entity procedures */
entity->tx_next = 0;
/* todo: deal with ciphering/integrity algos and keys */
/* receiving entity procedures */
/* deliver all SDUs if t_reordering is running */
@@ -542,17 +552,22 @@ static void nr_pdcp_entity_reestablish_drb_um(nr_pdcp_entity_t *entity)
/* set rx_next and rx_deliv to the initial value */
entity->rx_next = 0;
entity->rx_deliv = 0;
/* todo: deal with ciphering/integrity algos and keys */
/* ciphering and integrity: common for both tx and rx entities */
entity->set_security(entity, integrity_algorithm, integrity_key, ciphering_algorithm, ciphering_key);
/* Flag PDCP entity as re-established */
entity->entity_suspended = false;
}
static void nr_pdcp_entity_reestablish_srb(nr_pdcp_entity_t *entity)
static void nr_pdcp_entity_reestablish_srb(nr_pdcp_entity_t *entity,
int integrity_algorithm,
const uint8_t *integrity_key,
int ciphering_algorithm,
const uint8_t *ciphering_key)
{
/* transmitting entity procedures */
entity->tx_next = 0;
/* todo: deal with ciphering/integrity algos and keys */
/* receiving entity procedures */
free_rx_list(entity);
@@ -561,7 +576,9 @@ static void nr_pdcp_entity_reestablish_srb(nr_pdcp_entity_t *entity)
/* set rx_next and rx_deliv to the initial value */
entity->rx_next = 0;
entity->rx_deliv = 0;
/* todo: deal with ciphering/integrity algos and keys */
/* ciphering and integrity: common for both tx and rx entities */
entity->set_security(entity, integrity_algorithm, integrity_key, ciphering_algorithm, ciphering_key);
/* Flag PDCP entity as re-established */
entity->entity_suspended = false;
+5 -1
View File
@@ -91,7 +91,11 @@ typedef struct nr_pdcp_entity_t {
void (*delete_entity)(struct nr_pdcp_entity_t *entity);
void (*release_entity)(struct nr_pdcp_entity_t *entity);
void (*suspend_entity)(struct nr_pdcp_entity_t *entity);
void (*reestablish_entity)(struct nr_pdcp_entity_t *entity);
void (*reestablish_entity)(struct nr_pdcp_entity_t *entity,
int integrity_algorithm,
const uint8_t *integrity_key,
int ciphering_algorithm,
const uint8_t *ciphering_key);
void (*get_stats)(struct nr_pdcp_entity_t *entity, nr_pdcp_statistics_t *out);
/* set_security: pass -1 to integrity_algorithm / ciphering_algorithm
+7 -1
View File
@@ -62,7 +62,13 @@ void add_drb(int is_gnb,
unsigned char *integrity_key);
void nr_pdcp_remove_UE(ue_id_t ue_id);
void nr_pdcp_reestablishment(ue_id_t ue_id, int rb_id, bool srb_flag);
void nr_pdcp_reestablishment(ue_id_t ue_id,
int rb_id,
bool srb_flag,
int ciphering_algorithm,
const uint8_t *ciphering_key,
int integrity_algorithm,
const uint8_t *integrity_key);
void nr_pdcp_suspend_srb(ue_id_t ue_id, int srb_id);
void nr_pdcp_suspend_drb(ue_id_t ue_id, int drb_id);