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

@@ -570,9 +570,11 @@ extern "C" OEMCryptoResult OEMCrypto_DecryptCENC(
return OEMCrypto_ERROR_INVALID_SESSION;
}
return session_ctx->DecryptCENC(
OEMCryptoResult result = session_ctx->DecryptCENC(
iv, block_offset, pattern, data_addr, data_length, is_encrypted,
crypto_engine->destination(), out_buffer->type);
if (result != OEMCrypto_SUCCESS) return result;
return crypto_engine->PushDestination(out_buffer, subsample_flags);
}
extern "C" OEMCryptoResult OEMCrypto_CopyBuffer(
@@ -602,7 +604,7 @@ extern "C" OEMCryptoResult OEMCrypto_CopyBuffer(
if (crypto_engine->destination() != NULL) {
memcpy(crypto_engine->destination(), data_addr, data_length);
}
return OEMCrypto_SUCCESS;
return crypto_engine->PushDestination(out_buffer, subsample_flags);
}
extern "C" OEMCryptoResult OEMCrypto_WrapKeybox(const uint8_t* keybox,