Commit Graph

2628 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
ef65e86ee2 Modify OEMCrypto unit tests to allow 16.3 or 16.4
Merge from Widevine repo of http://go/wvgerrit/121790

Some unit tests expected OEMCrypto to be the latest ODK version,
but we do not require this for v16.

Bug: 184905579
Change-Id: Iccdbcc0b28587aad79a2a63d8c39a564a47fb585
2021-04-12 14:00:53 -07:00
Fred Gylys-Colwell
6628c7f693 Update OEMCrypto test comments and logs
Merge from Widevine repo of http://go/wvgerrit/121886

This CL merges some changes from branch rvc-dev to sc-dev
that prepared it for merge.

One change is that the unit tests now say they are part of
Android S instead of R.

Bug: 180546871
Change-Id: I2ebbd8f7b8586389ebb75f3743a2dc2ad8caa214
2021-04-12 14:00:53 -07:00
Fred Gylys-Colwell
d265a5fe73 Update OEMCryptoCENC.h header to obfuscate missing functions
This CL adds AllocateSecureBuffer and FreeSecureBuffer to the list of
function names that are obfuscated. It also corrects some spelling and
formatting in OEMCrypto headers. This is still version 16.4.

Merge from Widevine repo of
http://go/wvgerrit/115803
http://go/wvgerrit/111104
http://go/wvgerrit/108703
http://go/wvgerrit/108703

Bug: 139814713
Bug: 141202789
bug: 168634557
bug: 168635928
bug: 168637230
bug: 168639188
Change-Id: I6f06549b2cf104c6751b2947964569e974fcdcd2
2021-04-12 14:00:53 -07:00
Fred Gylys-Colwell
e998b08de7 Clean up duration tests
Merge from Widevine repo of http://go/wvgerrit/120903

Some comments in the duration tests had stale numbers in them. This
was fixed.

Also, the tests CdmUseCase_LicenseDuration were failing with a v16 CDM
and a v15 OEMCrypto because the exact cutoff time is different in
those two cases. That is exactly why specifying the license duration
is not recommended. The tests have been modified to handle both
acceptable behaviors.

Bug: 182237739
Change-Id: I05765beacfe69d02e7366bb3f651f0d5888ab3e5
2021-04-12 14:00:53 -07:00
Fred Gylys-Colwell
504b05492b Use either spelling of AllocateSecureBuffer in dynamic adapter
Merge from Widevine repo of http://go/wvgerrit/121883

There was a problem in the v16.3 header that did not rename
OEMCrypto_AllocateSecureBuffer to _oecc109 or
OEMCrypto_FreeSecureBuffer to _oecc110. These functions are only used
in testing.

This changes the dynamic adapter to accept either name for those
functions.

Bug: 171121061
Change-Id: I30121c7524e8db580ba85f3e686a7a7c429d80a9
2021-04-12 14:00:53 -07:00
Fred Gylys-Colwell
6a59fee30a Update ODK library for OPK compatibility
This is a merge from http://go/wvgerrit of several changes to the ODK
library that allow it to be used in the same compilation unit as the
OPK serialization/deserialization code.

Merge of:
http://go/wvgerrit/104403
http://go/wvgerrit/105663
http://go/wvgerrit/106004
http://go/wvgerrit/107903
http://go/wvgerrit/107985
http://go/wvgerrit/110167
http://go/wvgerrit/110403
http://go/wvgerrit/110423
http://go/wvgerrit/110663
http://go/wvgerrit/110703
http://go/wvgerrit/110985
http://go/wvgerrit/111703
http://go/wvgerrit/112563
http://go/wvgerrit/113243
http://go/wvgerrit/115204
http://go/wvgerrit/117803
http://go/wvgerrit/121949

