VtsKernelEncryptionTest: test correctness of metadata encryption

Test that metadata encryption with dm-default-key v2 is working
correctly.  Both AES-256-XTS and Adiantum are tested, when supported.

To avoid having to find a region on disk that can safely be modified,
only decryption is actually tested.  This should be good enough since
the device wouldn't work anyway if decryption didn't invert encryption.

For now we don't specifically test that file contents aren't encrypted
twice, since that's already implied by the FBE test cases.

See the file-level comment for more details.

Test: atest -v vts_kernel_encryption_test

      Ran on Cuttlefish.  The new test cases passed as expected (and
      were not skipped -- verified this via the gtest log).

      Ran on Cuttlefish with a kernel patch that made dm-default-key use
      the wrong key.  The new test cases failed as expected.

      Ran on Cuttlefish with a kernel without CONFIG_CRYPTO_ADIANTUM.
      The Adiantum test case was skipped as expected.

Bug: 151100202
Change-Id: I4109d005499cf80dfc14d82465dd5724c9310b20
Merged-In: I4109d005499cf80dfc14d82465dd5724c9310b20
2 files changed