In keystream generation mode, the encryption function generates a keystream that is then XOR'd with the plaintext stream to achieve encryption.