Commit Graph

122 Commits

Author SHA1 Message Date
Dan Willemsen
761d1723ff Replace libcrypto_static with libcrypto
libcrypto_static has restricted visibility, which is now being
implemented in Make, so we either need to allow it for all vendor
modules, or use the shared library instead.

Bug: 158599308
Test: treehugger
Test: mmma vendor/widevine/libwvdrmengine
Change-Id: I88ddce7ad221c66a20f4e05409ae77421e4196ad
2020-06-10 00:10:06 +00:00
Marco Nelissen
13a2504840 Link with actual headers instead of symlinks
Bug: 143245419
Test: build
Change-Id: I5981593697229c1f3314a4a8a4d0c447d7cbe808
2020-01-07 15:26:14 -08:00
Marco Nelissen
8af30972b2 Link with actual headers instead of symlinks
Bug: 143245419
Test: build
Change-Id: Iff096c2d3568f2db4260a1d2a86d2746ea4824ed
2020-01-07 13:21:05 -08:00
Robert Shih
8fce3e316b wv hidl: upgrade Drm/Crypto factories to v1.3
Bug: 139134043
Test: MediaDrmTest
Change-Id: I94d1cc8a323c144805d74d5568944dd48ae80e60
2019-12-16 01:19:49 -08:00
Rahul Frias
1014e0d189 Correct unit/integration tests being aborted
[ Merge of http://go/wvgerrit/90244 ]

Tests now link with the dynamic rather than static version of libcrypto.

Bug: 145007632
Test: Unit/integration test
Change-Id: I62e34cac8fdbb8fcf7da5dc8bea142bf2aa76a2f
2019-11-22 11:40:03 -08:00
Fred Gylys-Colwell
ea539673a4 FDPT: Full Decrypt Path Testing Application
Cherry pick of http://go/ag/9326830

This is a merge of the full decrypt path testing CLs from the Widevine
repo: http://go/wvgerrit/q/topic:FDPT-subsamples

This is the Full Decrypt Path Testing application that can be used by
device makers to verify that OEMCrypto is correctly decrypting content
to secure buffers.

Testing: Ran App.
Bug: 113594822

Change-Id: Icbb1e2f2e762bac3cc1b7b20749922c14ea24449
2019-10-28 14:57:22 -07:00
Colin Cross
36e943c1ae Use libcrypto_static instead of libcrypto
Replace libcrypto with libcrypto_static, which can be protected through
visibility to ensure only modules that don't affect FIPS certification
can use it.

Bug: 141248879
Test: m checkbuild
Change-Id: I53757b813fe2984261a3bde963cac1886523dfdf
2019-09-19 00:40:10 +00:00
John W. Bruce
edccc13510 Disallow Blank App Package Name on Q and Later
(This is a merge of http://go/wvgerrit/78105)

The Widevine Android CDM should not allow itself to be instantiated
without an app package name, as this breaks SPOID protection.
Unfortunately, pathways exist prior to Android Q that allow this to
happen, and we cannot break these devices by changing the behavior now.
As such, we will only refuse to allow instantiation without an app
package name on devices first launched with Q and later.

This change also migrates the WVDrmFactory and its tests away from
explicitly naming friend classes for individual test, in favor of the
now-recommended "test peer" pattern.

Bug: 65680731
Test: libwvdrmengine_hidl_test
Test: CTS NativeMediaDrmClearkeyTest
Change-Id: Icccd1d8b9972ef6ad7e5b0dbf2d37ec987656385
2019-05-08 01:08:11 +00:00
Rahul Frias
088c5afa02 Move WV unit/integration tests to /data/nativetest
[ Merge of http://go/wvgerrit/73044 ]

The tests currently get copied to /data/bin. Changes in location
of system libraries causes test failures when tests are unable to
find dependent dynamic libraries.

Bug: 123879070
Test: WV unit/integration tests
Change-Id: I86edbe33b4753238fcf8b84243ac6e6c058ea145
2019-02-21 09:53:06 -08:00
Jeff Tinker
bf6245967e Add securityLevel to MediaDrm isCryptoSchemeSupported API
bug:110701831
test: cts media test cases, widevine integration tests

Change-Id: I4a8973537b4b90740cdaf79a36e73943bcf074fb
2019-01-22 23:27:48 +00:00
John W. Bruce
1cd093795e Resolve Merge Disparity
The same merge conflict happened in the Widevine and Android repos, but
it was resolved differently. This patch brings the resolutions back in
sync.

Bug: 111504510
Bug: 111505796
Bug: 115358798
Test: Android Build
Change-Id: I5161ae3e1aad41ee034dc5fec59dad1c7699d65c
2019-01-15 16:46:14 -08:00
Rahul Frias
ef00d6ffa5 Update property retrival method
[ Merge of http://go/wvgerrit/70203 ]

The earlier property_get() method had a limitation on property length.
Properties of some new devices exceed that length. An error message
is returned rather than a truncated string. Replace its use with
android::base::GetProperty() which does not have a length limitation.

Bug: 115358798
Test: WV unit/integration tests
Change-Id: I46ce9a7e77bcd031225d0082f83c57d484fe5405
2019-01-15 00:24:52 -08:00
Jeff Tinker
a00b50095c Add additional error conditions to MediaDrm
Merge of http://go/wvgerrit/70163

New codes are being added to handle resource
contention, lost session state, frame size too
large and insufficient security level for
decryption. Also cleans up inconsistent use of
tamper detected error where invalid state error
should have been used.

bug:111504510
bug:111505796
test: cts and gts media tests, widevine integration tests

Change-Id: I96ee441717d32ccbcabaa85c8f6a0013055ce16e
2019-01-10 15:17:48 -08:00
Edwin Wong
d81904ec78 Move MediaDrmApiTest to its own folder.
Merged from http://go/wvgerrit/67523

This is in preparation for adding the Full Decryption Path Test
android application so it will reside under
vendor/widevine/libwvdrmengine/test/java.

Test: build and run MediaDrmAPITest.apk from the new directory

bug: 113594822
Change-Id: If4adb51ba7bb24a5e28e04956909c2d5a1af3c53
2018-12-04 15:21:09 -08:00
Edwin Wong
20adb9438d Update Widevine HIDL service to 1.2.
Widevine HIDL service added new v1.2 media APIs,
update the service to support new APIs.

Merged from http://go/wvgerrit/67083

Test: Netflix and Play Movies & TV (streaming and offline playback)

Test: GTS WidevineH264PlaybackTests test
  e.g. ANDROID_BUILD_TOP= ./android-gts/toolsefed run gts -m GtsMediaTestCases
  --test com.google.android.media.gts.WidevineH264PlaybackTests#testL1With480P30

Test: Widevine unit tests

bug: 117570686
Change-Id: I3a2091e7c62a0d2697ef97f983fd898aedfb4519
2018-11-30 16:02:07 -08:00
Fred Gylys-Colwell
1a25cbdad6 Update Copyright
Merge from Widevine repo of http://go/wvgerrit/47860

This CL updates the copyright notice to indicate that files
shared with partners are shared under the Widevine Master
License Agreement.

bug: 77926774
test: comment change only
Change-Id: I0423668111578b80fb39a932d763df2827e2dfc3
2018-04-16 16:38:05 -07:00
Edwin Wong
bc66aebfe2 Upgrade widevine HIDL service to v1.1.
Merged from http://go/wvgerrit/44803.

Upgrade HIDL service to v1.1 and implements new 1.1 media API.

Test: Netflix and Play Movies & TV
  streaming and offline playback

Test: GTS WidevineH264PlaybackTests test
  e.g. ANDROID_BUILD_TOP= ./android-gts/tools/gts-tradefed run gts -m GtsMediaTestCases
  --test com.google.android.media.gts.WidevineH264PlaybackTests#testL1With480P30

Test: GTS MediaDrmTest tests
  e.g. ANDROID_BUILD_TOP= ./android-gts/tools/gts-tradefed run gts -m GtsMediaTestCases
  --test com.google.android.media.gts.MediaDrmTest#testWidevineApi28

Test: unit tests

bug: 69674645
Change-Id: I91e7e43f9178b61a531e846beffb5f5c17050a3c
2018-03-30 14:57:16 -07: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
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
Rahul Frias
1884cf738e Merges to android Pi release (part 8)
These are a set of CLs merged from the wv cdm repo to the android
	   repo.

* Android build fixes

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/36322 ]

* Address android compilation errors and warnings

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/36300 ]

* Gyp cleanup and OpenSSL v10.1 support.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/36001 ]

  OpenSSL 10.1 has a small number of incompatible changes.

  A desktop system upgrade exposed some issue in the build scripts.
  Specifically, the linux build was using both third_party/protobufs (2.6.1)
  and the version installed on the system (3.0 in this case). The linux
  cdm.gyp depended on cdm/cdm.gyp which caused that plus some
  additional issues.

  These changes are necessary to support g++ version:
    g++ (Debian 6.3.0-18) 6.3.0 20170516

  Also did some cosmetic rework on run_current_tests to make it easier
  to figure out what is going on when something fails.

  Also tweaked some of the compiler settings for g++ support (revisit
  this later).

* Refactored Service Certificate encryption to allow encryption of arbitrary data.

  Author: Thomas Inskip <tinskip@google.com>

  [ Merge of http://go/wvgerrit/36141 ]

* Send cdm test requests to UAT.

  Author: Jeff Fore <jfore@google.com>

  [ Merge of http://go/wvgerrit/36221 ]

  This change resolves the all of the
  CdmDecryptTest/CdmTestWithDecryptParam.DecryptToClearBuffer
  tests.

  The license servers will return different keys and keyids.
  Sending the request to staging returned key ids and keys that were
  not matching what was expected in the unit tests.

* Fix for building L3 OEMCrypto with clang and libc++

  Author: yucliu <yucliu@google.com>

  [ Merge of http://go/wvgerrit/35740 ]

  1. Include <time.h> for time(time_t*).
  2. Create endian check union on stack. Clang may create const union
  somewhere else, which may cause crash.

* Remove error result when a sublicense session does
  not exist. This is not considered an error.

  Author: Jeff Fore <jfore@google.com>

  [ Merge of http://go/wvgerrit/36080 ]

* Set default mock handler for GetSupportedCertificateTypes
  for all unit tests and removed the use of StrictMock from
  MockCryptoSession.

  Author: Jeff Fore <jfore@google.com>

  [ Merge of http://go/wvgerrit/35922 ]

  The handler for this was only set for one test and resulted
  in a number of failures.

* Set default handler for GetHdcpCapabilities. For
  now the default action is to call the real
  GetHdcpCapabilities of crypto_session.

  Author: Jeff Fore <jfore@google.com>

  [ Merge of http://go/wvgerrit/36140 ]

  I also changed the mock to a NiceMock to silence
  responses to unexpected calls to GetHdcpCapabilities.

  The default handler can be overridden as needed in
  the individual tests.

  This resolves the policy engine test failures.

* Finalize merge of cdm_partner_3.4 to master.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/35360 ]

  This is the final set of updates to merge all v3.4.1
  changes into master.

* Embedded license: Sublicense rotation.

  Author: Jeff Fore <jfore@google.com>

  [ Merge of http://go/wvgerrit/35360 ]

  Handle sublicense rotation event.

* Embedded license: Initial license phase.

  Author: Jeff Fore <jfore@google.com>

  [ Merge of http://go/wvgerrit/34280 ]

  Initial license phase - key loading subsession.

* Embedded license: generate session data.

  Author: Jeff Fore <jfore@google.com>

  [ Merge of http://go/wvgerrit/33722 ]

  Generate session data and add it to the license request for
  any embedded license material.

* Resolve missing symbol when building cd-cdm

  Author: Jeff Fore <jfore@google.com>

  [ Merge of http://go/wvgerrit/35840 ]

* C++11: Replace OVERRIDE def with override keyword

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/35400 ]

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
      commit in the chain.

Change-Id: I37d0cb17f255ac6389030047d616ad69f895748c
2018-01-16 19:29:39 -08:00
Rahul Frias
00da44bb68 Merges to android Pi release (part 6)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Enable Cast for Android Things build.

  Author: Thoren Paulson <thoren@google.com>

  [ Merge of http://go/wvgerrit/29941 ]

  Added a path to make_cast_libwvlevel3 for Android Things. Added the new
  system id to the preprocessor guards in android_keybox.cpp. Guarded the
  references to stderr in page_allocator.cpp because for some reason they
  don't get resolved when we link against the resulting library.

  BUG: 63443584

* Resolve memory leaks in use of OpenSSL.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/32700 ]

  Use of EVP_CIPHER_CTX requires a call to EVP_CIPHER_CTX_cleanup().

* Memory leak in OpenSSL RSA key handling.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/32621 ]

  This fixes a range of tests. --gtest_filter="CdmDecrypt*" runs
  five tests and still loses 5 objects totalling 1320 bytes (down
  from 6200 bytes).

* Unit test and mock OEMCrypto memory leaks.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/32640 ]

  More memory leak cleanup. All remaining leaks are due
  to calls to CRYPTO_malloc() without the matching free
  (i.e., calls into openssl).

* Clean up memory leaks in tests.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/32600 ]

  This is the first pass at cleaning up memory leaks. These leaks
  were affecting a lot of tests, making it hard to identify more
  serious leaks.

  Switch to unique_ptr<> pointers for CdmEngine in
  generic_crypto_unittest tests for FileSystem object in
  mock OEMCrypto's CryptoEngine object.

* Fix broken tests - linux-only & address sanitizer failures.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/32460 ]

  Fix broken test:
    WvCdmEnginePreProvTestStaging.ServiceCertificateInitialNoneTest

  Fix failures found by address sanitizer:
    DeviceFilesUsageInfoTest.RetrieveByProviderSessionToken
    DeviceFilesUsageInfoTest.UpdateUsageInfo

  NOTE: address sanitizer cannot handle EXPECT_CALL macros containing
  a call with a Contains matcher as an argument, e.g.:

  EXPECT_CALL(file,
              Write(Contains(certificate, wrapped_private_key, 0),
                    Gt(certificate.size() + wrapped_private_key.size())))

  The address sanitizer reports a crash, issues a report, and stops. A
  temporary fix is to replace the "Contains()" argument with "_".

* Usage license handling corrections

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/28540 ]

  Validate that offline licenses that do not contain a provider session
  token are not handled by the TEE.

  BUG: 38490468

  Test: WV Unit/integration tests, GtsMediaTestCases,
        WvCdmRequestLicenseTest.ReleaseRetryL3OfflineKeySessionUsageDisabledTest

* UsageTableEntry::CopyOldUsageEntry memcpy read out of range.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/32220 ]

  The function copies the pst from a variable length input vector
  into a 256 byte character array. But the length argument was a
  fixed value - MAC_KEY_SIZE. Depending on the actual PST length this
  can lead to memcpy reading out of bounds or the PST getting truncated.

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
  commit in the chain.

Change-Id: I81a4593d7d04d0ef6069ce48d0601b6fbdd85de9
2018-01-16 19:28:29 -08:00
Rahul Frias
169d0b6cb6 Merges to android Pi release (part 4)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Correct RELEASE_ALL_USAGE_INFO_ERRORs

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/28742 ]

  RELEASE_ALL_USAGE_INFO_ERROR_4 and 5 were introduced and made use of in
  http://go/wvgerrit/24022 (branch: oc-dev). The error code definitions
  were merged over in http://go/wvgerrit/24602.

  When http://go/wvgerrit/24622 from cdm_partners_3.2 was merged to master
  (http://go/wvgerrit/27723) there was conflict in error codes. The error
  codes were adjusted to RELEASE_ALL_USAGE_INFO_ERROR_3 and 4
  and were made use of.

  To avoid renaming the errors between oc-dev and master, new errors
  RELEASE_ALL_USAGE_INFO_ERROR_6 and 7 have been added to handle the
  scenarios noted in the merge from cdm_partner_3.2. The other
  errors have been reverted back to RELEASE_ALL_USAGE_INFO_ERROR_4 and 5.
  They will be used when http://go/wvgerrit/24602 is merged.

* Address compilation issues

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/28740 ]

  These changes enable compilation of most of the cdm code on android
  expect for OEMCrypto unit tests (b/62739406) on wv master.

* Add property for binary/base64 provisioning msgs.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/28074 ]

  Property is "provisioning_messages_are_binary". Its default setting is
  false in the CE CDM, but it can be overridden by integrators.

  Added section to integration guide that discusses Provisioning Server
  message formats and the new property.

  Link: https://docs.google.com/document/d/1cBVbhgrajLpDe2W3_vzLzUqzpdDt73chvm4_sZlZlS8/edit#heading=h.hgxw53ddw7jo

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
      commit in the chain.

Change-Id: I9168193819974d1ff65d9a94dbd762e45ecc43ca
2018-01-16 19:27:13 -08:00
Rahul Frias
0419b55222 Merges to android Pi release (part: 1)
Below are a set of CLs being merged from the wv cdm repo to the android repo.

* Fix handling of OEM Cert public key.

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/27921 ]

  This is a potential fix for b/36656190. Set aside public
  key on first call to get the public key, and use it afterwards.
  This gets rid of extra calls to OEMCrypto_GetOEMPublicCertificate(),
  which has side-effect of staging the OEM private key.

  This also fixes a problem where the public cert string was
  not being trimmed to match the size returned by
  OEMCrypto_GetOEMPublicCertificate().