bug: 174518179
bug: 175920940
bug: 175126254
Change-Id: I433459182043ca43a040cdbc16d04f2b8215067a
2021-04-12 13:59:59 -07:00
Alex Dale
36dc9bb97b Extended Android file store error logs.
[ Merge of http://go/wvgerrit/120763 ]

This change introduces additional logging information for files and
file system operations on Android.

File reading and writing will attempt to make sense of |errno| and
log useful information.   In the event that the file must be closed,
the file stat will be printed.

Failures in determining the file size will print potential reasons for
the encountered error.

This partly restructures the File interface implementation to use file
descriptors instead of the C standard libraries FILE handle.  This is
done to ensure that |errno| is set to an expected value.

This change also introduces the utility functions SafeWrite() and
SafeRead() to handle common, retriable errors.

Bug: 178232354
Test: Android MediaDrm GTS and Android file-based unittests
Change-Id: I15a3c47a271098c9edb4bd9f619ed1a12dca6143
2021-04-09 14:23:24 -07:00
Alex Dale
766204f2b8 Merge "Cleaned up OEMCrypto security level getter." into sc-dev am: 985d0b5129
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/14137665

Change-Id: I4709819030cb44c2ae5d7f4df190454b335d67e5
2021-04-09 21:12:46 +00:00
Alex Dale
eff0ef2713 Merge "Restructed reference root of trust (3/3 OEM Cert)" into sc-dev am: 9903798373
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13625377

Change-Id: I1539c4f04dcb38a5ef33ac42233233bdbf80d0c8
2021-04-09 21:12:43 +00:00
Alex Dale
74c1ab4cdc Merge "Restructed reference root of trust (2/3 DRM Cert)" into sc-dev am: cae8f6a04e
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13625376

Change-Id: Ife88e89ef54628034819a75dfd8a899a869253e4
2021-04-09 21:12:20 +00:00
Alex Dale
985d0b5129 Merge "Cleaned up OEMCrypto security level getter." into sc-dev 2021-04-09 20:59:39 +00:00
Alex Dale
9903798373 Merge "Restructed reference root of trust (3/3 OEM Cert)" into sc-dev 2021-04-09 20:48:47 +00:00
Alex Dale
cae8f6a04e Merge "Restructed reference root of trust (2/3 DRM Cert)" into sc-dev 2021-04-09 20:48:27 +00:00
Alex Dale
ca335b2c11 Only one function for reporting usage support.
[ Merge of http://go/wvgerrit/121567 ]

Replaced the two usage support functions GetUsageSupportType() and
UsageInformationSupport() into a single function HasUsageInfoSupport().

Since moving to only supporting a single usage info system (usage table
header + usage entries), the different usage support functions have
lost their purpose.

One version of the method works on an open session and will use a
cached value of the property if previously set.  The other can be
called without opening the session (as used for query calls).

This is part of larger fix for the usage table initialization process.

Bug: 169195093
Test: CE CDM unit tests
Change-Id: I637c24dd143e995dbb0f8848850e3c71ff1018eb
2021-04-09 01:34:57 -07:00
Alex Dale
ccda4faf7b Cleaned up OEMCrypto security level getter.
[ Merge of http://go/wvgerrit/121566 ]

This clean up is part of a larger usage table initialization fix.

Bug: 169195093
Change-Id: I3ee818d1e5621f1f2fa64b189da4e66503d5e680
2021-04-09 01:34:56 -07:00
Rahul Frias
01baae563f Merge "Reword "blacklisted" to "forbidden"" into sc-dev am: 574dc28df5
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/14128160

Change-Id: I1287ba5e0990628471bc8c0066a5c440c8b2b035
2021-04-09 08:32:27 +00:00
Rahul Frias
574dc28df5 Merge "Reword "blacklisted" to "forbidden"" into sc-dev 2021-04-09 07:38:26 +00:00
Rahul Frias
4b12b9c998 Merge "Correction to addition of LOCAL_LICENSE_KINDS to vendor/widevine" into sc-dev am: 6af4d181d1
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/14117911

Change-Id: I13489d43e4385855a9ac01c247f8c4acae545e84
2021-04-09 02:59:37 +00:00
Rahul Frias
6af4d181d1 Merge "Correction to addition of LOCAL_LICENSE_KINDS to vendor/widevine" into sc-dev 2021-04-09 02:14:01 +00:00
Robert Shih
b9780710c7 Merge "libvtswidevine: replace appspot with uat" into sc-dev am: 1f8f0f1ccc
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/14099570

Change-Id: I2c105cf52d26429af17c583ad6c727773d959170
2021-04-08 22:10:24 +00:00
Rahul Frias
a40af9d1ef Reword "blacklisted" to "forbidden"
[ Merge of http://go/wvgerrit/113563 ]

Bug: 159847851
Test: WV unit/integration tests
Change-Id: I138b3e3291cb9e75841d092ca1bfa9a652ad9f9a
2021-04-08 11:54:06 -07:00
Rahul Frias
7c8d3e287e Correction to addition of LOCAL_LICENSE_KINDS to vendor/widevine
Remove incorrectly identified license files in http://go/ag/13998816

Bug: 68860345
Bug: 151177513
Bug: 151953481
Test: mm
Change-Id: I676a63598c8a7df11a1cef6d8bebcc9940c961dc
2021-04-08 07:56:48 +00:00
Robert Shih
6a133bedcf libvtswidevine: replace appspot with uat
Bug: 179093540
Test: VtsHalDrmV1_2TargetTest
Change-Id: I1f343fb977f85ca4b7bf5fbc28fbfac23fbc3f05
2021-04-05 23:35:20 -07:00
Edwin Wong
c10f719067 Merge "Fix WVCryptoPlugin use after free vulnerability." into sc-dev am: 9d1ad7590a
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13808139

Change-Id: I4c2aadb7b98c48abc349582d0bca0ddb41d05df7
2021-04-05 21:35:55 +00:00
Edwin Wong
9d1ad7590a Merge "Fix WVCryptoPlugin use after free vulnerability." into sc-dev 2021-04-05 20:47:48 +00:00
Alex Dale
1df93e5cae Merge "Restructed reference root of trust (1/3 Keybox)" into sc-dev am: 3e2c0f03e7
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13625375

Change-Id: Iebbb289b724e71fd1b7f8697120d3970dc591fca
2021-03-31 03:02:39 +00:00
Alex Dale
3e2c0f03e7 Merge "Restructed reference root of trust (1/3 Keybox)" into sc-dev 2021-03-31 02:22:07 +00:00
Bob Badour
000b7d9716 Merge "[LSC] Add LOCAL_LICENSE_KINDS to vendor/widevine" into sc-dev am: ea0bd6030c
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13998816

Change-Id: I0e802fea548cd498d3d0e2787caf4a49f0339687
2021-03-26 07:01:24 +00:00
Bob Badour
ea0bd6030c Merge "[LSC] Add LOCAL_LICENSE_KINDS to vendor/widevine" into sc-dev 2021-03-26 06:45:39 +00:00
Alex Dale
bb709bfd27 Merge "Use new Base64 encode functions." into sc-dev am: 50757c84ec
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13972381

Change-Id: Iecee22009d4a0d56cf34133f83e44a5beab92747
2021-03-26 05:36:21 +00:00
Alex Dale
fb651b1974 Merge "Base64 encoding for string input." into sc-dev am: e189968a16
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13972380

Change-Id: I44f3bac15846b260feb3620641293660066bd004
2021-03-26 05:34:52 +00:00
Alex Dale
50757c84ec Merge "Use new Base64 encode functions." into sc-dev 2021-03-26 05:19:31 +00:00
Alex Dale
e189968a16 Merge "Base64 encoding for string input." into sc-dev 2021-03-26 05:18:43 +00:00
Bob Badour
376f47047c [LSC] Add LOCAL_LICENSE_KINDS to vendor/widevine
Added SPDX-license-identifier-Apache-2.0 legacy_by_exception_only to:
  Android.bp
  libwvdrmengine/Android.bp
  libwvdrmengine/vts/vendor_module/Android.bp

Added legacy_by_exception_only to:
  libwvdrmengine/cdm/Android.bp
  libwvdrmengine/cdm/core/src/Android.bp
  libwvdrmengine/cdm/core/test/Android.bp
  libwvdrmengine/cdm/metrics/src/Android.bp
  libwvdrmengine/cdm/test/integration-test.mk
  libwvdrmengine/cdm/test/unit-test.mk
  libwvdrmengine/level3/Android.bp
  libwvdrmengine/mediacrypto/Android.bp
  libwvdrmengine/mediacrypto/test/Android.mk
  libwvdrmengine/mediadrm/Android.bp
  libwvdrmengine/mediadrm/test/Android.mk
  libwvdrmengine/oemcrypto/odk/Android.bp
  libwvdrmengine/oemcrypto/odk/test/fuzzing/Android.bp
  libwvdrmengine/oemcrypto/odk/test/fuzzing/corpus_generator/Android.bp
  libwvdrmengine/oemcrypto/test/Android.mk
  libwvdrmengine/test/unit/Android.mk
  libwvdrmengine/tools/metrics_dump/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I41ef520b6e394a7708f453a706e6ef1a5f46c36a
2021-03-25 09:52:52 -07:00
Alex Dale
9f7e2c4413 Restructed reference root of trust (3/3 OEM Cert)
[ Merge of http://go/wvgerrit/116944 ]

This change is the last part of a three part change for restructing
the root of trust used by the reference implementation.

OEM Certificates are now managed by the root of trust of the crypto
engine.  Previously, OEM certs where handled separately on a session
by session basis.

Bug: 135283522
Test: oemcrypto_unittests ce_cdm_tests
Change-Id: I6cf1fa3fade28baad85b5fce57a8eab6f2ed17c1
2021-03-24 19:14:17 -07:00
Alex Dale
f6f5099604 Restructed reference root of trust (2/3 DRM Cert)
[ Merge of http://go/wvgerrit/115551 ]

This change is the second part of a three part change for restructing
the root of trust used by the reference implementation.

The use of RSA_shared_ptr has been replaced with the standard library
std::shared_ptr using the RsaPrivateKey wrapper class.  The
AuthenticationRoot class now uses this for the built-in DRM cert key.

RSA decryption and signature operations within the session context are
now performed the RsaPrivateKey class.  This has reduced the code size
and complexity within the reference and testbed, focusing their
implementation on key policy and less on mechanics.

Bug: 168544740
Bug: 135283522
Test: oemcrypto_unittests ce_cdm_tests
Change-Id: Ic743a529a9858f3182290d8bcf5e1633737b005b
2021-03-24 19:14:17 -07:00
Alex Dale
e4ee4eb404 Restructed reference root of trust (1/3 Keybox)
[ Merge of http://go/wvgerrit/115550 ]

This change is the first part of a three part change for restructing
the root of trust used by the reference implementation.

The API of the AuthenticationRoot class has been updated to reflect
the OEMCrypto functions that relate to the root of trust.  This
involves changing the keybox and DRM Cert methods and adding in new
stubs for OEM Certificates.

The WvKeybox now uses a RAII-like interface to ensure that keyboxes
are provisioned correctly or not at all.

Bug: 135283522
Test: oemcrypto_unittests ce_cdm_tests
Change-Id: I3f2baf29c1022e1806b6196fa6650d761785c626
2021-03-24 19:14:17 -07:00
Rahul Frias
43c7ac72b3 Merge "Have system clocks return wall time" into sc-dev am: 8c6ce2e4c9
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13944148

Change-Id: I02e6c1e5523512aa1c6b57082ec4d4b4ac1e5d3f
2021-03-24 01:50:30 +00:00
Rahul Frias
8c6ce2e4c9 Merge "Have system clocks return wall time" into sc-dev 2021-03-24 01:23:19 +00:00
Rahul Frias
e2d3826aff Save and retrieve key information from licenses and usage records am: e538c96131
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13947818

Change-Id: I50878894d78ceeda6d134dca653b9e84c5311e09
2021-03-23 22:32:51 +00:00
Alex Dale
d859c1ab17 Use new Base64 encode functions.
[ Merge of http://go/wvgerrit/119806 ]

This change replaces all calls for base64 encoding which first converts
a string to a vector.  The new base64 encoding function allow for
encoding binary data contained within strings.

Bug: 181732604
Test: Android unittests
Change-Id: Ibfe79dba99e6a2ee2f2a96e85b62fbd22519aea7
2021-03-23 14:49:58 -07:00
Alex Dale
e51f869190 Base64 encoding for string input.
[ Merge of http://go/wvgerrit/119805 ]

This change adds 3 new functions for encoding binary data from a C++
string to a base64 encoded ASCII string.

The CDM and protobuf generated code use C++ strings to store binary
data.  These binary strings are commonly converted into a base64
encoded ASCII string for logging and for returning to the app.

This change also cleans up some of the internal components of the
string_conversions library to use several standard library C++11
method.

Bug: 181732604
Test: CE CDM unittests
Change-Id: I547568c6402e011344260f2df2a06e972122ab8a
2021-03-23 14:49:46 -07:00
Rahul Frias
e538c96131 Save and retrieve key information from licenses and usage records
[ Merge of http://go/wvgerrit/120512 ]

Wrapped DRM private keys are loaded when a key request is made or when
offline/usage sessions are restored. They were earlier loaded when a
session was opened.

For streaming sessions, key material will be fetched from the default
or legacy certificates and loaded when a key request is made.

For offline and usage sessions, key material may be retrieved from
license or usage records if available. If not available, information
associated with the legacy certificate will be loaded.

Certificate and wrapped keys are also written out when an offline
license or usage record is saved.

Bug: 169740403
Test: WV unit/integration tests
      WvCdmRequestLicenseTest.ProvisioningWithExpiringCertTest
      WvCdmRequestLicenseTest.StreamingWithExpiringCertTest
      WvCdmRequestLicenseTest.RestoreOfflineKeysWithExpiringCertTest
Change-Id: Ice0154c632170c46da171cbbb23a97380c610a98
2021-03-23 13:06:55 -07:00
Cong Lin
c6e310b50a Refresh L3 builds for buffer overflow fixes on master
Merge CL from wv master:
https://widevine-internal-review.git.corp.google.com/c/cdm/+/118363

Fixes included in this CL:
go/wvgerrit/111603
Fix L3 block offset test and re-enable buffer overflow tests

go/wvgerrit/111784
Fix heap overflow test in L3 and OEMCrypto ref

go/wvgerrit/113644
Check for buffer overflow when computing subsample size

go/wvgerrit/113946
Fix test failures caused by huge key length in L3

Bug: 180956067
Bug: 175001473
Bug: 175741683
Bug: 172866305
Bug: 175041667
Test: L3 unit test
Test: go/forrest https://android-build.googleplex.com/builds/tests/view?invocationId=I10900007766741431&testResultId=TR22818280880061022&redirect=http://sponge2/3c1fc176-f3bc-46e6-af7c-b2925ae3765b
Change-Id: Ied639d0639295aa6fade1d9ff3c6eab6a941b36d
2021-03-23 16:49:04 +00:00
Rahul Frias
dfd695c671 Add CLIENT_TOKEN_NOT_SET error code am: 30ebbefb40
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13947817

Change-Id: Idaf7baba8b96c6efcd02c324758f50b4c55adea1
2021-03-23 04:09:58 +00:00
Rahul Frias
66c9d9e351 Add certificate information to Usage Information am: 1aa197ce4a
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13937951

Change-Id: If540a1344dda9387a41f4fa83b6a92c76be77b23
2021-03-23 04:09:56 +00:00
Rahul Frias
30ebbefb40 Add CLIENT_TOKEN_NOT_SET error code
[ Merge of http://go/wvgerrit/120511 ]

Bug: 169740403
Test: WV unit/integration test
Change-Id: Iba77c0b7e7f1bee1e96b0d08f0ab8e8591292012
2021-03-22 17:08:34 -07:00
Rahul Frias
1aa197ce4a Add certificate information to Usage Information
[ Merge of http://go/wvgerrit/120509 ]

Certificates and wrapped key material are stored in the usage information
file but apart from usage information records. Usage info records include
an identifier which indicates the associated certificate. Routines to
help with finding, inserting or removal of associated certificates have
been included. After a usage entry is deleted, a garbage collection
routine is run to remove any certificates not used by usage infomation
records.

Bug: 169740403
Test: WV unit/integration tests
Change-Id: I49075a7704a58c2488b73eb7c38b007958af566d
2021-03-22 17:07:25 -07:00
Rahul Frias
dfe3ecc1a8 Merge changes Ic0de6328,Ic263f3df into sc-dev am: 335720be1c
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13925120

Change-Id: I640243505f50e53e7f0ee97b8c6c23b667210cb2
2021-03-22 20:55:17 +00:00
Alex Dale
81d5236ef6 Merge "Sync Android reference with CDM reference." into sc-dev am: 8e090b47b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13635472

Change-Id: I5056c23eb5f4d5aee370a7ba7e5efcb1d0632cd5
2021-03-22 20:53:56 +00:00