Read and write functions work correctly only until read reads less bytes than requested or write writes less bytes than requested. Read function fails because it decrypts whole read buffer which is only partially filled with valid data. Write function fails because it encrypts whole buffer, but sends only part of encrypted bytes.
Read and write functions work correctly only until read reads less bytes than requested or write writes less bytes than requested. Read function fails because it decrypts whole read buffer which is only partially filled with valid data. Write function fails because it encrypts whole buffer, but sends only part of encrypted bytes.
These commits fix both issues.