summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:18:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:18:54 +0000
commita5f28e22cc28ca53d092f6545bc924ee43a8bbe4 (patch)
tree7e02d01734d97de08bdeed66d2d5185f8e4f0a61 /media
parentReleasing progress-linux version 115.8.0esr-1~deb12u1progress7u1. (diff)
downloadfirefox-esr-a5f28e22cc28ca53d092f6545bc924ee43a8bbe4.tar.xz
firefox-esr-a5f28e22cc28ca53d092f6545bc924ee43a8bbe4.zip
Merging upstream version 115.9.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'media')
-rw-r--r--media/gmp-clearkey/0.1/ClearKeyUtils.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/media/gmp-clearkey/0.1/ClearKeyUtils.cpp b/media/gmp-clearkey/0.1/ClearKeyUtils.cpp
index 1b1a7b4200..3f9588bdf9 100644
--- a/media/gmp-clearkey/0.1/ClearKeyUtils.cpp
+++ b/media/gmp-clearkey/0.1/ClearKeyUtils.cpp
@@ -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;