Skip to content

calculation error of count when calculating XMAC for integrity checking when received dl_nas_transfer message. Could you pls add me as developer for oai/openairinterface5g?

  • What I did

    1.COTS UE + OAI eNB(oai/openairinterface5G) + COTS EPC, S1AP setup ok, cell setup successfully. UE capability: EIA1 2.Attach UE through OAI eNB 3.Checking of NAS message integrity was failed when receiving the second dl nas transfer message, because "mac != msg->header.message_authentication_code"

  • How I did it

  • How to verify it

    Attach UE(EIA1) through OAI eNB with at least two dl nas transfer messages.

  • How to fix it

    There is calculation error at _nas_message_get_mac@openair3\NAS\COMMON\API\NETWORK\nas_message.c:1306 and _nas_message_get_mac@openair3\NAS\COMMON\API\NETWORK\nas_message.c:1372 which are for EIA1 and EIA2 integrity.

Current code on Master branch of oai/openairinterface5G: if (direction == SECU_DIRECTION_UPLINK) { count = 0x00000000 || ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || (emm_security_context->ul_count.seq_num & 0x000000FF); } else { count = 0x00000000 || ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || (emm_security_context->dl_count.seq_num & 0x000000FF); }

It should be:

if (direction == SECU_DIRECTION_UPLINK) { count = 0x00000000 | ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) | (emm_security_context->ul_count.seq_num & 0x000000FF); } else { count = 0x00000000 | ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) | (emm_security_context->dl_count.seq_num & 0x000000FF); }

  • Description for the changelog
Edited by Robert Schmidt