Factory tool implements Widevine IRPC HAL v3
Implement IRPC HAL v3 interfaces for extracting device registration CSR. The new interface calls OEMCrypto_GetDeviceInformation() and OEMCrypto_GetSignedCsrPayload() and then constructs the CSR. Also added all mandatory fields of device info in the request. Test: Run extraction tool on Pixel 7 and upload CSR Test: Verified Widevine remote provisioning Bug: 268246995 Change-Id: I24097ba32c7a105266071c1341c938b5874b38d8
This commit is contained in:
@@ -81,6 +81,7 @@ bool OEMCryptoInterface::Init(const std::string& oemcrypto_path) {
|
||||
LOAD_SYM(GetBootCertificateChain);
|
||||
LOAD_SYM(BuildInformation);
|
||||
LOAD_SYM_IF_EXIST(GetDeviceInformation);
|
||||
LOAD_SYM_IF_EXIST(GetDeviceSignedCsrPayload);
|
||||
|
||||
OEMCryptoResult status = Initialize();
|
||||
if (status != OEMCrypto_SUCCESS) {
|
||||
@@ -145,7 +146,7 @@ OEMCryptoResult OEMCryptoInterface::GetOEMCryptoBuildInfo(
|
||||
}
|
||||
|
||||
OEMCryptoResult OEMCryptoInterface::GetVerifiedDeviceInformation(
|
||||
VerifiedDeviceInfo& verified_device_info) {
|
||||
std::vector<uint8_t>& verified_device_info) {
|
||||
if (handle_ == nullptr) {
|
||||
return OEMCrypto_ERROR_INIT_FAILED;
|
||||
}
|
||||
@@ -153,27 +154,46 @@ OEMCryptoResult OEMCryptoInterface::GetVerifiedDeviceInformation(
|
||||
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);
|
||||
verified_device_info.resize(0);
|
||||
size_t verified_device_info_size = 0;
|
||||
OEMCryptoResult result = GetDeviceInformation(verified_device_info.data(),
|
||||
&verified_device_info_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);
|
||||
verified_device_info.resize(verified_device_info_size);
|
||||
result = GetDeviceInformation(verified_device_info.data(),
|
||||
&verified_device_info_size);
|
||||
verified_device_info.resize(verified_device_info_size);
|
||||
LOGI("GetVerifiedDeviceInformation second attempt result %d", result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
OEMCryptoResult OEMCryptoInterface::GetSignedCsrPayload(
|
||||
const std::vector<uint8_t>& challenge,
|
||||
const std::vector<uint8_t>& device_info,
|
||||
std::vector<uint8_t>& signed_csr_payload) {
|
||||
if (handle_ == nullptr) {
|
||||
return OEMCrypto_ERROR_INIT_FAILED;
|
||||
}
|
||||
if (GetDeviceSignedCsrPayload == nullptr) {
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
size_t signed_csr_payload_size = signed_csr_payload.size();
|
||||
OEMCryptoResult result = GetDeviceSignedCsrPayload(
|
||||
challenge.data(), challenge.size(), device_info.data(),
|
||||
device_info.size(), signed_csr_payload.data(), &signed_csr_payload_size);
|
||||
LOGI("GetDeviceSignedCsrPayload first attempt result %d", result);
|
||||
if (result == OEMCrypto_ERROR_SHORT_BUFFER) {
|
||||
signed_csr_payload.resize(signed_csr_payload_size);
|
||||
result = GetDeviceSignedCsrPayload(challenge.data(), challenge.size(),
|
||||
device_info.data(), device_info.size(),
|
||||
signed_csr_payload.data(),
|
||||
&signed_csr_payload_size);
|
||||
signed_csr_payload.resize(signed_csr_payload_size);
|
||||
LOGI("GetDeviceSignedCsrPayload second attempt result %d", result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user