Recreate usage tables on error
am: 4228e2327e
Change-Id: I66140b35d3b992aaedb15c8e2dd2167127183eb3
This commit is contained in:
@@ -710,6 +710,10 @@ CdmResponseType CryptoSession::LoadKeys(
|
|||||||
} else if (OEMCrypto_ERROR_TOO_MANY_KEYS == sts) {
|
} else if (OEMCrypto_ERROR_TOO_MANY_KEYS == sts) {
|
||||||
LOGE("CryptoSession::LoadKeys: OEMCrypto_LoadKeys error=%d", sts);
|
LOGE("CryptoSession::LoadKeys: OEMCrypto_LoadKeys error=%d", sts);
|
||||||
result = INSUFFICIENT_CRYPTO_RESOURCES;
|
result = INSUFFICIENT_CRYPTO_RESOURCES;
|
||||||
|
} else if (OEMCrypto_ERROR_USAGE_TABLE_UNRECOVERABLE == sts) {
|
||||||
|
// Handle vendor specific error
|
||||||
|
LOGE("CryptoSession::LoadKeys: OEMCrypto_LoadKeys error=%d", sts);
|
||||||
|
result = NEED_PROVISIONING;
|
||||||
} else {
|
} else {
|
||||||
LOGE("CryptoSession::LoadKeys: OEMCrypto_LoadKeys error=%d", sts);
|
LOGE("CryptoSession::LoadKeys: OEMCrypto_LoadKeys error=%d", sts);
|
||||||
result = LOAD_KEY_ERROR;
|
result = LOAD_KEY_ERROR;
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ using wvcdm::kLevel3;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static const size_t kMaxGenericEncryptChunkSize = 100*1024;
|
static const size_t kMaxGenericEncryptChunkSize = 100*1024;
|
||||||
|
OEMCryptoResult kOemCryptoResultVendorSpecificError1 =
|
||||||
|
static_cast<OEMCryptoResult>(10008);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const uint8_t* key_id;
|
const uint8_t* key_id;
|
||||||
@@ -1156,18 +1158,26 @@ extern "C" OEMCryptoResult OEMCrypto_LoadKeys(
|
|||||||
} else {
|
} else {
|
||||||
if (pair.fcn->LoadKeys_V9_or_V10 == NULL)
|
if (pair.fcn->LoadKeys_V9_or_V10 == NULL)
|
||||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||||
return pair.fcn->LoadKeys_V9_or_V10(pair.session, message, message_length,
|
OEMCryptoResult result = pair.fcn->LoadKeys_V9_or_V10(
|
||||||
signature, signature_length,
|
pair.session, message, message_length, signature, signature_length,
|
||||||
enc_mac_key_iv, enc_mac_key, num_keys,
|
enc_mac_key_iv, enc_mac_key, num_keys, &key_array_v10[0], pst,
|
||||||
&key_array_v10[0], pst, pst_length);
|
pst_length);
|
||||||
|
// Convert a vendor specific error, to make it actionable
|
||||||
|
if (result == kOemCryptoResultVendorSpecificError1)
|
||||||
|
result = OEMCrypto_ERROR_USAGE_TABLE_UNRECOVERABLE;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pair.fcn->version < 13) {
|
if (pair.fcn->version < 13) {
|
||||||
if (pair.fcn->LoadKeys_V11_or_V12 == NULL)
|
if (pair.fcn->LoadKeys_V11_or_V12 == NULL)
|
||||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||||
return pair.fcn->LoadKeys_V11_or_V12(
|
OEMCryptoResult result = pair.fcn->LoadKeys_V11_or_V12(
|
||||||
pair.session, message, message_length, signature, signature_length,
|
pair.session, message, message_length, signature, signature_length,
|
||||||
enc_mac_key_iv, enc_mac_key, num_keys, key_array, pst, pst_length);
|
enc_mac_key_iv, enc_mac_key, num_keys, key_array, pst, pst_length);
|
||||||
|
// Convert a vendor specific error, to make it actionable
|
||||||
|
if (result == kOemCryptoResultVendorSpecificError1)
|
||||||
|
result = OEMCrypto_ERROR_USAGE_TABLE_UNRECOVERABLE;
|
||||||
|
return result;
|
||||||
} else {
|
} else {
|
||||||
if (pair.fcn->LoadKeys == NULL) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
if (pair.fcn->LoadKeys == NULL) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||||
return pair.fcn->LoadKeys(pair.session, message, message_length,
|
return pair.fcn->LoadKeys(pair.session, message, message_length,
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ typedef enum OEMCryptoResult {
|
|||||||
OEMCrypto_ERROR_LICENSE_INACTIVE = 47,
|
OEMCrypto_ERROR_LICENSE_INACTIVE = 47,
|
||||||
OEMCrypto_ERROR_ENTRY_NEEDS_UPDATE = 48,
|
OEMCrypto_ERROR_ENTRY_NEEDS_UPDATE = 48,
|
||||||
OEMCrypto_ERROR_ENTRY_IN_USE = 49,
|
OEMCrypto_ERROR_ENTRY_IN_USE = 49,
|
||||||
|
OEMCrypto_ERROR_USAGE_TABLE_UNRECOVERABLE = 50, // Reserved. Do not use.
|
||||||
} OEMCryptoResult;
|
} OEMCryptoResult;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user