Internal 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 changes the tool used by widevine internally. Another CL will update the tool for factory use. Test: Ran the tool on Pixel 7 w/wo verified device info being present Bug: 263312447 Change-Id: I71a48cc210f6a6f26f339f512a1851237ba94172
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
LOGE("%s", dlerror()); \
|
||||
return false; \
|
||||
}
|
||||
#define LOAD_SYM_IF_EXIST(name) \
|
||||
name = reinterpret_cast<name##_t>(LOOKUP(handle_, OEMCrypto_##name));
|
||||
|
||||
// These are implementations required by OEMCrypto Reference Implementation
|
||||
// and/or the Testbed, but not needed in this package.
|
||||
@@ -78,6 +80,7 @@ bool OEMCryptoInterface::Init(const std::string& oemcrypto_path) {
|
||||
LOAD_SYM(Terminate);
|
||||
LOAD_SYM(GetBootCertificateChain);
|
||||
LOAD_SYM(BuildInformation);
|
||||
LOAD_SYM_IF_EXIST(GetDeviceInformation);
|
||||
|
||||
OEMCryptoResult status = Initialize();
|
||||
if (status != OEMCrypto_SUCCESS) {
|
||||
@@ -141,4 +144,37 @@ OEMCryptoResult OEMCryptoInterface::GetOEMCryptoBuildInfo(
|
||||
return result;
|
||||
}
|
||||
|
||||
OEMCryptoResult OEMCryptoInterface::GetVerifiedDeviceInformation(
|
||||
VerifiedDeviceInfo& verified_device_info) {
|
||||
if (handle_ == nullptr) {
|
||||
return OEMCrypto_ERROR_INIT_FAILED;
|
||||
}
|
||||
if (GetDeviceInformation == nullptr) {
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
verified_device_info.device_info.resize(0);
|
||||
size_t device_info_size = 0;
|
||||
verified_device_info.signed_csr_payload.resize(0);
|
||||
size_t signed_csr_payload_size = 0;
|
||||
|
||||
OEMCryptoResult result = GetDeviceInformation(
|
||||
verified_device_info.device_info.data(), &device_info_size,
|
||||
verified_device_info.signed_csr_payload.data(), &signed_csr_payload_size);
|
||||
LOGI("GetVerifiedDeviceInformation first attempt result %d", result);
|
||||
if (result == OEMCrypto_ERROR_SHORT_BUFFER) {
|
||||
verified_device_info.device_info.resize(device_info_size);
|
||||
verified_device_info.signed_csr_payload.resize(signed_csr_payload_size);
|
||||
result = GetDeviceInformation(
|
||||
verified_device_info.device_info.data(), &device_info_size,
|
||||
verified_device_info.signed_csr_payload.data(),
|
||||
&signed_csr_payload_size);
|
||||
verified_device_info.device_info.resize(device_info_size);
|
||||
verified_device_info.signed_csr_payload.resize(signed_csr_payload_size);
|
||||
LOGI("GetVerifiedDeviceInformation second attempt result %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace widevine
|
||||
|
||||
Reference in New Issue
Block a user