Merge changes I490befba,I32512a3e into oc-dev
* changes: Remove API Version TODO Comments Define Provisioning-Unique ID for New Device IDs
This commit is contained in:
@@ -374,23 +374,38 @@ bool CryptoSession::GetProvisioningId(std::string* provisioning_id) {
|
||||
if (!initialized_) {
|
||||
return false;
|
||||
}
|
||||
OEMCryptoResult sts;
|
||||
M_TIME(
|
||||
sts = OEMCrypto_GetKeyData(
|
||||
buf,
|
||||
&buf_size,
|
||||
requested_security_level_),
|
||||
metrics_,
|
||||
oemcrypto_get_key_data_,
|
||||
sts,
|
||||
metrics::Pow2Bucket(buf_size),
|
||||
requested_security_level_);
|
||||
if (OEMCrypto_SUCCESS != sts) {
|
||||
return false;
|
||||
}
|
||||
|
||||
provisioning_id->assign(reinterpret_cast<char*>(&buf[8]), 16);
|
||||
return true;
|
||||
if (pre_provision_token_type_ == kClientTokenOemCert) {
|
||||
// OEM Cert devices have no provisioning-unique ID embedded in them, so we
|
||||
// synthesize one by using the External Device-Unique ID and inverting all
|
||||
// the bits.
|
||||
if (!GetExternalDeviceUniqueId(provisioning_id)) return false;
|
||||
|
||||
for (size_t i = 0; i < provisioning_id->size(); ++i) {
|
||||
char value = (*provisioning_id)[i];
|
||||
(*provisioning_id)[i] = ~value;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
OEMCryptoResult sts;
|
||||
M_TIME(
|
||||
sts = OEMCrypto_GetKeyData(
|
||||
buf,
|
||||
&buf_size,
|
||||
requested_security_level_),
|
||||
metrics_,
|
||||
oemcrypto_get_key_data_,
|
||||
sts,
|
||||
metrics::Pow2Bucket(buf_size),
|
||||
requested_security_level_);
|
||||
if (OEMCrypto_SUCCESS != sts) {
|
||||
return false;
|
||||
}
|
||||
|
||||
provisioning_id->assign(reinterpret_cast<char*>(&buf[8]), 16);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t CryptoSession::GetSecurityPatchLevel() {
|
||||
|
||||
Reference in New Issue
Block a user