Commit Graph

1505 Commits

Author SHA1 Message Date
Rahul Frias
cda1d7895f Stop Parsing the Command Line in InitLogging
* Add dummy comments to blank files

  git5 patch does not seem to handle blank files well.  This CL will
  allow the new CDM interface to be tested on iOS before it is
  officially merged in google3.

* Stop Parsing the Command Line in InitLogging

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

  This change removes the parameters from InitLogging() and removes the
  code in the Linux implementation that was using them.

Change-Id: I65849a89a2fac10cfc86eb16165bfcad468140aa
2015-09-30 13:45:38 -07:00
Rahul Frias
9dd196e0ec Add PolicyEngine::SetLicenseForRelease()
* Add CE test for incomplete remove()

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

  This depends on I064c053dd986a432865163aed5c9c3493f14340b to get
  PolicyEngine to implement the EME semantics expressed in this test.

  This also excludes another error code from causing an error log in
  CdmEngine::AddKey, because this is actually an expected, handled
  error in the CE CDM and it causes some confusing noise during testing
  and development.

* Drop CdmEngine test main

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

  The command-line arguments are no longer in use anywhere, and
  dropping the CdmEngine test's main allows me to add those tests to
  the CE test suite.

* Add PolicyEngine::SetLicenseForRelease()

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

  In order to implement the EME-specified behaviors for load() &
  remove(), some small changes are required in PolicyEngine.

  According to EME, you should be able to remove() an active session.
  This means that releasing a persistent session is not a separate load
  operation.  EME also states that the keys should be expired when this
  is done.

  Remove() is implemented using GenerateKeyRequest(type=release).  This
  leads to CdmLicense::RestoreLicenseForRelease, which in turn calls
  PolicyEngine::SetLicense.  When removing an active session, the policy
  engine will have keys already loaded.  The old behavior would cause
  these keys to be reloaded.  We need them to be expired, instead.

  Once a remove() has been started, the keys should never be loadable
  again.  If a release confirmation is not received by the CDM, the
  session should still be loadable.  EME states that once a session has
  had remove() called, then is loaded again later, there should be no
  keys.  Not that they should be expired, but not present.  The old
  behavior would cause these keys to be reloaded as usable.

  This new method allows EME remove() and load() behaviors to be
  faithfully implemented in the CE CDM.  When removing an active
  session, the old keys become expired.  When removing a partially-
  removed, newly-loaded session, no keys will be loaded at all.

  This change does not affect any existing tests in core/.

  New tests have been added in PolicyEngineTest to cover the behavior
  of the new method.

Change-Id: Idd61487c277c9eadb4a044cb2a563e151442a548
2015-09-29 08:58:23 -07:00
Rahul Frias
0f579c519f Merge "Reject session clobbering and namespace fixes" 2015-09-29 00:48:23 +00:00
Fred Gylys-Colwell
297cac93c0 Merge "Level 3 Build With Android Emulator" 2015-09-28 23:02:35 +00:00
Rahul Frias
cdf309b9f4 Reject session clobbering and namespace fixes
* Reject session clobbering.

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

  This fixes a bug in I17de92b3e682c9c731f755e69466bdae7f560393 in which
  sessions can be clobbered by a forced session ID.  This bug manifested
  in subtle test failures which involved repeatedly creating sessions.
  This was traced to OEMCrypto not being terminated, then upward to a
  leaked CryptoSession and CdmSession, and then finally to clobbered
  session IDs.

  To avoid the bug in future, first, reject duplicate session IDs.
  Second, change the OpenSession API to make forced IDs explicit.

* Fix unit test namespaces.

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

  This fixes some odd errors that occur when linking multiple test
  suites into one executable.  When two object files both contain
  a definition of wvcdm::MockCryptoSession, for example, one will win
  silently and cause the other's tests to misbehave and/or crash.

  The solution is to put all mocks into an anonymous namespace, since
  each wvcdm::(anonymous)::MockCryptoSession is separate.

  In order to avoid lots of repetitions of wvcdm:: in the anonymous
  namespaces, all anonymous namespaces in unit tests now live inside
  or the wvcdm namespace.  This has been done even for tests which
  are not currently using mocks.

