Modifiable OEMCrypto

Merge from Widevine repo of http://go/wvgerrit/24729

This CL adds a new variant of the OEMCrypto mock code that adjusts its
behaviour based on a configuration file.  This is intended for
testing.

For example, a tester can set current_hdcp to 2 in the options.txt
file, push it to the device, and verify that a license is granted for
HDCP 2.0.  Then the tester can edit the value of current_hdcp to 1 and
push the file to the device.  Playback should stop because the license
is no longer valid.

This variant uses a real level 1 liboemcrypto.so to push data to a
secure buffer.  That means we can test playback for a license that
requires secure buffers on an Android device with real secure buffers.

b/35141278
b/37353534

Change-Id: Id12f2800c6395d9da7cffebd6797aac17414b38d
This commit is contained in:
Fred Gylys-Colwell
2017-04-14 13:49:41 -07:00
parent ab0d00b92a
commit 5c768c896e
4 changed files with 430 additions and 2 deletions

View File

@@ -130,6 +130,17 @@ class CryptoEngine {
// The current destination.
uint8_t* destination() { return destination_; }
// Subclasses can adjust the destination -- for use in testing.
virtual void adjust_destination(OEMCrypto_DestBufferDesc* out_description,
size_t data_length, uint8_t subsample_flags) {
}
// Push destination buffer to output -- used by subclasses for testing.
virtual OEMCryptoResult PushDestination(
OEMCrypto_DestBufferDesc* out_description, uint8_t subsample_flags) {
return OEMCrypto_SUCCESS;
}
protected:
explicit CryptoEngine(wvcdm::FileSystem* file_system);
uint8_t* destination_;