Move system ID extraction outside of CryptoSession.
[ Merge of http://go/wvgerrit/151391 ] This CL moves the logic for extracting the system ID from keybox or OEM certificate (from OEMCrypto or device files) to a dedicated SystemIdExtractor. Before Provisioning 4.0, the system ID could only be found from data returned by OEMCrypto. However, with provisioning 4.0, the system ID can now be found in the OEM certificate that is stored on the device files. Bug: 232020319 Test: system_id_extractor_unittest Test: Forest L37800000954493485 Change-Id: Ie1b7987906e2e4fef015cd659a947b6dbb7594b1
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "ota_keybox_provisioner.h"
|
||||
#include "properties.h"
|
||||
#include "string_conversions.h"
|
||||
#include "system_id_extractor.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
#include "wv_cdm_event_listener.h"
|
||||
|
||||
@@ -839,6 +840,17 @@ CdmResponseType CdmEngine::QueryStatus(RequestedSecurityLevel security_level,
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
if (query_token == QUERY_KEY_SYSTEM_ID) {
|
||||
SystemIdExtractor extractor(security_level, crypto_session.get(),
|
||||
file_system_);
|
||||
uint32_t system_id;
|
||||
if (!extractor.ExtractSystemId(&system_id)) {
|
||||
LOGW("ExtractSystemId failed");
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
*query_response = std::to_string(system_id);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
CdmResponseType status;
|
||||
M_TIME(status = crypto_session->Open(security_level),
|
||||
@@ -857,16 +869,6 @@ CdmResponseType CdmEngine::QueryStatus(RequestedSecurityLevel security_level,
|
||||
*query_response = device_id;
|
||||
return NO_ERROR;
|
||||
}
|
||||
if (query_token == QUERY_KEY_SYSTEM_ID) {
|
||||
uint32_t system_id;
|
||||
const bool got_id = crypto_session->GetSystemId(&system_id);
|
||||
if (!got_id) {
|
||||
LOGW("QUERY_KEY_SYSTEM_ID unknown failure");
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
*query_response = std::to_string(system_id);
|
||||
return NO_ERROR;
|
||||
}
|
||||
if (query_token == QUERY_KEY_PROVISIONING_ID) {
|
||||
std::string provisioning_id;
|
||||
status = crypto_session->GetProvisioningId(&provisioning_id);
|
||||
|
||||
Reference in New Issue
Block a user