Factory BCC extraction tool to consume verified device info

BCC extraction tool calls OEMCrypto_GetDeviceInformation() to read
verified device info from TEE. If the verified device info is not
available, (e.g. not implemented), it falls back to using OS properties.

This CL is mostly identical to ag/20799640, which has the same change
for our internal extraction tool. For historical reason, we keep two
copies of the extraction tool which are slightly different from each
other, one for factory use, one for debug use. Long term they will be
merged.

Test: Ran the tool on Pixel 7 w/wo verified device info being present
Bug: 263312447
Change-Id: Ib9c77dee45e9ff996fc2dc2da14f16f60eaff77c
This commit is contained in:
Cong Lin
2022-12-20 20:07:10 -08:00
parent ead412cc55
commit 691f43cbef
5 changed files with 143 additions and 31 deletions

View File

@@ -13,6 +13,13 @@
namespace widevine {
struct VerifiedDeviceInfo {
std::vector<uint8_t> device_info;
// Used by Interface of Remote Provisioning Component (IRPC) v3 for CSR
// uploading
std::vector<uint8_t> signed_csr_payload;
};
class OEMCryptoInterface {
public:
OEMCryptoInterface() = default;
@@ -30,6 +37,11 @@ class OEMCryptoInterface {
// implementation.
OEMCryptoResult GetOEMCryptoBuildInfo(std::string& build_info);
// Retrieves the verified device information of the OEMCrypto library from
// OEMCrypto implementation.
OEMCryptoResult GetVerifiedDeviceInformation(
VerifiedDeviceInfo& verified_device_info);
private:
typedef OEMCryptoResult (*Initialize_t)();
typedef OEMCryptoResult (*Terminate_t)();
@@ -38,11 +50,15 @@ class OEMCryptoInterface {
size_t* additional_signature_size);
typedef OEMCryptoResult (*BuildInformation_t)(char* buffer,
size_t* buffer_length);
typedef OEMCryptoResult (*GetDeviceInformation_t)(
uint8_t* device_info, size_t* device_info_length,
uint8_t* signed_csr_payload, size_t* signed_csr_payload_length);
Initialize_t Initialize = nullptr;
Terminate_t Terminate = nullptr;
GetBootCertificateChain_t GetBootCertificateChain = nullptr;
BuildInformation_t BuildInformation = nullptr;
GetDeviceInformation_t GetDeviceInformation = nullptr;
void* handle_ = nullptr;
};

View File

@@ -41,6 +41,8 @@ class WidevineProvisioner {
cppbor::Array BuildCertReqRecipients(const std::vector<uint8_t>& pubkey,
const std::vector<uint8_t>& kid) const;
void InitializeCryptoInterface();
bool GetDeviceInfoCommon(cppbor::Map& device_info_map);
bool TryAddVerifiedDeviceInfo(cppbor::Map& device_info_map);
std::unique_ptr<OEMCryptoInterface> crypto_interface_;
};