Ciphering EMM information message. Chainging detach_request security header in the UE to integrity and ciphered to avoid malformed message.

This commit is contained in:
Pedro Alvarez 2019-01-14 17:00:16 +00:00
parent b5d5f9f91c
commit b675e1fcc9
2 changed files with 6 additions and 2 deletions

View File

@ -1321,7 +1321,7 @@ nas::pack_emm_information(srslte::byte_buffer_t *nas_buffer)
emm_info.utc_and_local_time_zone_present = false;
emm_info.net_dst_present = false;
uint8_t sec_hdr_type =2;
uint8_t sec_hdr_type =LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED;
m_sec_ctx.dl_nas_count++;
LIBLTE_ERROR_ENUM err = liblte_mme_pack_emm_information_msg(&emm_info, sec_hdr_type, m_sec_ctx.dl_nas_count, (LIBLTE_BYTE_MSG_STRUCT *) nas_buffer);
if (err != LIBLTE_SUCCESS) {
@ -1330,6 +1330,10 @@ nas::pack_emm_information(srslte::byte_buffer_t *nas_buffer)
return false;
}
// Encrypt NAS message
cipher_encrypt(nas_buffer);
// Integrity protect NAS message
uint8_t mac[4];
integrity_generate(nas_buffer,mac);
memcpy(&nas_buffer->msg[1],mac,4);

View File

@ -1351,7 +1351,7 @@ void nas::send_detach_request(bool switch_off)
detach_request.nas_ksi.nas_ksi = ctxt.ksi;
nas_log->info("Requesting Detach with GUTI\n");
liblte_mme_pack_detach_request_msg(&detach_request,
LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY,
LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED,
ctxt.tx_count,
(LIBLTE_BYTE_MSG_STRUCT *) pdu);