PDCP layer performs integrity protection and verification based on the role. I mean when PDCP entity works as a transmitter, it does integrity protection of upper layer SDU coming over SRB1 and SRB2 of an UE. When PDCP transmitting entity receives a packet, it prepares PDCP Control plane data pdu. For the format of PDCP control plane data pdu, please check 36.323 spec. PDCP layer calculates 32 bits long MAC-I from RRC integrity key and values of variables COUNT, BEARER ID and , DIRECTION.
At the receiver side, PDCP layer calculates X-MAC based on input parameters i.e RRC Integrity key, COUNT, BEARER ID and DIRECTION. If the calculated X-MAC corresponds to the received MAC-I, Integrity protection is verified successfully.