Avoid buffer change while encrypting data
# This is a combination of 2 commits.
# The first commit's message is:

Avoid buffer change while encrypting data
Rename buf_for_compress to buf_for_compress_encrypt