Reject Embedded Keys Under 16 Bytes

(This is a merge of http://go/wvgerrit/60620)

The license code handles keys larger than 16 bytes correctly, but it
does not properly reject keys smaller than 16 bytes.

This patch adds unit tests not only for the new error case but also
the existing success cases which were not previously being tested. As
part of this, license_unittest was changed to use a Test Peer instead
of making the test fixture a friend class.

Bug: 111069024
Test: CE CDM unit tests
Test: Android unit tests
Change-Id: Idb2deb6fbe0aeb19b530f9818bebff480541f5c8
This commit is contained in:
John W. Bruce
2018-10-08 10:05:34 -07:00
parent 44fe62b0a6
commit 3d603eb12d
14 changed files with 158 additions and 32 deletions

View File

@@ -84,7 +84,7 @@ enum {
kInvalidQueryKey = ERROR_DRM_VENDOR_MIN + 80,
kInvalidSessionId = ERROR_DRM_VENDOR_MIN + 81,
kKeyRequestError1 = ERROR_DRM_VENDOR_MIN + 82,
kKeySizeError = ERROR_DRM_VENDOR_MIN + 84,
kKeySizeError1 = ERROR_DRM_VENDOR_MIN + 84,
kKeySetIdNotFound1 = ERROR_DRM_VENDOR_MIN + 85,
kKeySetIdNotFound2 = ERROR_DRM_VENDOR_MIN + 86,
kKeySetIdNotFound3 = ERROR_DRM_VENDOR_MIN + 87,
@@ -270,10 +270,11 @@ enum {
kLoadEntitledContentKeysError = ERROR_DRM_VENDOR_MIN + 279,
kGetProvisioningError = ERROR_DRM_VENDOR_MIN + 280,
kDeviceCannotReprovision = ERROR_DRM_VENDOR_MIN + 281,
kKeySizeError2 = ERROR_DRM_VENDOR_MIN + 282,
// This should always follow the last error code.
// The offset value should be updated each time a new error code is added.
kErrorWVDrmMaxErrorUsed = ERROR_DRM_VENDOR_MIN + 281,
kErrorWVDrmMaxErrorUsed = ERROR_DRM_VENDOR_MIN + 282,
// Used by crypto test mode
kErrorTestMode = ERROR_DRM_VENDOR_MAX,