Since Android U, AVF (with Microdroid) supports Encrypted Storage which is the storage solution in a VM. Within a VM, this is mounted at a path that can be retrieved via the AVmPayload_getEncryptedStoragePath()
. Any data written in encrypted storage is persisted and is available next time the VM is run.
Encrypted Storage is backed by a para-virtualized block device on the guest which is further backed by a disk image file in the host. The block device is formatted with an ext4 filesystem.
Encrypted Storage uses block level encryption layer (Device-Mapper's “crypt” target) using a key derived from the VM secret and AES256 cipher with HCTR2 mode. The Block level encryption ensures the filesystem is also encrypted.
Encrypted Storage does not offer the level of integrity offered by primitives such as authenticated encryption/dm-integrity/RPMB. That level of integrity comes with substantial disk/performance overhead. Instead, it uses HCTR2 which is a super-pseudorandom permutation encryption mode, this offers better resilience against malleability attacks (than other modes such as XTS).
With Updatable VM feature shipping in Android V, Encrypted Storage can be accessed even after OTA/updates of boot images and apks. This requires chipsets to support Secretkeeper HAL.