Session: Improvements to encryption functionality
- Use CBC mode if CTR is unavailable, since the older method should be more commonly supported.
- Apply PKCS7 padding manually when using mcrypt, since mcrypt zero-pads instead. This didn't matter for CTR because the effective blocksize is 1, but it does for CBC. OpenSSL uses PKCS7 padding for CBC mode by default, so we don't have to worry about it there.
Bug: T136587
Change-Id: I7290b1a7aa64df70f4ab10eee2080141528c4788
(cherry picked from commit 9634f22207b50364da356f9cd28e42e6753eeee5)