Commit Graph

53 Commits

Author SHA1 Message Date
Alex Dale
659301abd3 Specified /bin/bash for Android scripts.
[ Merge of http://go/wvgerrit/165139 ]

Changed the specified shell program used to execute our team's Android
scripts to bash.

Bug: 266891333
Test: ./build_all_unit_tests.sh
Change-Id: Id6fc8e4db10a71e9f17fc48a52a4883331e908d3
2023-01-26 22:23:25 -08:00
Jeff Tinker
bcc3313828 Create a build_all_unit_tests.sh script
bug: 163163467
test: ./build_all_unit_tests.sh
      ./build_and_run_all_unit_tests.sh

Merge from: go/wvgerrit/116524

Change-Id: I5eaf5ed34b46445d23530ca0edca94bfaeb3abaf
2021-02-09 12:10:31 -08:00
Rahul Frias
b1f54bbba8 Add Duration Use Case integration tests
Cherry pick from http://go/wvgerrit/102986, rvc-dev branch of
http://go/wvgerrit/105825, rvc-widevine-release of http://go/ag/12561661

This CL adds several integration tests that match the duration use
cases. The test classes are designed for the core cdm, but the test
cases match those found in oemcrypto/odk/test/odk_timer_test.cpp.

See this document for a list of use cases:
libwvdrmengine/docs/License_Duration_and_Renewal.pdf

Test: Ran the tests against v16 OEMCrypto. Some fail against v15.
Bug: 161463952
Change-Id: I7cd424ae241d3897fbd06956e87dd9da0752cb6d
2020-11-02 23:10:41 +00:00
Rahul Frias
d1dff772d3 Add some policy integration tests
Cherry-pick from branch rvc-dev of http://go/wvgerrit/105824 and
rvc-widevine-release http://go/ag/12561660

This adds two policy integration tests to verify that we are handling offline
licenses correctly.

Bug: 161023174
Bug: 129301787
Test: WV unit/integration tests
Change-Id: I20f5d6a9fbfd2ff8cff361e1005e45b46c700704
2020-11-02 00:44:02 -08:00
Rahul Frias
19605579d5 Search for test executables in odk_test
[ Merge of http://go/wvgerrit/94507 ]

./build_and_run_all_tests.sh runs all WV unit/integration tests.
It searches for unit/integration tests in $OUT/data/nativetest/ .
ODK tests are in $OUT/data/nativetest/vendor/odk_test. Adding this
path to the list of directories that the script searches through.

Bug: 150158890
Test: Run ./build_and_run_all_tests.sh
Change-Id: Ib3b7d247a5cb86f9972157c13ad60b7f3cbbb7dc
2020-02-26 13:51:14 -08:00
Fred Gylys-Colwell
7665614b2e OEMCrypto v16.1
Merge of http://go/wvgerrit/93404

This CL updates the Widevine CDM to support OEMCrypto v16.1

Test: Tested in 16.2 CL
Bug: 141247171
Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
2020-02-03 14:45:32 -08:00
Alex Dale
aa0d93bf36 Included metrics for LRU replacement.
[ Merge of http://go/wvgerrit/88016 ]

In the event of an LRU replacement event on AddKey, we gather some
metrics on what the state of the usage table is and some info on the
the entry that was removed.

Metrics collected:
 - How many usage info (streaming license) in the table
 - How many offline licenses in the table
 - What type of entry was evicted from the table
 - How stale (time since last use) was the evicted entry

This also enables unit tests for marshalling the metrics into proto
message on Android unit test.

Bug: 135046978
Test: Android and Linux unit tests
Change-Id: If8e562ae6f98270a0e6c5aa4251127ce9b79a8b0
2019-12-16 17:38:50 -08:00
Rahul Frias
0acde10d1a Add certificate_provisioning_unittest
[ Merge of http://go/wvgerrit/87964 ]

A preliminary test has been added, more to follow.

Bug: 142747616
Test: android unit tests
Change-Id: Ida8eb853c14f73f60f7bc354f14a02224c2ce66c
2019-10-17 18:03:00 -07:00
Fred Gylys-Colwell
e03739585f Merge "Update build_and_run script" 2019-02-21 20:18:46 +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
Fred Gylys-Colwell
6c4a10ea15 Update build_and_run script
Merge from Widevine repo of http://go/wvgerrit/73024

This updates the build_and_run_all_unit_tests.sh to only build a
predefined list of tests.  This prevents the accidental inclusion of
android.hardware.drm@1.2-service-lazy.widevine.rc.

Bug: b/123885511
Test: Unit tests build and extra library does not.
Change-Id: I4368817103720976de2b21de2591a0712944c8d0
2019-02-20 17:21:45 -08:00
Adam Stone
9f31068de6 Merge "Add a metric decorator around cdm engine" 2019-02-04 17:55:35 +00:00
Adam Stone
46eecb6b80 Add a metric decorator around cdm engine
[ Merge from http://go/wvgerrit/69105 ]

This adds a metric collecting decorator class around cdm engine. This
implementation uses a templated decorator. The decorator enables:

1) Wrapping the CDM Engine methods to capture timing and error
information.
2) Allows use of a mock CDM Engine for testing.

Test: Unit tests. GPlay manual testing and GTS tests.
BUG: http://b/64724336
Change-Id: I5e4a0f552974fab1939bc7ab02719a1f5849cf3f
2019-02-01 10:32:44 -08:00
John W. Bruce
a1b5b42d55 Add a Reader-Writer Lock
(This is a merge of http://go/wvgerrit/70666)

We need a reader-writer lock implementation in order to make use of the
new threading guarantees in OEMCrypto v15. However, we do not have
access to an STL reader-writer lock due to only being on C++11. This
patch adds a home-grown reader-writer lock, as well as tests to verify
that its behavior is sound.

Bug: 70889998
Bug: 118584039
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: Iaddcefb50e72452fbd27d04879eacf775484e675
2019-01-29 13:41:38 -08:00
Srujan Gaddam
4c5c4caf66 Add detail about L3 initialization
Bug: b/70299597
Merge of http://go/wvgerrit/67304
Test: Android, CE CDM, and Linux tests

There's a few different things that can go wrong in the L3
initialization, with seeding and device key failures among others. They
should be recorded in metrics to track. Along the same lines, since
multiple errors can happen in conjunction, metrics needs to change to
add more fields for errors. This CL also adds the
hidl_metrics_adapter_unittest to the Android test scripts.

Change-Id: Ie5bcf81bbe294a1136c58410f90087a13b3d911d
2018-12-14 11:32:19 -08:00
Rahul Frias
caa8c99752 Push generic_crypto_unittest to the device
[ Merge of http://go/wvgerrit/68066 ]

This got dropped as a side-effect of b/120519038 and causes only
some of the WV unit tests to be executed. Oops.

b/120519038
Test: WV unit/integration tests

Change-Id: If256af0f7e620006642a98a1bbecb5a55da7090c
2018-12-09 02:34:18 -08:00
Rahul Frias
7653f2dc15 Allow tests to take serial number as a parameter
[ Merge of http://go/wvgerrit/67583 ]

The new command formats are
$ build_and_run_all_unit_tests.sh [-j <num>] [-s <device_number>]
$ run_all_unit_tests.sh [-s <device_number>]

Bug: 120519038
Test: WV unit/integration tests with a single device and with two devices
      connected (with and without specifying a target serial number)

Change-Id: I518038c3fc178a7eb658fcd4cf82dd13dfa7131f
2018-12-04 23:33:51 -08:00
John W. Bruce
fb4d53bae6 Replace shared_ptr With std::shared_ptr
(This is a merge of http://go/wvgerrit/65783)

Straightforward patch to replace our shared_ptr implementation with
std::shared_ptr, which works identically for all our use cases.

Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I9e8624dd3cab70a45941a45eb553c1ea0c077d2f
2018-11-14 10:50:34 -08:00
Fred Gylys-Colwell
b849630a6f Fix generic crypto tests
Merge from Widevine repo of http://go/wvgerrit/56524

Test: unit tests, including generic crypto tests, pass.
Bug: 72354901 Fix Generic Crypto tests.
Change-Id: I39404424acb2d896afe06c461a02e3664c0f45de
2018-09-18 16:33:11 -07:00
Rahul Frias
5d690be108 Merges to android Pi release (part 11)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Get System ID From OEM Cert

  Author: John W. Bruce <juce@google.com>

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

  (This is a merge of http://go/wvgerrit/30220 .  However, it has been
  significantly modified in the merge due to needing to support both
  OpenSSL and BoringSSL.)

  Previously, extracting the system ID was only supported on Keybox-based
  systems. This patch adds support for extracting the system ID from the
  OEM Certificate chain on Provisioning 3.0 devices. This is done by
  getting the Widevine intermediate cert from the chain, finding the
  Widevine System ID extension in that cert, and extracting the value.

  The code that does the extraction is separate from any code that calls
  OEMCrypto so that it can be unit-tested in isolation. This patch adds a
  crypto_session_unittest test to do this unit-testing.

  Bug: 34776194
  Test: crypto_session_unittest
  Test: widevine_ce_cdm_unittest

* Remove unique_ptr from oemcrypto mod mock

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

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

  Because we can't have C++11.

  Bug: 69935608

* Update CHANGELOG.md

  Author: Gene Morgan <gmorgan@google.com>

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

   - Add items about adapter support.
   - Add mention of SRM support.

  Merged from cdm_partner_3.5
  (Change-Id: I6d891e157edc3afb2797bf281ef3f06bdb8fe474)

* Add Adapter for OEMCrypto v13 to v12.

  Author: Gene Morgan <gmorgan@google.com>

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

  Also fix OEMCrypto_LoadKeys() definition broken by wvcl/38160
  (srm_requirement param).

* Allow certain warnings in protobuf build.

  Author: Gene Morgan <gmorgan@google.com>

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

  maybe-uninitialized is triggered in release build. Allow it.

* Enable -fPIC for jsmc.c build.

  Author: Gene Morgan <gmorgan@google.com>

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

  -fPIC was removed for common c/c++ build rules. Add it back.

* Missing OEMCrypto_LoadKeys param in static adapter.

  Author: Gene Morgan <gmorgan@google.com>

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

  srm_requirement param was omitted in v11 static adapter.

* Remove OEMCrypto v12 specification.

  Author: Gene Morgan <gmorgan@google.com>

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

* Update documentation for v3.5.

  Author: Gene Morgan <gmorgan@google.com>

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

* Added padded preprov key for 7880

  Author: Srujan Gaddam <srujzs@google.com>

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

  Bug: 68765915

* Change overrides in CE L3FileSystem

  Author: Srujan Gaddam <srujzs@google.com>

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

  The 'override's are changed to the macro defined in override.h to
  be gnu++98 compliant.

* Use source android level3 + add cache_flush call

  Author: Srujan Gaddam <srujzs@google.com>

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

  I put both changes in this CL since I have to generate Level3 libraries
  for both anyways. The first change involves shifting from using a
  prebuilt static library to using an obfuscated source library output
  from the Haystack tool on google3. The second change is from here:
  https://critique.corp.google.com/#review/176536782, and addresses
  b/69387416. Since the cache_flush function wasn't being used, the
  execution on Angler gave inconsistent segfaults, which this CL fixes.

  Verified on Angler, Sailfish, and Linux.

  11/27/17: Added mips and mips64 libraries.

* Make CDM result codes constexprs

  Author: Rahul Frias <rfrias@google.com>

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

  The values in the enumeration list of CdmResponseType error codes
  were earlier implicit. Comments were added to denote the actual
  values. This changes to make it fixed values, which makes it slightly
  more error prone, but cleaner when errors are retired.

* Change watchdog timer to 2 minutes

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

  This relaxes the watchdog timer around the level 3 oemcrypto
  initialization to 120 seconds.  There are also a couple of new log
  messages at the end of initialization and at termination.

  Library for arm updated:
  level3/arm/libwvlevel3.a       Level3 Library 4445 Oct  4 2017 17:06:25

  Bug: 65379279

  Merged from https://widevine-internal-review.googlesource.com/35480

* Add test to get service certificate from server.

  Author: Gene Morgan <gmorgan@google.com>

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

  This was extracted from Ic38dd27d06dc7528ae4cd995da4261fe6c34ad55

* Add watch dog timer to OEMCrypto L3

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

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

  This code adds a watchdog timer to the level 3 initialization.  If
  initialization does not finish within 5 seconds, the process
  will abort, printing a small amount of debugging information.

  arm/libwvlevel3.a Level3 Library 4445 Sep 11 2017 14:05:15

  Test: unit tests on bullhead. Video on Play Movies.
  GTS tests run on loop overnight.

  Bug: 65379279
  Merged from https://widevine-internal-review.googlesource.com/33540

* Remove libwidevinehidl_utils dependency

  Author: Rahul Frias <rfrias@google.com>

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

  libwvdrmcryptoplugin_hidl has a dependency on libwidevinehidl_utils
  which was introduced due to an out of order merge from oc-mr1-dev
  to master.

  Bug: 69573113

* Automatically generate log location information

  Author: Rahul Frias <rfrias@google.com>

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

  Currently class and method names are manually added to each log message
  in the CDM on android and some other platforms. This change prepends
  log messages with file name, line number and function name automatically.

  The code is platform specific so it can be enabled and the precise
  format configured on a per-platform basis.

  As an example, here is a log on android before the change,

  11-01 02:48:48.658 D/WVCdm   (32198): CryptoSession::Open:
  Lock: requested_security_level: Default

  and after,

  11-01 02:48:48.658 D/WVCdm   (32198): [crypto_session.cpp(1108):Open]
  Lock: requested_security_level: Default

  A follow on CL will remove the manually added class/method information.

  Bug: 9261010

* Fix BoringSSL Compatibility of oec_session_util.cpp

  Author: John W. Bruce <juce@google.com>

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

  A previous change inadvertantly used APIs from OpenSSL that do not exist
  in BoringSSL in oec_session_util.cpp. As a temporary fix until we can
  move all targets to BoringSSL, this patch switches that file to use
  conditional compilation to choose the correct API depending on the
  library in use. It does not otherwise change the behavior of the file.

  Bug: 67908123
  Test: wv_ce_cdm_unittest on x86-64
  Test: linux_unit_tests

* Create local shared_ptr implementation

  Author: Gene Morgan <gmorgan@google.com>

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

  Derived from protobuf version, which came from google3.
  Removed locking (not thread-safe) and removed weak pointers (not
  needed for usages in CDM).

  Locking can easily be added if needed.

* Revert C++11 usage - back to gnu++98

  Author: Gene Morgan <gmorgan@google.com>

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

  These changes roll back C++11-specific constructs:
    std::unique_ptr -> std::auto_ptr
    container initializers
    nullptr -> NULL
    std::shared_ptr to local shared_ptr
    compiler flags (-std=c++11 -> -sdt=gnu++98)

  NOTE: the "local" shared_ptr implementation is temporarily
  a direct reference to the shared_ptr implementation in
  third_party/protobuf. This has been fixed (implementation
  extracted and moved to core/include) in CL 37600.

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

Change-Id: Ie09ecb970aa06fe9301ac255375ca7d8e7ead8bc
2018-01-16 19:33:36 -08:00
Rahul Frias
8b416ae165 Merges to android Pi release (part 10)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Level3 cleanup for SHA + field provision headers

  Author: Srujan Gaddam <srujzs@google.com>

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

  Moved some redundant macro and struct definitions out of hmac.cpp and
  sha.cpp into a separate header file to make the build easier and
  cleaner. Also cleaned up unnecessary includes and method signatures
  in field_provision.h.

* Address CDM_All_Tests failures

  Author: Rahul Frias <rfrias@google.com>

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

  CDM engine tests for CE CDM occasionally fails when CDM_All_Tests
  is run by the build server. The failures are due to a nonce generation
  error. If provisioning fails due to a nonce generation error, a delay
  followed by a retry will be attempted.

* Update OEMCrypto version to 13 in cdm.gyp

  Author: Gene Morgan <gmorgan@google.com>

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

* Use per-session service certificates for licensing

  Author: Rahul Frias <rfrias@google.com>

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

  These changes allow for service certificates to be specified on a
  per-session basis rather than use one common to a CdmEngine instance.

  This also allows for a service certificate request and response handling
  when allowed on the platform, when privacy mode is enabled and a service
  certificate is not provided.

  Request license tests accept a service certificate command line
  parameter in hex (ascii). Earlier it expected it in binary.

  Bug: 68328352

* Refactor service certificate parsing

  Author: Rahul Frias <rfrias@google.com>

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

  Service certificates may still be set in CdmEngine but service
  certificate requests and responses have been moved from CdmEngine
  to ServiceCertificate. This allows them to be called from lower
  in the heirarchy (a class that CdmEngine depends on).

  Bug: 68328352

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

  Author: Gene Morgan <gmorgan@google.com>

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

  This reverts commit 2d3fb5c4c8f4cf5c986ee43723914a23cf76e8f0.

* Modified scripts/makefiles for L3 build

  Author: Srujan Gaddam <srujzs@google.com>

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

  Changed build-android-haystack.sh and make_fastball_libwvlevel3.sh
  to build using the new liboemcrypto.cpp file. Also changed
  makefiles to build using the new file. Renamed liboemcrypto.cc to
  liboemcrypto.cpp to make it consistent across android and CE CDM. Added
  static libraries that were rebuilt using this change.

* Added android implementations for Level3

  Author: Srujan Gaddam <srujzs@google.com>

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

  Moved getUniqueID and added Level3FileSystem implementations for
  android. Also deleted redundant and unnecessary methods from
  anroid_keybox.cpp.

* Refactored getUniqueID and updated libl3oemcrypto.cc

  Author: Srujan Gaddam <srujzs@google.com>

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

  Renamed getUniqueID header and added comments to make it clear what the
  function is doing. Also removed obfuscation of the method name since it
  is implemented by the partner. Updated the libl3oemcrypto.cc file to
  reflect the change as well as be obfuscated.

* Moved clear_cache function out of entry_points

  Author: Srujan Gaddam <srujzs@google.com>

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

  clear_cache function is unobfuscated and relies on compiler flags to
  work properly, and therefore should be removed from the
  libl3oemcrypto.cpp file and linked during the final build.

* Minor gyp changes and added L3 build file

  Author: Srujan Gaddam <srujzs@google.com>

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

  Gyp changes to cdm_unittests.gyp to make the test Level3FileSystem build
  only on a level3 build and to oec_level3.gyp to be compatible with the
  changes to the x86-64 platform settings changes (and to use -Wno-unused
  to catch all unused warnings the libl3oemcrypto.cc might cause). This
  change also includes an x86-64 libl3oemcrypto.cc so a Level3 OEMCrypto can build.

* Merge CE & Linux file system/factory + dynamic adapter changes

  Author: Srujan Gaddam <srujzs@google.com>

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

  This CL merges the changes from
  I27f5037e4fcea94abd84181f55053843b68f3e8d - it adds the CE
  implementation for the file system, as well as the factory methods
  needed to build the file system (and their implementations for both CE
  and linux). As part of the merge, since the Linux build relies on the
  dynamic adapter, that was fixed and gyp changes were made to reflect the
  change.

* Cherry pick change to retrieve/save provisioning cert

  Author: Srujan Gaddam <srujzs@google.com>

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

  This is cherry pick from level3-dev-3.3 of a merge of
  I4f5dc5c216fa916e0bca0631c4ceda68859baf1d to save the
  certificate for future tests with the current test host setup.

* Merged changes of usage/linux impl of L3FileSystem

  Author: Srujan Gaddam <srujzs@google.com>

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

  This is a merge of change I15d38b3c36933d061d168e0ec30bcefd0182f32d. It
  also adds a similar change in usage of L3FileSystem write for a line in
  usage_table.cpp.

* Add cdm build changes for new Level3 build

  Author: Srujan Gaddam <srujzs@google.com>

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

  Original CL: Ib611cf8a8589afa5cd25d6dc5b0aa43922cfda1e

  Adds level3 oemcrypto library for static adapter. Includes changes to
  gyp files to choose between oemcrypto libraries. Also includes changes
  to the dynamic adapter, level3 headers, and entry_points to be
  compatible with the function signature differences when using the
  static adapter.

* Merge OEMCrypto Level3FileSystem interface

  Author: Srujan Gaddam <srujzs@google.com>

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

  This merges in the interface for the Level3FileSystem object from
  level3_dev_3.3 as well as the linux implementation. Furthermore, this
  merge includes changes in properties and gyp files to allow compilation.
  The associated changes are I3f1c58f0e3782de0669a96725a38673a26cc1a49,
  I9fb2d10b0f966896bea685166c6b6b2e33c995dd, and
  I4c87a5412a8a022fa9cfba43f33bd4d683e61536.

* Merged misc. changes to Level3 files

  Author: Srujan Gaddam <srujzs@google.com>

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

  Continuation of I03d3aa1a308f2f010dcb6f5e15f927e81e42925b. These changes
  are miscellaneous changes from level3-dev-3.3 involving include
  statements, Caligo compatibility, and new Level3 signatures from changes
  Ibc5befd492b295970e839f3481e2b512b52dcb08 and
  If599e62c72b5eb40c53633cd72a4d20dc859ee52.

* Merged change involving getUniqueId()

  Author: Srujan Gaddam <srujzs@google.com>

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

  This is a merge from level3-dev-3.3. This change
  (Ibc5befd492b295970e839f3481e2b512b52dcb08) involves
  separating out the method getUniqueId() from the linux_ and
  android_keybox.cpp. This was done so that clients can
  supply the necessary implementation for the method.

* Merged needle file changes from level3-dev-3.3

  Author: Srujan Gaddam <srujzs@google.com>

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

  Continuation of I3dbf34bab526945720280f819dd3212ae982d2f7. These are
  changes (Ibc5befd492b295970e839f3481e2b512b52dcb08) involving the
  compiled needles for Haystack. Major changes include function signature
  changes, adding non-state needles automatically, and include statements.

* Merged keybox/usage table access and function sigs

  Author: Srujan Gaddam <srujzs@google.com>

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

  These are changes from level3-dev-3.3. They involve changing function
  signatures/include files for the new Haystack runtime
  (Ibc5befd492b295970e839f3481e2b512b52dcb08). They are also
  related to change I0285e6d85e80b06b7df1ed298cd1145a6c9c4842. Keybox and
  usage table file names are replaced with constant needles. Furthermore,
  a state needle was added that removes the OldUsageTable file. In
  addition, this CL includes removals of method references that are now
  stale due to the introduction of change
  I9fb2d10b0f966896bea685166c6b6b2e33c995dd.

* Android unit test build fixes

  Author: Srujan Gaddam <srujzs@google.com>

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

  Removed crypto_session_unittest from build script (introduced
  in http://go/wvgerrit/32824), since crypto_session.cpp requires
  some changes to be merged over from oc-mr1-dev (b/64456400).
  Added oemcrypto_session_tests_helper.cpp to the oemcrypto test
  makefile so the oemcrypto unit tests can link in the
  methods from the refactor in http://go/wvgerrit/36562.

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

Change-Id: I7e45901a151e51da96d192d359edddc5fe74946e
2018-01-16 19:32:22 -08:00
Rahul Frias
81d607c008 Merges to android Pi release (part 9)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Make Android NDK Builds Work With Latest BoringSSL

  Author: John W. Bruce <juce@google.com>

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

  The latest updates to BoringSSL require C99 or later. Our NDK-based
  builds (OEMCrypto Variants & Fastball) were not specifying a C standard.
  This patch adds compiler flags so that C files are compiled as C11 now.
  Note that this is about the *C* standard in use, not the *C++* standard,
  which this patch leaves untouched.

  BUG: 67907873
  Test: build_android_mock.sh

*  Update BoringSSL to f7412cb072cc6b1847140e0c4f8b3ceeccd0e708

  Author: John W. Bruce <juce@google.com>

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

  This is the result of running UPDATE_BORINGSSL.sh. Future runs of this
  script should produce much smaller sets of changed files, but because
  the BoringSSL revision already in this directory was so old and
  contained many extraneous files from the Android operating system, the
  set of changed files is extensive this time.

  BUG: 67907873

* Refactoring the build files.

  Author: Vasantha Rao Polipelli <vasanthap@google.com>

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

  Move all common build dependencies to .gypi so that all fuzz test
  binary targets can be added to .gyp file without repeating code.

* Introduce service certificate request property

  Author: Rahul Frias <rfrias@google.com>

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

  Platforms differ on whether they allows service certificates to be
  requested if privacy mode is enabled and a certificate is not present.
  This property allows behavior to be configurable.

  Generating the service certificate request will be introduced
  in a follow on CL.

  BUG: 68328352

* Deprecate using keyboxes as identification

  Author: Rahul Frias <rfrias@google.com>

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

  Previously some platforms supported using keyboxes rather than
  certificates as the identification tokens in the license request
  message. All platforms that share core CDM code of the master branch now
  either provision using a keybox and use a DRM certificate or an
  OEM certificate as identification. No future usage of keyboxes
  as identifying tokens is planned.

  Since the platform property use_certificates_as_identification
  is always set to true, the negative code paths are never taken and
  can be removed.

* OEMCrypto_GenerateSignature API Fuzz Test.

  Author: Vasantha Rao Polipelli <vasanthap@google.com>

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

  - The first automated API fuzz test.
  - Also sumitting the corpus for the API fuzzed.

* Add Script to Update BoringSSL from Source

  Author: John W. Bruce <juce@google.com>

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

  Adds a script to third_party/boringssl/ that, when run, deletes all the
  auto-generated files in the generated/ directory and regenerates them
  from scratch, starting from the latest public HEAD of BoringSSL.

  Bug: 67907873

* Fix Fastball / OEMCrypto Variant BoringSSL Makefiles

  Author: John W. Bruce <juce@google.com>

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

  Previously, when moving the BoringSSL source within the tree, I was not
  able to verify that I had not broken the NDK-compatible makefiles used
  by Fastball because that build is broken on master. I had to make a
  best-guess as to how they should be updated and hope.

  Now, however, I have been informed that the OEMCrypto Variants also use
  these makefiles, and I have been able to use that build to find where I
  broke them and get them fully working.

  Bug: 67386164
  Test: build_android_mock.sh

* Add kit/ to BoringSSL Include Path for Fastball & OEMCrypto Variants

  Author: John W. Bruce <juce@google.com>

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

  When I moved the BoringSSL source in the tree, I updated the Android.mk
  files that pointed to it in order to build it. I did not realize that
  some makefiles outside that directory also contained hardcoded pointers
  into that directory. These references broke after the move. This patch
  fixes those paths to point to the new BoringSSL location.

  Bug: 67386164
  Test: build_android_mock.sh

* OEMCrypto Unit Test Refactor.

  Author: Vasantha Rao Polipelli <vasanthap@google.com>

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

  Refactoring OEMCrypto Tests so the Session Utility test code can be reused in fuzz tests.

* Reorder license server config table to match ids

  Author: Jeff Fore <jfore@google.com>

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

* Separate Hand-Written BoringSSL Files from Downloaded/Generated Ones

  Author: John W. Bruce <juce@google.com>

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

  I want to make updating BoringSSL as simple as possible for us going
  forward. A future commit will add a script that automatically downloads
  and sets up the latest version of BoringSSL. To facilitate this script,
  a clear distinction needs to be made between the files that can be
  downloaded with / regenerated from the BoringSSL source and the files
  that are maintained by us by hand.

  The version of BoringSSL in this change is exactly the same as the one
  already in this directory. It has just been moved one folder deeper.

  Bug: 67907873

* Remove BoringSSL Symlinks, They Are Confusing Gerrit

  Author: John W. Bruce <juce@google.com>

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

  There are some symlinks in the current copy of BoringSSL that are
  causing headaches when I try to upload future changes to Gerrit. These
  were inherited from the Android OS and are not used by our build
  anywhere. They would be wiped out when I update BoringSSL anyway, but
  wiping them out in a separate change before I upload any other changes
  avoids confusing Gerrit.

  Bug: 67907873

* Add group master key id to support sublicense master
  key rotation, and content identification.

  Author: Jeff Fore <jfore@google.com>

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

* OEMCrypto Fuzzer test framework

  Author: Vasantha Rao Polipelli <vasanthap@google.com>

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

  - Adding a sample fuzz test.
  - Adding build scripts for building the new Fuzz Tests to come.

  Design doc: go/oemcrypt_ref_impl_fuzz

* Build Mod Mock with C++ 11

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

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

  This should fix the android oemcrypto mock build:
  http://go/wvbuild/job/Android_OEMCrypto_Variants

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

Change-Id: Ic4d5be3118ef97e3f7d386149a2b5d9be8f0a87e
2018-01-16 19:31:28 -08: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
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
Adam Stone
466ec4e632 Create two new metric types to simplify metrics.
This is part one of a mult-part change to revise some metrics. Several
metrics are currently EventMetric type when they should be a simpler
type.

Test: Added unit tests for the new types. Also, re-ran existing tests.
Verified playback works with Google Play, and re-ran Widevine GTS tests.

Bug: 36220619
Change-Id: I2ec8fc355f66ad4834dd722aacd22541fb9c94ad
2017-08-24 12:19:17 -07:00
John W. Bruce
4d448d8165 Get System ID From OEM Cert
(This is a merge from http://go/wvgerrit/30220)

Previously, extracting the system ID was only supported on Keybox-based
systems. This patch adds support for extracting the system ID from the
OEM Certificate chain on Provisioning 3.0 devices. This is done by
getting the Widevine intermediate cert from the chain, finding the
Widevine System ID extension in that cert, and extracting the value.

The code that does the extraction is separate from any code that calls
OEMCrypto so that it can be unit-tested in isolation. This patch adds a
crypto_session_unittest test to do this unit-testing.

Bug: 34776194
Test: crypto_session_unittest
Change-Id: I3e273968208fb31ae6019ccc383b419625d1ae22
2017-07-26 20:31:39 -07:00
Rahul Frias
e61259e075 Support provisioning 3.0
[ Merge of http://go/wvgerrit/29004 ]

Enable support for provisioning with OEM certificates as root of
trust.

b/62972441

Test: WV unit/intgration test, cdm_feature_test and GTSMediaTestCases

Change-Id: I30576fc0bb68a873eeaaca03f6b9c89fa6a14327
2017-07-23 18:00:23 +00:00
Adam Stone
457aceb859 Fixes metrics collection during CdmEngine close.
This fixes a problem where a CdmEngine instance (and its sessions) could
be closed before its metrics could be collected. The change allows the
wv_content_decryption_module to extract metrics from instances about to
be closed. These are held until reported to the caller.

Test: Manually verified that collection is now occurring correctly. Also
added unit test: wv_cdm_metric_test.

This is a merge from wvgerrit/29069

Change-Id: If82bfd5cae3b72b9d14ab4741424a7ae7cc0a3a6
2017-07-12 13:07:15 -07: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
Rahul Frias
5da8da58f6 Corrections for big usage table support in L3
[ Merge of http://go/wvgerrit/26421 ]

* Corrects usage_table_header lifetime management. Earlier the
  UsageTableHeader class was a singleton tied to the CdmEngine lifetime.
  With SPOIDs there might be multiple concurrent CdmEngine objects.
  The UsageTableHeader class is now associated with OEMCrypto
  lifetime. There are two UsageTableHeader objects one for each L1 and L3.
  These get allocated/deallocated on OEMCrypto Initialization/Termination
  respectively.
* UsageTableHeader requires OEMCrypto, file read/writes and
  metric gathering to perform its required functionality. Because of the
  lifetime changes, CryptoSession, DeviceFiles and MetricsGroup objects
  need to passed to the methods rather than at Creation time.
* Miscellaneous fixes, when moving or deleteing entries.
* Adds usage_table_header_unittests.
* Addresses failures with request_license_test with secure stop in L3.

b/36858906
b/36855557
b/36048120
b/38341136
b/37100505
b/35946047

Test: Verified by unit and integration tests. Added new
      usage_table_header_unittests

Change-Id: I20e396ab2c0afbd14372dd93b969e5b0f1ccd291
2017-05-31 00:37:58 -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
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
Fred Gylys-Colwell
8274b77019 Include Metric Unit Tests
Merge from Widevine repo of http://go/wvgerrit/23842

This CL updates the android make files and test scripts to include the
two new unit test suites in metrics/test.

Change-Id: Ie31bdc3ae3709ab116d2a340ee5b55c7c12d1d33
2017-02-17 16:22:06 -08:00
Rahul Frias
ee5aff7706 Correct setting of service certificate.
[ Merge of http://go/wvgerrit/23380 ]

The service certificate was setup correctly if specified in mediadrm
properties. If instead the service certificate was later fetched from
the license service, it would not be marked as valid. This led to an
infinite loop of service certificate fetches and processing. This
prevented the license from being fetched and playback failures.

b/34638410

Test: Verified by new service certificate unittests + Hulu playback
using fugu.

Change-Id: I2a4f8754614fccdad3c80d3e13fba0b44d177d61
2017-01-27 02:44:38 -08:00
Fred Gylys-Colwell
3147ad3265 Remove missing tests from build_all_test script
Merge from Widevine repo of http://go/wvgerrit/23180

The previous CL removed entry_writer_test and
circular_buffer_test. This CL updates the android build and run alll
unit test scripts.

Change-Id: Ib41046d0f224899f4d1d2742f07c030f7ce6b084
2017-01-23 19:54:07 +00:00
Fred Gylys-Colwell
eb3f8b786a File util, generic crypto, and key query
This CL merges several CLs from the widevine repo:

http://go/wvgerrit/18012 Add support for querying allowed usage for key.
http://go/wvgerrit/17971 Add per-origin storage.
http://go/wvgerrit/18152 Add OEMCrypto's generic crypto operations to CDM.
http://go/wvgerrit/17911 QueryKeyControlInfo => QueryOemCryptoSessionId

Note: numbering in wv_cdm_types.h was added in this CL and will be
back ported to wvgerrit in a future CL.

Change-Id: Idb9e9a67e94f62f25dc16c5307f75a08b3430b64
2016-09-14 16:43:07 -07:00
Fred Gylys-Colwell
a4ebdf80b5 Push android unit tests to /data
Merge of http://go/wvgerrit/17652

This CL changes the android/build_and_run_all_unit_tests.sh script to
push exectuables to /data if it can't push to /system/bin.

The script run_all_unit_tests.sh will check if test files are in /data
and run those first, if not, it runs the files in /system/bin.

This change is needed to test unit tests on devices where /system/bin
is a read only file system, even after running "adb remount".

This CL will help verify, but will not fix
b/27678092

Change-Id: Ia0fe8c2e68722f58c2626f22113abdbdc8c5e408
2016-05-02 15:16:14 -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
Aaron Vaage
a249c67504 OEMCrypto Profiler
This CL is a merge from the widevine repo of:
http://go/wvgerrit/16491 Circular Buffer
http://go/wvgerrit/16512 Circular Buffer Tests
http://go/wvgerrit/16493 Entry Writer
http://go/wvgerrit/16495 Profiled Scope
http://go/wvgerrit/16500 Stats Collection
http://go/wvgerrit/16543 Disallow Stats Copy or Assign
http://go/wvgerrit/16514 Moving OEM Function Enum
http://go/wvgerrit/16501 Defining Session Interface
http://go/wvgerrit/16502 Session Definitions
http://go/wvgerrit/16573 Remove code to num bytes table
http://go/wvgerrit/16556 Connecting Profiler to Profiled Scope
http://go/wvgerrit/16557 Android Reading Profiler History
http://go/wvgerrit/16574 Adding Get Stats Method
http://go/wvgerrit/16606 Seperating Session Parsing
http://go/wvgerrit/16607 Adding get stats method to DRMPlugin
http://go/wvgerrit/16608 Fixing Linux Build Failure
http://go/wvgerrit/16612 Stop Clearing History
http://go/wvgerrit/16613 Accessing profiler information using session id
http://go/wvgerrit/16614 Making All Session Subsets of Global Session

BUG: 25123303
BUG: 26027857
Change-Id: Ie2422e644aa631871852ea0e461695aeb7060f88
2016-01-27 10:14:46 -08:00
Fred Gylys-Colwell
34dfb112f1 Remove gtest and boringssl from android unit test build script
Merge of http://go/wvgerrit/16300

This CL removes gtest and boringssl from
build_and_run_all_unit_tests.sh.  Instead, we change each "mm"
to "mm || mma".  Thus, if mm fails, we assume it is because of a
missing dependency and try mma which builds all dependencies.

bug: 25297287

Change-Id: Ief76fa4077e4cd8653da9306cc92ed14cf080564
2016-01-13 18:14:12 -08:00
Rahul Frias
9d0c8256a2 Support for IPv6 in HTTP socket and BufferReader unittests
* Add Apple MD5 support in DeviceFiles

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

  Patch courtesy of Spotify.

* Changing vague BufferReader log message

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

  Amending the buffer reader log message for null parameters in the
  read function to say the type of parameter to help tell the
  difference between Read2, Read2s, Read4, Read4s, Read8, and
  Read8s.

  Bug: 23619044

* Fix HTTP socket tests

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

  This fixes the build on Jenkins. I missed these when I updated HTTP
  socket because they are not part of the CE CDM test suite.

* Update HttpSocket for IPv6

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

  Previously, HttpSocket made assumptions about IPv4.
  This CL updates this utility to be agnostic to IPv4 vs IPv6.
  If our servers start resolving to IPv6 addresses in future,
  our tests can now handle this transparently.

* Removed low level warnings from PSSH

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

  Unneeded warnings in parsing PSSH and in buffer reader
  were appearing in the logs. LOGW commands were replaced
  with LOGV.

  Bug: 23419359

* BufferReader unit tests and hardening.

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

  Added unit tests for public-facing functions.
  Added protection against null or negative parameters.

  Bug: 23419008

Change-Id: Ia44100a2d1bafe68986ae9a0793214885b21e61e
2015-10-01 14:32:11 -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
KongQun Yang
e3f668785e Exit on error when build and run Android unit tests
Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13200/

Change-Id: Ifd785a9b30293746f0ae0262b37f03bc905a5e09
2015-03-06 16:57:01 -08:00
John "Juce" Bruce
12821d5968 Add Max-Res Decode Engine to CDM Core
(This is a port of http://go/wvgerrit/11555 from the Widevine CDM
repo.)

Bug: 16034599
Change-Id: Ie69afac7d89e27623adbc84d2baebccf1d1ba6e6
2014-11-04 11:55:23 -08:00
Jeff Tinker
773ddd3864 Fix MediaDrmAPITest install command in test script
Change-Id: Ibf062788e26e75838875460718c665ea56a773aa
related-to-bug: 17080975
2014-08-20 11:21:56 -07: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
Rahul Frias
4819a26bd4 Fixes for query information and usage reporting
* The Usage APIs return usage reports from either L1 or L3 (if available).
* Correction to when usage reports are saved. In addition to other events
  they are now saved when keys are loaded, usage reports are released and soon
  after first decryption and periodically (60 seconds) after that,
  if decryption takes place.
* Usage reports now get deleted on an unprovision request.
* Policy timer is now started when offline licenses are restored.
* Usage session is now released, when a usage response is received.
* Usage tests ahev been enabled.
* Added CDM extended duration (integration) tests to test usage reporting
  and querying. These need to be run manually as they take a while (currently
  half an hour).

b/15592374

[ Merge of https://widevine-internal-review.googlesource.com/#/c/10800
  from the Widevine CDM repo ]

Change-Id: Ia817e03ebbe880e08ba7b4a235ecb82b3ff35fbf
2014-08-07 10:58:40 -07:00
Rahul Frias
7a933ee48e Merge of usage reporting and license changes from WV CDM repo
* CdmSession unittest and license request time changes
  b/15914199
  Merge of https://widevine-internal-review.googlesource.com/#/c/10597/

* Specify OEMCrypto API version in client capabilities
  b/15388863
  Merge of https://widevine-internal-review.googlesource.com/#/c/10616/

* Report start and last play time in license request
  b/15995227
  Merge of https://widevine-internal-review.googlesource.com/#/c/10617/

* Respect can_play flag
  b/15330338
  Merge of https://widevine-internal-review.googlesource.com/#/c/10619/

* Restore offline session information
  b/16009274
  Merge of https://widevine-internal-review.googlesource.com/#/c/10641/

Change-Id: I17fdc309efbc1d44385a86a368df11b1349b29c2
2014-07-02 17:17:38 -07:00
Jeff Tinker
38cc7122fd Improve unit test build script
Make the build_and_run_all_unit_tests script push individual tests
instead of doing a full sync, makes it easier to run unit tests
against release builds.

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

Change-Id: I8efda77be9ab863f616fab88c4782b7c9edb8858
2013-12-12 10:58:42 -08:00