* Complete provisioning request/response for Provisioning 3.0

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27780 ]

  Fix bug on provisioning request path where GenerateDerivedKeys()
  was being called when preparing to generate the signature.

  Add message signature verification, and call correct OEMCrypto
  routine to rewrap the private key (OEMCrypto_RewrapDeviceRSAKey30).

* Implement Cdm::deleteAllUsageRecords()

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27780 ]

  Delete all usage records for current origin.  Removes usage
  records from file system and retains the PSTs.  The deletes
  any usage entries matching those PSTs held by OEMCrypto.

  BUG: 35319024

* Remove stringencoders library from third_party.

  Author: Jacob Trimble <modmaker@google.com>

  [ Merge of http://go/wvgerrit/27585 ]

  We have a fork of the stringencoders library that we use for base64
  encoding.  This reimplements base64 encoding to remove the extra
  dependency and to reduce the amount of code.

* Add Cdm::deleteUsageRecord() based on key_set_id.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27605 ]

  Delete specified usage record from file system usage info and
  from OEMCrypto.

  BUG: 35319024

* Modifiable OEMCrypto

  Author: Fred Gylys-Colwell <fredgc@google.com>

  [ Merge of http://go/wvgerrit/24729 ]

  This CL adds a new variant of the OEMCrypto mock code that adjusts its
  behavior 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.

  BUG: 35141278
  BUG: 37353534

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
      commit in the chain.

Change-Id: I58443c510919e992bb455192e70373490a00e2b6
2018-01-16 19:21:54 -08:00
Jiyong Park
a731bbcfbf Merge "Build widevine tests with BOARD_VNDK_VERSION set" into oc-mr1-dev am: 21715115bc
am: a8d6af5ec2

Change-Id: I494add05603760ee2acafa2b508b5d7f2585f0e2
2017-08-09 02:43:58 +00:00
Jiyong Park
853773dd93 Build widevine tests with BOARD_VNDK_VERSION set
The tests are using vendor only libs such as libcdm and libwvlevel3,
thus marked as LOCAL_PROPRIETARY_MODULE to use the libs. In addition,
the dependency to libmedia is changed to libmedia_omx since libmedia is
not available to vendor modules. UniquePtr is replaced with
std::unique_ptr since UniquePtr.h in /libnativehelper is not available
to vendors (and will not be completely removed in a near future).

Bug: 37342627
Test: BOARD_VNDK_VERSION=current m -j tests

Change-Id: I4e9d3267b20c1d52f57664b89f15330e2ebd953d
2017-08-07 16:28:28 +09:00
Paul Duffin
940146a195 Add dependencies on org.apache.http.legacy where needed
Incorporates two main changes:
* Stops statically including the org.apache.http.legacy library. That library is
  a stubs library so it makes no sense to statically include it.
* Adds uses-library declaration for org.apache.http.legacy to those packages
  that depend on org.apache.http.legacy, either directly or transitively.

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
    Added <uses-library> for org.apache.http.legacy to ensure classes
    are provided at runtime. It is marked as optional as the
    application is intended to be run on versions that do not provide
    the library, but provide the classes by default, i.e. its
    minSdkVersion is < M (23).

* libwvdrmengine/test/java/AndroidManifest.xml
    Added <uses-library> for org.apache.http.legacy to ensure classes
    are provided at runtime. It is marked as optional as the
    application is intended to be run on versions that do not provide
    the library, but provide the classes by default, i.e. its
    minSdkVersion is < M (23).

Bug: 18027885
Test: m -j32 droid && adb reboot bootloader && fastboot flashall -w
Change-Id: I4eb4621bc4c2f481c0d909acac871187f006e145
2017-07-25 09:14:51 +01:00
Robert Sloan
02fb7421b9 Remove BoringSSL static targets in widevine.
Test: WidevineDashPolicyTests, MediaDrmTest, WidevineFailureTests, WidevineGenericOpsTests, WidevineH264PlaybackTests, WidevineHLSPlaybackTests, WidevineVP9WebMPlaybackTests, WidevineCodecStressTests

I saw (probably unrelated) in
com.google.android.media.gts.WidevineHEVCPlaybackTests#testL1WithUHD30
com.google.android.media.gts.WidevineH264PlaybackTests#testL1WithUHD30
com.google.android.media.gts.WidevineVP9WebMPlaybackTests#testVP9WebMCencSubSampleL1With240P30fps
com.google.android.media.gts.WidevineCodecStressTests#testVideoSecureH264
com.google.android.media.gts.WidevineCodecStressTests#testVideoSecureH265

BUG: 62945210
Change-Id: I5b5274d99ca5ad9299dc9cf9d83cb23fb6f6c13e
2017-07-18 21:44:52 +00:00
Kyle Alexander
038580c6c9 Update unit tests to build into /data/bin
Tradefed needs these tests to be in the /DATA directory.

Test: cd vendor/widevine && ./build_and_run_all_unit_tests
      All tests should build and pass.
      make tests
      unzip android-tests.zip and verify all tests located in DATA/bin

Bug: 62055647
Change-Id: I35925e29558561c4726bb2249499bfee4e54cf45
2017-06-12 23:48:15 -07:00
John W. Bruce
6262f3721f Prefix ENABLE_MEDIADRM_64 with TARGET_
This build-time flag should be prefixed.

Bug: 37039525
Test: Built OS
Change-Id: Ie1db1f05bdaf43e4066d26a41391af0d7c729128
2017-04-27 18:50:05 -07:00
John W. Bruce
68d26ef98b Remove API Version TODO Comments
(This is a merge of http://go/wvgerrit/26221)

We have agreed on API 26 for O, so these comments can be removed without
making any further changes.

Bug: 34548395
Test: This is a comment-only change. But I verified it builds.
Change-Id: I490befba4f47902a84b60e562a7a5eb162a9f3be
2017-04-19 16:48:14 -07:00
John W. Bruce
19947dfe6f Move SPOID Enable/Disable Logic Out of WVDrmPlugin
(This is a merge of http://go/wvgerrit/25580)

While writing fixes for b/36660726, b/34716264, and b/36065223, it
became clear that having the logic that checks whether the device
supports SPOIDs embedded inside WVDrmPlugin was complicating its code
and inhibiting testing of the class. By moving this check into the code
that instantiates WVDrmPlugin, the result of the calculation can be
independently tested while the tests for WVDrmPlugin can put it in
whatever state they need for the sake of unit testing.

As a consequence of this, the check on retrieving the "deviceUniqueId"
byte array property, which was removed when SPOIDs were implemented, can
be reinstated.

Bug: 36660726
Bug: 34716264
Bug: 36065223
Test: libwvdrmdrmplugin_hidl_test & libwvdrmengine_hidl_test
Change-Id: I961d2ee42bbdc42f0c324e36d9a74ac92205a437
2017-04-18 09:56:58 -07:00
Edwin Wong
d9e7070de7 Remove dependencies from frameworks C++ containers.
Replace AString, KeyedVector, List, String8 and Vector
with stl containers. Remove corresponding frameworks
libraries.

Test: Play Movies & TV (streaming and pinning)
Test: Netflix
Test: unit tests

bug: 34677927
Change-Id: I125f45054987d69bbca59c1ffdcbe8add38c3c13
2017-04-05 22:46:04 +00:00
John W. Bruce
b99a4c736f Turn on 64-bit Executables on Supported Platforms
This commit changes the unit tests and HAL Service to run as 64-bit on
devices that have enabled 64-bit DRM Plugins.

Bug: 36076017
Test: Turned on the flag for a device and used the file command to
      verify that all binaries were built as 64-bit.
Test: Turned the flag back off and verified that all binaries were built
      as 32-bit. This should affect no current devices.
Change-Id: Ieb7218f15b9359f2038a6f60b8c994b16d2b5b53
2017-04-01 19:05:30 -07:00
John W. Bruce
bfe6046199 Build Android Unit Tests 32-bit Only
(This is a merge of http://go/wvgerrit/24738)

The change to enable 64-bit as a possible target for Widevine Android
made all the unit tests build as 64-bit on compatible platforms. Since
none of these devices support 64-bit properly yet, this is a mistake.
This patch restores unit test builds to being 32-bit only for now.

In the future, when the switch for 64-bit-supporting devices is added,
it will also switch the unit tests to 64-bit mode.

Bug: 36071236
Test: Verified unit test format with "file" command.
Change-Id: Ib4d3678181f3221b85fe6409f1d842dd15af3daa
2017-03-23 17:09:15 -07:00
Fred Gylys-Colwell
85365a1497 Fix or ignore compiler warnings
Merge from Widevine repo of http://go/wvgerrit/24688

b/35466719

Change-Id: If89f0cad0c61f37536a84f8dadaf08072356343a
2017-03-22 14:07:08 -07:00
Edwin Wong
2dc53442e7 Implement Widevine drm HIDL HAL service.
Modify Android mediadrm and mediacrypto glue layer to use
HIDL interface.

Test: Play Movies (streaming and offline playback)

Test: ANDROID_BUILD_TOP= ./android-gts/tools/gts-tradefed
run gts -m GtsMediaTestCases

Test:
adb shell /system/bin/libwvdrmengine_hidl_test

Test:
adb shell /system/bin/libwvdrmmediacrypto_hidl_test

Test:
adb shell /system/bin/libwvdrmdrmplugin_hidl_test

bug: 34628973
Change-Id: Icd5f2dd556acb9874697963b4d7d62cb7c943e74
2017-03-02 13:46:11 -08:00
John W. Bruce
df0dad5311 Enable 64-bit Android Builds
(This is a merge of go/wvgerrit/23686)

This patch removes the makefile lines that previously prevented the
Widevine DRM Plugin from being built as 64-bit on Android. 64-bit
builds are now fully supported.

Only one piece of CDM code has had to change. Due to a bug in
libprotobuf before v3.0, int64 values from protobufs are technically a
different type from int64_t values in code on some 64-bit
architectures. Both have the same in-memory representation at runtime
but are seen as distinct types by the compiler. The compiler will
automatically convert in most places, but template instantiation is
not one of them, so a few places that passed a Protobuf int64 directly
into a template had to be modified.

Please note that tweaks to the mediadrmserver (not covered by this
patch) are needed in order for it to run as 64-bit and load 64-bit DRM
Plugins. Please also note that, as we have no 64-bit L1 OEMCrypto on
any devices, using the 64-bit mediadrmserver and Widevine library will
make your device fall back to L3 for the time being.

Bug: 18949752
Test: OEMCrypto unit tests
Test: Widevine unit tests
Test: Google Play (on Marlin)
Test: Widevine GTS Tests (on Marlin)
Change-Id: Ib6cdf2dd1ff75a1c473cacdc5e22397caa0a656c
2017-03-02 02:58:56 +00:00
Aaron Vaage
edb9f00df7 Widevine Metrics System
This change is the complete Widevine metrics system. It will
measure and record runtime information about what is happening
in the CDM - such as errors and throughput.

Bug: 33745339
Bug: 26027857
Change-Id: Ic9a82074f1e2b72c72d751b235f8ae361232787d
2017-01-27 16:59:17 -08:00
Dan Albert
eadd3689a2 Stop hard coding gtest paths.
These are automatically exported by libgtest.

Change-Id: Ia55222989523ecda7a4a686ef794040515f56224
Test: mma
Bug: None
2016-08-22 13:53:20 -07:00
Kyle Alexander
27c8c3f150 Add display and logging for validating HDCP levels.
This adds display and logging values to help with debugging b/28024277.

Matching Widevine cl: go/wvgerrit/17446

Bug: 28024277
Change-Id: Ib25ebf37f885b60ae4ab41851df4af4e75b5aace
2016-04-11 09:48:27 -07:00
Jeff Tinker
5dd0d2a5ce Merge "Fix StringIndexOutOfBoundsException in MediaDrmAPITest" into nyc-dev 2016-04-08 18:05:12 +00:00
Jeff Tinker
06c45414b5 Fix StringIndexOutOfBoundsException in MediaDrmAPITest
The AES test was useful to verify the framework API changes, but
the decrypt test was not correct.  Removing it for now.

Merge of go/wvgerrit/17472

bug: 27973491
Change-Id: I942fda22072636ea7ce56b992e7d3a60077c0d27
2016-04-08 16:51:22 +00:00
John "Juce" Bruce
0555a7c9de Move Widevine Unit Tests to Standard gMock
(In addition to being a merge of http://go/wvgerrit/17394, this commit
updates tests/Android.mk to no longer try to build the private gMock.)

Previously, we maintained our own version of gMock (named libwvgmock
to avoid naming conflicts) and depended on it for our unit tests. Now
that Android has gMock in the externals/ directory and vaage@ has
eliminated the need for us to customize gMock's arity, we can stop
depending on or maintaining our own copy.

Bug: 26907374
Change-Id: Ia01d6c02e2f28a642480d7ef178b9bc3dde6d306
2016-04-01 14:49:43 -07:00
Jeff Tinker
4aedea8512 Support AES-CBC sample encryption in MediaDrm
bug:23719082
Change-Id: I1842bab291d6c86a87e46abbb98827c87f7f1d53
2016-01-11 17:16:08 -08:00
Kyle Alexander
6886b1fa12 Add HDCP, HEVC and VP9 content samples to ExoPlayer
Change-Id: I8a181ce9f617df52b5dafb974c7891b24610fece
2015-11-30 10:14:37 -08:00
Rahul Frias
0fe3f79cc3 Additional merges from cdm master
* Update unit test make files to use BoringSSL

  [ Merge of http://go/wvgerrit/14173 ]

  This CL updates the android makefiles to use the libcrypto_static.

* Do Not Run Provisioning Tests On Devices Without Keyboxes

  [ Merge of http://go/wvgerrit/15633 ]

  The provisioning tests outside OEMCrypto were failing on devices that
  use baked-in certificates because only OEMCrypto knows that the cert
  is baked in and the device cannot be reprovisioned. This change
  skips those two tests if the device says it does not implement
  rewrapping the cert. (i.e. it does not implement provisioning)

  Bug: 23554998

* Add new third-party libs (protobuf & gyp)

  [ Merge of http://go/wvgerrit/14717 ]

  The CE CDM used to expect these to be installed system-wide, which
  creates challenges for integrators who must cross-compile the CDM.

  These are now used in source form from third_party.

Change-Id: I29cca2f9415fe2fafdf948273e5a0f5d7de50285
2015-10-05 14:24:40 -07:00
Kyle Alexander
bc14139fc0 am 86adf4a2: Add secure VP9 content to GTS content list.
* commit '86adf4a25ce0f1ead40c9877ff981d30f5c9cbc2':
  Add secure VP9 content to GTS content list.
2015-07-02 01:09:41 +00:00
Kyle Alexander
86adf4a25c Add secure VP9 content to GTS content list.
ExoPlayerDemo build is based on the demo-debug.apk built from:
google3/third_party/java_src/android_libs/exoplayer

Supporting cl in google3: cl/97176187

Bug: 19571315
Change-Id: I611e9e5f363ecfeb66e4813c1f6939abbf855d09
2015-07-01 10:02:49 -07:00
Tim Kilbourn
c74222f523 Rename the internal copy of gmock.
The external/gmock project does not include the patches needed for
widevine, so renaming the internal copy allows both to coexist in the
build system.

(cherry-pick of 5b830f19b6 with conflict.)

Change-Id: I77c956db30921afffe31d11e1cd2d99541925f35
2015-06-23 16:00:47 -07:00
John "Juce" Bruce
8443abc555 Re-Add MIPS to Android CDM Build
(This is a merge of http://go/wvgerrit/14795)

This change restores the ability to build the Widevine CDM for Android
for MIPS devices. It restores the precompiled binaries for MIPS and
re-adds MIPS to all makefiles.

This change includes a new build of the obfuscated binaries for
MIPS32r1 that were built using a MIPS device on the emulator.

level3/mips/libwvlevel3.a  Level3 Library Jun 19 2015 12:32:49

Bug: 19482469
Change-Id: Ifa1c299a5751f3772c42289d8333a2b8cec51f69
2015-06-19 16:34:08 -07:00