Commit Graph

627 Commits

Author SHA1 Message Date
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
53463f292d Merge "Remove unused code from test methods" 2016-01-07 18:36:13 +00:00
Rahul Frias
0adf6e7b53 Remove unused code from test methods
[ Merge from http://go/wvgerrit/16406 ]

This was detected by static analysis tool cppcheck.

b/26348775

Change-Id: Icc6a55b9b4a1ffe882488ac069e3c3df2e796e91
2016-01-04 19:05:01 -08:00
Rahul Frias
42d96c362d Remove unused methods
[ Merge of http://go/wvgerrit/16405/ ]

Methods in string conversion and license request tests were not being used.
This was detected by static analysis cppcheck reports.

b/26349052

Change-Id: I44779abf6b6fdc01b5391bff7d47be1d20ef84d2
2016-01-04 18:40:58 -08:00
Fred Gylys-Colwell
1735b367f3 Level 3 OEMCrypto library
This CL contains the level 3 oemcrypto library built for android.  I
used the toolchain from the mnc-emu-release branch because I'm having
problems with the toolchain on master.

This includes the security patch API, and several bug fixes to the library.

Current versions:
mips/libwvlevel3.a  Level3 Library Dec 17 2015 21:26:57
arm/libwvlevel3.a  Level3 Library Dec 17 2015 21:09:47
x86/libwvlevel3.a  Level3 Library Dec 17 2015 21:19:15

http://go/wvgerrit/16371 Level 3 OEMCrypto library
http://go/wvgerrit/16315 Security Patch Level - haystack version
http://go/wvgerrit/16282 Correctly handle null pointer in GetKeyData
http://go/wvgerrit/16294 Initialize data for generation number
http://go/wvgerrit/16280 Correctly handle bad RSA key

bug: 26089773
bug: 26092100
bug: 26086944
Change-Id: I3ea1b5d219dae0c88deafa742f61d67e97297902
2015-12-18 11:18:16 -08:00
Fred Gylys-Colwell
a235a61e28 Merge "Close session before terminate" 2015-12-17 19:41:38 +00:00
Fred Gylys-Colwell
1744b5a779 Update stub file for mips 64 build
Merge from widevine of http://go/wvgerrit/16363

Add temporary OEMCrypto API to the stub file used by android mips 64
devices.

bug: 26213020
Change-Id: I4b71fd21c5cf5dbb14645f606586af54d03ccaea
2015-12-16 19:35:10 -08:00
Fred Gylys-Colwell
4a37b21a22 Close session before terminate
Merge from the widevine repo of http://go/wvgerrit/16362

A test class holds a default session that it expects to be able to
close in the tear down.  This was not true in the TimingTest because
it calls OEMCrypto_Terminate which closes all open sessions.

This CL closes the default session, and then reopens it again after
OEMCrypto_Initialize.

Change-Id: Ib4128ec3c0a33794c03aa934174cb6fff448483e
2015-12-16 17:26:26 -08:00
Fred Gylys-Colwell
ce6d392041 Unit Tests for Security Patch Level
Merge of widevine change http://go/wvgerrit/16249

This CL adds unit tests and reference code for the security patch
level, which is a new feature in OEMCrypto v11.  This CL also adjusts
the dynamic and static adapters to still run with devices that have a
v10 OEMCrypto.

The level 3 haystack code will be updated in a future CL.

bug: 26188985

Change-Id: I518ef46b4098cf3718fe0c0390bfb6825db4fb6b
2015-12-16 16:11:13 -08:00
Fred Gylys-Colwell
17faabee44 Fail early in oemcrypto unit tests
Merge from widevine of http://go/wvgerrit/16293

This CL adds ASSERT_NO_FATAL_FAILURE around many subroutines in the
oemcrypto unit tests.  This should help debug tradefed tests because
it will cause a test to stop after the first error.  This is important
for tests that are failing on OpenSession and then spewing garbage
into the log as every other ASSERT fails after that.

I also replaced the home-grown EXPECT_ALMOST with the standard
EXPECT_NEAR.  I also passed the file through clang-format to corect
whitespace problems.

Change-Id: I2c2c1c1dbeac234291dafc9fa8c23da8d270eb4e
2015-12-16 13:39:29 -08:00
Fred Gylys-Colwell
12db6099d2 Merge "Merge CE Device Changes" 2015-12-10 21:45:24 +00:00
Fred Gylys-Colwell
0dc746a380 OEMCrypto v11 Documentation and Headers
Merge from widevine repo of http://go/wvgerrit/16186

These are the OEMCrypto v11 documents and header files. I have updated
just enough code so that existing unit tests pass.  New unit tests,
the reference implementation, and the level 3 implementation are in
future CLs.

Change-Id: I9bbf1909e047f63a5877320a2d06740a3c4a3e32
2015-12-09 13:51:18 -08:00
Fred Gylys-Colwell
a99825b7aa Unit Test for OEMCrypto to Reject Future Key Control Block
Merge from widevine repo of http://go/wvgerrit/16250

The verification string in the key control block has an obvious
pattern that is incremented every time we update the API.  This CL
adds a unit test to make sure an implementation of OEMCrypto is not
casually accepting a future version of the key control block before
the API has even been defined.

Change-Id: I3f837f7346ef7de399441f5fcda9b13b65fa51f4
2015-12-09 09:58:36 -08:00
Fred Gylys-Colwell
6d7dcb8cba Updates to OEMCrytpo Mock
Squash merge from the widevine repo of several changes to oemcrypto
unit tests and the mock reference code.

http://go/wvgerrit/16264 Use unsigned int for count in usage table (more mock)
http://go/wvgerrit/16262 Use unsigned int for count in usage table (mock version)
http://go/wvgerrit/16247 Fix mock OEMCrypto_DeleteUsageTable
http://go/wvgerrit/16070 Fix OEMCrypto_GenerateRSASignature return values
http://go/wvgerrit/15991 Fix buffer overflow for 32-bit systems
http://go/wvgerrit/15993 Return Correct Value from OEMCrypto_RefreshKeys
http://go/wvgerrit/15880 Cast RSA_size() to int
http://go/wvgerrit/15831 Be strict about warnings for CE CDM

b/23729420
b/25221168

Change-Id: I97b91dfc672db8c586ae317977871b7d6afac4bb
2015-12-07 15:33:56 -08:00
Fred Gylys-Colwell
e4513f4a59 Merge CE Device Changes
This is a merge of the following changes made for CE devices in the
widevine share repo:

http://go/wvgerrit/16211 Only load offline session if needed in GKR
http://go/wvgerrit/16245 Unreserve IDs in reservation test
http://go/wvgerrit/16242 Re-enable WebM tests
http://go/wvgerrit/16240 Un-reserve reserved license IDs
http://go/wvgerrit/16190 Add temporary session type
http://go/wvgerrit/16189 Enforce license type and can_persist for storage

Change-Id: I592416f66c0d1286844266c01cc9b4906c7b6b05
2015-12-07 14:12:46 -08:00
Kyle Alexander
6886b1fa12 Add HDCP, HEVC and VP9 content samples to ExoPlayer
Change-Id: I8a181ce9f617df52b5dafb974c7891b24610fece
2015-11-30 10:14:37 -08:00
Edwin Wong
c1894e8fa4 Remove usage reports upon factory reset of device.
(This is a merge of http://go/wvgerrit/16162)

Usage tables on L3 devices are stored under IDM*. They will be removed
upon factory reset. However, we need to call OEMCrypto_DeleteUsageTable
for L1 devices because the usage tables are stored in secure storage.

bug: 25597957
Change-Id: I8533dfac60fad6ce7ddfd026a283633d6875dcf3
2015-11-20 17:34:34 -08:00
John "Juce" Bruce
64ad54fdb0 Update Widevine Android Version Number to 4.0
(This is a merge of http://go/wvgerrit/15992)

This also updates the canary so that it will be silent on master.

Bug: 25153516
Change-Id: I11163c98230c5a521609b5556b139f4508996858
2015-10-23 15:12:11 -07:00
Rahul Frias
072cf7e711 Add level 3 libs and address build warnings
* Fix strict aliasing error in gcc

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

  This also ensures the alignment of 64-bit memory access in a portable
  way, without using compiler-specific mechanisms like attributes or
  platform-specific mechanisms like memalign.

  (The aliasing error does not show up in clang.)

* Return kNotSupported for non-Widevine init data

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

  This also improves logging for the init data parser by including a
  verbose message for non-Widevine PSSHs and by using a new IsEOF()
  method to avoid misleading "Unable to read atom size" logs.

* Cast RSA_size() to int

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

  It has been suggested that this may be unsigned on some versions of
  OpenSSL or BoringSSL.

* Be strict about warnings for CE CDM

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

  * Enable all warnings and treat warnings as errors in the CE build.
  * Fix all existing warnings (mostly unused variables, consts, and
  functions, and one signed/unsigned comparison).
  * Exclude protobuf warnings rather than maintain a divergent copy.

* Fix release build errors

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

* Level 3 Build With Android Emulator

  [ Merge 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.

  These libraries work for arm, x86, mips, arm64, and x86_64.  The level
  3 library is disabled for mips64.

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

Change-Id: I1e50aa78bdc84ecb905f2e55297d4f48b140341c
2015-10-15 22:50:29 +00:00
Rahul Frias
72e4a10a8b Merge "Additional merges from cdm master" 2015-10-07 20:42:38 +00:00
Rahul Frias
e5dfb83e03 Improve query performance
[ Merge of http://go/wvgerrit/15780 ]

Android mediaDrm allows callers to serially query status information through a
property API. CDM however retrieves all status information in a map and
filters out all but the relevent one. This leads to delays in Netflix app
startup. Rewriting the CDM interface to return only the queried value.

b/24181894

Change-Id: Ie9ed6288524e3a7e03b83aa55ef3531dd52a0dfb
2015-10-05 15:22:20 -07:00
Rahul Frias
0fe3f79cc3 Additional merges from cdm master
* Update unit test make files to use BoringSSL

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

  This CL updates the android makefiles to use the libcrypto_static.

* Do Not Run Provisioning Tests On Devices Without Keyboxes

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

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

  Bug: 23554998

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

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

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

  These are now used in source form from third_party.

Change-Id: I29cca2f9415fe2fafdf948273e5a0f5d7de50285
2015-10-05 14:24:40 -07:00
Fred Gylys-Colwell
16f9a38a6b am 08198c7b: am 78583720: Clarify HDCP Type (mnc-dev branch)
* commit '08198c7bfa9c2d57fde2a616cc26b82189925822':
  Clarify HDCP Type (mnc-dev branch)
2015-10-03 15:40:00 +00:00
Fred Gylys-Colwell
08198c7bfa am 78583720: Clarify HDCP Type (mnc-dev branch)
* commit '78583720331fc5ff673ec645a26a97f33bb02ebf':
  Clarify HDCP Type (mnc-dev branch)
2015-10-03 15:34:47 +00:00
Rahul Frias
e7069f6ffc Merge "Support for IPv6 in HTTP socket and BufferReader unittests" 2015-10-02 23:24:35 +00:00
Rahul Frias
692140c488 Merge "Stop Parsing the Command Line in InitLogging" 2015-10-02 23:24:17 +00: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
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
85da7bdb98 Refactoring to cache service certs and initialization data
* Extend CdmLicense's stored_init_data_

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

  CdmLicense will store init data when a server cert must be
  provisioned.  After provisioning, the original init data can be used
  to generate the originally-intended license request.

  To do this before, the caller had to call CdmSession's
  GenerateKeyRequest with an empty InitializationData object.  However,
  the init data's type still had to be set, as did the license type.

  This CL allows the caller to use a truly empty InitializationData
  without a type.  To permit this, CdmLicense now stores a full
  InitializationData object, rather than just a copy of it's data field.

  With this CL, the caller also avoid storing the original license type.
  To accomplish this, CdmSession uses the already-set is_offline_ and
  is_release_ flags from the original call to reconstruct the intended
  license type.  The caller uses the new type kLicenseTypeDeferred.

  To facilitate storing whole InitializationData objects, they are now
  copyable.

  This ultimately simplifies server cert code for the new CE CDM.

* Store service certs in Properties

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

  This allows CE devices to mimic the Chrome CDM's behavior of sharing
  server certs between sessions.

  This also affects Android behavior.  Previously, provisioned service
  certificates were per-session, while explicitly-set service certs
  were per-DRM-plugin.  Now, both are per-DRM-plugin.

  A DRM plugin is associated with a mediaDrm object. Content
  providers will still be able to retrieve and use different
  certificates. The change here requires an app, that wishes to use
  different provisioned service certificates will have to use
  multiple mediaDrm objects. This is an unlikely scenario.

Change-Id: If2586932784ed046ecab72b5720ff30547e84b97
2015-09-30 10:51:46 -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
Fred Gylys-Colwell
7858372033 Clarify HDCP Type (mnc-dev branch)
Merge from widevine repo of http://go/wvgerrit/15735

This is a documentation only change.

This CL updates the docs for OEMCrypto to clarify that HDCP v2.2
should be type 1.  The document version number is rolled to 10.3.

See original document for version history:
https://docs.google.com/document/d/1pHSJ2IKL0axmQz2gmDZ7olxPWb_ZcULaJrYwDZAeS7k/edit#

bug: 24098055
Change-Id: If2dd677cd824482ab18eeed03a335d7b82adbcbe
2015-09-23 17:16:14 -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