Commit Graph

37 Commits

Author SHA1 Message Date
Alex Dale
59f0f7cd36 Added new error code OEMCrypto_ERROR_INVALID_KEY.
[ Merge of http://go/wvgerrit/138606 ]

The new error code OEMCrypto_ERROR_INVALID_KEY is to replace the now
deprecated error code OEMCrypto_ERROR_INVALID_RSA_KEY.  This error code
serves the same purpose of OEMCrypto_ERROR_INVALID_RSA_KEY, but may be
appied to RSA, ECC and Twisted-Edward ECC keys.  In general, this error
code is to indicate that a key is poorly formatted / unparsable, used in
an operation without allow permissions, or used in an operation that it
cannot be association (RSA signing with an ECC key).

Going forward, new OEMCrypto implementation should use
OEMCrypto_ERROR_INVALID_KEY in place of OEMCrypto_ERROR_INVALID_RSA_KEY.
The CDM will continue to support both error codes.

Bug: 201581141
Test: Testbed unit tests
Change-Id: I2cf1af33a9a1d8716eec4cc63bba52d2f4af4c1b
2021-11-11 20:25:31 -08:00
John W. Bruce
71aaf870c8 Make implicit 64-to-32-bit conversions in core_message_serialize.cpp explicit
(This is a merge of http://go/wvgerrit/134404.)

There were two lines that were tripping Clang's `-Wshorten-64-to-32`
warning. This CL makes both conversions explicit to appease the warning.
There should be no change in behavior.

Bug: 194971260
Test: ODK Unit Tests
Change-Id: I6d111e9a4efc1f0e31b51e455c47c0e885d48e6b
2021-10-27 12:41:47 -07:00
John W. Bruce
8d35b2c4e2 ODK: Fix a few implict type conversion issues
(This is a merge of http://go/wvgerrit/134403.)

Reported as errors by UBSAN

Bug: 194971260
Test: Ran ODK unit tests
Change-Id: I2f38fb6952d259458af8498e86b3308421e93320
2021-10-27 12:40:10 -07:00
TreeHugger Robot
9d84d5deba Merge "Migrate tests to googletest 1.10+ API" 2021-10-16 00:20:40 +00:00
John W. Bruce
8609a28dac Remove unused variable
Merge from Widevine repo of http://go/wvgerrit/134728

This variable was written to, but the value was never read. Newer
compilers would complain about this. This patch removes the unused
variable.

Bug: 202400919
Change-Id: I87cae291d41b18db91a4c4f8a76edb537635db2c
2021-10-13 21:24:12 +00:00
Fred Gylys-Colwell
b63085ab5a Layered Clock interface
Merge from Widevine repo of http://go/wvgerrit/131306
which is a
Merge of non OPK files from http://go/wvgerrit/129344
and http://go/wvgerrit/129563. The OPK files are squash merged
in the CL http://go/wvgerrit/131303.

This splits the clock interface into two layers so that we can save
the previous value.

Bug: 158719238
Change-Id: I473966eb9b0766d27372682e8ebfbcb53f546980
2021-10-13 21:20:55 +00:00
Jeff Tinker
b082f3fb0b Implement serialization version checking
Merge from Widevine repo of http://go/wvgerrit/125263
and http://go/wvgerrit/135749

Define a |major.minor| version in the
serialization layer and check for compatibility
between REE and TEE before accepting connections.

bug: 158857733
test: opk_all_tests
Change-Id: Iad44a1f50a27c6bca4959c6d41c9b361712dbde8
2021-10-13 21:20:55 +00:00
John W. Bruce
895d391121 Migrate tests to googletest 1.10+ API
(This is a cherry-pick of http://go/wvgerrit/135227 and
http://go/wvgerrit/135246 from the Widevine repo.)

Googletest has deprecated the TEST_CASE nomenclature in favor of the
International Software Testing Qualifications Board-compliant term
TEST_SUITE. See
https://google.github.io/googletest/primer.html#beware-of-the-nomenclature
for more info.

Bug: 156766290
Test: build_and_run_all_unit_tests.sh
Change-Id: Ib94d534d17677601c4c160eb6b8d4e4e07df85c9
2021-10-11 17:05:48 -07:00
Fred Gylys-Colwell
bac33dbc6e Use local provisioning server
Merge from Widevine repo of http://go/wvgerrit/133703 and
http://ag/14707867

[ Cherry-pick of http://ag/15835345 ]

In order to use a local provisioning server, we need to use a
different test keybox system id that is in the dev device database
instead of the production database. We also need to use a local
license server that uses the dev license server.

Bug: 187646550
Test: GtsMediaTestCases

Change-Id: Ice89143dd26de22757375a770c6bac716fcbc057

Add Keybox OTA Provisioning functions to OEMCrypto header

Merge from Widevine repo of http://go/wvgerrit/133704 and
http://go/ag/14707868

Bug: 188228998
Change-Id: Iff54bc2870e87bf7239e179e1d02fbcc8df6198f

Stub build changes to support OTA Keybox

Merge from Widevine repo of http://go/wvgerrit/133725 and
http://go/ag/14781459

This CL adds a new unit test file for testing OTA keybox
reprovisioning functionality. This new test is built when running the
dynamic adapter in the linux build, and in the Android build.

Bug: 187646550
Change-Id: I625513840188f95e74831ef2ea399e827e837439

Add OTA Keybox functions to dynamic adapter

Merge from Widevine repo of http://go/wvgerrit/125843
and http://go/ag/14781460

Bug: 187646550
Change-Id: Ief78ed10599c091690e0d7dc488ea71674c763b5

Refactor dynamic adapter keybox verification

Merge from Widevine repo of http://go/wvgerrit/133727
http://go/ag/14812524

The keybox validation needs to be done separately from initializing
the library so that we can support Keybox OTA Reprovisioning.

If L1 loads, but the keybox is missing, the initialization should
succeed. When the keybox is validated, the adapter should try to look
for a keybox on the filesystem. if none is found, it should either
return NEEDS PROVISIONING or an error.

Bug: 187646550
Change-Id: I34a8c365a5a5ca35c379bea827c85c749964744c

Update crypto session to use new OTA keybox functionality

Merge from Widevine repo of http://go/wvgerrit/133728 and
http://go/ag/14812525

This CL stubs out two new CryptoSession functions that call the new
OEMCrypto functions for OTA Keybox Provisioning. It builds!  Yay!

It also adds a boolean needs_keybox_provisioning that is set to true
when OEMCrypto reports that it needs a keybox. This should only happen
if there is no keybox installed and oemcrypto supports provisioning.

Bug: 187646550
Change-Id: Ide9533943125aa13b8899b652b118a0b410c882c
2021-09-29 14:00:36 -07:00
Fred Gylys-Colwell
a87eec804c Fix unused param warnings in oemcrypto fuzz test
Merge from Widevine repo of http://go/wvgerrit/122403

Re-merge of http://go/wvgerrit/105184 which was accidentally
undone by http://go/wvgerrit/107063.

Unused params are reported as warning when built in Android.

Test: Ran oemcrypto unit tests
Bug: 160734070
Change-Id: Id8384c58c8ace0b214464380fb961d108f1b5c3b
2021-04-23 10:11:48 -07:00
Fred Gylys-Colwell
14a034209c Turn on ODK tests in CE CDM test and fix test helper
Merge from Widevine repo of http://go/wvgerrit/122223

This adds the ODK unit tests to the CE CDM tests so that they run as
part of the presubmit tests.

The test helper had some pointer problems converting a bool to a
uint32, so it has been updated to handle this correctly.

Some other tests failed comparing signed to unsigned, to these have
also been fixed.

test: ran odk_test
bug: 118657876
Change-Id: I744a1e89f4e4729c31d3f53e729984ffac1d96fd
2021-04-23 10:11:48 -07:00
Fred Gylys-Colwell
79b2a933e4 Fix another typo
Merge from Widevine repo of http://go/wvgerrit/122123

Bug: 171912044
Change-Id: Ic7459870ac532f04f254913e685a306dbdfe1f7a
2021-04-14 09:53:02 -07:00
Fred Gylys-Colwell
e51c9fbbb8 Update license comment
Merge from Widevine repo of http://go/wvgerrit/121950

Remove term "Master" from "Widevine Master License Agreement".

Bug: 168562298
Change-Id: I655babf1bc447f4872f6a0f849107262be42df7a
2021-04-12 14:10:08 -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
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
Fred Gylys-Colwell
20bb84ffee Merge recent doc changes for OEMCrypto
This is a cherry pick of recent changes to OEMCrypto and ODK. Most of
these are part of the document migration to doxygen.

See http://go/wvgerrit/106005 and its parents for code reviews.

Bug: 144715340
Bug: 148232693
Bug: 167580674
Change-Id: I658f99c8117b974faed97322d61fac0f382283af
2020-09-15 19:10:53 -07:00
Fred Gylys-Colwell
f60a2d8e22 Update OEMCrypto documentation to v16.3 am: aa5fc5afd0 am: 30ea7ee843 am: 615bf191a5 am: cc446c0075
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11707216

Change-Id: I80833b2d971bdbe82af3ba709651d98ac8e29e5b
2020-06-04 22:29:48 +00:00
Fred Gylys-Colwell
aa5fc5afd0 Update OEMCrypto documentation to v16.3
Merge from Widevine repo of http://go/wvgerrit/101243

Changed the version number to 16.3 and the date to June 1st.  The
delta document has a short description of CL's added since
April 6th.

Test: documentation changes only
Bug: 157030231
Change-Id: I93c2b09d6a24efc71ed77110b115cafbd6fde1c6
2020-06-03 06:14:35 -07:00
Fred Gylys-Colwell
7cb5714fdd Update ODK Library to 16.3 am: 166b3e8403 am: 62802d8e10 am: 4b9e91eefd am: 084bfcf938
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11699230

Change-Id: Ia726a9e052814f3ab7740daf0267df9cb94c6d20
2020-06-02 22:26:46 +00:00
Fred Gylys-Colwell
0360cf948f ODK: forward compatibility and nonce-free offline license support am: 8dc1d7a11d am: 5bb396fb72 am: c2920550ed am: 0000eef77d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11688972

Change-Id: Ia701b9c7696d33a47f8d2a342cec3f5d79ca20db
2020-06-02 22:26:44 +00:00
Fred Gylys-Colwell
166b3e8403 Update ODK Library to 16.3
Merge from Widevine repo of http://go/wvgerrit/101130

https://cr/314253512
ODK Library: roll version number to 16.3

https://cr/314253425
ODK Library: Accept release request as renewal request

To support forward compatibility, the v16 server should parse a
release request as a renewal request.

https://cr/314213725
ODK: Accept larger message sizes

The ODK should accept a message size that is larger than the
current
API requires. This allows for future API versions to append
fields to
a message that current the current license SDK will
ignore.

https://cr/313962712
ODK: accept messages with future API version numbers

This CL updates the ODK parse functions to accept future versions
of
the message. This will allow a v16 server to talk to a v17
device.

https://cr/313814938
ODK Version String

Add an automatically generated version string to odk_structs.h

Bug: 157030231
Bug: 157512150
Bug: 157822248
Bug: 157512322
Test: unit tests on taimen
Change-Id: I346f73c41bc984fe17856d3b61cd08cf92b39919
2020-06-02 08:30:34 -07:00
Fred Gylys-Colwell
8dc1d7a11d ODK: forward compatibility and nonce-free offline license support
Merge of http://go/wvgerrit/101183

This is a combination of multiple commits from google3:
* http://cl/313814938
  ODK Version String
* http://cl/313962712
  ODK: accept messages with future API version numbers
* http://cl/312219187
  Ignore hash if initial load of license, and the nonce not required
  (squashed into http://cl/313962712)

Test: OEMCryptoLicenseTest.LoadKeyWithNoRequest
Bug: 157822248
Bug: 156853321
Change-Id: I735d355241876bddb0c52440b0049efb72a4b26f
2020-06-01 19:13:32 +00:00
Cong Lin
c3be1c3098 Merge "Fix implicit type conversion issue in ODK" into rvc-dev am: c34e2af181 am: f5e7afe51d am: 5f76c56c05 am: d622cde29c
Change-Id: I1cd80a70c9b094e245a904e310406f1cbf523fb2
2020-05-30 03:56:07 +00:00
Cong Lin
69e7e21882 Fix implicit type conversion issue in ODK
Merging CL
https://widevine-internal-review.googlesource.com/c/cdm/+/100924 Fix implicit type conversion issue in ODK

1. Implicit cast is reported as error when compiling ODK with Level3
2. Override odk_add_overflow_xxx function with the built in functions can cause
redefinition issue when compiling Level3; Let's use odk customized overflow functions.

Bug: b/157510403
Test: ODK unittests and CDM unittests passed.
Change-Id: Ieef8ccfb41d08007ec72f4a061f92968e55539cb
2020-05-29 10:07:08 -07:00
Bharath Chandra Elluru
7664781685 Merging changes from http://cl/312740650 to change buganizer component
id to which odk fuzz scripts log any bugs.

Bug: b/157252243
Cricticque cl: http://cl/312740650

Test: This is a configuration change to change buganizer component Id.
No functionality testing involved.
Change-Id: I17e76c015b7fc264281aa32eae975165ec8e6bed

Change-Id: If0b8954c606f9359b45bccd5276703138d4e02f5
2020-05-21 14:36:50 -07:00
Bharath Chandra Elluru
ac942791c9 Merging Android odk fuzz changes to improve coverage from http://go/wvgerrit/99911
Test: The changs have been made in google3 and fuzzer has been running
successfully with improved coverage
Critique CL: http://cl/310633618
Bug: b/155435131
Change-Id: Ib02601302db238ce8fbeb3963ce8e05e864ba985

Change-Id: I11eba4d1aa1536b44929b742a5e2c2bf89d818fb
2020-05-12 16:18:35 -07:00
Bharath Chandra Elluru
d0b3316d96 Merge Android odk fuzz changes(Adding corpus) from http://go/wvgerrit/98692
Google3 CLs:
http://cl/308666040

Bug: b/154264716
Test: Locally ran and built odk fuzz binaries and tested
fuzzer binaries on pixel device
Change-Id: Icdb81291e101a0abdb75f84008f701c06e7384d6

Change-Id: Iad573209b47bd450c843a7cab5570a76c012fce9
2020-04-27 14:00:17 -07:00
Bharath Chandra Elluru
d524d840e3 Copy submitted odk fuzzing changes from cdm repository to android
Merging odk changes from http://go/wvgerrit/98084

Copy submitted changes for oemcrypto/odk/test/fuzzing from cdm
repository to android so that fuzzer scripts in odk can be run
using go/android-fuzzing

Google3 CLs:
http://cl/301943247
http://cl/304011238
http://cl/307142293
http://cl/307087692

Bug: 150900870
Test: The fuzzer scripts can be built once the code is moved to android
tree. Odk fuzzer scripts have been verified and successfully running in
google3

Change-Id: I92b8a357c32b145c7f80bdc93d05214862368957
2020-04-21 18:42:43 +00:00
Cong Lin
78fddc230a (WV to Android) Fix un-initialized-value warning as error in odk_test
Merge from Widevine repo of http://go/wvgerrit/95968

Un-initialized int array allocated on heap is detected by MemorySanitizer using this command:

rabbit test --config=msan --keep_going --compilation_mode=opt --runs_per_test=1 //video/widevine/export/common/oemcrypto_core_message/odk:odk_test

Bug: 151339875
Test: cdm and odk unit tests
Change-Id: Ic3329b918636a58eccb518ded7b262c4d98c3644
2020-03-17 21:44:17 +00:00
Cong Lin
5a6a2075f5 ODK: Address review comments
Merge of http://go/wvgerrit/95666

Mostly fixing coding styles and a few vulnerability check.
Updating tests according to the fix.

Bug: 150614088
Bug: 150881959
Test: Ran cdm and odk unit tests
Change-Id: I109a96ee8ded089d59ab49c2f94b6833c932fd1e
2020-03-12 18:25:46 -07:00
Fred Gylys-Colwell
c5b7a01ab5 Update ODK Library and add license release unit test
Merge from Widevine repo of two CLs.

Merge from Widevine repo of http://go/wvgerrit/94743

A license release should not have a core message. This CL adjusts the
existing unit tests to verify this. There is also a new unit test called
SecureStop that explicitly tests sending a secure stop in a new
session without first loading the license.

Merge from Widevine repo of http://go/wvgerrit/94865

This CL has the following changes copied from google3:
http://cr/298871728 Remove odk_static_assert for Message size temporarily
http://cr/298755935 Fix a compiling error during macro expansion
http://cr/298481745 Add missing header for android
http://cr/298448142 Fix odk_test gyp file
http://cr/298419641 Remove header from Android.bp
http://cr/298402053 Separate sizeOf(args) bytes in fuzz tests
http://cr/297730316 No core messages for license release
http://cr/297714346 Add copybara_test and piper_sot_to_gerrit
http://cr/297636713 Adding some comments around boolean conversion code
http://cr/297420679 Autofuzzer when ran with address sanitizer ...
http://cr/296513584 Minor fix with fuzzing odk clock values
http://cr/296322024 Fixing errors in code with how request ...
http://cr/296313159 Fuzzing ODK clock values by setting aside ...
http://cr/295763207 Add more odk tests and move helper functions to test helper
http://cr/294524098 Adding a Build Rule for ODK_KDO_Fuzzer and updating
http://cr/294492213 Address a few review comments of ODK
http://cr/293674368 odk_fuzz: add TODOs & comments
http://cr/293492806 Fix spelling

Bug: 150243585
Bug: 150020278
Bug: 150095506
Bug: 147297226
Bug: 148290294
Bug: 148907684
Bug: 150608451
Test: unit tests
Change-Id: I25fd406f29f4eba40f5cb27e9a1317dce4ffc2f5
2020-03-05 19:06:31 +00:00
TreeHugger Robot
6a0cc01e0f Merge "Address review comments and sync branches" 2020-02-07 23:27:36 +00:00
Fred Gylys-Colwell
a3477aab03 Address review comments and sync branches
This CL merges some missed pieces of the merge from Widevine repo of
http://go/wvgerrit/93405

Test: unit tests
Bug: 147879734, 147396294, 141247171
Change-Id: I3b92b983f68f6a529f109bc5dec91b313e3fd7fb
2020-02-07 14:12:26 -08:00
Alex Dale
8977119d05 Small fixes leftover from V16 merge.
[ Merge of http://go/wvgerrit/93505 ]

During the merge process there were a few CL comments (ag/10122083)
that were not able to be addressed.  Most changes in the CL are
spelling / grammar corrections.

Bug: 148907684
Bug: 141247171
Test: CDM unit tests
Change-Id: I9a8648525bbe5ed319521ebf01741a958ab69ae2
2020-02-06 17:44:45 -08:00
Fred Gylys-Colwell
db2050dff1 OEMCrypto v16.2
Merge from Widevine repo of http://go/wvgerrit/93404

This is the unit tests, reference code, and documentation for
OEMCrypto v16.2. Backwards compatibility should work for a v15
OEMCrypto.

Some review comments will be addressed in future CLs.

Bug: 141247171
Test: Unit tests
Test: Media GTS tests on bonito
Change-Id: I9d427c07580e180c0a4cfdc4a68f538d351c0ddd
2020-02-04 20:33:16 -08:00
Fred Gylys-Colwell
7665614b2e OEMCrypto v16.1
Merge of http://go/wvgerrit/93404

This CL updates the Widevine CDM to support OEMCrypto v16.1

Test: Tested in 16.2 CL
Bug: 141247171
Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
2020-02-03 14:45:32 -08:00
Robert Shih
2443fe807a odk: core serialization structs & functions
odk directory copied from wvgerrit.
branch oemcrypto-v16
commit 0c9a7dc

Bug: 140758896
Test: odk_test
Change-Id: I0c631f771b794468a63e4395f6b9c3b60a1dfd4f
2019-12-13 01:32:03 +00:00