Remove direct access to the sealing CDI from the payload
Change the API from offering the raw sealing CDI to offering VM instance
secrets that happend to be derived from the sealing CDI. This makes it
harder for the payload to leak its sealing CDI and losing the ability to
have secrets in the VM.
Bug: 243514248
Test: atest MicrodroidTests
Test: atest ComposHostTestCases
Change-Id: I0e72dabe7daca4d72a35788412d2ee19a3b446a5
diff --git a/tests/testapk/src/native/testbinary.cpp b/tests/testapk/src/native/testbinary.cpp
index d1cfc56..85cbd97 100644
--- a/tests/testapk/src/native/testbinary.cpp
+++ b/tests/testapk/src/native/testbinary.cpp
@@ -73,14 +73,14 @@
return ndk::ScopedAStatus::ok();
}
- ndk::ScopedAStatus insecurelyExposeSealingCdi(std::vector<uint8_t>* out) override {
- uint8_t cdi[64];
- size_t cdi_size = get_dice_sealing_cdi(cdi, sizeof(cdi));
- if (cdi_size == 0) {
+ ndk::ScopedAStatus insecurelyExposeVmInstanceSecret(std::vector<uint8_t>* out) override {
+ const uint8_t identifier[] = {1, 2, 3, 4};
+ uint8_t secret[32];
+ if (!get_vm_instance_secret(identifier, sizeof(identifier), secret, sizeof(secret))) {
return ndk::ScopedAStatus::
- fromServiceSpecificErrorWithMessage(0, "Failed to get sealing cdi");
+ fromServiceSpecificErrorWithMessage(0, "Failed to VM instance secret");
}
- *out = {cdi, cdi + cdi_size};
+ *out = {secret, secret + sizeof(secret)};
return ndk::ScopedAStatus::ok();
}