Commit Graph

4852 Commits

Author SHA1 Message Date
Rahul Frias
64d5b38ff5 Throw DeniedByServerException when provisioning detects a revoked device
[ Merge of http://go/wvgerrit/117267 ]

The client will now advertise the ability to handle provisioning errors
by a minor version updated to the provisioning protocol version.
The provisioning service may indicate that the individual device
is revoked or all devices with the same make/model have been revoked.

If the provisoning service has not been upgraded, the protocol version
field in the request will be ignored. The provisioning service/SDK
will respond with an HTTP 400 error to a provisioning request from
a revoked device.

Bug: 174174765
Test: WvCdmRequestLicenseTest.ProvisioningRevocationTest,
      WV unit/integration tests
Change-Id: I5ff61496685f310de6704a90452b8b76b3505cbb
2021-02-23 14:36:21 -08:00
Edwin Wong
8659675556 Merge "Display menu if no argument is given." into sc-dev 2021-02-23 21:03:08 +00:00
Rahul Frias
41ecde78cc Certificate provisioning proto updates
[ Merge of http://go/wvgerrit/117266 ]

These changes facilitate communication of provisioning errors from
provisioning service/SDK to the client.

Clients will indicate in the SignedProvisioningMessage whether they
support handling of error information in the ProvisioningResponse.
The provisioning service/SDK can then indicate why the provisioning
request is being rejected.

The protocol_version field from SignedProvisioningMessage has also been
broken into separate protocol version and provisioning type fields.
This will support changes planned for future releases.

Bug: 174174765
Test: WV unit/integration tests
Change-Id: Ic1a41ed8f83b69697300c586a78266fac20298fb
2021-02-23 00:09:32 -08:00
Edwin Wong
0ac0ee50eb Display menu if no argument is given.
If not argument is given, the app just sits and wait
for stdin input, this can be confusing for the user.
Add logic to display menu if no argument is given.

Test: metrics_dump
  display menu

Test: metrics_dump [bugreport from sabrina-q.gz]
  display mediadrm and widevine metrics

Test: metrics_dump --mediadrm [adb shell dumpsys media.metrics output]
  display mediadrm metrics

Test: metrics_dump --widevine [adb shell dumpsys media.metrics output]
  display widevine metrics

Test: metrics_dump [bugreport from sabrina-q.gz] --widevine
  display menu because the order is app_name, options, input file

Bug: 180983850
Change-Id: I9b35f782d8f59663661148d3950f89e4724b6bce
Merged-In: I9b35f782d8f59663661148d3950f89e4724b6bce
2021-02-22 23:04:59 -08:00
Alex Dale
a1d66834de Merge changes I09249afe,I713ff1c4 into sc-dev
* changes:
  Enable the CDM to track the DRM private key type.
  Report OEMCrypto's ECC capabilities.
2021-02-23 06:53:31 +00:00
Alex Dale
19e1008df7 Merge "Updated DrmDeviceCertificate for signature algo." into sc-dev 2021-02-23 06:53:18 +00:00
Robert Shih
ae9b1cd128 Merge "OEMCrypto_LoadLicense doc cleanup" into sc-dev 2021-02-22 23:30:55 +00:00
Robert Shih
00b4a9b5b5 OEMCrypto_LoadLicense doc cleanup
Bug: 162255728
Change-Id: I11f74b1f38e0e073e0e2e464bdce41e720f00549
2021-02-20 08:38:39 +00:00
Robert Shih
f7285fb0e9 wvhidl: map wvcdm LogPriority to hidl LogPriority
[Merge of http://go/wvgerrit/117343]

Bug: 162255728
Test: VtsHalDrmV1_4TargetTest
Change-Id: I368b2d7a125e62e46ded322c1e171a15a9a7a1b4
2021-02-19 01:53:22 -08:00
Alex Dale
e15c0607c7 Enable the CDM to track the DRM private key type.
[ Merge of http://go/wvgerrit/110923 ]

The CDM is responsible for telling OEMCrypto the underlying DRM
private key type when loading it into a session.  To do this, the
CDM must determine and store the key type of a successfully loaded
provisioning response.  The type of key is available from the
DRM certificate proto that is provided in the reponse.

This change introduces a class to contain the wrapped key and
type together.  To store the type, the CDM device files have been
updated to include a key type with the DRM certificate and to
store from and load to the new class.

Unittests have been updated for using the new class where the
wrapped key was used before.

Test: Linux unit tests
Bug: 140813486
Change-Id: I09249afe9c291632fb651ecd00eac697d6939ec7
(cherry picked from commit 6c457402e944079271cef488aa4699f986da6a2e)
Merged-In: I09249afe9c291632fb651ecd00eac697d6939ec7
2021-02-18 23:10:39 +00:00
Alex Dale
e70c7a116e Report OEMCrypto's ECC capabilities.
[ Merge of http://go/wvgerrit/110824 ]

When generating a provisioning request, the CDM includes the different
certificate key types that are supported.

This change will enable the reporting of ECC certificate types if
OEMCrypto supports them.

Test: Linux unit tests and Android integration test
Bug: 140813486
Change-Id: I713ff1c469dff5c8a41461727ce63486d962575e
(cherry picked from commit 547d2f8775)
Merged-In: I713ff1c469dff5c8a41461727ce63486d962575e
2021-02-18 23:09:53 +00:00
Alex Dale
5e982e8fff Updated DrmDeviceCertificate for signature algo.
[ Merge of http://go/wvgerrit/110823 ]

DrmDeviceCertificate is the CDM's reduced version of DrmCertificate
used in the backend.  With the introduction of ECC, the CDM needs to
extract the signature algorithm to determine how to handle the wrapped
private key used by OEMCrypto post-provisioning.

This change brings the DrmDeviceCertificate in line with the
provisioning service's DrmCertificate message as the new source of
truth.

Bug: 140813486
Test: Compiled proto
Change-Id: I164a1c9266fb74b6cdd0ff35f1986ca032033bba
(cherry picked from commit 667c672c80)
Merged-In: I164a1c9266fb74b6cdd0ff35f1986ca032033bba
2021-02-18 23:08:29 +00:00
Robert Shih
9397f5b972 Merge "wv hidl: map CdmResponseType to drm@1.4 Status" into sc-dev 2021-02-18 00:25:48 +00:00
Robert Shih
0450bfcda1 WVDrmPlugin: map OEMCryptoResult to drm@1.4 Status
Bug: 162255728
Change-Id: Ieb7de4e3d40e132ab17d5907132879714ef7e918
Test: MediaDrmTest#testExceptionMessage
2021-02-17 09:05:21 +00:00
Robert Shih
bbfa2b4ff4 Merge "Run git-clang-format on log.{h,cpp}" into sc-dev 2021-02-17 09:01:14 +00:00
Robert Shih
89b9cb2706 Run git-clang-format on log.{h,cpp}
Bug: 168341163
Test: build
Change-Id: Ie51b1d4ab66e256992b6fffa524331ec124e047d
2021-02-16 00:39:43 -08:00
Robert Shih
fa49fdade0 Run git-clang-format
Bug: 168341163
Test: build
Change-Id: Icf8bd644ee5e87cd499ee017c8c522a96d385d4c
2021-02-11 08:40:31 -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
Robert Shih
6ed2c30a0a wv hidl: map CdmResponseType to drm@1.4 Status
Bug: 162255728
Test: VtsHalDrmV1_4TargetTest
Change-Id: Icc96c17f38218475efc7489348b75c9978f16b01
2021-02-08 19:10:43 -08:00
Robert Shih
e77b029214 Merge "libwvhidl: implement API to get plugin logs" into sc-dev 2021-02-05 05:28:00 +00:00
Edwin Wong
3ee1f400e7 Fix potential decrypt src pointer overflow. am: c3a24e6c86 am: 25f89c373c am: 15ba854123 am: 37e0991645
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13421305

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I71106d21ee571a1446ffe9271e8c1f5672505abf
2021-02-04 18:25:22 +00:00
Robert Shih
12995287fa libwvhidl: implement API to get plugin logs
Bug: 162255728
Test: VtsHalDrmV1_4TargetTest
Change-Id: I333cb1ee2f25ae718e7f544f4a5f7ee50668041a
2021-02-04 06:43:54 -08:00
Robert Shih
83ef9081d1 Save recent Widevine CDM logs
Bug: 162255728
Test: cdm unit tests
Change-Id: Ibc0daf374bedd8ac2a9a0515835e2775045962a7
2021-02-04 05:12:09 +00:00
Edwin Wong
2b094e710e Fix potential decrypt src pointer overflow. am: c3a24e6c86 am: 25f89c373c am: 15ba854123 am: 0126cc541f am: cd37425acb
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13421305

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia0171ddb362a84d8b08c9a429e40adab4baf1b8c
2021-02-03 02:19:51 +00:00
Edwin Wong
cd37425acb Fix potential decrypt src pointer overflow. am: c3a24e6c86 am: 25f89c373c am: 15ba854123 am: 0126cc541f
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13421305

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1644e541f8f21e85f58b600880537da9bd7d9301
2021-02-03 01:33:24 +00:00
Edwin Wong
37e0991645 Fix potential decrypt src pointer overflow. am: c3a24e6c86 am: 25f89c373c am: 15ba854123
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13421305

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3356e46dd849cd63e90f36d33e72dec525403f7d
2021-02-03 01:13:28 +00:00
Edwin Wong
0126cc541f Fix potential decrypt src pointer overflow. am: c3a24e6c86 am: 25f89c373c am: 15ba854123
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13421305

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0ca1b56fb48691be44e302dc0acaecfdf14b7e5c
2021-02-03 01:11:50 +00:00
Edwin Wong
15ba854123 Fix potential decrypt src pointer overflow. am: c3a24e6c86 am: 25f89c373c
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13421305

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie5c32617a1ebbed4805aa0a048a2ab92ff958c11
2021-02-03 00:35:53 +00:00
Edwin Wong
25f89c373c Fix potential decrypt src pointer overflow. am: c3a24e6c86
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13421305

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I243e7a6e4ea799af9759be2ee41f9d9ff7805f0e
2021-02-03 00:03:49 +00:00
Edwin Wong
c3a24e6c86 Fix potential decrypt src pointer overflow.
Merged from http://go/wvgerrit/114903

There is a potential integer overflow to bypass the
source base size check in decrypt. The source pointer
can then point to the outside of the source buffer,
which could potentially leak arbitrary memory content
to destination pointer.

Test: sts-tradefed
  sts-tradefed run sts-engbuild-no-spl-lock -m StsHostTestCases --test android.security.sts.Bug_176496160#testPocBug_176496160

Test: push to device with target_hwasan-userdebug build
  adb shell /data/local/tmp/Bug-17649616064

Bug: 176496160
Bug: 176444786
Change-Id: I208e0d5d949e8ef003fcf7d6f129eab66b9b3656
2021-01-28 17:59:08 +00:00
bohu
f225e9876e widevine: allows to build service on 64bit only guest
BUG: 177228019
Change-Id: I0181dcc355e706dd923f940018821fcae244a941
Merged-In: I0181dcc355e706dd923f940018821fcae244a941
(cherry picked from commit 8d723e7b8c)
2021-01-27 18:17:24 +00:00
Robert Shih
e0a1e459a2 libwvhidl: implement setPlaybackId
Bug: 159337195
Bug: 168341163
Test: GtsMediaTestCases MediaDrmTest#testSetPlaybackId
Change-Id: I4fc687892c9dd3b8077b3ecdfd9bbc355b298571
2021-01-20 15:26:01 +00:00
Robert Shih
56195b41c6 libwvhidl: upgrade to android.hardware.drm@1.4
Bug: 136119370
Test: GtsMediaTestCases MediaDrmTest#testRequiresSecureDecoder
Change-Id: Iaaa7c225c0056904b5fd98c4557ec47f661b2c7d
2021-01-19 05:52:59 -08:00
Jingjiang Li
5eb7d21fd5 Merge "Allow priv-app to invoke signRSA API." 2021-01-14 03:30:54 +00:00
jingjiangli
5bf19f51a9 Allow priv-app to invoke signRSA API.
For more details please refer to: https://docs.google.com/document/d/1FcnUvv7w5xu05UgEFjRtpUWcBiitBmatewYbYjh8w8s/edit#heading=h.44t8ehqbf98p

Bug: b/175603696
Change-Id: I5544ae858bc2b9358e53ca03c5d5805bc33f061e
2021-01-14 02:39:42 +00:00
Bharath Chandra Elluru
1c27386af0 Merge "Merge oemcrypto buffer overflow tests from cdm" 2021-01-11 22:13:48 +00:00
Bharath Chandra Elluru
6b548748b2 Merge oemcrypto buffer overflow tests from cdm
Widevine CLs:
http://go/wvgerrit/112243
http://go/wvgerrit/110563
http://go/wvgerrit/95483
http://go/wvgerrit/107047
http://go/wvgerrit/111123
http://go/wvgerrit/106224
http://go/wvgerrit/106263
http://go/wvgerrit/106223
http://go/wvgerrit/104223
http://go/wvgerrit/108583
http://go/wvgerrit/111403
http://go/wvgerrit/111623
http://go/wvgerrit/106264
http://go/wvgerrit/110483
http://go/wvgerrit/111944
http://go/wvgerrit/108684
http://go/wvgerrit/104183
http://go/wvgerrit/111443
http://go/wvgerrit/111869
http://go/wvgerrit/108843
http://go/wvgerrit/104363
http://go/wvgerrit/104423
http://go/wvgerrit/104263
http://go/wvgerrit/106584
http://go/wvgerrit/105924
http://go/wvgerrit/104524
http://go/wvgerrit/113023

Bug:175401639

Test: We would like to run these tests on pixel devices from master
branch using go/wv-and-dash

Change-Id: Ic4188504af64de9ce79941f75ac6feaf29189a4d
2021-01-11 22:13:16 +00:00
Rahul Frias
53d6db47e5 Adding additional logs to the decryption flow
[ Merge of http://go/wvgerrit/111507 ]

Bug: 174195349
Test: WV unit/integration tests
Change-Id: If8eb2c6ba326ed246da7adfa1137e16fe69bb044
2020-12-20 12:12:35 -08:00
Rahul Frias
e851d42eb1 [automerger skipped] Reprovision on error 10085 [ DO NOT MERGE ] am: c5b65aa5ed am: dd140c463c -s ours
am skip reason: subject contains skip directive

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13139811

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibe54309a1e7b9d3f59da95c659ba5e9152a23dee
2020-12-09 18:41:28 +00:00
Rahul Frias
dd140c463c Reprovision on error 10085 [ DO NOT MERGE ] am: c5b65aa5ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13139811

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0251d7327a8c395fd79c0aaf52241a548d954713
2020-12-09 18:09:13 +00:00
Rahul Frias
14d2f62358 Merge "Reprovision on error 10085" 2020-12-08 20:29:48 +00:00
Alex Dale
6311f130c4 Merge "Restrict reserved Client ID fields." 2020-12-08 04:31:28 +00:00
Alex Dale
78f4bca3a9 Restrict reserved Client ID fields.
[ Merge of http://go/wvgerrit/108904 ]

Client ID name-value fields in the license request share the same
namespace with app parameters and WV standard device information.  As
a result, it was possible for applications to provide parameters that
could potentially fool the license server with spoof values.

This CL restricts the use of the fields that are common across both the
Android CDM and CE CDM.  Currently, Android specific fields are
restricted by the MediaDrmPlugin layer, and there are no CE CDM
specific fields currently defined.

The non-HIDL DRM plugin does not restrict these fields; however, it
will be removed in S.

Bug: 171723566
Test: Android integration test
Change-Id: I5ad9ead73c5aff712dff8133953de5ddc3296452
2020-12-04 12:34:01 -08:00
Rahul Frias
c5b65aa5ed Reprovision on error 10085 [ DO NOT MERGE ]
[ Merge of http://go/wvgerrit/110603 and http://go/ag/13139808 ]

Qualcomm SoC may report 10085 (RSASSA-PSS signature error) when
OEMCrypto_PrepareAndSignLicenseRequest is called. The app needs to
reprovision (or the user needs to factory reset their device) in order
to recover.

If the 10085 error is returned, the app currently will get a
MediaDrmStateException. The app has no way to be able to tell
whether this is due to the 10085 error or some other error.

This change returns a NEED_PROVISIONING error at the CDM level, which
will result in the app receiving a NotProvisionedException when
MediaDrm.getKeyRequest is called.

Bug: 174375589
Test: GtsMediaTestCases, WV unit/integration tests
Change-Id: I4f2884c8a5fd88ab2e9bfbc0731a20e58cec0f36
2020-12-03 03:29:33 -08:00
Rahul Frias
c034e1f8d2 Reprovision on error 10085
[ Merge of http://go/wvgerrit/110603 ]

Qualcomm SoC may report 10085 (RSASSA-PSS signature error) when
OEMCrypto_PrepareAndSignLicenseRequest is called. The app needs to
reprovision (or the user needs to factory reset their device) in order
to recover.

If the 10085 error is returned, the app currently will get a
MediaDrmStateException. The app has no way to be able to tell
whether this is due to the 10085 error or some other error.

This change returns a NEED_PROVISIONING error at the CDM level, which
will result in the app receiving a NotProvisionedException when
MediaDrm.getKeyRequest is called.

Bug: 174375589
Test: WV unit/integration tests
Change-Id: I4f2884c8a5fd88ab2e9bfbc0731a20e58cec0f36
2020-12-03 03:10:52 -08:00
Rahul Frias
99938c3a36 Fix Format String Signedness
[ Merge of http://go/wvgerrit/110165 ]

The conditional compilation for flagging the CDM and ODKiTEE logging
functions as printf-like was guarded by a check on "__gnuc__" or
"__clang__". However, GCC doesn't actually define "__gnuc__", it
defines "__GNUC__", all caps. Fixing this causes GCC to find a slew
of format-string errors that Clang was accepting. This patch fixes the
capitalization and the uncovered errors, most of which fall into one of
a few categories:

1) The format string and variable had different signedness. For these,
   the format strings are updated to match the variables.
2) The variable was an array index that was not of size_t. For these,
   the variables have been updated to be size_t and the format strings
   have been updated to use %zu. A few index variables that weren't
   actually used in format strings are also fixed to be size_t.
3) The code assumed the signedness of the internal representation of an
   integer literal, enum constant, or enum variable. For these, I either
   cast the input to a known type so that the format string is valid
   regardless of internal representation or I switched to a hexadecimal
   format string. The latter case is more useful on ODKiTEE enums where
   the literal value is in the code as a 32-bit hexadecimal value
   anyway.

This patch also adds missing integer casts to the enum literals in the
ODKiTEE logging header. (These are required for pedantic C99
compatibility when using literal values that do not fit into a 16-bit
integer.)

Bug: 173460694
Test: jenkins/odkitee_ta
Test: build.py x86-64
Change-Id: I244972639a5a6ea0de157eb67e1e0dfa9787ec32
2020-11-27 03:50:40 -08:00
Alex Dale
c2df654ecc Merge "Updated usage table capacity property string." 2020-11-18 07:23:49 +00:00
Cong Lin
f28ced6886 Merge "Upgrade L3 to v16 and update Android.bp files" 2020-11-18 00:16:23 +00:00
Cong Lin
0f32446ee7 Upgrade L3 to v16 and update Android.bp files
Merging CL:
* http://go/wvgerrit/108203
* http://go/wvgerrit/103904 (changes to L3 source files excluded)

Also added ODK dependency which is required by L3 v16.
Do not replace constant sizeof() with a hard-coded value in L3 library because it is target-specific.

Test: Unit tests on gLinux
    jenkins/linux_unit_tests
    jenkins/ce_cdm_tests
Test: Unit tests on Pixel 4(flame-userdebug, rvc-qpr-dev)
    vendor/widevine/libwvdrmengine/build_and_run_all_unit_tests.sh
Test: Manual ExoPlayer L1/L3 playback tests (flame-userdebug)
    WV: Secure HD/SD (cenc,MP4,H264)
    WV: Secure HD/SD (cbc1,MP4,H264)
    WV: Secure HD/SD (cbcs,MP4,H264)
Test: Widevine GTS tests(bramble-userdebug, master)
    http://ab/I23800006571451275
Bug: 136317881
Bug: 139814713
Bug: 173331251
Change-Id: I1656e83a74a0eaf650f55f5e2388819bf5020c0d
2020-11-17 23:28:51 +00:00
Robert Shih
e7bac6e6a1 [automerger skipped] x86 L3: use correct struct size [ DO NOT MERGE ] am: 44aea963d0 am: 4e94dce40b -s ours
am skip reason: subject contains skip directive

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/13061527

Change-Id: Ia99f6ff49bb481870af1bd2a373f7d38b37f92ce
2020-11-17 03:32:14 +00:00