added functional tests for cbc mode
fixed input data corruption in cbc mode