Commit Graph

43 Commits

Author SHA1 Message Date
Rahul Frias
80659961ac Merges to android Pi release (part 7)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Resolve intermittent decrypt error.

  Author: Jeff Fore <jfore@google.com>

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

  The CdmSession's closed state was not properly
  initialized resulting in intermittent
  SESSION_NOT_FOUND_FOR_DECRYPT errors.

  In CdmEngine::Decrypt the session is looked up by
  the key id. A list of open sessions is acquired
  by calling CdmSessionMap::GetSessionList and each
  session in the list is queried to see if it has
  the key.

  In building the list in CdmSessionMap::GetSessionList,
  sessions are only added to the query list *if* the session
  is not closed.

  The closed status was not initialized and during testing
  the query list would not contain the session causing
  CdmEngine::Decrypt to return SESSION_NOT_FOUND_FOR_DECRYPT
  resulting in the ce cdm api returning widevine::Cdm::kNoKey.

* No support for pre- C++11 compilation.

  Author: Gene Morgan <gmorgan@google.com>

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

* Handle unaligned nonce pointer in RewrapDeviceRSAKey calls.

  Author: Gene Morgan <gmorgan@google.com>

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

  The pointer points into a message and it may not be aligned.
  Always copy the nonce into aligned memory before checking it.

  BUG: 38140370

  Add note to CHANGELOG for this.

* Compiler strictness: more checks and code cleanup.

  Author: Gene Morgan <gmorgan@google.com>

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

  Use the switches proposed in b/38033653 (as much as possible - some
  conflicts with protobufs and gtest prevent fully accepting them).

  Switch to clang for x32 build; ensure that both x86-64 and x86-32 builds
  compile and link cleanly.

  BUG: 38032429
  BUG: 38033653

  This partially resolves b/38458986

* Android build fixes

  Author: Rahul Frias <rfrias@google.com>

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

  These corrections address compile warnings and errors for android
  and unit tests.

* Embedded License: Add sub license key sessions.

  Author: Jeff Fore <jfore@google.com>

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

  NOTE: this adds the AddSubSession() method, but it is not yet being
  used. Use and proper cleanup is in an upcoming CL.

* Embedded license: Add track label field.

  Author: Jeff Fore <jfore@google.com>

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

  A new track label field (a string) is added to the key container and the
  sub session data objects.

  This field will be used in handling sub license requests.

* Embedded license: extract keys from init_data.

  Author: Jeff Fore <jfore@google.com>

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

* Embedded license: add protobuf messages.

  Author: Jeff Fore <jfore@google.com>

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

  also sync the widevine header definition with recent naming changes.

* Improve handling of provisioning response errors.

  Author: Gene Morgan <gmorgan@google.com>

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

  Separate out the case of no response and the case
  where the message is believed to be a JSON+base64
  message but it doesn't parse properly.

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

Change-Id: I3c86f1c54980b071aec7461ac58541836551f896
2018-01-16 19:29:04 -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
11068accd2 Merges to android Pi release (part 3)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Add CDM status return for decrypt blocked by HDCP.

  Author: Gene Morgan <gmorgan@google.com>

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

  New status code is kKeyUsageBlockedByPolicy. It is returned by the decrypt()
  call instead of kDecryptError or kNoKey.

  Also shuffled the CDM status returns to define the EME-aligned codes
  first, and added comments to highlight the differences in handling.

  BUG: 37540672

* Change division and mod ops to relocatables

  Author: Srujan Gaddam <srujzs@google.com>

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

  This is similar to I2dad1028acf295288cd10817a2bcff2513c053c9.
  We should be using the relocatable functions instead of the
  native division and mod operations.

* Cleanup Encrypted ClientID in provisioning request

  Author: Gene Morgan <gmorgan@google.com>

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

  b/36897239

  Staging server does not support it (or the client is not constructing
  it properly).  Leave it disabled pending investigation.

