// // Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary // source code may only be used and distributed under the Widevine Master // License Agreement. // #ifndef WV_CRYPTO_PLUGIN_H_ #define WV_CRYPTO_PLUGIN_H_ #include #include "HidlTypes.h" #include "wv_content_decryption_module.h" #include "WVTypes.h" namespace wvdrm { namespace hardware { namespace drm { namespace V1_2 { namespace widevine { using ::android::hidl::memory::V1_0::IMemory; struct WVCryptoPlugin : public ICryptoPlugin { WVCryptoPlugin(const void* data, size_t size, const sp& cdm); virtual ~WVCryptoPlugin() {} Return requiresSecureDecoderComponent(const hidl_string& mime) override; Return notifyResolution(uint32_t width, uint32_t height) override; Return setMediaDrmSession(const hidl_vec& sessionId) override; Return setSharedBufferBase(const hidl_memory& base, uint32_t bufferId) override; Return decrypt( bool secure, const hidl_array& keyId, const hidl_array& iv, Mode mode, const Pattern& pattern, const hidl_vec& subSamples, const SharedBuffer& source, uint64_t offset, const DestinationBuffer& destination, decrypt_cb _hidl_cb) override; Return decrypt_1_2( bool secure, const hidl_array& keyId, const hidl_array& iv, Mode mode, const Pattern& pattern, const hidl_vec& subSamples, const SharedBuffer& source, uint64_t offset, const DestinationBuffer& destination, decrypt_1_2_cb _hidl_cb) override; private: WVDRM_DISALLOW_COPY_AND_ASSIGN_AND_NEW(WVCryptoPlugin); wvcdm::CdmSessionId mSessionId; std::map > mSharedBufferMap; sp const mCDM; Status_V1_2 attemptDecrypt( const wvcdm::CdmDecryptionParameters& params, bool haveEncryptedSubsamples, std::string* errorDetailMsg); static void incrementIV(uint64_t increaseBy, std::vector* ivPtr); }; } // namespace widevine } // namespace V1_2 } // namespace drm } // namespace hardware } // namespace wvdrm #endif // WV_CRYPTO_PLUGIN_H_