Adds the initial pieces of a sample DRM Engine that accepts keys in the clear through the decrypt call instead of using the DrmClientPlugin and its key ladder. This is to help unblock teams writing code that consumes DRM Engines while Widevine continues working their real DRM engine. This is based on the in-progress Widevine DRM Engine. This change contains the DRM Engine glue pieces (.so entry point, DrmPluginFactory, etc.) and a CryptoPlugin implementation. However, said CryptoPlugin will not work until an implementation of OEMCrypto is provided in a future checkin and the CryptoPlugin is hooked up to it. For ease of loading, this library also implements the old CryptoFactory interface and entry point. If asked to create a CryptoPlugin with no data, it will defer to the old Widevine Crypto Plugin. Change-Id: I0bfbec7e32439a50a2956488dd970284f0075e61
42 lines
939 B
C++
42 lines
939 B
C++
/*
|
|
* Copyright 2012 Google Inc. All Rights Reserved.
|
|
*/
|
|
|
|
#ifndef WV_CRYPTO_PLUGIN_H_
|
|
#define WV_CRYPTO_PLUGIN_H_
|
|
|
|
#include "media/stagefright/foundation/ABase.h"
|
|
#include "media/hardware/CryptoAPI.h"
|
|
#include "OEMCryptoDASH.h"
|
|
|
|
namespace wvclearkey {
|
|
|
|
class WVCryptoPlugin : public android::CryptoPlugin {
|
|
public:
|
|
WVCryptoPlugin();
|
|
virtual ~WVCryptoPlugin();
|
|
|
|
virtual bool requiresSecureDecoderComponent(const char *mime) const {
|
|
return false;
|
|
}
|
|
|
|
virtual ssize_t decrypt(
|
|
bool secure,
|
|
const uint8_t key[16],
|
|
const uint8_t iv[16],
|
|
Mode mode,
|
|
const void *srcPtr,
|
|
const SubSample *subSamples, size_t numSubSamples,
|
|
void *dstPtr,
|
|
android::AString *errorDetailMsg);
|
|
|
|
private:
|
|
DISALLOW_EVIL_CONSTRUCTORS(WVCryptoPlugin);
|
|
|
|
OEMCrypto_SESSION mSession;
|
|
};
|
|
|
|
} // namespace wvclearkey
|
|
|
|
#endif // WV_CRYPTO_PLUGIN_H_
|