* Certificate Provisioning fixes.

  Author: Gene Morgan <gmorgan@google.com>

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

  Partial fix for BUG: 37482676
  Partial fix for BUG: 37481392

  Update service certificates, get rid of DEV/QA root certificate.
  Provisioning request and response are base64 (web-safe) encoded.
  Response is optionally JSON-wrapped.

  Change ConfigTestEnv; clearer comments and a closer match to reality.

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

Change-Id: I79d3c4bf1124e5e0d3e4d40baead65a8266ea874
2018-01-16 19:25:31 -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
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
Edwin Wong
485f11483c Replace toStatus indirection.
CdmResponseType are mapped to android::status_t, then map to hidl
android::hardware::drm::V1_0::Status. This CL removes the indirection
by mapping cdm errors to hidl Status.

Test: Play Movies (pin and streaming)
Test: Netflix (download and streaming)
Test: libwvdrmmediacrypto_hidl_test and libwvdrmdrmplugin_hidl_test
Test: GtsMediaTestCases module
Test: Vts - VtsHalDrmV1_0Target

bug: 34682447
Change-Id: I0b04f47871f5e4898e7297831d5fceab52e0f7f9
2017-08-03 17:57:44 -07: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
fc7e636bdf Merge "Update unit tests to build into /data/bin" into oc-dev
am: b683d2be57

Change-Id: I1a88eb1d4f9a8d1df6fc66f6277c5afc5ead9c07
2017-06-13 22:18:14 +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
Steven Moreland
680f23d350 Remove redundant dependencies
android.hidl.base@1.0 and android.hidlmanager@1.0 are built into libhidltransport.

Test: links
Bug: 33276472
Change-Id: Id9053e4484275e3404f31a72d2037884ff6bef5b
(cherry picked from commit 80ec937545)
2017-05-02 21:52:59 +00: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
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
f2463075ac Fix & Improve Test-Building and -Running Scripts
(This is a merge of wvgerrit/24922)

This contains several fixes and improvements to the
build_and_run_all_unit_tests.sh and run_all_unit_tests.sh scripts:

* All tests are now identified as vendor binaries and thus are stored in
  the /vendor/bin/ directory instead of /system/bin/. Previously, some
  tests had moved to /vendor/bin/ but the scripts had not been updated,
  causing these tests to fail to run.
* The -j parameter can now be passed to build_and_run_all_unit_tests.sh,
  for those who want to speed up their build by using multiple cores.
* The 64-bit library directories are now added to the library search
  path, in anticipation of devices with 64-bit DRM Plugins.
* Checking for Verity protection is now done in
  build_and_run_all_unit_tests.sh (which is the script that actually
  modifies the file system) instead of just in run_all_unit_tests.sh.
* The library search path is no longer set unnecessarily for
  libwvdrmengine_hidl_test.
* The Treble-only tests and non-Treble-only tests now only run on
  devices that meet their respective criteria.

Bug: 36071236
Test: Ran build_and_run_all_unit_tests.sh
Change-Id: Iea236880c4445858111c801dfa278a528bca0f6c
2017-03-29 19:01:04 -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
Edwin Wong
c4aad89fd0 Rename libhidl_utils to libwidevinehidl_utils.
This library is local to vendor/widevine HAL service, rename to
indicate this is used only by widevine HAL.

Test: Play Movies & TV (streaming and pinned)

Test: Netflix

bug: 36430909
Change-Id: Iacaf78f4223bf305569e7f1d04dd4e4ad0a87727
2017-03-20 11:14:36 -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
Aaron Vaage
af71f66aa4 Removing Widevine OEMCrypto Profiler
This is a merge of go/wvgerrit/22806

This change removed the oemcrypto profiler to allow
the new metrics system free-reign over how to collect
and store measurements.

