Add cipher mode and pattern encryption support
[ Merge of http://go/wvgerrit/16364 ] http://go/wvgerrit/16249 changed the name of the encryption pattern structure from OEMCrypto_PatternDesc to OEMCrypto_CENCEncryptPatternDesc to remove ambiguity. These are matching changes to CDM core. [ Merge of http://go/wvgerrit/16340 ] This CL passes the cipher mode in the license to OEMCrypto when keys are loaded and specifies the pattern encryption scheme to OEMCrypto_DecryptCENC. b/20630275 Change-Id: I86b82bbdc891fd0100beb9fad385ca2082176271
This commit is contained in:
@@ -412,6 +412,9 @@ CdmResponseType CryptoSession::LoadKeys(
|
||||
ko->key_control_iv = NULL;
|
||||
ko->key_control = NULL;
|
||||
}
|
||||
ko->cipher_mode = ki->cipher_mode() == kCipherModeCbc
|
||||
? OEMCrypto_CipherMode_CBC
|
||||
: OEMCrypto_CipherMode_CTR;
|
||||
}
|
||||
uint8_t* pst = NULL;
|
||||
if (!provider_session_token.empty()) {
|
||||
@@ -672,6 +675,10 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
|
||||
&buffer_descriptor, params.subsample_flags);
|
||||
}
|
||||
if (params.is_encrypted || sts == OEMCrypto_ERROR_NOT_IMPLEMENTED) {
|
||||
OEMCrypto_CENCEncryptPatternDesc pattern_descriptor;
|
||||
pattern_descriptor.encrypt = params.pattern_descriptor.encrypt_blocks;
|
||||
pattern_descriptor.skip = params.pattern_descriptor.skip_blocks;
|
||||
pattern_descriptor.offset = params.pattern_descriptor.offset_blocks;
|
||||
AutoLock auto_lock(crypto_lock_);
|
||||
// Check if key needs to be selected
|
||||
if (params.is_encrypted) {
|
||||
@@ -683,11 +690,10 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO(rfrias): add encrypt pattern parameter.
|
||||
sts = OEMCrypto_DecryptCENC(
|
||||
oec_session_id_, params.encrypt_buffer, params.encrypt_length,
|
||||
params.is_encrypted, &(*params.iv).front(), params.block_offset,
|
||||
&buffer_descriptor, NULL, params.subsample_flags);
|
||||
&buffer_descriptor, &pattern_descriptor, params.subsample_flags);
|
||||
}
|
||||
|
||||
switch (sts) {
|
||||
|
||||
Reference in New Issue
Block a user