Files
android/libwvdrmengine/mediacrypto/include/WVCryptoPlugin.h
John "Juce" Bruce e0f4942b8f Fix cens Mode in Android CDM
(This is a merge of go/wvgerrit/20500)

This patch removes the logic that calculates the "pattern offset" from
the Android glue layer. There is no such thing as a pattern offset, and
setting this value to anything other than zero may break cens mode on
some devices.

To reduce the risk of setting this value to anything other than zero,
the offset_blocks parameter has been removed from the pattern descriptor
in the CDM Core. It will have to remain part of OEMCrypto v11,
unfortunately, but the code to set it to zero is now centralized in
CryptoSession.

Bug: 28726863
Change-Id: I9c5bfe470fe251c7a57901dc2e998f4dab7fe7d7
2016-08-26 16:02:21 -07:00

57 lines
1.7 KiB
C++

//
// Copyright 2013 Google Inc. All Rights Reserved.
//
#ifndef WV_CRYPTO_PLUGIN_H_
#define WV_CRYPTO_PLUGIN_H_
#include <stdint.h>
#include "utils/StrongPointer.h"
#include "utils/Vector.h"
#include "media/hardware/CryptoAPI.h"
#include "media/stagefright/foundation/ABase.h"
#include "media/stagefright/foundation/AString.h"
#include "wv_content_decryption_module.h"
namespace wvdrm {
class WVCryptoPlugin : public android::CryptoPlugin {
public:
WVCryptoPlugin(const void* data, size_t size,
const android::sp<wvcdm::WvContentDecryptionModule>& cdm);
virtual ~WVCryptoPlugin() {}
virtual bool requiresSecureDecoderComponent(const char* mime) const;
virtual void notifyResolution(uint32_t width, uint32_t height);
virtual android::status_t setMediaDrmSession(
const android::Vector<uint8_t>& sessionId);
virtual ssize_t decrypt(bool secure, const uint8_t key[16],
const uint8_t iv[16], Mode mode, const Pattern &pattern,
const void* srcPtr,
const SubSample* subSamples, size_t numSubSamples,
void* dstPtr, android::AString* errorDetailMsg);
private:
DISALLOW_EVIL_CONSTRUCTORS(WVCryptoPlugin);
android::sp<wvcdm::WvContentDecryptionModule> const mCDM;
bool mTestMode;
wvcdm::CdmSessionId mSessionId;
wvcdm::CdmSessionId configureTestMode(const void* data, size_t size);
static wvcdm::CdmResponseType countEncryptedBlocksInPatternedRange(
size_t range, size_t startingOffset, const Pattern& pattern,
uint64_t* result);
static void incrementIV(uint64_t increaseBy, std::vector<uint8_t>* ivPtr);
};
} // namespace wvdrm
#endif // WV_CRYPTO_PLUGIN_H_