Commit Graph

2567 Commits

Author SHA1 Message Date
Kyle Alexander
66977c3cab Add missing unit tests to device tests.zip package
Need to add missing unit tests to the test package so that
they will be available to the tradefed-based ATP test platform.

Test: lunch sailfish-userdebug, make
      check out/.../tests.zip package for missing files.

Bug: 74028858
Change-Id: I009751ea8fe7aed48bcdd92ac9bcc050e48ce666
2018-03-07 15:57:08 -08:00
Fred Gylys-Colwell
5bd4dbb502 Use license.widevine.com cert for provisioning server
Merge from Widevine repo of http://go/wvgerrit/44505

This CL changes the certificate provisioning code to verify the
provisioning message using a cert from license.widevine.com instead of
the staging certificate.

It also adjusts the certificates in config_test_env.cpp because the
license and provisioning servers are different and may probably have
different certs.

bug: 73031756
test: unit tests with mock oemcrypto, and read oemcrypto on sailfish
Change-Id: I4b457a369a49ef07bda9e5632ab59e5f621ec966
2018-03-02 14:36:42 -08:00
Srujan Gaddam
9acc38df40 Turn off erroneous tool for L3 obfuscation
Merge of http://go/wvgerrit/44508

b/73893009

Test: Unit/integration tests

One of the tools in Caligo (fix_constants) led to segfaults in the x86
build when creating usage table headers and in OEMCrypto_Terminate.
This file removes that level of obfuscation temporarily until the
problem is fixed.
2018-03-01 13:43:48 -08:00
TreeHugger Robot
1ca7b6aeef Merge "Disable v14 unit test for Pi" 2018-03-01 01:04:16 +00:00
Fred Gylys-Colwell
f1f88f529e Disable v14 unit test for Pi
Merge from Widevine repo of http://go/wvgerrit/44502

OEMCrypto v14 is no longer required for Pi, so this CL disables the
unit test verifying that version.  The test will be re-enabled for
MR1.

test: unit tests
bug: 74003607
Change-Id: I76f9b66e1652ffb1f8a5bfc7be572e3c7a4cff83
2018-02-28 15:27:14 -08:00
Edwin Wong
328cdd0e3a Merge "Do not install move_widevine_data.sh in new devices." 2018-02-28 00:01:32 +00:00
Anton Hansson
fe7ca1ad87 vendor/widevine: Set LOCAL_SDK_VERSION where possible.
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Change-Id: I1c0366e78fb44f06bc07329866440097275f5b51
2018-02-27 18:58:17 +00:00
Edwin Wong
0fa3ae72be Do not install move_widevine_data.sh in new devices.
Merged from http://go/wvgerrit/44312

The move script is only needed for existing devices that
are running Widevine DRM and are upgrading to Pi or later
Android releases. New devices release with Pi and future
Android releases do not need to run this script.

To run this script, vendor must add the dependency to the
corresponding device makefile and build from ANDROID_ROOT.

For example:
  PRODUCT_PACKAGES += \
      android.hardware.drm@1.0-impl \
      android.hardware.drm@1.0-service \
      android.hardware.drm@1.0-service.widevine \
      move_widevine_data.sh

In addition, vendor needs to update device SELinux policy.

Test: Upgrade from O-MR1 to Pi, Netflix & Play Movies
  can play back offline content downloaded in O-MR1

Test: adb shell to verify script is in /system/bin

Test: adb shell to verify widevine data is moved to
/data/vendor/mediadrm

Test: use audit2allow to verify no avc:denied for widevine drm service

bug: 73656300
Change-Id: I7ad0dfcc0e490f4c018b6a17df6313fade89937f
2018-02-27 08:57:53 -08:00
TreeHugger Robot
b6729a0b14 Merge "Adjust nonce flood rate in mock oemcrypto" 2018-02-26 23:08:09 +00:00
TreeHugger Robot
a617065987 Merge "Adjust cdm engine test response to nonce flood" 2018-02-26 23:06:18 +00:00
Paul Duffin
00f28599b9 Add uses-library for org.apache.http.legacy
The following change descriptions were generated automatically and so
may be a little repetitive. They are provided to give the reviewer
enough information to check the comments match what has actually been
changed and check the reasoning behind the changes.

* libwvdrmengine/test/castv2/AndroidManifest.xml
    Add uses-library for org.apache.http.legacy because CastSignAPITest
    depends on org.apache.http.legacy library at build time so
    presumably needs it to be provided at runtime. Unfortunately,
    CastSignAPITest targets P and from P onwards the
    org.apache.http.legacy library is only provided when explicitly
    requested through the manifest.