* Move timer and timer_unittest to Android.

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

  These are not used anywhere else.

Change-Id: I234f31e9b5c79061205728783596ebaff65e0aff
2015-09-28 15:54:22 -07:00
Rahul Frias
39f2fa2ab0 Merge "Make CdmProvisioningResponse const and DeviceFiles level support" 2015-09-28 22:44:34 +00:00
Fred Gylys-Colwell
c041acfed5 Level 3 Build With Android Emulator
Merge from widevine of http://go/wvgerrit/15778

This CL rebuilds the level 3 libraries with the android emulator
sdk_phone_*.  This seems to avoid problems with the x86 build using
incorrect compiler flags.

Versions:
level3/mips/libwvlevel3.a  Level3 Library Sep 28 2015 13:25:25
level3/arm/libwvlevel3.a  Level3 Library Sep 28 2015 13:18:25
level3/x86/libwvlevel3.a  Level3 Library Sep 28 2015 13:08:28

bug: 21766765
Change-Id: I0470d3ea55bf9fc18ff7c69f6f39d532c9865404
2015-09-28 15:36:35 -07:00
Fred Gylys-Colwell
4a34853ca1 Merge "Variable Length Key ID Tests" 2015-09-28 21:53:26 +00:00
Fred Gylys-Colwell
a9fe9bb38c Variable Length Key ID Tests
Merge from Widevine repo of http://go/wvgerrit/14973 and
http://go/wvgerrit/14573.

Some devices were failing the variable length key id tests, so they
were removed from Android while we decided whether the tests are too
strict for future releases.

This CL re-instates the tests with the understanding that the maximum
key id length is 16 bytes, as discussed in b/24469550.  If we decide
that it is OK to have longer key ids, then another CL will be needed
to test with those lengths.

bug: 21935358

Change-Id: Ic6b776a8b119daac961c71280994fcc944984d8a
2015-09-28 12:58:17 -07:00
Rahul Frias
4e047b8b0c Make CdmProvisioningResponse const and DeviceFiles level support
* Make CdmProvisioningResponse const.

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

  The lack of const on this reference seems to be a mistake, since the
  responses is never modified.  This also allows the new CE CDM to pass
  responses directly through from the caller.

* Let Properties determine DeviceFiles level support

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

  Non-Android platforms do not have multiple security levels, and so do
  not use the security level to construct a base path.

  Instead of requiring a known "security level" to construct a file,
  accept anything that platform Properties will accept as a base path.

* Drop Properties::GetSecurityLevel().

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

  This seems to be dead code.

Change-Id: I94a970279213100730d6e6c763558dbe386f936a
2015-09-25 19:05:02 -07:00
Rahul Frias
d5e3c89be8 Merge "Expose status, add backward compat in tests and remove unused code" 2015-09-26 01:19:57 +00:00
Rahul Frias
9c43416e13 Merge "Merge of CLs" 2015-09-26 01:19:24 +00:00
Adam Langley
f1258e9835 Use the shared-library version of libcrypto in libwvdrmengine.
Previously, libwvdrmengine was linking in the static version of
libcrypto, but libwvdrmengine itself is a shared library. This change
makes it depend on the shared-library version of libcrypto instead,
which gets PIC correct and other things.

Change-Id: I28aa71e2fcbb388f8514b1088110466edbc041a5
2015-09-24 18:48:46 -07:00
Rahul Frias
ba95515ae0 Expose status, add backward compat in tests and remove unused code
* Expose release and offline statuses in CdmEngine.

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

  This will allow me to make some intelligent decisions in the new CE
  CDM implementation without having to duplicate all the information
  known in the lower levels.

* Account for backward compat support in tests

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

  One test ensures that device path backward compatibility is working,
  while another assumes it is used.

  This fixes test results when
  Properties::security_level_path_backward_compatibility_support()
  is false.

  Previously, the CE CDM did not run these tests, and so this went
  unnoticed.

* Remove Lock::Try, which is not used.

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

