nr pdcp security: add a 'decipher' API function

This commit is contained in:
Cedric Roux
2025-06-23 10:02:54 +02:00
parent 69d1d5fb5f
commit a0974f7c73
2 changed files with 9 additions and 4 deletions
+6 -4
View File
@@ -136,10 +136,10 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
}
if (entity->has_ciphering)
entity->cipher(entity->security_context,
buffer + header_size + sdap_header_size,
size - (header_size + sdap_header_size),
entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1);
entity->decipher(entity->security_context,
buffer + header_size + sdap_header_size,
size - (header_size + sdap_header_size),
entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1);
if (entity->has_integrity) {
unsigned char integrity[PDCP_INTEGRITY_SIZE] = {0};
@@ -380,10 +380,12 @@ static void nr_pdcp_entity_set_security(struct nr_pdcp_entity_t *entity,
if (parameters->ciphering_algorithm == 2) {
entity->security_context = nr_pdcp_security_nea2_init(entity->security_keys_and_algos.ciphering_key);
entity->cipher = nr_pdcp_security_nea2_cipher;
entity->decipher = nr_pdcp_security_nea2_cipher;
entity->free_security = nr_pdcp_security_nea2_free_security;
} else if (parameters->ciphering_algorithm == 1) {
entity->security_context = nr_pdcp_security_nea1_init(entity->security_keys_and_algos.ciphering_key);
entity->cipher = nr_pdcp_security_nea1_cipher;
entity->decipher = nr_pdcp_security_nea1_cipher;
entity->free_security = nr_pdcp_security_nea1_free_security;
} else {
LOG_E(PDCP, "FATAL: only nea1 and nea2 supported for the moment\n");
+3
View File
@@ -156,6 +156,9 @@ typedef struct nr_pdcp_entity_t {
void (*cipher)(stream_security_context_t *security_context,
unsigned char *buffer, int length,
int bearer, uint32_t count, int direction);
void (*decipher)(stream_security_context_t *security_context,
unsigned char *buffer, int length,
int bearer, uint32_t count, int direction);
void (*free_security)(stream_security_context_t *security_context);
stream_security_context_t *integrity_context;
void (*integrity)(stream_security_context_t *integrity_context,