Commit Graph

1616 Commits

Author SHA1 Message Date
Fred Gylys-Colwell
bfa8d39a63 Remove some names
Merge from Widevine repo of http://go/wvgerrit/168657

Some people who have left were still in OWNERS files and TODOs.

Bug: 274772704
Test: comments only
Change-Id: I583da815586e5ca52316b2e238d1c1bb3a5e919a
2023-03-27 02:45:01 +00:00
Alex Dale
ce25b9d44c Avoid null dereference with empty BCC strings.
[ Merge of http://go/wvgerrit/168482 ]

The function OEMCrypto_GetBootCertificateChain() does not always
provide an additional signature depending on the device.  However, the
CDM would still attempt to dereference the first character in the
additional signature buffer when empty.  This CL changes how the data
pointer to an output string is acquired.  Empty string will instead
pass in a null pointer.

Bug: 272643393
Test: run_prov40_tests
Test: atest GtsMediaTestCases
Change-Id: I10b0a3c7df4fc73272aa701bb01c60672645d4fc
(cherry picked from commit a878e7b98d)
2023-03-20 20:29:58 +00:00
Alex Dale
7c213563ca Merge "Add mutex to CdmEngine for use of cert_provisioning_." into udc-dev 2023-03-15 21:34:37 +00:00
Pete Bentley
965a7f308d Include hmac.h in test_base.cpp. am: 4247f72e79
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/21985924

Change-Id: I83c97a129c52454782e9d1641ec3fec5c36fb568
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-13 18:31:19 +00:00
Pete Bentley
4247f72e79 Include hmac.h in test_base.cpp.
Cherry-pick note: Compile fix only, needed for latest AOSP BoringSSL in tm-qpr-dev-plus-aosp and downstream branches, e.g. udc-*-dev.

Original change description:
Include what you use - this is no longer pulled in
by the other headers used in this file.

Bug: 272749540
Test: m
Change-Id: I0d4b480e47f84f367d1a9547b89811c52073a2fc
Merged-In: I0d4b480e47f84f367d1a9547b89811c52073a2fc
(cherry picked from commit c785e91ec3)
2023-03-13 10:44:08 +00:00
Alex Dale
6e5ab021d8 Add mutex to CdmEngine for use of cert_provisioning_.
[ Merge of http://go/wvgerrit/167618 ]
[ PoC http://ag/21922303 ]

Bug: 258188673
Test: sts-tradefed run sts-dynamic-develop -m StsHostTestCases \
    -t android.security.sts.Bug_258188673
Test: GtsMediaTestCases
Change-Id: If71a0e7a81f376cf28688a590b6cb9dcea699545
2023-03-09 14:01:40 -08:00
Cong Lin
e8add8eed8 Sync oemcrypto files from cdm udc-dev to Android
Changes included in this CL:

166806: Update OEMCrypto_GetDeviceInformation() | https://widevine-internal-review.googlesource.com/c/cdm/+/166806
166808: Update Android L3 after OEMCrypto_GetDeviceInformation() signature changes | https://widevine-internal-review.googlesource.com/c/cdm/+/166808
166809: Decode device info and write it to CSR payload | https://widevine-internal-review.googlesource.com/c/cdm/+/166809
167158: Fix Android include path and copy_files | https://widevine-internal-review.googlesource.com/c/cdm/+/167158
167159: Fix common typos and use inclusive language suggested by Android linter | https://widevine-internal-review.googlesource.com/c/cdm/+/167159

165618: Explicitly state python3 where needed. | https://widevine-internal-review.googlesource.com/c/cdm/+/165618

166757: Update Android.bp for Android | https://widevine-internal-review.googlesource.com/c/cdm/+/166757
164993: Refactor basic oemcrypto unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/164993
164978: Update OEMCrypto Unit Test Docs | https://widevine-internal-review.googlesource.com/c/cdm/+/164978
166941: Update make files for OEMCrypto | https://widevine-internal-review.googlesource.com/c/cdm/+/166941

165279: Refactor license unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/165279
165318: Refactor provisioning unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/165318
164800: Add extra check for renew on license load unit test | https://widevine-internal-review.googlesource.com/c/cdm/+/164800
165860: Remove duplicate definition of MaybeHex() | https://widevine-internal-review.googlesource.com/c/cdm/+/165860

164889: Updated CoreCommonRequestFromMessage and fix test | https://widevine-internal-review.googlesource.com/c/cdm/+/164889
164967: Add OPK pre-hook and post-hook error codes | https://widevine-internal-review.googlesource.com/c/cdm/+/164967
165140: Add hidden device_id_length to v18 provisioning message | https://widevine-internal-review.googlesource.com/c/cdm/+/165140
165204: Fix memory leak in oemcrypto test | https://widevine-internal-review.googlesource.com/c/cdm/+/165204

165958: Fix oemcrypto_generic_verify_fuzz mutator signature offset | https://widevine-internal-review.googlesource.com/c/cdm/+/165958

166037: Support SHA-256 in OEMCrypto Session Util | https://widevine-internal-review.googlesource.com/c/cdm/+/166037

Test: Run GtsMediaTests on Pixel 7
Bug: 270612144

Change-Id: Iff0820a2de7d043a820470a130af65b0dcadb759
2023-02-28 11:21:05 -08:00
Rahul Frias
3f7ecbc43e Merge changes Ia54117ff,I4d469a73,I926d8309 into udc-dev
* changes:
  Remove comment.
  Request debug headers and log URL correctly
  Integration tests for renew on license load
2023-02-25 00:09:25 +00:00
John "Juce" Bruce
340810f77f Remove hash algorithm from renewal requests
(Merged from http://go/wvgerrit/165859.)

Since renewal requests are signed with the MAC keys and not an
asymmetric key, it does not make sense to query OEMCrypto for the
asymmetric key hash algorithm nor to include the result in the renewal
request.

Bug: 262427121
Test: opk_ta
Change-Id: Ib309b63b79e553f4754c013718df242247ab9488
2023-02-24 21:11:50 +00:00
Rahul Frias
c41b6cb713 Request debug headers and log URL correctly
Merged from https://widevine-internal-review.googlesource.com/165861

We want debug headers to help diagnose b/186031735. I also
saw that we were only logging the domain name for some
errors instead of the full URL.

Bug: 186031735
Test: GtsMediaTestCases
Change-Id: I4d469a73e54f86d4d3b5d50bd0030fdb2a36df50
2023-02-22 15:09:22 -08:00
Rahul Frias
ca79034a3d Integration tests for renew on license load
Merged from https://widevine-internal-review.googlesource.com/164468

We need to add integration tests in the form of duration license tests
in order to test that this feature works with licenses from a real
server.

Bug: 253513745
Test: WV unit/integration tests
Change-Id: I926d8309ed24183ae117e3f66fb92fec2d95c310
2023-02-22 13:59:22 -08:00
Rahul Frias
04d136df36 Merge "Logging for L1 devices falling back to L3" 2023-02-15 21:53:10 +00:00
Rahul Frias
ca583d9510 Logging for L1 devices falling back to L3
[ Merge of http://go/wvgerrit/161877 ]

This change introduces some logging to shed some light on
why some L1 devices fallback to L3.

* Additional logging has been added to indicate whether a lookup of
  the symbols for OEMCrypto_Initialize, OEMCrypto_APIVersion
  or OEMCrypto_Terminate failed.
* OEMCrypto_Initialize error code is saved and reported later.

Bug: 245887116
Test: GtsMediaTestCases
Change-Id: Ice4d966d2fee458de2fae28a1355f292f879c38b
2023-02-14 14:11:08 -08:00
Alex Dale
b11890a694 Provide BCC in WVDrmFactory dumpsys.
[ Merge of go/wvgerrit/c/cdm/+/165138 ]

Enabled the Widevine DRM service on Android to return the raw boot
certificate chain via the CDM status query capabilities.  This
property key is not available for app-level queries.

The BCC is dumped by the WVDrmFactory when requested to print all
CDM properties via dumpsys.

Bug: 234095402
Test: request_license_test
Test: adb shell dumpsys android.hardware.drm.IDrmFactory/widevine -p
Change-Id: I34695b0655b4c609979577e9986974bc0fbda898
2023-02-13 13:27:50 -08:00
Alex Dale
2c05c65138 Delete secure stops by key set ID.
[ Merge of http://go/wvgerrit/165617 ]

Similar to the issue with updating secure stops by PST (see
http://go/wvgerrit/165597), when deleting different secure stops with
the same PST results in unintended behavior.  This CL changes how the
CDM identifies which secure stop to delete from storaged based on the
key set ID rather than the PST.

Bug: 263316107
Test: device_files_unittest
Test: GTS MediaDrmParameterizedTests and MediaDrmStressTest
Change-Id: Ic3843a1435f252f052c7189423c211c28ed74eaa
2023-02-07 22:32:24 -08:00
Bob Badour
080bfc7414 Merge "Cleanup vendor projects are proprietary." into tm-qpr-dev-plus-aosp am: cbb6177df2
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/21276850

Change-Id: I7ba871f7714ba4eb5dcb5b0571b6024533a25217
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-05 03:54:39 +00:00
Bob Badour
6f047790e0 Cleanup vendor projects are proprietary.
Test: m droid dist
Change-Id: I0bdec38c4d12710fa97b91665d211ba6c0d4b24d
2023-02-03 14:37:11 -08:00
Alex Dale
5ae1d0fa6e Update secure stops by key set ID.
[ Merge of http://go/wvgerrit/165191 ]

Previously, when updating a secure stop / usage info record, the
existing record was identified by PST.  It was assumed that apps would
never use the same PST for different licenses; however, this was never
enforced.  Certain GTS tests use the same PST across multiple tests to
identify different licenses.  Depending on the order of operations,
the periodic updating of the usage entry might overwrite the wrong
entry.

Key set IDs are generated by the CDM, and are guaranteed to be unique
within the scope of the same file system.  Given that key set IDs are
not expected to be transfered to different licenses, using the key
set ID to identify secure stop / usage info records eliminates the
possibility of overwriting the wrong entry.

Bug: 263316107
Test: device_files_unittest
Test: GTS MediaDrmParameterizedTests and MediaDrmStressTest
Change-Id: I2e2d50d188e05c8ca6b8095549796b913ea72d7a
2023-02-01 15:33:13 -08:00
Kyle Zhang
a95cd36de5 Merge "Add liboemcrypto.so as required by WV APEX" 2023-01-11 05:37:46 +00:00
TreeHugger Robot
d933e34824 Merge "Renaming of Usage Table related variables and types." 2023-01-10 02:43:26 +00:00
Kyle Zhang
a5c7a48f8a Add liboemcrypto.so as required by WV APEX
[ Merge of go/wvgerrit/164757 ]

Modify Widevine apex configuration to add add liboemcrypto.so as
required by WV APEX.

Bug: 243699259
Test: atp v2/widevine-eng/drm_compliance
Change-Id: I136dde5d77aed4fb14737e4692153c8f3b2c701b
2023-01-09 06:32:39 +00:00
Rahul Frias
609349c314 Merge changes Ib18af309,Iebd58823,Ic3a503ef
* changes:
  Support renew on load
  Move functionality to policy_timer.
  Remove references to policy_timers_v15
2022-12-22 08:11:29 +00:00
Rahul Frias
ab91cf934e Support renew on load
[ Merge of http://go/wvgerrit/164477 ]

Renew on load is supported when OEMCrypto is >= v18.
A new class, policy_timer_v18 has been added to support this
functionality. In addtition,offsets of renewal from first decrypt
and license start are also included.

Bug: 256038127
Test: GtsMediaTestCases
Change-Id: Ib18af3096d1d8807af6a03fd2f84783123ab6b6d
2022-12-21 17:33:02 -08:00
Rahul Frias
78a4902214 Move functionality to policy_timer.
[ Merge of http://go/wvgerrit/164277 ]

No functional changes are made in this CL. policy_timer_v16 and
policy_timer_v15 derive from policy_timer. We have removed
support for OEMCrypto v15. policy_timer_v15 has also been removed.

This allows us to move functionality from policy_timer_v16
to policy_timer class. This will ease subsequent renew on
license load functionality.

Bug: 256038127
Test: Luci tests
Change-Id: Iebd588237edd02b30a820c4d9d57ce041c26964e
2022-12-21 16:10:01 -08:00
Alex Dale
1603ba127f Renaming of Usage Table related variables and types.
[ Merge of http://go/wvgerrit/164077 ]

This CL makes major changes to the names of variables and types that
are related to the usage table, header, entries, entry indexes, and
other related data.

The renaming followed these rules:
1)  "Usage table header" will exclusively refer to the header blob
    that is OEMCrypto specific.  The CDM class "UsageTableHeader"
    is the CDM-layer's abstraction around the "usage table" concept.
    The name has been updated to reflect that.
2)  The "Cdm" prefix is only used for the CDM-specific data types for
    the usage table and entry info.  It has been removed from
    OEMCrypto-specific types.
    - UsageTableHeader -> CdmUsageTable
    - CdmUsageTableHeader -> UsageTableHeader
    - CdmUsageEntry -> UsageEntry
3)  The "usage_" prefix has been removed from variables when the usage
    table or usage entries are the subject of the function or class.
4)  UsageEntryIndex is the type for entry indexes, instead of directly
    using uint32_t.  This matches how we wrap other types in
    "wv_cdm_types.h"
5)  Changed entry "number" to entry "index".
6)  Vectors of elements have been renamed to be either pluralized or
    have a suffix "_list".
7)  "Usage info" was occasionally being used to refer to the usage
    table or entries generally, rather than specifically secure-stop.
    - CryptoSession::HasUsageInfoSupport() -> HasUsageTableSupport()

The most major change is that the files "usage_table_header*" have
been renamed to be "cdm_usage_table*".

Bug: 242914226
Test: run_x86_64_tests and request_license_test
Change-Id: Iee98446b71f4f2934d3c9e0fb949eb05b84d1f8c
2022-12-21 15:50:49 -08:00
Rahul Frias
1e15b36b1a Support ATSC license installation
[ Merge of http://go/wvgerrit/163900/ ]

ATSC licenses can be saved by calling
MediaDrm#setPropertyString("storeAtscLicense",<value>)
where <value> is
"<atsc-key-set-ID>:<license-file-data in Base64 format>"

Before storing an ATSC license a session must be opened and the
ATSC mode must be enabled.

Use MediaDrm#setPropertyString("atscMode","enable");

Bug: 176871821
Test: WV Unit/integration/Luci tests
Test: libwvdrmdrmplugin_hal_test
Test: GtsMediaTestCases
Change-Id: Iec2a8b7f87b1122395d06856202278b92316fdfe
2022-12-21 11:56:18 -08:00
Rahul Frias
233bac3a6f Add error codes to support ATSC license installation
[ Merge of http://go/wvgerrit/163899 ]

Bug: 176871821
Test: WV Unit/integration/Luci tests
Test: libwvdrmdrmplugin_hal_test
Change-Id: I0153093433715b1357d3854043cc6362f9261c57
2022-12-21 11:55:08 -08:00
Kyle Zhang
0080d04579 Merge "Pick widevine oemcrypto-v18 change" 2022-12-21 19:44:33 +00:00
Rahul Frias
539843da00 Remove references to policy_timers_v15
[ Merge of http://go/wvgerrit/164257 ]

Support for OEMCrypto v15 is being removed from the CDM. The
policy_timers_v15 will no longer be invoked and can be removed.

Bug: 256038127
Test: WV unit/integration tests
Change-Id: Ic3a503ef2a17223dd0bc13696960dcd6822cc343
2022-12-21 05:42:14 -08:00
Kyle Zhang
11255b7426 Pick widevine oemcrypto-v18 change
No-Typo-Check: From a third party header file
Bug: 260918793
Test: unit tests
Test: atp v2/widevine-eng/drm_compliance
Change-Id: I36effd6a10a99bdb2399ab1f4a0fad026d607c70
2022-12-21 00:03:50 +00:00
Rahul Frias
915efa9894 Sync license_protocol.proto
[ Merge of http://go/wvgerrit/159982 ]

Add in TimerDelayBase, initial_renewal_delay_base, client version
and DTCPUsageRules.

Bug: 256038127
Test: WV unit/integration tests
Change-Id: I0ea7490ff2663a3df15d150836b06277f14eaa0f
2022-12-13 23:53:14 -08:00
Robert Shih
2384efde1e New CdmResponseType fields: oec_result & crypto_session_method
[ Merge of go/wvgerrit/163437 ]

Bug: 253271674
Test: cdm unit tests
Change-Id: I064e28af593e4a55c13d03115bb5181a879a1ed4
2022-12-12 19:06:59 -08:00
Robert Shih
096b0eda5a Squashed merge 3 CLs.
1. "Change CdmResponseType from enum into a struct"
Merged from http://go/wvgerrit/163199
Bug: 253271674

2. "Log request information when server returns 401"
Bug: 260760387
Bug: 186031735
Merged from http://go/wvgerrit/162798

3. "Specify server version on the command line"
Bug: 251599048
Merged from http://go/wvgerrit/158897

Test: build android.hardware.drm-service.widevine
Test: Netflix and Play Movies & TV
Test: build_and_run_all_unit_tests.sh

Bug: 253271674
Change-Id: I70c950acce070609ee0343920ec68e66b058bc23
2022-12-08 21:08:14 +00:00
Alex Dale
ac9641ae13 Merge "Revert "Core CDM: Removed secure stop support."" 2022-12-05 22:05:07 +00:00
Alex Dale
16a4c2690a Revert "Core CDM: Removed secure stop support."
This reverts commit b039f31b27.

Reason for revert: Feature rejected by Android

Bug: 242289743
Change-Id: I8cd6014b4e2de93b3c574d407d6c8885863fed4f
2022-12-03 00:46:22 +00:00
Alex Dale
cd51e53a98 Merge "Revert "Core CDM: Retrieving USAGE_INFO triggers clean-up."" 2022-12-03 00:32:27 +00:00
Alex Dale
d62d71189e Revert "Core CDM: Retrieving USAGE_INFO triggers clean-up."
This reverts commit da9ba6c3ba.

Reason for revert: Feature rejected by Android

Bug: 242289743
Change-Id: Ia9ee53b4a897b4b52551c665e8551233abee6b6b
2022-12-02 22:48:05 +00:00
Alex Dale
f4ca978229 Merge "Revert "Core CDM: Remove secure stop from LRU algorithm."" 2022-12-02 22:41:06 +00:00
Alex Dale
0c353d6851 Revert "Core CDM: Remove secure stop from LRU algorithm."
This reverts commit 7a34c1748c.

Reason for revert: Feature rejected by Android

Bug: 242289743
Change-Id: I63a730a6e5fa16d0d2425d216fd7f0fff8c09a4c
2022-12-01 23:50:05 +00:00
Alex Dale
8bfd31402b Merge "Revert "Core CDM: Removed ability to add secure stop entry."" 2022-12-01 23:47:43 +00:00
Alex Dale
40181d5ea7 Revert "Core CDM: Removed ability to add secure stop entry."
This reverts commit afcadcc793.

Reason for revert: Feature rejected by Android

Bug: 242289743
Change-Id: Ibf018322d65af9a2a7808b81823907f3226f1950
2022-12-01 03:36:42 +00:00
Alex Dale
672f7aee80 Merge "Revert "Core CDM: Remove usage info API from DeviceFiles."" 2022-12-01 03:34:24 +00:00
Alex Dale
3012cd1ee6 Revert "Core CDM: Remove usage info API from DeviceFiles."
This reverts commit 244e6301bd.

Reason for revert: Feature rejected by Android

Bug: 242289743
Change-Id: I00a6e223dfabd85a5f12a224dfea6456a24a1770
2022-11-30 23:58:52 +00:00
Alex Dale
5ffa2885c9 Merge "Revert "Core CDM: Do not store/retrieve USAGE_INFO entries."" 2022-11-30 23:51:37 +00:00
Alex Dale
5ebe8eddeb Revert "Core CDM: Do not store/retrieve USAGE_INFO entries."
This reverts commit 982ddb042d.

Reason for revert: Feature rejected by Android

Bug: 242289743
Change-Id: I06fd9a79c2013a7dc523ffd06180c3ff36ab7d34
2022-11-30 01:47:13 +00:00
Alex Dale
ba42d5edf5 Merge "Revert "Core CDM: Remove usage info as a run-time type."" 2022-11-30 01:46:17 +00:00
Alex Dale
1ea92c34c8 Revert "Core CDM: Remove usage info as a run-time type."
This reverts commit 5dd2b07286.

Reason for revert: Feature rejected by Android

Bug: 242289743
Change-Id: I8dc95139d113ad1d44acd2e8dd6cbda604b6c073
2022-11-30 00:29:14 +00:00
Edwin Wong
6d3457b9d9 Remove hidl support.
Merged from http://go/wvgerrit/161857

Test: streaming(Netflix, Play Movies & TV)
Test: ./build_and_run_all_unit_tests.sh
Test: adb shell ps | grep drm
Test: metrics_dump
Test: hardware/interfaces/drm/aidl/vts$ atest VtsAidlHalDrmTargetTest

Bug: 259299992
Change-Id: I76bcc82bbfb3fc60987b66265a580946a16c341d
2022-11-22 19:03:30 +00:00
John "Juce" Bruce
ff73463d0b Add String Formatting Util
(Merged from http://go/wvgerrit/160042.)

Since we don't have access to std::format yet, this patch adds a
function to wvutil to format text into a std::string.

Bug: 255466913
Test: x86-64
Test: raven
Change-Id: I28043da76af5b4772a29fa7e7241343caf9b54a1
2022-11-15 05:24:19 +00:00
Edwin Wong
a3e67a9104 Merge "Update CdmResponseTypeToString" 2022-11-13 01:21:12 +00:00