Section: 4.4.4 Integrity protection of NAS signalling messages 4.4.4.1 General
Content: For the UE, integrity protected signalling is mandatory for the 5GMM NAS messages once a valid 5G NAS security context exists and has been taken into use. For the network, integrity protected signalling is mandatory for the 5GMM NAS messages once a secure exchange of 5GS NAS messages has been established for the NAS signalling connection. Integrity protection of all NAS signalling messages is the responsibility of the NAS. It is the network which activates integrity protection. The use of "null integrity protection algorithm" 5G-IA0 (see subclause 9.11.3.34) in the current 5G NAS security context is only allowed: a) for an unauthenticated UE for which establishment of emergency services is allowed; b) for a W-AGF acting on behalf of an FN-RG; c) for a W-AGF acting on behalf of an N5GC device; and d) for a 5G-RG acting on behalf of an AUN3 device. For setting the security header type in outbound NAS messages, the UE and the AMF shall apply the same rules irrespective of whether the "null integrity protection algorithm" or any other integrity protection algorithm is indicated in the 5G NAS security context. If the "null integrity protection algorithm"5G-IA0 has been selected as an integrity protection algorithm, the receiver shall regard the NAS messages with the security header indicating integrity protection as integrity protected. Details of the integrity protection and verification of NAS signalling messages are specified in 3GPP TS 33.501[ Security architecture and procedures for 5G System ]  [24]. When a NAS message needs to be sent both ciphered and integrity protected, the NAS message is first ciphered and then the ciphered NAS message and the NAS sequence number are integrity protected by calculating the MAC. NOTE: NAS messages that are ciphered with the "null ciphering algorithm" 5G-EA0 are regarded as ciphered (see subclause 4.4.5). When a NAS message needs to be sent only integrity protected and unciphered, the unciphered NAS message and the NAS sequence number are integrity protected by calculating the MAC. When a 5GSM message is piggybacked in a 5GMM message, there is only one Sequence number IE and one Message authentication code IE for the 5GMM message piggybacking the 5GSM message.