Snap for 8211163 from 06587fd100 to tm-release
Change-Id: Ie5b014021092284c793cbe45209f5e1b7b02a1c9
This commit is contained in:
@@ -144,6 +144,7 @@ SharedBufferBase::~SharedBufferBase() {
|
||||
const char* detailedError = "";
|
||||
*_aidl_return = 0; // bytes decrypted
|
||||
|
||||
native_handle_t* handle = nullptr;
|
||||
uint8_t* srcPtr = nullptr;
|
||||
void* destPtr = nullptr;
|
||||
// Convert parameters to the form the CDM wishes to consume them in.
|
||||
@@ -159,6 +160,7 @@ SharedBufferBase::~SharedBufferBase() {
|
||||
}
|
||||
|
||||
const auto NON_SECURE = DestinationBuffer::Tag::nonsecureMemory;
|
||||
const auto SECURE = DestinationBuffer::Tag::secureMemory;
|
||||
if (in_args.destination.getTag() == NON_SECURE) {
|
||||
const SharedBuffer& dest = in_args.destination.get<NON_SECURE>();
|
||||
if (mSharedBufferMap.find(dest.bufferId) == mSharedBufferMap.end()) {
|
||||
@@ -218,10 +220,8 @@ SharedBufferBase::~SharedBufferBase() {
|
||||
}
|
||||
destPtr = static_cast<void*>(
|
||||
dest->mBase + in_args.destination.get<NON_SECURE>().offset);
|
||||
} else if (in_args.destination.getTag() ==
|
||||
DestinationBuffer::Tag::secureMemory) {
|
||||
native_handle_t* handle = android::makeFromAidl(
|
||||
in_args.destination.get<DestinationBuffer::Tag::secureMemory>());
|
||||
} else if (in_args.destination.getTag() == SECURE) {
|
||||
handle = android::makeFromAidl(in_args.destination.get<SECURE>());
|
||||
destPtr = static_cast<void*>(handle);
|
||||
}
|
||||
} // lock_guard scope
|
||||
@@ -276,6 +276,7 @@ SharedBufferBase::~SharedBufferBase() {
|
||||
// Decrypt
|
||||
std::string errorDetailMsg;
|
||||
Status res = attemptDecrypt(params, hasProtectedData, &errorDetailMsg);
|
||||
native_handle_delete(handle);
|
||||
if (res != Status::OK) {
|
||||
detailedError = errorDetailMsg.data();
|
||||
return toNdkScopedAStatus(res, detailedError);
|
||||
|
||||
@@ -25,7 +25,7 @@ class WVGenericCryptoInterface {
|
||||
const uint8_t* key_id,
|
||||
size_t key_id_length) {
|
||||
return OEMCrypto_SelectKey(session, key_id, key_id_length,
|
||||
OEMCrypto_CipherMode_CBC);
|
||||
OEMCrypto_CipherMode_CBCS);
|
||||
}
|
||||
|
||||
virtual OEMCryptoResult encrypt(OEMCrypto_SESSION session,
|
||||
|
||||
@@ -263,6 +263,11 @@ SecurityLevel WVDrmPlugin::mapSecurityLevel(const std::string& level) {
|
||||
::ndk::ScopedAStatus WVDrmPlugin::openSession(SecurityLevel in_securityLevel,
|
||||
vector<uint8_t>* _aidl_return) {
|
||||
vector<uint8_t> sessionId;
|
||||
if (SecurityLevel::DEFAULT == in_securityLevel) {
|
||||
auto err = openSessionCommon(sessionId);
|
||||
*_aidl_return = sessionId;
|
||||
return toNdkScopedAStatus(err);
|
||||
}
|
||||
|
||||
if (SecurityLevel::UNKNOWN == in_securityLevel) {
|
||||
*_aidl_return = sessionId;
|
||||
@@ -279,8 +284,7 @@ SecurityLevel WVDrmPlugin::mapSecurityLevel(const std::string& level) {
|
||||
}
|
||||
|
||||
if (wvcdm::QUERY_VALUE_SECURITY_LEVEL_L3 == native_security_level &&
|
||||
in_securityLevel >= SecurityLevel::SW_SECURE_DECODE &&
|
||||
in_securityLevel != SecurityLevel::DEFAULT) {
|
||||
in_securityLevel >= SecurityLevel::SW_SECURE_DECODE) {
|
||||
*_aidl_return = sessionId;
|
||||
return toNdkScopedAStatus(Status::ERROR_DRM_CANNOT_HANDLE);
|
||||
}
|
||||
@@ -292,25 +296,13 @@ SecurityLevel WVDrmPlugin::mapSecurityLevel(const std::string& level) {
|
||||
|
||||
setPropertyString("securityLevel", std::string(wvcdm_security_level));
|
||||
|
||||
SecurityLevel securityLevel = in_securityLevel;
|
||||
if (SecurityLevel::DEFAULT == in_securityLevel) {
|
||||
std::string level;
|
||||
Status status = queryProperty(wvcdm::kLevelDefault,
|
||||
wvcdm::QUERY_KEY_SECURITY_LEVEL, level);
|
||||
if (status == Status::OK) {
|
||||
securityLevel = mapSecurityLevel(level);
|
||||
} else {
|
||||
ALOGE("openSession: failed to query security level, status=%d", status);
|
||||
}
|
||||
}
|
||||
|
||||
status = openSessionCommon(sessionId);
|
||||
if (Status::OK == status) {
|
||||
SecurityLevel currentSecurityLevel = SecurityLevel::UNKNOWN;
|
||||
const auto ret = getSecurityLevel(sessionId, ¤tSecurityLevel);
|
||||
if (!ret.isOk() || securityLevel != currentSecurityLevel) {
|
||||
if (!ret.isOk() || in_securityLevel != currentSecurityLevel) {
|
||||
ALOGE("Failed to open session with the requested security level=%d",
|
||||
securityLevel);
|
||||
in_securityLevel);
|
||||
closeSession(sessionId);
|
||||
sessionId.clear();
|
||||
status = Status::ERROR_DRM_INVALID_STATE;
|
||||
|
||||
Reference in New Issue
Block a user