Merge "Adjust provisioning retry"

This commit is contained in:
TreeHugger Robot
2020-02-20 04:36:48 +00:00
committed by Android (Google) Code Review
3 changed files with 41 additions and 66 deletions

View File

@@ -199,6 +199,7 @@ CdmResponseType CertificateProvisioning::GetProvisioningRequest(
default_url->assign(kProvisioningServerUrl);
if (crypto_session_->IsOpen()) crypto_session_->Close();
CdmResponseType status = crypto_session_->Open(requested_security_level);
if (NO_ERROR != status) {
LOGE("Failed to create a crypto session: status = %d",

View File

@@ -395,14 +395,6 @@ CdmResponseType CryptoSession::GetTokenFromOemCert(std::string* token) {
return NO_ERROR;
}
// TODO(b/141655126): This function can be optimized to not load private
// key when it isn't needed.
status = OEMCrypto_LoadOEMPrivateKey(oec_session_id_);
if (status != OEMCrypto_SUCCESS) {
return MapOEMCryptoResult(status, GET_TOKEN_FROM_OEM_CERT_ERROR,
"GetTokenFromOemCert");
}
std::string temp_buffer(CERTIFICATE_DATA_SIZE, '\0');
bool retrying = false;
while (true) {
@@ -1124,6 +1116,15 @@ CdmResponseType CryptoSession::PrepareAndSignProvisioningRequest(
if (pre_provision_token_type_ == kClientTokenKeybox) {
const CdmResponseType status = GenerateDerivedKeys(message);
if (status != NO_ERROR) return status;
} else if (pre_provision_token_type_ == kClientTokenOemCert) {
const OEMCryptoResult status = OEMCrypto_LoadOEMPrivateKey(oec_session_id_);
if (status != OEMCrypto_SUCCESS) {
return MapOEMCryptoResult(status, GET_TOKEN_FROM_OEM_CERT_ERROR,
"GetTokenFromOemCert");
}
} else {
LOGE("Unknown method %d", pre_provision_token_type_);
return UNKNOWN_CLIENT_TOKEN_TYPE;
}
OEMCryptoResult sts;