Bug: 33745339
Bug: 26027857
Change-Id: I6b9051faa6835f13860258c94f8bcfd3a59f1be6
2017-01-17 17:53:40 -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
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
Rahul Frias
e0da404b14 Use Jsmn to parse json data
[ Merge of http://go/wvgerrit/16628 ]

Jsmn will replace a local method that parsed json init data.
Added a fix to include all key Ids in the WidevineCencHeader rather than
just the first. Also modified the content_id to reflect that it is a
base64 encoded value.

b/20630275

Change-Id: I7080c8cea21be4dea09a4905a96b4cc03e584c1d
2016-01-29 13:38:32 -08:00
Aaron Vaage
8ecc290a23 Fixing missing include path for OEMCrypto Profiler
This is a merge of:
http://go/wvgerrit/16616 Fixing Android Makefile to Profiler

Change-Id: I2b4741fc02896927b5ed16ce68cca55d69bb5ade
2016-01-27 16:47:35 -08:00
John "Juce" Bruce
5bd0e73b3e resolved conflicts for merge of 256dd1a5 to master
Change-Id: Iffef557a3d9d3df321b5ae38e891d5a2a3e88e70
2015-06-19 19:49:36 -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
Tim Kilbourn
5b830f19b6 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.

Change-Id: I77c956db30921afffe31d11e1cd2d99541925f35
2015-05-14 17:05:59 -07:00
Fred Gylys-Colwell
f75fddcdf1 Update unit test make files to use BoringSSL
Merge from widevine of go://wvgerrit/14173

This CL updates the android makefiles to use the libcrypto_static.

Change-Id: I74567ff880ebdce366766a9ab44c92cc9540b8db
2015-04-22 07:47:51 -07:00
Ying Wang
0c850a4cb3 Remove setup of proto generated include/header dependency.
They are now set up automatically by the build system.

Bug: 20093047
Change-Id: I3ab1256952915e402adf6510c0f6fdb158feb802
2015-04-07 12:51:20 -07:00
Dan Albert
723d67c88f Remove Widevine CDM Dependency on STLPort
* Replace an stlport static assert with a C++11 static_assert.
 * Move some libraries that were being built with the NDK but
   statically included into platform code off the NDK.
 * Rebuild the obfuscated binaries to use the new STL.
 * Remove MIPS support temporarily due to an inability to generate
   obfuscated binaries for it. (To be fixed in b/19482469.)

Bug: 15193147
Change-Id: Icc166583b0c6af68550baf17ab8c33076a1179d3
2015-02-25 15:53:36 -08:00
Jeff Davidson
dfab729fd7 Remove references to protobuf 2.3.0.
Change-Id: I08b9e6441e26083cf182402916288ae073425f9c
2015-01-08 19:01:44 -08:00
Dan Albert
de4bc34719 Fix build.
This project is still using stlport (without telling the build system
about it), which was causing (broken) stlport headers to override
libc++ headers, leading to a broken copy of std::enable_if, which in
turn caused <atomic> to fail to compile. Since this project has
prebuilts that will need to be updated before this project can
actually move away from stlport, tell the build system that it is
still using stlport for now.

Bug: 18433002
Change-Id: I38b356428977ed2184eb28a07bd5e7424a4ace8d
2014-11-25 13:41:47 -08:00
Fred Gylys-Colwell
20191d996c Allow Secure Stops to be queried and deleted by application ID
This CL changes the WVDrmPlugin so that an application can segregate
its secure stops from those of other applications by setting an
application ID.

This CL is a merge of the following Widevine CLs:
https://widevine-internal-review.googlesource.com/#/c/11565/
Add getSecureStop by ssid

https://widevine-internal-review.googlesource.com/#/c/11572
Add getSecureStop by SSID and releaseAllSecureStops by app id.

https://widevine-internal-review.googlesource.com/#/c/11564/
Store Usage Info by App Id (device_file stubs)

https://widevine-internal-review.googlesource.com/#/c/11563/
Add application id to StoreUsageInfo.

https://widevine-internal-review.googlesource.com/#/c/11561/
Added Application ID to PropertySet for secure stop.

bug: 18053197
bug: 18076411
Change-Id: I5444baf67ba1b960dee2dc958bced8de82ab70a3
2014-11-05 17:39:44 -08:00
Jeff Tinker
fbe0994902 Fix widevine unit test builds on 64-bit devices
bug: 17080975
Change-Id: Ic54d484e18fe0416855264ca073474f3d597e1a3
2014-08-16 12:11:05 -07:00
Jeff Tinker
f6ec81ffe7 Updated gMock to 1.7.0
This change updates gMock to the new release, 1.7.0.  This is
necessary for Android, as Android Master has updated their gTest to
1.7.0, and we must always use the matching version of gMock.

This should not break any existing tests, as 1.7.0 is
backwards-compatible with 1.6.0 code in nearly all cases.  There are
a few bugfixes around being too generous with type coercion in
EXPECT_THAT() and ASSERT_THAT() that could break code that was
accepted by the compiler before but was never technically safe.

For a full list of changes, including all the awesome new matchers
you can now use in your tests, see CHANGES, which is included from
gMock unchanged.

For a full list of modifications made to allow this to work on
Android Master, see the updated README.android.

No changes to the GYP files were necessary as part of this upgrade.

Change-Id: Ib1445044e78c9fe0cf16031d544577d65ebbf6df
2014-03-10 11:37:24 -07:00
Rahul Frias
f6c2a60485 Allow Apps to Voluntarily Downgrade to L3 Crypto
This merges the following changes from the Widevine CDM repository:

564f4cc  Add CdmClientPropertySet to CDM
  Adds an interface to the CDM that allows it to query its client for
  certain properties.  In this case, this includes the ability to
  specify what security level is desired, as well as support for
  service ceritifcate privacy mode.

9cfbd3e  Force Level 3 fallback
  Adds support for voluntarily invoking L3 crypto to the OEMCrypto
  wrapper.

95d12c1  Add pointer to CdmClientPropertySet class to OpenSession.
  Adds support for storing the property set on a session-by-session
  basis and choosing the appropriate crypto level.

17de442  Add Settable Properties for Clank to Android
  Adds support for setting the aforementioned properties to the
  DrmEngine

bbe704d  Fixes to force fallback to level three security
  Corrections to invoke provisioning, OEMCrypto API with configured
  security level rather than the default. Unit tests were also revised.

Note that some parts of this are also support for the ability to use
a service certificate-based privacy mode. The remaining code for
supporting this mode is still forthcoming.

Bug: 10109249
Change-Id: I2755e4dea1de3e8a56cff237360298f7b7f1bddc
2013-08-15 11:31:45 -07:00
John "Juce" Bruce
b0d85ac1af Add Call to Install Keybox to Widevine CDM
This merges the following changes from the Widevine CDM repository:

1a72a7e  Combine utility code into single library on Android
  Combines several previously-separate files into a static library,
  libcdm_utils, so that it can easily be used by both CDM and
  OEMCrypto.

8c4d04d  Install Keybox
  If the keybox has not been installed, install it from
  /factory/wv.keys.

Bug: 9972451
Change-Id: I8688ecd0adcf321e0c7d0faf55dd10f3910c12ec
2013-08-08 14:52:31 -07:00
Jeff Tinker
1aff209f91 Field provisioning for L3 OEMCrypto
bug: 8621460

Merge of https://widevine-internal-review.googlesource.com/#/c/4955/
from Widevine CDM repository.

Change-Id: I30cf4314283db51c8e706c026501784259c87c13
2013-04-23 15:37:58 -07:00
Rahul Frias
7e390361f6 Add device ID to Widevine license request
Also added other Client identification fields specified in license exchange
protocol, Appendix C

https://docs.google.com/a/google.com/document/d/1cng6cDnchbDQDymLEd5MxMc_laS3EDv6IsoW3IzpgwQ/edit#heading=h.pmkiti873xeg

They are company, model, architecture, device and product name.

bug: 8292249
Change-Id: I4d5fa93a0c85c7abb025c66d48e4aafbfe90efd8
2013-04-18 10:02:27 -07:00
Jeff Tinker
e6b1fedc4c Widevine CENC drm engine update
bug: 8601053

This import syncs to the widevine git repository change
commit 6a99ad1b59ad39495f62954b3065ddc22b78da49

It includes the following changes from the widevine git
repository, which complete the jb-mr2 features

    Fix Unit Test Makefile
    Adds support for device certificate provisioning.
    Support application parameters
    Certificate based licensing
    Proto for client files
    Implement Property Query API
    Add Device Query For Unique ID
    Implement Generic Crypto in DrmEngine
    Do not validate Key IDs on clear playback
    Allow OEMCrypto_DecryptCTR with clear content and no key
    Add a case to the MediaDrm API test to repro b/8594163
    Implement requiresSecureDecoderComponent
    Implement Eventing API
    Add end-to-end decryption test with vectors
    Refactoring of properties class
    Refactor OEMCrypto unittest.
    Fix for b/8567853: License renewal doesn't renew license.
    Add KEY_ERROR callback to WvContentDecryptionModule() ctor.
    Merged certificate_provisioning.proto and
      client_identification.proto to license_protocol.proto.
    Fix nonce check failure after a malformed key in OEC Mock.
    asynchronize decryption
    Allow querying of control information
    make debugging AddKey & Decrypt statuses easier
    Revert "Revert "Send KEY_ERROR event to app on license
      expiration or failure""
    Revert "Send KEY_ERROR event to app on license expiration
      or failure"
    Send KEY_ERROR event to app on license expiration or failure
    remove extra session id copy
    use KeyError constants directly
    replace variable-length arrays with std::vector and fixed-sized array
    pass session ids as const references
    refactor key extraction and update keys on renewal
    Updates to enable renewals and signaling license expiration.
    fix error constant in OEMCrypto_DecryptCTR

Change-Id: I5f7236c7bdff1d5ece6115fd2893f8a1e1e07c50
2013-04-12 14:21:37 -07:00
Jeff Tinker
f3ec8c19d6 Import updates to the Widevine CENC DRM Plugin
This change incorporates the following CLs from the Widevine
cdm repository:

    Update the java request/response test app to match Drm API changes
    Don't build the mock liboemcrypto.so by default
    Do not build CDM tests by default
    Fix Build Break in DrmEngine Unit Tests
    Fix Build Break in WVDrmPlugin
    Initial version of roadmap for CDM projects.
    Implement License Query
    Implement Generic DRM in OEMCrypto Reference Implementation
    Add key_data_length field when calling OEMCrypto_LoadKeys
    Policy engine unittests
    Generalized DRM API for OEMCrypto
    Fixes proto buf libraries build.
    Add Version Number to OEMCrypto API
    Test key control block duration field in OEMCrypto
    Add fix for missing crypto offset.
    Fixed android/media*/test builds and added proto files for Cert. provisioning
    Refactor and clean up callback code in CDM.
    Add "device_id" name-value pair to LicenseRequest::ClientIdentification
    Separate unit and end-to-end tests from the top level makefie.
    Includes changes for 'fall back to l3 oemcrypto lib' in top level makefile.
    Fall Back to Level 3 if Level 1 Fails
    Fix compilation error in wvcdm_unittest.
    Fix Android build break due to Decrypt() signature change in cdm_engine.h.
    Wire up callbacks and errors in the Steel proxy.
    Fix lock assert if there is no keybox on the device.
    RSA Certificate Unit Test
    Change Generic_Verify signature to constant.

Change-Id: I2e42db9d0b4f8d4e833675ae81d0714509bbfd2c
2013-04-03 19:53:12 -07:00
Jeff Tinker
1a8aa0dd05 Initial import of Widevine Common Encryption DRM engine
Builds libwvmdrmengine.so, which is loaded by the new
MediaDrm APIs to support playback of Widevine/CENC
protected content.

Change-Id: I6f57dd37083dfd96c402cb9dd137c7d74edc8f1c
2013-03-22 11:14:17 -07:00