* libwvdrmengine/test/java/AndroidManifest.xml
    Add uses-library for org.apache.http.legacy because MediaDrmAPITest
    depends on org.apache.http.legacy library at build time so
    presumably needs it to be provided at runtime. Unfortunately,
    MediaDrmAPITest targets P and from P onwards the
    org.apache.http.legacy library is only provided when explicitly
    requested through the manifest.

Bug: 72375096
Bug: 18027885
Test:  make checkbuild
Change-Id: I3a761a693918fd506ace26fd7c3502a2a42c031d
2018-02-23 14:55:50 +00:00
Fred Gylys-Colwell
d2c384f619 Adjust cdm engine test response to nonce flood
Merge from Widevine repo of http://go/wvgerrit/43720

This CL changes the cdm engine test's Provision method so that it
keeps OEMCrypto alive during the provisioning.  This is only needed
when testing with the oemcrypto mock and the nonce flood rate has been
throttled to 1.  In that case, if OEMCrypto is allowed to terminate
between each request, all nonce requests will be an error.

Keeping OEMCrypto alive does not modify the desired test results when
oemcrypto is not throttled.

This CL changes test code only.

bug: 73607610
test: unit tests
Change-Id: I71b27b1bb8200188a0a821afc977d7a9cc7fd968
2018-02-21 13:35:57 -08:00
Fred Gylys-Colwell
9729663671 Adjust nonce flood rate in mock oemcrypto
Merge from Widevine repo of http://go/wvgerrit/43721

This CL allows the tester to change the nonce flood rate from the
default of 20.  A tester would want this value to be larger to make
tests run more quickly.

Setting the rate to 1 makes every other nonce request a flood error.
A tester wants to do this in order to verify cdm code responds to
nonce flood correctly.  Several failing oemcrypto tests have also been
corrected.

This CL changes test code only.