Change-Id: Id18cf1f5b18c7322b8b636819276361af225734f
2015-09-24 10:16:34 -07:00
Rahul Frias
3343f886a3 Merge of CLs
* Move Properties::Init into platform-specific code

  This enables a refactor where property initialization for CE CDM will
  use values provided by the application during library initialization.

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

* Add Properties::AlwaysUseKeySetIds().

  When true, all sessions will have key set IDs and all session IDs
  will be the same as the corresponding key set ID.

  This will help the new CDM interface stick more closely to the EME
  APIs, in which there are no such things as key set IDs and sessions
  only have a single, random ID used for both streaming and offline.

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

* Reserve key set IDs in memory, rather than on the file system.

  This makes it more efficient to use key set IDs for non-offline
  sessions.

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

Change-Id: I765c3519619b17cc3c4ef95b1a6b125f479ee1d0
2015-09-23 23:34:42 -07:00
Rahul Frias
ae5397ebcd Merge "Prevent renewal license when can_renew is set to false" 2015-09-23 07:13:02 +00:00
Fred Gylys-Colwell
2057d49b3c Merge "Modify Code to Work with Clang/C++11" 2015-09-16 23:20:03 +00:00
Fred Gylys-Colwell
bf0c87e734 Modify Code to Work with Clang/C++11
Merge from widevine repo of http://go/wvgerrit/15659

The clang compiler is more strict about C++11. This is needed for
future Android work.

In particular, iostream no longer converts to bool automtically, so
those instances were replaced with ss.fail().

Arrays or structures that appear to be variable length need to be
placed last in a structure.  In oemcrypto_test a variable size
structure was replaced with an explicit buffer size, and a check was
added to make sure the buffer is not exceeded.

