Widevine CENC drm engine update
bug: 8601053
This import syncs to the widevine git repository change
commit 6a99ad1b59ad39495f62954b3065ddc22b78da49
It includes the following changes from the widevine git
repository, which complete the jb-mr2 features
Fix Unit Test Makefile
Adds support for device certificate provisioning.
Support application parameters
Certificate based licensing
Proto for client files
Implement Property Query API
Add Device Query For Unique ID
Implement Generic Crypto in DrmEngine
Do not validate Key IDs on clear playback
Allow OEMCrypto_DecryptCTR with clear content and no key
Add a case to the MediaDrm API test to repro b/8594163
Implement requiresSecureDecoderComponent
Implement Eventing API
Add end-to-end decryption test with vectors
Refactoring of properties class
Refactor OEMCrypto unittest.
Fix for b/8567853: License renewal doesn't renew license.
Add KEY_ERROR callback to WvContentDecryptionModule() ctor.
Merged certificate_provisioning.proto and
client_identification.proto to license_protocol.proto.
Fix nonce check failure after a malformed key in OEC Mock.
asynchronize decryption
Allow querying of control information
make debugging AddKey & Decrypt statuses easier
Revert "Revert "Send KEY_ERROR event to app on license
expiration or failure""
Revert "Send KEY_ERROR event to app on license expiration
or failure"
Send KEY_ERROR event to app on license expiration or failure
remove extra session id copy
use KeyError constants directly
replace variable-length arrays with std::vector and fixed-sized array
pass session ids as const references
refactor key extraction and update keys on renewal
Updates to enable renewals and signaling license expiration.
fix error constant in OEMCrypto_DecryptCTR
Change-Id: I5f7236c7bdff1d5ece6115fd2893f8a1e1e07c50
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "WVCryptoPlugin.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <openssl/sha.h>
|
||||
@@ -26,19 +27,37 @@ using namespace wvcdm;
|
||||
WVCryptoPlugin::WVCryptoPlugin(const void* data, size_t size,
|
||||
WvContentDecryptionModule* cdm)
|
||||
: mCDM(cdm),
|
||||
mSessionId(static_cast<const char*>(data), size),
|
||||
mTestMode(false) {
|
||||
size_t index = mSessionId.find("test_mode");
|
||||
mTestMode(false),
|
||||
mSessionId(configureTestMode(data, size)) {}
|
||||
|
||||
wvcdm::CdmSessionId WVCryptoPlugin::configureTestMode(const void* data, size_t size) {
|
||||
wvcdm::CdmSessionId sessionId(static_cast<const char *>(data), size);
|
||||
size_t index = sessionId.find("test_mode");
|
||||
if (index != string::npos) {
|
||||
mSessionId = mSessionId.substr(0, index);
|
||||
mTestMode = true;
|
||||
sessionId = sessionId.substr(0, index);
|
||||
mTestMode = true;
|
||||
}
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
bool WVCryptoPlugin::requiresSecureDecoderComponent(const char *mime) const {
|
||||
// TODO: Determine if we are using L1 or L3 and return an appropriate value.
|
||||
// For Demo 2, we are always L3.
|
||||
return false;
|
||||
|
||||
bool WVCryptoPlugin::requiresSecureDecoderComponent(const char* mime) const {
|
||||
if (!strncasecmp(mime, "video/", 6)) {
|
||||
// Type is video, so query CDM to see if we require a secure decoder.
|
||||
CdmQueryMap status;
|
||||
|
||||
CdmResponseType res = mCDM->QueryStatus(&status);
|
||||
|
||||
if (res != wvcdm::NO_ERROR) {
|
||||
ALOGE("Error querying CDM status: %u", res);
|
||||
return false;
|
||||
}
|
||||
|
||||
return status[QUERY_KEY_SECURITY_LEVEL] == QUERY_VALUE_SECURITY_LEVEL_L1;
|
||||
} else {
|
||||
// Type is not video, so never require a secure decoder.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns negative values for error code and
|
||||
@@ -49,14 +68,24 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE],
|
||||
const uint8_t iv[KEY_IV_SIZE], Mode mode,
|
||||
const void* srcPtr, const SubSample* subSamples,
|
||||
size_t numSubSamples, void* dstPtr,
|
||||
AString *errorDetailMsg) {
|
||||
AString* errorDetailMsg) {
|
||||
if (mode != kMode_Unencrypted && mode != kMode_AES_CTR) {
|
||||
return BAD_TYPE;
|
||||
}
|
||||
|
||||
// If the caller requested secure decrypt, verify that we can comply.
|
||||
if (secure) {
|
||||
// TODO: Can't do secure in the Demo 2 milestone
|
||||
return -EPERM;
|
||||
CdmQueryMap status;
|
||||
|
||||
CdmResponseType res = mCDM->QueryStatus(&status);
|
||||
|
||||
if (res != wvcdm::NO_ERROR) {
|
||||
ALOGE("Error querying CDM status: %u", res);
|
||||
return PERMISSION_DENIED;
|
||||
} else if (status[QUERY_KEY_SECURITY_LEVEL] !=
|
||||
QUERY_VALUE_SECURITY_LEVEL_L1) {
|
||||
return PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert parameters to the form the CDM wishes to consume them in.
|
||||
|
||||
Reference in New Issue
Block a user