Improve Widevine MediaDrm plugin tests

1. add missing checks to set the overall result when some tests fail
(to verify b/10528466)

2. Fix test result on L1 devices where we can't hash the decrypt result
due to inaccessible memory buffers.

3. Configure the codec with a surface to avoid codec errors on L1 devices

b/10528466

Merge of https://widevine-internal-review.googlesource.com/#/c/7510/
from the widevine CDM repo

Change-Id: I5c7ef5ce802cc4ff63f62524ef2120fb671920f4
This commit is contained in:
Jeff Tinker
2013-08-28 17:03:36 -07:00
parent b4dae0af49
commit d4fa39113d
3 changed files with 144 additions and 83 deletions

View File

@@ -206,17 +206,22 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE],
// can then use the hash to verify that decryption was successful.
if (mTestMode) {
SHA256_CTX ctx;
uint8_t digest[SHA256_DIGEST_LENGTH];
SHA256_Init(&ctx);
SHA256_Update(&ctx, dstPtr, offset);
SHA256_Final(digest, &ctx);
String8 buf;
for (size_t i = 0; i < sizeof(digest); i++) {
buf.appendFormat("%02x", digest[i]);
if (secure) {
// can't access data in secure mode
errorDetailMsg->setTo("secure");
} else {
SHA256_CTX ctx;
uint8_t digest[SHA256_DIGEST_LENGTH];
SHA256_Init(&ctx);
SHA256_Update(&ctx, dstPtr, offset);
SHA256_Final(digest, &ctx);
String8 buf;
for (size_t i = 0; i < sizeof(digest); i++) {
buf.appendFormat("%02x", digest[i]);
}
errorDetailMsg->setTo(buf.string());
}
errorDetailMsg->setTo(buf.string());
return kErrorTestMode;
}