Add recoverable errors
[ Merge of http://go/wvgerrit/71326 ] Nonce flood, frame size, session and system invalidation errors will now bubble up to the app. OEMCrypto v15 returns OEMCrypto_ERROR_BUFFER_TOO_LARGE, OEMCrypto_ERROR_SESSION_LOST_STATE, OEMCrypto_ERROR_SYSTEM_INVALIDATED and a variety of nonce errors. These will be reported to HIDL as OUTPUT_TOO_LARGE_ERROR, ERROR_DRM_SESSION_LOST_STATE, ERROR_DRM_INVALID_STATE and ERROR_DRM_RESOURCE_CONTENTION. Bug: 120572706 Test: Unit/Integration tests Change-Id: Ida177300046327ce81592a273028ef6c3a0d9fd9
This commit is contained in:
@@ -228,12 +228,24 @@ CdmResponseType ServiceCertificate::EncryptClientId(
|
||||
std::string iv(KEY_IV_SIZE, 0);
|
||||
std::string key(SERVICE_KEY_SIZE, 0);
|
||||
|
||||
if (!crypto_session->GetRandom(key.size(),
|
||||
reinterpret_cast<uint8_t*>(&key[0])))
|
||||
return CLIENT_ID_GENERATE_RANDOM_ERROR;
|
||||
if (!crypto_session->GetRandom(iv.size(),
|
||||
reinterpret_cast<uint8_t*>(&iv[0])))
|
||||
return CLIENT_ID_GENERATE_RANDOM_ERROR;
|
||||
CdmResponseType status =
|
||||
crypto_session->GetRandom(key.size(),
|
||||
reinterpret_cast<uint8_t*>(&key[0]));
|
||||
|
||||
if (status != NO_ERROR) {
|
||||
LOGE("ServiceCertificate::EncryptClientId: GetRandom error: %d", status);
|
||||
return status == RANDOM_GENERATION_ERROR ?
|
||||
CLIENT_ID_GENERATE_RANDOM_ERROR : status;
|
||||
}
|
||||
|
||||
status = crypto_session->GetRandom(iv.size(),
|
||||
reinterpret_cast<uint8_t*>(&iv[0]));
|
||||
|
||||
if (status != NO_ERROR) {
|
||||
LOGE("ServiceCertificate::EncryptClientId: GetRandom error: %d", status);
|
||||
return status == RANDOM_GENERATION_ERROR ?
|
||||
CLIENT_ID_GENERATE_RANDOM_ERROR : status;
|
||||
}
|
||||
std::string id, enc_id, enc_key;
|
||||
clear_client_id->SerializeToString(&id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user