|
|
@ -142,8 +142,8 @@ bool pdcp_entity_base::integrity_verify(uint8_t* msg, uint32_t msg_len, uint32_t
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp_entity_base::cipher_encrypt(uint8_t* msg, uint32_t msg_len, uint32_t count, uint8_t* ct)
|
|
|
|
void pdcp_entity_base::cipher_encrypt(uint8_t* msg, uint32_t msg_len, uint32_t count, uint8_t* ct)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
byte_buffer_t ct_tmp;
|
|
|
|
|
|
|
|
uint8_t* k_enc;
|
|
|
|
uint8_t* k_enc;
|
|
|
|
|
|
|
|
uint8_t ct_tmp[PDCP_MAX_SDU_SIZE];
|
|
|
|
|
|
|
|
|
|
|
|
// If control plane use RRC encrytion key. If data use user plane key
|
|
|
|
// If control plane use RRC encrytion key. If data use user plane key
|
|
|
|
if (is_srb()) {
|
|
|
|
if (is_srb()) {
|
|
|
@ -162,12 +162,12 @@ void pdcp_entity_base::cipher_encrypt(uint8_t* msg, uint32_t msg_len, uint32_t c
|
|
|
|
case CIPHERING_ALGORITHM_ID_EEA0:
|
|
|
|
case CIPHERING_ALGORITHM_ID_EEA0:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case CIPHERING_ALGORITHM_ID_128_EEA1:
|
|
|
|
case CIPHERING_ALGORITHM_ID_128_EEA1:
|
|
|
|
security_128_eea1(&(k_enc[16]), count, cfg.bearer_id - 1, cfg.tx_direction, msg, msg_len, ct_tmp.msg);
|
|
|
|
security_128_eea1(&(k_enc[16]), count, cfg.bearer_id - 1, cfg.tx_direction, msg, msg_len, ct_tmp);
|
|
|
|
memcpy(ct, ct_tmp.msg, msg_len);
|
|
|
|
memcpy(ct, ct_tmp, msg_len);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case CIPHERING_ALGORITHM_ID_128_EEA2:
|
|
|
|
case CIPHERING_ALGORITHM_ID_128_EEA2:
|
|
|
|
security_128_eea2(&(k_enc[16]), count, cfg.bearer_id - 1, cfg.tx_direction, msg, msg_len, ct_tmp.msg);
|
|
|
|
security_128_eea2(&(k_enc[16]), count, cfg.bearer_id - 1, cfg.tx_direction, msg, msg_len, ct_tmp);
|
|
|
|
memcpy(ct, ct_tmp.msg, msg_len);
|
|
|
|
memcpy(ct, ct_tmp, msg_len);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -177,8 +177,8 @@ void pdcp_entity_base::cipher_encrypt(uint8_t* msg, uint32_t msg_len, uint32_t c
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp_entity_base::cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t count, uint8_t* msg)
|
|
|
|
void pdcp_entity_base::cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t count, uint8_t* msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
byte_buffer_t msg_tmp;
|
|
|
|
|
|
|
|
uint8_t* k_enc;
|
|
|
|
uint8_t* k_enc;
|
|
|
|
|
|
|
|
uint8_t msg_tmp[PDCP_MAX_SDU_SIZE];
|
|
|
|
|
|
|
|
|
|
|
|
// If control plane use RRC encrytion key. If data use user plane key
|
|
|
|
// If control plane use RRC encrytion key. If data use user plane key
|
|
|
|
if (is_srb()) {
|
|
|
|
if (is_srb()) {
|
|
|
@ -197,12 +197,12 @@ void pdcp_entity_base::cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t cou
|
|
|
|
case CIPHERING_ALGORITHM_ID_EEA0:
|
|
|
|
case CIPHERING_ALGORITHM_ID_EEA0:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case CIPHERING_ALGORITHM_ID_128_EEA1:
|
|
|
|
case CIPHERING_ALGORITHM_ID_128_EEA1:
|
|
|
|
security_128_eea1(&k_enc[16], count, cfg.bearer_id - 1, cfg.rx_direction, ct, ct_len, msg_tmp.msg);
|
|
|
|
security_128_eea1(&k_enc[16], count, cfg.bearer_id - 1, cfg.rx_direction, ct, ct_len, msg_tmp);
|
|
|
|
memcpy(msg, msg_tmp.msg, ct_len);
|
|
|
|
memcpy(msg, msg_tmp, ct_len);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case CIPHERING_ALGORITHM_ID_128_EEA2:
|
|
|
|
case CIPHERING_ALGORITHM_ID_128_EEA2:
|
|
|
|
security_128_eea2(&k_enc[16], count, cfg.bearer_id - 1, cfg.rx_direction, ct, ct_len, msg_tmp.msg);
|
|
|
|
security_128_eea2(&k_enc[16], count, cfg.bearer_id - 1, cfg.rx_direction, ct, ct_len, msg_tmp);
|
|
|
|
memcpy(msg, msg_tmp.msg, ct_len);
|
|
|
|
memcpy(msg, msg_tmp, ct_len);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|