diff options
Diffstat (limited to 'include/keymaster/android_keymaster_messages.h')
-rw-r--r-- | include/keymaster/android_keymaster_messages.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/keymaster/android_keymaster_messages.h b/include/keymaster/android_keymaster_messages.h index de674b8..7d43043 100644 --- a/include/keymaster/android_keymaster_messages.h +++ b/include/keymaster/android_keymaster_messages.h @@ -21,6 +21,10 @@ #include <stdlib.h> #include <string.h> +#include <string> +#include <string_view> +#include <vector> + #include <keymaster/android_keymaster_utils.h> #include <keymaster/authorization_set.h> #include <keymaster/km_version.h> @@ -63,6 +67,7 @@ enum AndroidKeymasterCommand : uint32_t { GENERATE_TIMESTAMP_TOKEN = 31, CONFIGURE_VENDOR_PATCHLEVEL = 32, CONFIGURE_BOOT_PATCHLEVEL = 33, + CONFIGURE_VERIFIED_BOOT_INFO = 34, }; /** @@ -1178,4 +1183,36 @@ struct ConfigureBootPatchlevelRequest : public KeymasterMessage { using ConfigureBootPatchlevelResponse = EmptyKeymasterResponse; +struct ConfigureVerifiedBootInfoRequest : public KeymasterMessage { + explicit ConfigureVerifiedBootInfoRequest(int32_t ver) + : ConfigureVerifiedBootInfoRequest(ver, {}, {}, {}) {} + + ConfigureVerifiedBootInfoRequest(int32_t ver, std::string_view boot_state_param, + std::string_view bootloader_state_param, + std::vector<uint8_t> vbmeta_digest_param) + : KeymasterMessage(ver), boot_state(boot_state_param), + bootloader_state(bootloader_state_param), vbmeta_digest(std::move(vbmeta_digest_param)) {} + + size_t SerializedSize() const override { + return sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) // buffer sizes + + boot_state.size() + bootloader_state.size() + vbmeta_digest.size(); + } + uint8_t* Serialize(uint8_t* buf, const uint8_t* end) const override { + buf = append_collection_to_buf(buf, end, boot_state); + buf = append_collection_to_buf(buf, end, bootloader_state); + return append_collection_to_buf(buf, end, vbmeta_digest); + } + bool Deserialize(const uint8_t** buf_ptr, const uint8_t* end) override { + return copy_collection_from_buf(buf_ptr, end, &boot_state) && + copy_collection_from_buf(buf_ptr, end, &bootloader_state) && + copy_collection_from_buf(buf_ptr, end, &vbmeta_digest); + } + + std::string boot_state; + std::string bootloader_state; + std::vector<uint8_t> vbmeta_digest; +}; + +using ConfigureVerifiedBootInfoResponse = EmptyKeymasterResponse; + } // namespace keymaster |