Add missing 'offset' parameter to decrypt.
Required for functionality
Test: gtests passing
Change-Id: I9e368c146092512dfa42230be0e05848044d2df5
related-to-bug: 32815560
diff --git a/drm/crypto/1.0/default/CryptoPlugin.cpp b/drm/crypto/1.0/default/CryptoPlugin.cpp
index 6056f81..81365c8 100644
--- a/drm/crypto/1.0/default/CryptoPlugin.cpp
+++ b/drm/crypto/1.0/default/CryptoPlugin.cpp
@@ -54,7 +54,8 @@
const hidl_array<uint8_t, 16>& keyId,
const hidl_array<uint8_t, 16>& iv, Mode mode,
const Pattern& pattern, const hidl_vec<SubSample>& subSamples,
- const hidl_memory& source, const DestinationBuffer& destination,
+ const hidl_memory& source, uint32_t offset,
+ const DestinationBuffer& destination,
decrypt_cb _hidl_cb) {
android::CryptoPlugin::Mode legacyMode;
@@ -88,9 +89,14 @@
AString detailMessage;
- void *destPtr = NULL;
sp<IMemory> sharedSourceMemory = mapMemory(source);
+
+ void *srcPtr = static_cast<void *>(sharedSourceMemory->getPointer());
+ uint8_t *offsetSrc = static_cast<uint8_t *>(srcPtr) + offset;
+ srcPtr = static_cast<void *>(offsetSrc);
+
sp<IMemory> sharedDestinationMemory;
+ void *destPtr = NULL;
if (destination.type == BufferType::SHARED_MEMORY) {
sharedDestinationMemory = mapMemory(destination.nonsecureMemory);
@@ -102,8 +108,8 @@
destPtr = static_cast<void *>(handle);
}
ssize_t result = mLegacyPlugin->decrypt(secure, keyId.data(), iv.data(),
- legacyMode, legacyPattern, sharedSourceMemory->getPointer(),
- legacySubSamples, subSamples.size(), destPtr, &detailMessage);
+ legacyMode, legacyPattern, srcPtr, legacySubSamples,
+ subSamples.size(), destPtr, &detailMessage);
if (destination.type == BufferType::SHARED_MEMORY) {
sharedDestinationMemory->commit();