bug: 73607610
test: unit tests
Change-Id: I3f52ff7ea9bcc1db7bc0e010da0b64a12d3b4dd3
2018-02-21 13:34:09 -08:00
Rahul Frias
aef1f6f48e Merge "Correct format specifier" 2018-02-17 00:55:30 +00:00
Rahul Frias
3480900b1a Correct format specifier
[ Merged from http://go/wvgerrit/43640 ]

Bug: 62266605
Test: WV unit/integration test
Change-Id: I9944805f0dd7f5b33e3a0b2eb40f2a3a6e26489e
2018-02-16 15:07:14 -08:00
Srujan Gaddam
68e22bc2cd Fix test sample for cbcs decryption
Merge of http://go/wvgerrit/43541

Test: Unit/Integration tests

b/73500155

This change uses the same clear data as the kCenc30Cbc1Key33Sample to
verify decryption, since it shares the same key as opposed to the
32Sample.
2018-02-16 14:20:53 -08:00
Fred Gylys-Colwell
a0040ec5bf Halt tests after multiple failures
Merge from Widevine repo of http://go/wvgerrit/43440

This CL changes several tests so that they abort after multiple
failures.  This prevents a network error from putting one of the usage
table tests into an infinite loop.

bug: 73397596
test: unit tests
Change-Id: Iaaec9eb2b39a6a2b2cfc90ee1c28bae0486aa851
2018-02-16 02:16:06 +00:00
Fred Gylys-Colwell
10275f508a Merge "Fix compiler warnings" 2018-02-16 02:15:09 +00:00
Fred Gylys-Colwell
ef0ec145d3 Fix compiler warnings
Merge from Widevine repo of http://go/wvgerrit/43420

Remove or mark unused variables.  Fix unsigned/signed comparisons.

bug: 73390805
test: unit tests
Change-Id: Ic523400a5decf82fae733042b260e0c39a087cd3
2018-02-15 11:18:54 -08:00
Fred Gylys-Colwell
46b7e5a53c Merge "Mark unused typedef as unused" 2018-02-15 16:50:35 +00:00
Fred Gylys-Colwell
901e673085 Mark unused typedef as unused
Merge from Widevine repo of http://go/wvgerrit/43401

This turns off a bunch of unused typedef warning messages

test: unit tests
bug: 70894426
Change-Id: I8c0f02b98a2e89c4623c942a0981f01f3fe47da6
2018-02-14 16:40:38 -08:00
Rahul Frias
fe2c777a8e Disambiguate INSUFFICIENT_CRYPTO_RESOURCES errors
[ Merge of http://go/wvgerrit/43281 ]

Bug: 73164325
Test: WV unit/integration test, playback tests using Netflix and
      Play Movies.

Change-Id: Ifc3dd8863da1616eb4a7df35ad010f53b6d5e3d2
2018-02-14 15:45:27 -08:00
Rahul Frias
5053a887dd Enforce security level checks only on encrypted content
[ Merged of http://go/wvgerrit/43260 ]

Bug: 73250635
Bug: 73251811
Bug: 70278160
Bug: 73159523

Test: WV unit/integration tests, GtsMediaTestCases, playback using
      Play Movies and Netflix.

Change-Id: I677aeab80fc90e5c8b9c71a185ca626c75013938
2018-02-13 18:57:42 -08:00
Rahul Frias
e0cc4f61b2 Correct HDCP values returned in query command
[ Merge of http://go/wvgerrit/43240 ]

HDCP related changes were made in http://go/wvgerrit/42602. This
also changed the string values returned in the HDCP query command.
This CL reverts changes to the string values as were specified in
the Widevine Modular DRM Plugin vendor extensions document. Changing
them at this point will impact applications.

Bug: 70278160

Test: WV unit/integration tests, GtsMediaTestCases, playback using
      Play Movies and Netflix.

Change-Id: I20171a8272aeeff5007cf90c9939b2ce1ce0fb13
2018-02-13 16:54:37 -08:00
Srujan Gaddam
a4e7e3fd80 Merge "Fix dead code in dynamic adapter" 2018-02-13 03:47:18 +00:00
Srujan Gaddam
c616bfcd51 Fix dead code in dynamic adapter
b/73254535

Test: unit/integration tests

Merge of http://go/wvgerrit/43100
2018-02-12 17:06:53 -08:00
Fred Gylys-Colwell
6562488d0f Fix key size when decrypting KCB with entitlement keys.
Merge from Widevine repo of http://go/wvgerrit/42942

This CL changes test code only.

Bug: 73132054
test: unit tests

Change-Id: Ic9ca1879a942b0cad8ea15a98ed263a5fd170b4c
2018-02-09 11:44:11 -08:00
Rahul Frias
928ae5639e Merge "Changes to support new MediaDrm methods" 2018-02-09 03:36:39 +00:00
Rahul Frias
8d27f791e6 Merge "Detect when unable to meet policy requirements" 2018-02-09 03:36:12 +00:00
Rahul Frias
dc25029fc4 Changes to support new MediaDrm methods
[ Merge from http://go/wvgerrit/42602 ]

Renamed HDCP related query names to better reflect their purpose.

Bug: 69674645
Test: wv unit/integration tests
Change-Id: If4da45ff676da0e812852bf34f209d99e59c059b
2018-02-08 16:29:34 -08:00
Srujan Gaddam
3bbd0584a8 Fix cipher mode assignment in adapter
b/73127061

Merge of http://go/wvgerrit/42923

Test: Unit tests/playback
2018-02-08 15:08:09 -08:00
Rahul Frias
0bc2cf66bc Merge "Add tests for Cenc 3.0 cipher and sample modes" 2018-02-08 14:58:41 +00:00
Rahul Frias
c78ce178d4 Detect when unable to meet policy requirements
[ Merged of http://go/wvgerrit/39766 ]

The security level (software/hardware, decryption/decode)
in the policy that specified how the key was to be used was
not being respected for L3. Playback would either continue or
a vendor specific error would be thrown.

If the device cannot use the key as permitted by the policy
CryptoException#ERROR_INSUFFICIENT_OUTPUT_PROTECTION will be thrown.

Bug: 31913737
Bug: 31913439

Test: WV unit/integration tests
Test: Playback using playmovies and netflix. Cast playback using
      playmovies.

Change-Id: If25735ab0f789108431115623cb236687c5ef818
2018-02-07 21:47:52 -08:00
Rahul Frias
91efb844a1 Merge "Correct request_license_test failures" 2018-02-07 17:06:57 +00:00
TreeHugger Robot
3bad5757d7 Merge "Fix backwards compatibility" 2018-02-06 23:12:12 +00:00
TreeHugger Robot
eb8d77d8f1 Merge "Correct AES bit size for generic crypto" 2018-02-06 22:50:43 +00:00
Fred Gylys-Colwell
a682329684 Fix backwards compatibility
Merge from Widevine repo of http://go/wvgerrit/42403

This CL changes the names of some unit tests so that they don't run
when testing an older version of oemcrypto.

bug: 68275290
test: ran unit tests against v8-v14 oemcrypto.
Change-Id: I773350adf4df3f3b310478400cd4d4e85789fc37
2018-02-06 21:23:42 +00:00
Fred Gylys-Colwell
8ae3759a7d Correct AES bit size for generic crypto
Merge from Widevine repo of http://go/wvgerrit/42402

This changes the AES key size back to 128 for keys that are not
entitlment keys.

bug: 72904259
test: unit tests
Change-Id: I07cc56050cafb82c65b67c56df3f18d375047eb8
2018-02-06 12:10:49 -08:00
Rahul Frias
92eaccb3c7 Add tests for Cenc 3.0 cipher and sample modes
[ Merge of http://go/wvgerrit/42444 ]

This covers cenc, cens, cbc1 and cbcs. This also covers
HLS v2 format.

b/70684636

Test: Verified using WV unit/integration tests

Change-Id: I3e85b496d29b91c514f0bb806712cdf0cee12903
2018-02-06 09:47:02 -08:00
Rahul Frias
d9d53dee3b Correct request_license_test failures
[ Merge of http://go/wvgerrit/42103 ]

* While deprecating keyboxes as identification, some code to
  restore a license was mistakenly removed in http:://go/wvgerrit/36740,
  http://ag/3442777

* Corrections to keep track of cipher mode, call SelectKeys when cipher
  mode changes and to use the backward compatible LoadKeys call in case
  OEMCrypto is v13.

Bug: 70160032

Test: Ran WV unit/integration tests. Request license test failures
      have been addressed.

Change-Id: Id03c50874085af6d9985d10c19a74a02efb7a1f5
2018-02-06 09:46:36 -08:00
TreeHugger Robot
4e5599d4ff Merge "Use real system id in GetProvisioningTokenValidMetrics" 2018-02-06 04:20:17 +00:00
Fred Gylys-Colwell
ee43f9b411 Clean symbol export on mod mock
Merge from Widevine repo of http://go/wvgerrit/42281

This cleans up some of the oemcrypto mock code.  This code is only
used for testing.

bug: 72831885
bug: 69271232
Change-Id: I8add162839d6febe56a89df84e8ae0cf0b97a2d9
2018-02-05 11:53:27 -08:00
TreeHugger Robot
51212b1505 Merge "Test Carmicahel RSA Keys" 2018-02-02 23:44:01 +00:00
Fred Gylys-Colwell
a6cd7c501b Use real system id in GetProvisioningTokenValidMetrics
Merge from Widevine repo of http://go/wvgerrit/42102

The unit test should use the real system id if it is using a real
oemcrypto.

test: ran unit tests on sailfish.
bug: 72718962

Change-Id: Ib58a47976f85b840c6f34d379b1c020e7e85d59a
2018-02-01 13:54:00 -08:00
TreeHugger Robot
eead89c86c Merge "Remove finalized concept from media.metrics" 2018-01-31 22:37:49 +00:00
Fred Gylys-Colwell
dfe6489ca2 Test Carmicahel RSA Keys
Merge from Widevine repo of http://go/wvgerrit/42064

This adds a unit test to verify that OEMCrypto can load a certificate
with an RSA private key generated using the Carmichael Totient.

bug: 67309725
test: No new failures. This code is part of unit tests only.

Change-Id: I492cf6bcff0ac2d1a838e7aa334c4b2b580ac5c7
2018-01-31 01:07:56 +00:00
Fred Gylys-Colwell
78f933d6ae Correct capitalization of OEMCrypto_LoadKeys_V13
Merge from Widevine repo of http://go/wvgerrit/42063

The dynamic adapter could not load old LoadKeys functions because the
spelling was wrong.

bug: 72646612
Change-Id: Ia6d917a17a95c48925496c5959ddb2bdff771241
2018-01-30 14:48:49 -08:00
Fred Gylys-Colwell
c45384bf00 Merge changes from topic "entitlement_license"
* changes:
  Fix some unit tests
  Add basic handling for entitlement keys in a license.
  Refactor key sessions to move them out of crypto session.
  Fix entitlement keys encryption and content key loading.
2018-01-30 20:17:32 +00:00
Fred Gylys-Colwell
8230484de2 Fix some unit tests
Merge from Widevine repo of http://go/wvgerrit/42020

This CL fixes the OEMCrypto unit tests for refresh license.

Test: ran unit tests

bug: 64851667
bug: 72497813
Change-Id: Ice1661fd832793358b725be9016d85465f6b8d14
2018-01-30 00:48:11 -08:00
Fred Gylys-Colwell
9ae7489938 Add basic handling for entitlement keys in a license.
Merge from Widevine repo of http://go/wvgerrit/41834

Key rotation is not yet supported.

The key statuses are updated from a license. The
mechanism expects content keys tro come in a license.
For entitlement licenses, the content keys come in the
init_data.

This code does not yet support the key rotation event.
(A new pssh with wrapped keys is a passed to the cdm)
The policy engine/key status mechanism needs to be
updated to handle updated from the init_data.

For now, the cdm builds a license with a key container
with the content keys and used that to call
PolicyEngine::SetLicense to setup the policy engine
and key statuses.

Bug: 64003606
Bug: 70334840

Test: In child CL
Change-Id: Ibf46a18f5321cab4ff6f1778ba30527942c8021f
2018-01-30 00:11:04 -08:00