ards to a state after sending a NACK to the compressor, if bidirectional link is used. The decompressor does not assume context corruption and remains in the current state until k packets arrive with error in the last n packets. 2.2.3.3 Ciphering and Integrity Protection Functions The RRC confidentiality protection is provided by the PDCP sublayer between a UE and the serving gNB. The user-plane security policy indicates whether the user-plane confidenti- ality and/or user-plane integrity protection is activated for all DRBs belonging to the PDU session. The input parameters to the 128-bit NR encryption algorithm (NEA) (or alterna- tively encryption algorithm for 5G), which is used for ciphering, are 128-bit cipher key referred to as KEY (KRRCenc), 32-bit COUNT (PDCP COUNT), 5-bit radio bearer identity BEARER, 1-bit direction of the transmission, that is, DIRECTION, and the length of the keystream required identified as LENGTH. The DIRECTION bit is set to zero for uplink and one for downlink. Fig. 2.17 illustrates the use of the ciphering algorithm NEA to encrypt plain text by applying a keystream using a bit-wise binary addition of the plaintext block and the keystream block. The plaintext block may be recovered by generating the same keystream block using the same input parameters and applying a bit-wise binary addi- tion with the ciphertext block. Based on the input parameters, the algorithm generates the output keystream block keystream which is used to encrypt the input plaintext block to pro- duce the output ciphertext block. The input parameter LENGTH only denotes the length of the keystream block and not its content [2,11]. The ciphering algorithm and key to be used by the PDCP entity are configured by upper layers and the ciphering method is applied according to the security architecture of 3GPP system architecture evolution (SAE, which is the LTE system architecture). The ciphering function is activated by upper layers. After security activation, the ciphering function is applied to all PDCP PDUs indica