bug: 20893039
Change-Id: I5e25fc618dcf68262079c15554ee4ceae1858b8b
2015-09-16 15:58:33 -07:00
Rahul Frias
395f68456b Prevent renewal license when can_renew is set to false
[ Merge of https://go/wvgerrit/15670 ]

b/18459002

Change-Id: Idad43a621750ff01aee61e8d972957f364a698cf
2015-09-16 15:30:38 -07:00
Fred Gylys-Colwell
914e13067f Add Support for Baked-In Certificates
Port from the widevine repo of http://go/wvgerrit/15628

This change enables easy support for baked-in certificates. Platforms
using this feature need only change the supports_keybox property to
false, replace keys.cpp with the file provided by Google, and make
sure the cert.bin provided by Google is preinstalled in the storage.

To enable this, new files defining storage for the embedded private
key were added to MockOEMCrypto. When supports_keybox is false, these
are referenced to get the embedded private key. As this code is mostly
shared with the existing test utility function that loads the test
certificate, the shared code was moved to a helper. Also, the behavior
of the MockOEMCrypto implementation OEMCrypto_LoadDeviceRSAKey when
supports_keybox is false was changed from erroring to validating that
the "wrapped private key" is actually the magic value 0xDEADBEEF.

Bug: 23554998
Change-Id: I8b5d7b4d37b8ec80bb4342e441625cbc5046df89
2015-09-16 13:35:10 -07:00
Rahul Frias
ff6b79d945 Add integration tests to verify releaseAllSecureStops
[ Merge of http://go/wvgerrit/15477 ]

The fix was committed to mnc-dev 25a6185c84

b/23498809

Change-Id: I298ce3f1e52866f3998d964c97a588a06b36ea92
2015-09-14 11:07:20 -07:00
Rahul Frias
6af72cb3b4 Merge "Enable CDM integration tests to run against staging" 2015-09-11 20:44:02 +00:00
Rahul Frias
48feb576e6 Enable CDM integration tests to run against staging
[ Merge of https://go/wvgerrit/15534 ]

Added command line support and configuration information.
Removed secure transfer, full path and port options from the usage
message as they are not supported.

b/23593222

Change-Id: I7d4cdb4b4db543a6302c742bfc2d2572d75957bd
2015-09-10 14:13:10 -07:00
Rahul Frias
199cfb8f19 Make OEM Crypto API version available through mediaDrm properties
[ Merge of http://go/wvgerrit/15540 ]

b/22771529

Change-Id: I8a3d3b3d7a943c531ef0ff2c860442e0690b9175
2015-09-08 16:33:58 -07:00
Elliott Hughes
8b0a0ff046 am b4abf77e: Remove manual #include "AndroidConfig.h".
* commit 'b4abf77efc34e2409b122b65ff6be76216254929':
  Remove manual #include "AndroidConfig.h".
2015-08-28 20:59:53 +00:00
Elliott Hughes
b4abf77efc Remove manual #include "AndroidConfig.h".
That file (a) was always forced upon you anyway and (b) no longer
exists.

Change-Id: I5964a0420e9114419b62d5b98e7ecef6c5b48296
(cherry picked from commit c2d4ae15fbbb4ebee364449cf9693566e10d07a1)
2015-08-28 20:53:41 +00:00
Fred Gylys-Colwell
c94912d197 Compile Level 3 OEMCrypto on Emulators
Merge from Widevine of http://go/wvgerrit/15507

This change recompiles the oemcrypto libraries on the emulators
because those should have the "least common denomintor" of compiler
options.

New Versions:
android/level3/mips/libwvlevel3.a  Level3 Library Aug 27 2015 11:53:29
android/level3/arm/libwvlevel3.a  Level3 Library Aug 27 2015 11:43:45
android/level3/x86/libwvlevel3.a  Level3 Library Aug 27 2015 11:48:16

bug: 21766765
Change-Id: Ic69bacd71af835df940af1c21166b0ade57abf04
2015-08-27 11:57:08 -07:00
Rahul Frias
265fa9d9b2 am 178cadfc: am 25a6185c: Address releaseAllSecureStops crash
* commit '178cadfce145b6164d4ff7c693e996bf1536b98b':
  Address releaseAllSecureStops crash
2015-08-25 19:09:31 +00:00
Rahul Frias
178cadfce1 am 25a6185c: Address releaseAllSecureStops crash
* commit '25a6185c8434c62af73d2c6c91bda5fc50d20ca7':
  Address releaseAllSecureStops crash
2015-08-25 19:05:30 +00:00
Rahul Frias
25a6185c84 Address releaseAllSecureStops crash
[ Merge of http://go/wvgerrit/15474 ]

Changes to releaseAllSecureStops made use of a session that was
initialized only if getSecureStops had been previously called. If it was not,
accessing the session resulted in a segfault. This was uncovered by a change
in how the Netflix app invoked mediaDrm.

b/23498809

Change-Id: Ib426ae1830c3a42c5e0849f1b6e8bbfe0d2c74ff
2015-08-25 10:40:12 -07:00
Jeff Tinker
5530a792ab am 85f1e34a: (-s ours) am 6a7d526d: am c48fedc1: (-s ours) am af90b037: am 1827f14b: am c1447241: (-s ours) am 693f0813: am 87922237: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit '85f1e34a1cc63b988744e723cb68343b813a25fe':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-22 01:38:13 +00:00
Jeff Tinker
85f1e34a1c am 6a7d526d: am c48fedc1: (-s ours) am af90b037: am 1827f14b: am c1447241: (-s ours) am 693f0813: am 87922237: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit '6a7d526def295ed39d58562ca02a46c4801b8eed':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-22 00:41:21 +00:00
Jeff Tinker
cd628c1b90 am 6d19a7b0: (-s ours) am 6bf90ce0: am cee546e5: (-s ours) am bcf3a11f: am e5d4a0be: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit '6d19a7b031848460004d679c076965959f7604ed':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 17:30:09 +00:00
Jeff Tinker
6d19a7b031 am 6bf90ce0: am cee546e5: (-s ours) am bcf3a11f: am e5d4a0be: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit '6bf90ce0aed049ea6c2aec6085417fb6e234d3b6':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 17:23:46 +00:00
Jeff Tinker
6a7d526def am c48fedc1: (-s ours) am af90b037: am 1827f14b: am c1447241: (-s ours) am 693f0813: am 87922237: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit 'c48fedc14cb0a47bc99db89faf9b875525cd5fab':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 17:01:59 +00:00
Jeff Tinker
c48fedc14c am af90b037: am 1827f14b: am c1447241: (-s ours) am 693f0813: am 87922237: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit 'af90b037a4baa6e12ee2399c85c7e3d4b592498e':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 16:55:19 +00:00
Jeff Tinker
af90b037a4 am 1827f14b: am c1447241: (-s ours) am 693f0813: am 87922237: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit '1827f14b689c909973d8e859c8a7a00db7044bd7':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 16:40:47 +00:00
Jeff Tinker
1827f14b68 am c1447241: (-s ours) am 693f0813: am 87922237: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit 'c14472413260a6b233282a6ff3acb58b6571ab5c':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 16:27:34 +00:00
Jeff Tinker
6bf90ce0ae am cee546e5: (-s ours) am bcf3a11f: am e5d4a0be: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit 'cee546e501a3e2c0591f259bb25a114130d58eb0':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 15:58:06 +00:00
Jeff Tinker
cee546e501 am bcf3a11f: am e5d4a0be: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit 'bcf3a11f0fe87ef7b56c374ed89b91ed8a17f44b':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 15:46:33 +00:00
Jeff Tinker
c144724132 am 693f0813: am 87922237: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit '693f0813814b10bfd23bea578fa258255477b207':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 15:36:22 +00:00
Jeff Tinker
bcf3a11f0f am e5d4a0be: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit 'e5d4a0be30bac8fdba7194841084dcf61be6e8a2':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 15:34:51 +00:00
Jeff Tinker
693f081381 am 87922237: DO NOT MERGE Part of fix for libmedia OOB write anywhere
* commit '87922237de893b92c7b4d252999dd91d04470bd0':
  DO NOT MERGE Part of fix for libmedia OOB write anywhere
2015-08-21 15:28:57 +00:00
John Bruce
da6a221f91 am 67b5d921: am 0e1839ac: Merge "Do Not Clean Up Licenses As Aggressively" into mnc-dev
* commit '67b5d9216d192025ffe7d3e2e6ba82d76ee6942d':
  Do Not Clean Up Licenses As Aggressively
2015-08-20 22:22:28 +00:00
John Bruce
67b5d9216d am 0e1839ac: Merge "Do Not Clean Up Licenses As Aggressively" into mnc-dev
* commit '0e1839ac4d4b540f46db83684b436d400fe4a292':
  Do Not Clean Up Licenses As Aggressively
2015-08-20 22:13:15 +00:00
Jeff Tinker
e5d4a0be30 DO NOT MERGE Part of fix for libmedia OOB write anywhere
Prevent usage of client provided address on
non-secure devices spoofed as being secure.

b/23223325

merge of go/wvgerrit/15420 from widevine repo

Change-Id: I1d4f3a652b3d5e78fca508f92005cfa8df5ec6db
2015-08-20 21:56:50 +00:00
Jeff Tinker
87922237de DO NOT MERGE Part of fix for libmedia OOB write anywhere
Prevent usage of client provided address on
non-secure devices spoofed as being secure.

b/23223325

merge of go/wvgerrit/15420 from widevine repo

Change-Id: I1d4f3a652b3d5e78fca508f92005cfa8df5ec6db
2015-08-20 14:49:43 -07:00
John Bruce
0e1839ac4d Merge "Do Not Clean Up Licenses As Aggressively" into mnc-dev 2015-08-20 21:21:43 +00:00
Jeff Tinker
f0eb4b9045 am d38fc184: am 1319c433: Part of fix for libmedia OOB write anywhere
* commit 'd38fc184a7dc544d064d8086f5e72092debaa413':
  Part of fix for libmedia OOB write anywhere
2015-08-19 23:18:19 +00:00
Jeff Tinker
d38fc184a7 am 1319c433: Part of fix for libmedia OOB write anywhere
* commit '1319c43361cc8fdd3e2ce61db4185e38f128e76b':
  Part of fix for libmedia OOB write anywhere
2015-08-19 23:13:05 +00:00