Skip to content
Snippets Groups Projects
Commit d8dc28a5 authored by alwu's avatar alwu
Browse files

Bug 1861016 - some fixes. r=media-playback-reviewers,jolin, a=RyanVM

parent d44ebacd
No related branches found
No related tags found
No related merge requests found
......@@ -105,10 +105,10 @@ bool ClearKeyUtils::DecryptCbcs(const vector<uint8_t>& aKey,
mozilla::Span<uint8_t> aSubsample,
uint32_t aCryptByteBlock,
uint32_t aSkipByteBlock) {
assert(aKey.size() == CENC_KEY_LEN);
assert(aIV.size() == CENC_KEY_LEN);
assert(aCryptByteBlock <= 0xFF);
assert(aSkipByteBlock <= 0xFF);
if (aKey.size() != CENC_KEY_LEN || aIV.size() != CENC_KEY_LEN) {
CK_LOGE("Key and IV size should be 16!");
return false;
}
std::unique_ptr<PK11SlotInfo, MaybeDeleteHelper<PK11SlotInfo>> slot(
PK11_GetInternalKeySlot());
......@@ -133,6 +133,14 @@ bool ClearKeyUtils::DecryptCbcs(const vector<uint8_t>& aKey,
std::unique_ptr<PK11Context, MaybeDeleteHelper<PK11Context>> ctx(
PK11_CreateContextBySymKey(CKM_AES_CBC, CKA_DECRYPT, key.get(), &ivItem));
if (!ctx) {
CK_LOGE("Failed to get PK11Context!");
return false;
}
assert(aCryptByteBlock <= 0xFF);
assert(aSkipByteBlock <= 0xFF);
uint8_t* encryptedSubsample = &aSubsample[0];
const uint32_t BLOCK_SIZE = 16;
const uint32_t skipBytes = aSkipByteBlock * BLOCK_SIZE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment