am a74980b2: Address key selection and decryption concurrency issues
* commit 'a74980b2f1b91727e39e3e558b3bec6a1ad8337b': Address key selection and decryption concurrency issues
This commit is contained in:
@@ -92,6 +92,8 @@ class CryptoSession {
|
|||||||
bool is_destination_buffer_type_valid_;
|
bool is_destination_buffer_type_valid_;
|
||||||
SecurityLevel requested_security_level_;
|
SecurityLevel requested_security_level_;
|
||||||
|
|
||||||
|
KeyId key_id_;
|
||||||
|
|
||||||
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoSession);
|
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoSession);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -272,17 +272,6 @@ CdmResponseType CdmSession::Decrypt(const CdmDecryptionParameters& params) {
|
|||||||
if (crypto_session_.get() == NULL || !crypto_session_->IsOpen())
|
if (crypto_session_.get() == NULL || !crypto_session_->IsOpen())
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
|
|
||||||
// Check if key needs to be selected
|
|
||||||
if (params.is_encrypted) {
|
|
||||||
if (key_id_.compare(*params.key_id) != 0) {
|
|
||||||
if (crypto_session_->SelectKey(*params.key_id)) {
|
|
||||||
key_id_ = *params.key_id;
|
|
||||||
} else {
|
|
||||||
return NEED_KEY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return crypto_session_->Decrypt(params);
|
return crypto_session_->Decrypt(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -433,7 +433,6 @@ bool CryptoSession::RefreshKeys(const std::string& message,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CryptoSession::SelectKey(const std::string& key_id) {
|
bool CryptoSession::SelectKey(const std::string& key_id) {
|
||||||
AutoLock auto_lock(crypto_lock_);
|
|
||||||
const uint8_t* key_id_string =
|
const uint8_t* key_id_string =
|
||||||
reinterpret_cast<const uint8_t*>(key_id.data());
|
reinterpret_cast<const uint8_t*>(key_id.data());
|
||||||
|
|
||||||
@@ -550,6 +549,18 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
|
|||||||
if (!SetDestinationBufferType()) return UNKNOWN_ERROR;
|
if (!SetDestinationBufferType()) return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoLock auto_lock(crypto_lock_);
|
||||||
|
// Check if key needs to be selected
|
||||||
|
if (params.is_encrypted) {
|
||||||
|
if (key_id_.compare(*params.key_id) != 0) {
|
||||||
|
if (SelectKey(*params.key_id)) {
|
||||||
|
key_id_ = *params.key_id;
|
||||||
|
} else {
|
||||||
|
return NEED_KEY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OEMCrypto_DestBufferDesc buffer_descriptor;
|
OEMCrypto_DestBufferDesc buffer_descriptor;
|
||||||
buffer_descriptor.type =
|
buffer_descriptor.type =
|
||||||
params.is_secure ? destination_buffer_type_ : OEMCrypto_BufferType_Clear;
|
params.is_secure ? destination_buffer_type_ : OEMCrypto_BufferType_Clear;
|
||||||
|
|||||||
Reference in New Issue
Block a user