Commit Graph

57 Commits

Author SHA1 Message Date
Cong Lin
3122896ecb Re-generate Android V L3 after renewal policy fix
Merge of
https://widevine-internal-review.git.corp.google.com/c/cdm/+/199044

L3 builds created for this fix:
https://widevine-internal-review.git.corp.google.com/c/cdm/+/199050

Fix to L3 renewal policy bypass attack:
OEMCrypto_DeriveKeysFromSessionKey cannot be called after a license is
loaded.

System IDs:
build_arm_v() { build_arm_with_id 33097; }
build_arm64_v() { build_arm64_with_id 33098; }
build_x86_v() { build_x86_with_id 33099; }
build_x86_64_v() { build_x86_64_with_id 33100; }

Test: tested with
https: //widevine-internal-review.git.corp.google.com/c/cdm/+/196392
Test: run_level3_static_tests
Test: run wvts on Pixel7
Bug: 334154045
Change-Id: Ib188d0a37a2193f56dfd287e2f0274ba65bd7b3e
2024-05-31 17:42:58 +00:00
Rahul Frias
72077acec6 Re-generate Android L3 after merging oemcrypto-v19 to master
[ Merge of http://go/wvgerrit/192271 ]

Test: L3 unit tests and GTS on pixel 7
Bug: 324147162
Test: WVTS
Change-Id: I5d94b0c9b3f681774e32623463b0d689f5bacc8c
2024-03-11 22:48:46 +00:00
Cong Lin
02fbb0adcd Re-generate Android L3 after L3 fixes
Build L3 after
https://widevine-internal-review.git.corp.google.com/c/cdm/+/186593

Test: run_dynamic_level3
Bug: 323957284
Change-Id: Ica4974d4ed941174e43d4898771ffe004f9cf8db
2024-02-23 08:47:28 -08:00
Cong Lin
2ba9667dee Update L3 with new SystemIDs for Android V
ID     Description
33097  Android Arm L3 Provisioning 3.0 2024
33098  Android Aarch64 L3 Provisioning 3.0 2024
33099  Android X86 L3 Provisioning 3.0 2024
33100  Android X86 64 L3 Provisioning 3.0 2024

Test: L3 playback tests on pixel
Change-Id: I74a377fa52e1cb8f4c3ae1c7c1edf70086b3fd14
2024-02-23 08:47:27 -08:00
Cong Lin
0e165f6d54 L3 v19: Rebuild Android L3 and update .bp files
Regenerate L3 after fixes and add new source to .bp files.

Test: Build Widevine apex in Android main
Change-Id: I93fd5cf22437a2c8e6d2b60d9994dbf97f4ba213
2024-02-23 08:47:13 -08:00
Cong Lin
9651c61e25 Fix session id in dynamic adapter and re-generate L3
Merge of https://widevine-internal-review.googlesource.com/c/cdm/+/173330

Skipping files that are not in android from the CL above.

Original commit message:

Pass the real oemcrypto session id from `pair.session` instead of
`session`, since `session` can be changed when L1 and L3 are running in parallel and `session` in that case may not be the correct oemcrypto session id any more.

Also adding a few missing v18 L3 functions pointers to the dynamic
adapter.

Need to re-generate L3 since the L3 sources changed.

Test: L3 unit tests
Test: GTS dash policy tests and Dexter tests
Bug: 271290471
Bug: 279967915
Change-Id: Idc44d57ca38eb1de24c0038917800e37c25b9afc
2023-05-01 19:25:27 +00:00
Cong Lin
efd05207c8 Re-generate Android L3 after zero-initializer fix
Merge of https://widevine-internal-review.googlesource.com/c/cdm/+/170631

Original fix:

Array intializer "= {0}" may involve compiler specific behaviors which
can cause haystack hang on arm32 target. Fix is to use memset() instead.

Test: debug build verified on arm32 device
Test: Ran GTS media tests on Pixel 7
Bug: 274637461
Change-Id: I02f5df232934e0c78e259c85e4faf313c01c0b6b
2023-04-14 12:38:49 -07:00
Cong Lin
c0f1a22890 Update Android L3 after CloseSession() fix
Merge of https://widevine-internal-review.googlesource.com/c/cdm/+/169301/

Orignial commit message:

Fix session open flag when closing entitled key session

When a session is closed, it also closes all its entitled key sessions.
A bug in L3 accidentally resets session_open flags in other active
sessions.

Re-generated Android L3.

Test: L3 key rotation tests in Pixel 7
Test: Run GTS media test on Pixel 7
Bug: 264688931
Change-Id: Ia02aeb2b0914a1634874871f1b82ed82f8069dbb
2023-03-29 21:50:19 -07:00
Cong Lin
3dd24639b3 Update Android L3 after entitled key session fix
This is a merge of
https://widevine-internal-review.googlesource.com/c/cdm/+/168143

Original commit message:
Level3_RemoveEntitledKeySession(key_session) can be called when the
entitled key_session is already released by its entitlement session.
Do not return an error if the key_session to be removed is no longer
valid.

Test: run_dynamic_level3, oemcrypto unit tests on Pixel
Test: GTS media tests
Bug: 264688931
Change-Id: If0e0d0db2137c29e1dab4df321cf11ebcad2451f
2023-03-15 09:52:05 -07:00
Cong Lin
eed03c1bd1 Re-generate Android L3 after memset fix
This is a merge of
167280: Re-generate Android L3 after memset fix | https://widevine-internal-review.googlesource.com/c/cdm/+/167280

Original fix and commit message:
167279: Fix a few memset calls in L3 haystack | https://widevine-internal-review.googlesource.com/c/cdm/+/167279

Test: GtsMediaTest on Pixel 7
Bug: 264978856
Change-Id: Id7a801389edec23f020297b762ccf5e0e3d77c6a
2023-03-02 12:55:07 -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
Cong Lin
7aceca7310 Update L3 after key double free fix master
Merge of https://widevine-internal-review.googlesource.com/c/cdm/+/165018

Orignal commit message:
Update L3 in master branch after key double free fix

The fix is here:
https://widevine-internal-review.googlesource.com/c/cdm/+/164909/

Re-generated L3 libraries.

Test: ran L3 unit tests
Test: verified GTS tests on arm32 device
Bug: 252434586
Change-Id: Iea022b3d1087b79edf6649c038e1f701375989c6
2023-01-17 16:52:36 -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
Kyle Zhang
af0168dbed Merge cdm changes to android repo
Bug: 251924225
Test: GtsMediaTestCases
Change-Id: I1b4e64c0abf701fe1f5017f14dc72b72c3ea6770
2022-10-11 00:40:42 +00:00
Cong Lin
9935fae50d Loosen KCB encryption checks in L3
This is a merge from:
https://widevine-internal-review.googlesource.com/c/cdm/+/152372

The L3 source change which produced these libraries is:
https://widevine-internal-review.googlesource.com/c/cdm/+/152371/

Original commit message:
To address the bug with certain 16.4.x SDK versions returning a
clear key control block (KCB) for clients newer than 16.5, the
exact version check to determine whether key control blocks are
clear or not has been loosened.

Original behavior:
- ODK version >= 16.5.x --> Assume clear
- ODK version <= 16.4.x --> Assume encrypted
New behavior:
- No KCB IV --> Assume clear
- Otherwise --> Assume encrypted

This CL also includes a change to oemcrypto/include/OEMCryptoCENC.h
The changes to OEMCryptoCENC.h in the CL are comments or variable name
change. So it should be safe.
This change was merged to wv tm-dev here:
https://widevine-internal-review.googlesource.com/c/cdm/+/148411
So, adding it to Android tm-dev.

Test: run_level3_static_tests, CdmDecryptTest/CdmTestWithDecryptParam.* against LS SDK 16.4.2 & 17.0
Bug: 232557453
Change-Id: I2bbb5ab3ea33a16bd6c198077e5aefe960737ea0
2022-05-22 06:35:22 +00:00
Edwin
3c3da01d58 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Test:   atest vts_treble_vintf_vendor_test:vts_treble_vintf_vendor_test.DeviceManifest/SingleManifestTest#ManifestAidlHalsServed/0 -- --abi x86_64

Bug: 200055138
Bug: 170964303
Change-Id: I5654d90d8a4b0bae4b4a78e79b27c1cafec36be7
2022-02-01 22:20:04 -08:00
Cong Lin
efbe13ea36 Update Android L3 after cipher mode fix
This is a merge of
https://widevine-internal-review.googlesource.com/c/cdm/+/144790

Updated cipher mode to allow playback in v17;
Added check for key selection before decrypting.

Merge from Widevine repo of http://go/wvgerrit/144779
Fix allow_null for key control iv in L3 v17

Merge from Widevine repo of http://go/wvgerrit/144792
Fix api version check in L3 v17

Test: L3 unit tests
Bug: 217145027
Change-Id: I584bd57e26407cbf4d4b94eb1bc5cf80839377be
2022-02-01 10:00:40 -08:00
Yohei Yukawa
a4d835af3a Revert "Use aidl interface for Widevine service."
This reverts commit 96a8ccd4a1.

Reason for revert:
Could break DeviceManifest/SingleManifestTest#ManifestAidlHalsServed

Bug: 200055138
Bug: 170964303
Bug: 217241995
Change-Id: I9c42df15defec428c9ef8c62439c63d4a603fee6
2022-01-31 22:01:25 +00:00
Edwin
96a8ccd4a1 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Bug: 200055138
Bug: 170964303
Change-Id: If2f2a129914436ba5cef1c46f6cb9415e12c3d1c
2022-01-28 20:29:14 -08:00
Kyle Zhang
642965c678 Merge latest oemcrypto-v17 change
No-Typo-Check: Not related to this change.

Bug: 161477208
Change-Id: I99e4780f6855b7045aa0cd5a49c13d2d0d51ed64
2022-01-27 20:07:15 -08:00
[2~
39a44cce72 Re-generate L3 builds after security patch protecting RSA key
Merge from http://go/wvgerrit/133446

Commit message from Widevine repo:

"This change is to protect L3 RSA key from leaking in memory. After
this change, the RSA key, when loaded in memory, is XOR masked with
a key_mask."

The source CL that generates the new L3 libraries is here:
http://go/wvgerrit/130949

Test: L3 unit tests
Test: GTS test result https://android-build.googleplex.com/builds/abtd/run/L24400000950905884
Test: RSA performance test OEMCryptoLoadsCertificate.RSAPerformance
Test: Manual reboot tests on Pixel4
Bug: 183417993

Change-Id: I190e585ad03b8749e3487f9d3f0109be61a3c815
2021-09-13 09:32:07 -07:00
Cong Lin
61218ec6cf Fix L3 clock loading issue
This is a merge of http://go/wvgerrit/126703
Only obfuscated libraries for Android are included in this CL.

L3 loads clock info from an encrypted file during initialization. There
is a bug which calls the clock loading function before the decryption
key gets intialized in InitializeEngine(). Clock will be loaded with bad
decrypted data, which caused playback failure after system reboot.

The fix is to move clock loading after InitializeEngine() to ensure
decryption key is ready.

Bug: 188873354
Bug: 188892717
Test: L3 unit tests;
Test: Manual playback tests on Netflix
      Download, play, reboot device, play again
Test: GTS tests https://android-build.googleplex.com/builds/tests/view?invocationId=I02800009363823424&testResultId=TR23225132004211909&redirect=http://sponge2/73efa8e8-951a-48bb-b2a9-0b09d5038ed3

Change-Id: Icf34aa3135fdcb77dea8104a90ce90f14e79e61c
2021-06-21 22:15:18 +00:00
Cong Lin
563a79bd8b [RESTRICT AUTOMERGE] L3 Load RSA key from two parts and re-generate
build

This is a merge of CL from widevine repo (obfuscated code only):
https://widevine-internal-review.googlesource.com/c/cdm/+/124965

The source code change that produced the obfucated code is here:
https://widevine-internal-review.googlesource.com/c/cdm/+/121763

Original commit message from the fix above:
"This is a security improvement against an L3 exploit b/182584472.
The change is to store RSA private key in two parts instead of one,
and load it separately when the key is needed. This will make it
more difficult to find the entire RSA key.

This CL does the key loading part only. Key splitting is done
in Haystack in CL: cl/367515385"

New L3 system IDs included in the obfuscated code:
ID     Description
22593  Android S ARM L3 Field Provisioning 3.0
22594  Android S ARM 64 L3 Field Provisioning 3.0
22595  Android S x86 L3 Field Provisioning 3.0
22596  Android S x86 64 L3 Field Provisioning 3.0

Bug: 182584472
Test: L3 unit tests
Test: GTS tests
https://android-build.googleplex.com/builds/forrest/run/L16300000887061939
The only failed case is a test issue due to the new IDs not being added
to the allow list of the test yet. This test passed on local run with
the updated allow list.

Change-Id: If8b8b2cb9291ede0cb2dcc892f5557c3a68c4b96
2021-05-19 10:20:02 -07:00
Cong Lin
22f8ee9498 [RESTRICT AUTOMERGE] Refresh L3 libraries after buffer overflow fix sc-dev
Merge of [http://go/wvgerrit/118363]. Fixes included:

http://go/wvgerrit/111603
Fix L3 block offset test and re-enable buffer overflow tests

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

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

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

Test: Ran L3 unit tests
Test:
https://android-build.googleplex.com/builds/forrest/run/L81800000863169076
Bug: 182584472

Change-Id: Iae051ac2c06eb263b3b3be76d56b42917340af1d
2021-04-27 09:35:03 -07: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
Edwin Wong
307cf378a9 Convert Android.mk to Android.bp
This CL builds the Widevine drm services and libraries.
Soong makefile conversion for unit and integration
tests will be in a different CL.

This doc may help with the review:
https://docs.google.com/document/d/1lK3X9RFPwbbwewLNlS4TfSMhxIlPuAkHRnGcgwWpChU/edit?usp=sharing

Test: build
Test: Play Movies and Netflix streaming
Test: unit tests
  build_and_run_all_tests.sh
Test: gts
  ANDROID_BUILD_TOP= ./android-gts/tools/gts-tradefed run gts -m GtsMediaTestCases -t com.google.android.media.gts.MediaDrmTest

  atest GtsExoPlayerTestCases:com.google.android.exoplayer.gts.DashTest

Test: vts
  ANDROID_BUILD_TOP= PATH="$PWD/android-vts/tools:$PATH" vts-tradefed run commandAndExit vts --module VtsHalDrmV1_3Target

Bug: 162321744
Change-Id: I50c0fb2e8f28dfe7901587e3d3203542943e23b1
2020-08-19 14:54:47 -07: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
Srujan Gaddam
50c555336d Update Level 3 to OEMCrypto v15.2
Bug: b/132083217
Test: Linux, CE CDM, and Android unit/integration tests
Merge of http://go/wvgerrit/78946

This CL checks nonce collisions, checks iv offset compared to mac_keys
offset, checks the memory before the mac_keys to the iv, and clears the
encryption key after a LoadKeys call.

Change-Id: Ic8e4bcd6ee4512d93ef88583f337cfdf00c58fb0
2019-05-14 21:00:37 +00:00
Srujan Gaddam
3e5ade22f9 Handle not setting length in getUniqueID
Test: oc-mr1-release to q upgrade with L3 offline licenses, pi-dev to q
upgrade with L3 offline licenses, CE CDM tests, Android unit/integration
tests, Linux tests
Bug: b/112611429
Merge of http://go/wvgerrit/77111

The Level 3 uses the getUniqueID method to uniquely identify devices to
save device keys. This method needs to be consistent and as part of the
method, the length is set. In previous versions, this length isn't set,
but starting from Pi, it is. What this means is that decryption of the
device keys fails, and therefore offline licenses are lost. As a
workaround, we attempt to decrypt the device keys with the length
parameter and with the default if we failed to decrypt. Since the
generation number is also encrypted by the unique id, in the case where
we succeed in decrypting with the default, we reencrypt the generation
number so it can be read in when we handle the usage table. Finally, we
reencrypt everything with the correct length unique id.

Change-Id: Id682771c3921dea35592914fc7a1aaa92fa6737a
2019-04-22 12:11:39 -07:00
Srujan Gaddam
68a5505378 Reintroduce heaps into Level 3 obfuscation
Bug: b/116056586
Test: CE CDM, Android unit/integration, and GTS tests
Merge of http://go/wvgerrit/75891

Heapification was removed from the Level 3 in b/111246860 due to
contributing to performance issues. These issues are addressed in the
obfuscation tool and these libraries are built using those fixes.

Change-Id: I62dc09b41f845f3f7aa283af6968ac0cbc6cf368
2019-04-02 14:34:17 -07:00
Srujan Gaddam
9be36c1d4b Flush whole page + use percentile for page size
Bug: b/123559319, b/112824791, b/120287622 (partially)
Test: Android unit/integration tests, Linux unit tests,
GTS tests on Taimen, GTS tests on Crosshatch
Merge of http://go/wvgerrit/72483

This is a revert of http://go/ag/6216663. This addresses the
failures that led to the seg faults in the 64 bit Level 3 library. Cache
flushing must be done to the entire mmap'd page regardless of whether or
not we use the entire page. Since we now have to cache flush the entire
page, this gives us a performance hit due to us using the max page size.
To get around this, we reuse mmap'd pages only for the 95th percentile
page size or lower.

Change-Id: I14bc0d7e21faae6b6816ea589ba25f9661dcec93
2019-02-21 17:11:51 -08:00
Srujan Gaddam
252e437cc4 Revert "Add relocs param to TerminateRuntime"
This reverts commit ee45468c22.

Reason for revert: Segfaults occurring with 64-bit devices (B1 and C1) with the latest changes. The error condition points to SEGV_MAPERR, which combined with the build diff, leads me to believe this change caused the issue. b/123559319

Change-Id: I5255e14f74e2be229ffd8cd0765ca61a2a074139
2019-01-30 22:42:04 +00:00
Srujan Gaddam
ee45468c22 Add relocs param to TerminateRuntime
Bugs: b/112824791, b/120287622 (partially)
Merge of http://go/wvgerrit/70772
Tests: GTS tests, Android + Linux unit/integration tests

The Level 3 added functionality to reuse mmap'd pages, and as part of
it, the signature for TerminateRuntime changed so the relocs object can
be used to free all the pages at OEMCrypto_Terminate.

Change-Id: If3253926d948dcf69c178b9843cdf40aa7856d50
2019-01-24 15:33:47 -08:00
Rahul Frias
ef00d6ffa5 Update property retrival method
[ Merge of http://go/wvgerrit/70203 ]

The earlier property_get() method had a limitation on property length.
Properties of some new devices exceed that length. An error message
is returned rather than a truncated string. Replace its use with
android::base::GetProperty() which does not have a length limitation.

Bug: 115358798
Test: WV unit/integration tests
Change-Id: I46ce9a7e77bcd031225d0082f83c57d484fe5405
2019-01-15 00:24:52 -08:00
Srujan Gaddam
80166b37e2 Remove shared license code from OEMCrypto
Bug: b/119881112
Merge of http://go/wvgerrit/68983
Test: Android + Linux tests for ref and L3

This CL removes tests from OEMCrypto that test shared license
functionality and code in the ref and L3 that handle shared licenses.

Change-Id: Ia11510d8db3fa6e471a4ebbdb371fd76b0812984
2019-01-09 13:50:33 -08:00
Srujan Gaddam
ff307a7c0e Modify Level 3 full decrypt path testing for 15.1
Merge of http://go/wvgerrit/68986
Bug: b/120797208
Test: Android + Linux unit tests

OEMCrypto v15.1 introduced changes to full decrypt path testing.
This CL reflects those changes for the Level 3 code, including
removing InitializeDecryptHash and changes to error reporting.

Change-Id: I09cec6743524d326cb1a6c3ba4dd1764dbefff5f
2019-01-07 09:53:08 -08:00
Srujan Gaddam
4c5c4caf66 Add detail about L3 initialization
Bug: b/70299597
Merge of http://go/wvgerrit/67304
Test: Android, CE CDM, and Linux tests

There's a few different things that can go wrong in the L3
initialization, with seeding and device key failures among others. They
should be recorded in metrics to track. Along the same lines, since
multiple errors can happen in conjunction, metrics needs to change to
add more fields for errors. This CL also adds the
hidl_metrics_adapter_unittest to the Android test scripts.

Change-Id: Ie5bcf81bbe294a1136c58410f90087a13b3d911d
2018-12-14 11:32:19 -08:00
Srujan Gaddam
732c077f79 Changes to adapter + gyp to support v15
Bug: b/117558570
Test: Android, CE CDM, and Linux tests
Merge of http://go/wvgerrit/67566

This CL adds changes to support the Level 3 upgrade to v15 with both the
dynamic and static adapters. It also rearranges the wvcrc.cpp files so
that the tests have their own copy and Level 3 can just use the one in
ref/src.

Change-Id: Ieee2859601881aa1800622454e6ce0345eb94aa7
2018-12-06 23:04:12 +00:00
Fred Gylys-Colwell
f18ac47d71 Update oemcrypto adapter for v15 -> v14
Merge from master branch of Widevine repo of http://go/wvgerrit/66081
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/65962

This CL changes function names in the v14 level 3 libraries to work with
the dynamic adapter.  I also excluded several OEMCrypto unit tests from
running with a v14 oemcrypto because they require error code changes
introduced in v15.

Bug: 117888897 Fix backwards compatibility
Bug: 119313532 Integration test failing

Test: unit tests on taimen.  Play Movies, ExoPlayer, Netflix play on taimen.
Some unit tests do not pass because Taimen uses a v13 oemcrypto. Most pass.

Change-Id: Ib8eb8a89591fdba3055064c4bdf90523b01309a8
2018-11-16 17:14:02 -08:00
Srujan Gaddam
c2a3cf767d Move AES tables to clear buffers for decryption
b/111246860
Merge of http://go/wvgerrit/60040

The libraries were built with the following optimization flags:
arm: -02
arm64: -02
x86: -01
x86_64: -01 (-02 was giving segfaults)
mips: -01
mips64: -01
linux: -02

AES tables are currently obfuscated as part of Haystack, and
deobfuscated everytime they're being used as part of decryption. This
adds a considerable performance hit in constantly loading and unloading
these buffers. Since they're open source code (see:
https://github.com/openssl/openssl/blob/master/crypto/aes/aes_core.c),
obfuscating them doesn't provide much benefit.
2018-09-25 17:10:45 -07:00
Fred Gylys-Colwell
c06b55b42f Refactor Android L3s
Merge from Widevine repo of http://go/wvgerrit/57082
Merge from Widevine repo of http://go/wvgerrit/55420
Merge from Widevine repo of http://go/wvgerrit/52620

Refactor Android Level 3 libraries.

x86/libl3oemcrypto.cpp    Level3 Library 8162 Jul 31 2018 13:01:54
arm/libl3oemcrypto.cpp    Level3 Library 8158 Jul 31 2018 13:02:18
mips64/libl3oemcrypto.cpp Level3 Library 8161 Jul 31 2018 13:02:12
arm64/libl3oemcrypto.cpp  Level3 Library 8159 Jul 31 2018 13:02:17
mips/libl3oemcrypto.cpp   Level3 Library 8160 Jul 31 2018 13:02:22
x86_64/libl3oemcrypto.cpp Level3 Library 8163 Jul 31 2018 13:02:04

b/110952756
b/79203567

Test: unit tests on taimen and arm and x86 emulator.
Test: GTS tests on taimen.
Change-Id: I8a3af773983f84c73ac23851f4e6bf59690bf62b
2018-09-18 16:33:11 -07:00
Fred Gylys-Colwell
7bd1d0ea51 Update OEMCrypto L3 to v14
This CL updates the level 3 library to v14. It includes the following CLs:

http://go/wvgerrit/52941 Change initialization of TimeInfo object in L3
http://go/wvgerrit/50820 Use memmove instead of relocs memcpy
http://go/wvgerrit/49845 Use memmove or the relocs memcpy in entry_points
http://go/wvgerrit/48884 Merge back rollback changes from pi-dev
http://go/wvgerrit/47985 Deprecate all_obfuscated_symbols.h
http://go/wvgerrit/47720 Invalidate current key index when loading keys
http://go/wvgerrit/46206 Split mock into two -- step 3
http://go/wvgerrit/46205 Move some OEMCrypto types to common header - split the mock, step 2
http://go/wvgerrit/46204 Refactor utility code - split the mock, step 1
http://go/wvgerrit/44981 Fix pointer addresses of generation number
http://go/wvgerrit/47460 Address offline playback with rollbacked time
http://go/wvgerrit/46442 Convert union type-punning to memcpy in Level 3
http://go/wvgerrit/46441 Remove usage of strlen from Level 3
http://go/wvgerrit/41900 Increase size of RSA key for Level3
http://go/wvgerrit/41832 Remove LoadTestKeybox and test keybox code
http://go/wvgerrit/41826 Add prov 3.0 and remove prov 2.0 code
http://go/wvgerrit/44262 Fixed loading mac keys in mock and Level3
http://go/wvgerrit/43402 Add AES256 to Level 3
http://go/wvgerrit/43045 Add entitlement keys and V14 for Level3
http://go/wvgerrit/38800 Update LoadTestKeybox to take test keybox parameter
http://go/wvgerrit/42064 Test Carmicahel RSA Keys
http://go/wvgerrit/41701 Update print-version-strings

New version numbers:
level3/x86/libl3oemcrypto.cpp  Level3 Library 8162 May 21 2018 13:50:29
level3/arm/libl3oemcrypto.cpp  Level3 Library 8158 May 21 2018 13:52:17
level3/mips64/libl3oemcrypto.cpp Level3 Library 8161 May 21 2018 13:51:47
level3/arm64/libl3oemcrypto.cpp Level3 Library 8159 May 21 2018 13:50:47
level3/mips/libl3oemcrypto.cpp Level3 Library 8160 May 21 2018 13:51:51
level3/x86_64/libl3oemcrypto.cpp Level3 Library 8163 May 21 2018 13:51:19

Test: tested as part of http://go/ag/4674759
Change-Id: Ib2c09e4549e58ad57213168dac27b35543bd64c3
2018-09-09 11:37:50 -07:00
Fred Gylys-Colwell
947531a6a9 Refactor oemcrypto mock into stand alone reference code
Merge from Widevine repo of http://go/wvgerrit/46204
Refactor utility code - split the mock, step 1

Merge from Widevine repo of http://go/wvgerrit/46205
Move some OEMCrypto types to common header - split the mock, step 2

Merge from Widevine repo of http://go/wvgerrit/46206
Split mock into two -- step 3

Merge from Widevine repo of http://go/wvgerrit/47460
Split the mock into two -- step 3.5

The CL moves several files used by oemcrypto and cdm into a common
subdirectory, so that it may more easily be shared with partners.

The CORE_DISALLOW_COPY_AND_ASSIGN macro was moved to its own header in
the util/include directory.

This CL removes some references to the mock from other code, and puts
some constants and types, such as the definition of the keybox, into a
header in oemcrypto.

Test: tested as part of http://go/ag/4674759
bug: 76393338
Change-Id: I75b4bde7062ed8ee572c97ebc2f4da018f4be0c9
2018-09-02 11:45:16 -07:00
Srujan Gaddam
73c3007c24 Address offline playback with rollbacked time
Merge from http://go/wvgerrit/47640

Test: unit/integration tests

Bug: b/62058202

The usage table keeps track of license duration by using the current
system time. However, if a user were to rollback the time, they can
effectively continue offline playback indefinitely. This changes the way
we compute time by computing offsets by which the user rollbacked the
time and adding it to the current time. This change also includes a test
to verify protection against rollback for usage entries that is only run
when the user is root.

Change-Id: I97c430e1443747b0f9759ae5390b8f5d06bdebf1
2018-04-23 15:44:26 -07:00
Srujan Gaddam
f217742582 Fixed loading mac keys in mock and Level3
Merge of http://go/wvgerrit/45521/

Bug: b/73818548

Test: request_license_tests and GTS tests on sailfish and taimen

This change loads the mac keys into the session to be used in
GenerateSignature from the last call to one of: DeriveKeysFromSessionKey,
GenerateDerivedKeys, LoadKeys, and LoadUsageEntry. OEMCrypto tests are
changed to reflect this as well (specifically the order in which we call
the above methods).
2018-03-29 10:39:21 -07:00
Fred Gylys-Colwell
ef0ec145d3 Fix compiler warnings
Merge from Widevine repo of http://go/wvgerrit/43420

Remove or mark unused variables.  Fix unsigned/signed comparisons.

bug: 73390805
test: unit tests
Change-Id: Ic523400a5decf82fae733042b260e0c39a087cd3
2018-02-15 11:18:54 -08:00
Fred Gylys-Colwell
7bbe8e3bf1 Add Level3 changes for v14 adapters
Merge from Widevine repo of http://go/wvgerrit/41680

These changes change the signature of LoadKeys to LoadKeys_V13 for the
Level 3. This change will be reverted once we update Level 3 to v14.

level3/x86/libl3oemcrypto.cpp  Level3 Library 4464 Jan 23 2018 13:22:20
level3/arm/libl3oemcrypto.cpp  Level3 Library 4445 Jan 23 2018 12:12:32
level3/mips64/libl3oemcrypto.cpp Level3 Library 7285 Jan 23 2018 15:48:51
level3/arm64/libl3oemcrypto.cpp Level3 Library 7283 Jan 23 2018 12:47:26
level3/mips/libl3oemcrypto.cpp Level3 Library 4465 Jan 23 2018 15:13:13
level3/x86_64/libl3oemcrypto.cpp Level3 Library 7284 Jan 23 2018 13:50:10

test: Play Movies plays on sailfish.

Change-Id: Ia492463cd15178b12908faa24af7fbbcfef22e77
2018-01-24 21:54:35 -08:00
Rahul Frias
674a748f39 Compilation errors on taimen
This adds an include path to system core properties.h to
OEMCrypto L3 makefiles.

Bug: 72004865
Test: Verified by unit/integration tests on taimen.
      Verified playback using Play Movies (streaming/offline)
            and Netflix.

Change-Id: I73c21f2751b34b6b58d92ed5177951a6397b5bf7
2018-01-17 00:11:18 -08:00
Rahul Frias
aac1439dea Merges to android Pi release (part 12)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Correct error logging

  Author: Rahul Frias <rfrias@google.com>

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

  In tests, we set the cipher list to avoid using insecure
  ciphers when connecting to the provisioning/license service.
  The result of setting the cipher list was being incorrectly
  validated.

  Bug: 64847919

* Move mips cache headers to clear_cache_function.h

  Author: Srujan Gaddam <srujzs@google.com>

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

  Since the clear_cache function has been moved away from the dynamic
  adapter, we need these conditional includes to be migrated as well for
  MIPS.

* Comment out Level 3 debug call until merge

  Author: Srujan Gaddam <srujzs@google.com>

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

  This call was introduced in go/wvgerrit/34260/. Since the haystack tool
  in google3 still needs this merge, this should be commented out so the
  tool can still build until the merge has finished.

* Add logging for MAC keys to mock

  Author: Srujan Gaddam <srujzs@google.com>

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

  Bug: 70637842

* Move external interfaces into level3.h + refactor

  Author: Srujan Gaddam <srujzs@google.com>

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

  As part of b/70523618, this CL moves interfaces that partners are
  responsible for in Level 3 to level3.h so they can be visible as
  part of the CDM release process. It also cleans up some of the
  names of the files and adds documentation.

* Corrected close session logging level

  Author: Rahul Frias <rfrias@google.com>

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

  Bug: 69460963

* Remove Security Level Path Backward Compatibility Support

  Author: Rahul Frias <rfrias@google.com>

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

  From the android K release onwards certificates were stored in
  security level specific directories. If upgrading from
  previous releases persistent information needed to be moved
  to those directories.

  Since no device is likely to upgrade from J to Pi, comptibility
  support can be removed.

  Bug: 70160032

* Rename privacy_crypto_openssl To privacy_crypto_boringssl

  Author: John W. Bruce <juce@google.com>

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

  Now that we no longer support OpenSSL in the Shared Source CDM, the name
  of this file can be updated.

  Bug: 67907873
  Test: build.py x86-64
  Test: wv_ce_cdm_unittest
  Test: jenkins/linux_unit_tests

* Remove Conditional Compilation from OpenSSL/BoringSSL

  Author: John W. Bruce <juce@google.com>

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

  This change removes the usages of conditional compilation to support
  both BoringSSL and OpenSSL, as well as to support multiple versions of
  the OpenSSL API. All code is now compiled against one of the two
  versions of BoringSSL in third_party/.

  Note that in some cases, the kit/ and legacy_kit/ versions of BoringSSL
  had different APIs, so when removing the OpenSSL version compatibility
  conditional compilation, sometimes the older branch was kept and
  sometimes the newer branch was kept.

  Bug: 67907873
  Test: build.py x86-64
  Test: wv_ce_cdm_unittest
  Test: jenkins/linux_unit_tests

* Build CE & Jenkins CDMs With BoringSSL from third_party/

  Author: John W. Bruce <juce@google.com>

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

  Up until now, integrators have been responsible for providing a
  compatible crypto library for use by the CE CDM. (either OpenSSL or
  BoringSSL) After this change, this decision will no longer be in their
  hands. The CE CDM build will always use the copy of BoringSSL in
  third_party/, which will be statically linked with our library with
  hidden visibility. This allows us to better control what crypto library
  we use and will prevent continuing problems with trying to support both
  OpenSSL and BoringSSL.

  Unfortunately, BoringSSL began using C++11 in mid-2017, and we can't
  support C++11 right now. Until we can, we need to use a C++11-free
  version of BoringSSL for libssl. The CDM itself will continue to use a
  recent BoringSSL, as it only needs libcrypto. But the unit tests that
  need libssl have to use the legacy version.

  Bug: 67907873
  Test: build.py x86-64
  Test: wv_ce_cdm_unittest
  Test: jenkins/linux_unit_tests

* Modified RNG for Level3 to use more entropy

  Author: Srujan Gaddam <srujzs@google.com>

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

  Bug: 65165076

  Modified seed generation to use an xor of clock_gettime and
  client-implemented code to supply random seeds to the RNG. Modified the RNG
  as well to use xoroshiro128+ instead of xorshift, since it uses more
  than one seed/state (which are 64-bit) and has higher "statistical quality".
  The default implementations for the seed generation use /dev/urandom.

* Configure base path for Level3FileSystem

  Author: Srujan Gaddam <srujzs@google.com>

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

  This is in response to b/70354006. This change makes the
  Android Level3FileSystem use the existing properties method
  GetDevicesFilesBasePath for binderization. The same is done for the
  Linux implementation.

* Add legacy_kit/ to BoringSSL Directory

  Author: John W. Bruce <juce@google.com>

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

  This adds a second copy of BoringSSL to the third_party/boringssl/
  directory. This second copy is pinned to the last revision of BoringSSL
  not to require C++11 and is not updated by the UPDATE_BORINGSSL.sh
  script. This second copy will be used to provide libssl to the tests on
  devices that do not support C++11.

  Once we support C++11 in the CDM again, this weight should be removed
  and all targets should use the copy of BoringSSL in the kit/ directory.

  Bug: 67907873

* Use Shared Libraries for Unit Tests

  Author: John W. Bruce <juce@google.com>

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

  Some unit tests were using a statically-linked CDM instead of a
  dynamically-linked one. (Or, in one case, trying to link both ways into
  the same binary.) For now, we need to only link dynamically, so that the
  unit tests and the CDM can use different versions of BoringSSL.

  Long-term, we would like to test both kinds of linkage. (See b/69548115
  for that.)

  Some unit tests were also using a dynamicaly-linked CDM that was named
  such that it appeared to be statically-linked. This patch renames some
  targets to make the linkage clearer.

  Bug: 67907873

* Change CDM_Backwards_Compatiblity_Tests to dedicated brances

  Author: Fred Gylys-Colwell <fredgc@google.com>

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

  The build scripts used by CDM_Backwards_Compatiblity_Tests now pull
  old versions of oemcrypto from the dedicated branches oemcrypto-v*,
  which [will eventually] contain old oemcrypto versions, that build
  with the current build system with a current boringssl version.

  bug: 67907873

* Fix spacing on level3 header

  Author: Srujan Gaddam <srujzs@google.com>

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

* Correct Query status calls

  Author: Rahul Frias <rfrias@google.com>

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

  Bug: 70160032

* Refactoring to allow encryption of client ID

  Author: Rahul Frias <rfrias@google.com>

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

  The code has been restructured to allow encryption of client
  identification in provisioning requests. This will be enabled
  when server side changes have been made (b/69427217).

  * Additional information is included in the Client Identification
    portion of the provisioning request.
  * Client identification will be encrypted with a service
    certificate provided by the app/client. Platform changes
    to enable passing this to core are needed. If a service certificate
    is not provided, a default one associated with the production Keysmith
    will be used.
  * Switched APIs in CdmEngine to take a service certificate for
    provisioning rather than licensing. Service certificates for
    licensing are session based and passed as properties from platform
    code.

  Bug: 30737060

* Allow some CDM errors to be reported from multiple locations

  Author: Rahul Frias <rfrias@google.com>

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

  This creates some CdmResponseType errors which may be reused
  PARAMETER_NULL, NOT_INITIALIZED_ERROR, REINIT_ERROR.

  I have made changes to a few classes to report these errors.
  Will work on additional classes in a separate CL.

  Bug: 69864404

BUG: 71650075
Test: WV Unit/integration tests
Change-Id: Icc048770d424ac537d11ff327cda2cb142da802d
2018-01-16 19:34:30 -08:00
Rahul Frias
5d690be108 Merges to android Pi release (part 11)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Get System ID From OEM Cert

  Author: John W. Bruce <juce@google.com>

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

  (This is a merge of http://go/wvgerrit/30220 .  However, it has been
  significantly modified in the merge due to needing to support both
  OpenSSL and BoringSSL.)

  Previously, extracting the system ID was only supported on Keybox-based
  systems. This patch adds support for extracting the system ID from the
  OEM Certificate chain on Provisioning 3.0 devices. This is done by
  getting the Widevine intermediate cert from the chain, finding the
  Widevine System ID extension in that cert, and extracting the value.

  The code that does the extraction is separate from any code that calls
  OEMCrypto so that it can be unit-tested in isolation. This patch adds a
  crypto_session_unittest test to do this unit-testing.

  Bug: 34776194
  Test: crypto_session_unittest
  Test: widevine_ce_cdm_unittest

* Remove unique_ptr from oemcrypto mod mock

  Author: Fred Gylys-Colwell <fredgc@google.com>

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

  Because we can't have C++11.

  Bug: 69935608

* Update CHANGELOG.md

  Author: Gene Morgan <gmorgan@google.com>

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

   - Add items about adapter support.
   - Add mention of SRM support.

  Merged from cdm_partner_3.5
  (Change-Id: I6d891e157edc3afb2797bf281ef3f06bdb8fe474)

* Add Adapter for OEMCrypto v13 to v12.

  Author: Gene Morgan <gmorgan@google.com>

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

  Also fix OEMCrypto_LoadKeys() definition broken by wvcl/38160
  (srm_requirement param).

* Allow certain warnings in protobuf build.

  Author: Gene Morgan <gmorgan@google.com>

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

  maybe-uninitialized is triggered in release build. Allow it.

* Enable -fPIC for jsmc.c build.

  Author: Gene Morgan <gmorgan@google.com>

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

  -fPIC was removed for common c/c++ build rules. Add it back.

* Missing OEMCrypto_LoadKeys param in static adapter.

  Author: Gene Morgan <gmorgan@google.com>

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

  srm_requirement param was omitted in v11 static adapter.

* Remove OEMCrypto v12 specification.

  Author: Gene Morgan <gmorgan@google.com>

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

* Update documentation for v3.5.

  Author: Gene Morgan <gmorgan@google.com>

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

* Added padded preprov key for 7880

  Author: Srujan Gaddam <srujzs@google.com>

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

  Bug: 68765915

* Change overrides in CE L3FileSystem

  Author: Srujan Gaddam <srujzs@google.com>

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

  The 'override's are changed to the macro defined in override.h to
  be gnu++98 compliant.

* Use source android level3 + add cache_flush call

  Author: Srujan Gaddam <srujzs@google.com>

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

  I put both changes in this CL since I have to generate Level3 libraries
  for both anyways. The first change involves shifting from using a
  prebuilt static library to using an obfuscated source library output
  from the Haystack tool on google3. The second change is from here:
  https://critique.corp.google.com/#review/176536782, and addresses
  b/69387416. Since the cache_flush function wasn't being used, the
  execution on Angler gave inconsistent segfaults, which this CL fixes.

  Verified on Angler, Sailfish, and Linux.

  11/27/17: Added mips and mips64 libraries.

* Make CDM result codes constexprs

  Author: Rahul Frias <rfrias@google.com>

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

  The values in the enumeration list of CdmResponseType error codes
  were earlier implicit. Comments were added to denote the actual
  values. This changes to make it fixed values, which makes it slightly
  more error prone, but cleaner when errors are retired.

* Change watchdog timer to 2 minutes

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

  This relaxes the watchdog timer around the level 3 oemcrypto
  initialization to 120 seconds.  There are also a couple of new log
  messages at the end of initialization and at termination.

  Library for arm updated:
  level3/arm/libwvlevel3.a       Level3 Library 4445 Oct  4 2017 17:06:25

  Bug: 65379279

  Merged from https://widevine-internal-review.googlesource.com/35480

* Add test to get service certificate from server.

  Author: Gene Morgan <gmorgan@google.com>

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

  This was extracted from Ic38dd27d06dc7528ae4cd995da4261fe6c34ad55

* Add watch dog timer to OEMCrypto L3

commit ec624ea483cbf8fb3d4e8f393bc25c90a0e29d4b
  Author: Fred Gylys-Colwell <fredgc@google.com>

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

  This code adds a watchdog timer to the level 3 initialization.  If
  initialization does not finish within 5 seconds, the process
  will abort, printing a small amount of debugging information.

  arm/libwvlevel3.a Level3 Library 4445 Sep 11 2017 14:05:15

  Test: unit tests on bullhead. Video on Play Movies.
  GTS tests run on loop overnight.

  Bug: 65379279
  Merged from https://widevine-internal-review.googlesource.com/33540

* Remove libwidevinehidl_utils dependency

  Author: Rahul Frias <rfrias@google.com>

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

  libwvdrmcryptoplugin_hidl has a dependency on libwidevinehidl_utils
  which was introduced due to an out of order merge from oc-mr1-dev
  to master.

  Bug: 69573113

* Automatically generate log location information

  Author: Rahul Frias <rfrias@google.com>

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

  Currently class and method names are manually added to each log message
  in the CDM on android and some other platforms. This change prepends
  log messages with file name, line number and function name automatically.

  The code is platform specific so it can be enabled and the precise
  format configured on a per-platform basis.

  As an example, here is a log on android before the change,

  11-01 02:48:48.658 D/WVCdm   (32198): CryptoSession::Open:
  Lock: requested_security_level: Default

  and after,

  11-01 02:48:48.658 D/WVCdm   (32198): [crypto_session.cpp(1108):Open]
  Lock: requested_security_level: Default

  A follow on CL will remove the manually added class/method information.

  Bug: 9261010

* Fix BoringSSL Compatibility of oec_session_util.cpp

  Author: John W. Bruce <juce@google.com>

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

  A previous change inadvertantly used APIs from OpenSSL that do not exist
  in BoringSSL in oec_session_util.cpp. As a temporary fix until we can
  move all targets to BoringSSL, this patch switches that file to use
  conditional compilation to choose the correct API depending on the
  library in use. It does not otherwise change the behavior of the file.

  Bug: 67908123
  Test: wv_ce_cdm_unittest on x86-64
  Test: linux_unit_tests

* Create local shared_ptr implementation

  Author: Gene Morgan <gmorgan@google.com>

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

  Derived from protobuf version, which came from google3.
  Removed locking (not thread-safe) and removed weak pointers (not
  needed for usages in CDM).

  Locking can easily be added if needed.

* Revert C++11 usage - back to gnu++98

  Author: Gene Morgan <gmorgan@google.com>

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

  These changes roll back C++11-specific constructs:
    std::unique_ptr -> std::auto_ptr
    container initializers
    nullptr -> NULL
    std::shared_ptr to local shared_ptr
    compiler flags (-std=c++11 -> -sdt=gnu++98)

  NOTE: the "local" shared_ptr implementation is temporarily
  a direct reference to the shared_ptr implementation in
  third_party/protobuf. This has been fixed (implementation
  extracted and moved to core/include) in CL 37600.

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
  commit in the chain.

Change-Id: Ie09ecb970aa06fe9301ac255375ca7d8e7ead8bc
2018-01-16 19:33:36 -08:00