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
This commit is contained in:
Cong Lin
2020-10-17 16:14:45 -07:00
parent a8524e9199
commit 0f32446ee7
11 changed files with 286954 additions and 280362 deletions

View File

@@ -374,8 +374,8 @@ struct FunctionPointers {
L1_DeactivateUsageEntry_t DeactivateUsageEntry;
L1_ReportUsage_t ReportUsage;
L1_GetProvisioningMethod_t GetProvisioningMethod;
L1_GetOEMPublicCertificate_V15_t GetOEMPublicCertificate_V15;
L1_GetOEMPublicCertificate_t GetOEMPublicCertificate;
L1_GetOEMPublicCertificate_V15_t GetOEMPublicCertificate_V15;
L1_LoadOEMPrivateKey_t LoadOEMPrivateKey;
L1_RewrapDeviceRSAKey30_t RewrapDeviceRSAKey30;
L1_SupportedCertificates_t SupportedCertificates;
@@ -965,20 +965,16 @@ class Adapter {
level3_.Terminate = Level3_Terminate;
level3_.OpenSession = Level3_OpenSession;
level3_.CloseSession = Level3_CloseSession;
level3_.GenerateDerivedKeys_V15 = Level3_GenerateDerivedKeys;
level3_.GenerateDerivedKeys = Level3_GenerateDerivedKeys;
level3_.GenerateNonce = Level3_GenerateNonce;
level3_.GenerateSignature = Level3_GenerateSignature;
level3_.LoadKeys = Level3_LoadKeys;
// TODO(b/139814713): implement V16 DecryptCENC for Haystack L3
// level3_.LoadLicense = Level3_LoadLicense;
level3_.LoadLicense = Level3_LoadLicense;
level3_.LoadEntitledContentKeys = Level3_LoadEntitledContentKeys;
// TODO(b/139814713): fix this.
// level3_.LoadRenewal = Level3_LoadRenewal;
level3_.LoadRenewal = Level3_LoadRenewal;
level3_.RefreshKeys = Level3_RefreshKeys;
level3_.QueryKeyControl = Level3_QueryKeyControl;
level3_.SelectKey = Level3_SelectKey;
// TODO(b/139814713): implement V16 DecryptCENC for Haystack L3
level3_.DecryptCENC_V15 = Level3_DecryptCENC;
level3_.DecryptCENC = Level3_DecryptCENC;
level3_.CopyBuffer = Level3_CopyBuffer;
level3_.WrapKeybox = Level3_WrapKeyboxOrOEMCert;
level3_.InstallKeyboxOrOEMCert = Level3_InstallKeyboxOrOEMCert;
@@ -988,14 +984,13 @@ class Adapter {
level3_.GetKeyData = Level3_GetKeyData;
level3_.GetRandom = Level3_GetRandom;
level3_.RewrapDeviceRSAKey = Level3_RewrapDeviceRSAKey;
level3_.LoadDeviceRSAKey = Level3_LoadDeviceRSAKey;
// TODO(b/139814713): implement V16 DecryptCENC for Haystack L3
// level3_.LoadDRMPrivateKey = Level3_LoadDRMPrivateKey;
level3_.LoadDRMPrivateKey = Level3_LoadDRMPrivateKey;
level3_.LoadOEMPrivateKey = Level3_LoadOEMPrivateKey;
level3_.LoadTestRSAKey = Level3_LoadTestRSAKey;
level3_.GenerateRSASignature = Level3_GenerateRSASignature;
level3_.DeriveKeysFromSessionKey = Level3_DeriveKeysFromSessionKey;
level3_.APIVersion = Level3_APIVersion;
level3_.MinorAPIVersion = nullptr;
level3_.MinorAPIVersion = Level3_MinorAPIVersion;
level3_.SecurityPatchLevel = Level3_SecurityPatchLevel;
level3_.SecurityLevel = Level3_SecurityLevel;
level3_.GetHDCPCapability = Level3_GetHDCPCapability;
@@ -1013,8 +1008,7 @@ class Adapter {
level3_.DeactivateUsageEntry = Level3_DeactivateUsageEntry;
level3_.ReportUsage = Level3_ReportUsage;
level3_.GetProvisioningMethod = Level3_GetProvisioningMethod;
level3_.GetOEMPublicCertificate_V15 = Level3_GetOEMPublicCertificate;
level3_.RewrapDeviceRSAKey30 = Level3_RewrapDeviceRSAKey30;
level3_.GetOEMPublicCertificate = Level3_GetOEMPublicCertificate;
level3_.SupportedCertificates = Level3_SupportedCertificates;
level3_.IsSRMUpdateSupported = Level3_IsSRMUpdateSupported;
level3_.GetCurrentSRMVersion = Level3_GetCurrentSRMVersion;
@@ -1030,7 +1024,13 @@ class Adapter {
level3_.SupportsDecryptHash = Level3_SupportsDecryptHash;
level3_.SetDecryptHash = Level3_SetDecryptHash;
level3_.GetHashErrorCode = Level3_GetHashErrorCode;
level3_.LoadProvisioning = nullptr;
level3_.LoadProvisioning = Level3_LoadProvisioning;
level3_.PrepAndSignProvisioningRequest = Level3_PrepAndSignProvisioningRequest;
level3_.PrepAndSignLicenseRequest = Level3_PrepAndSignLicenseRequest;
level3_.PrepAndSignRenewalRequest = Level3_PrepAndSignRenewalRequest;
level3_.MaximumUsageTableHeaderSize = Level3_MaximumUsageTableHeaderSize;
level3_.AllocateSecureBuffer = Level3_AllocateSecureBuffer;
level3_.FreeSecureBuffer = Level3_FreeSecureBuffer;
// clang-format on
level3_.version = Level3_APIVersion();
@@ -1073,7 +1073,7 @@ class Adapter {
} else {
new_session.fcn = &level3_;
result = level3_.OpenSession(&new_session.session);
*session = new_session.session + kLevel3Offset;
*session = new_session.session;
}
if (result == OEMCrypto_SUCCESS) {
std::unique_lock<std::mutex> auto_lock(session_map_lock_);
@@ -1108,10 +1108,6 @@ class Adapter {
std::map<OEMCrypto_SESSION, LevelSession> session_map_;
std::mutex session_map_lock_;
std::vector<uint8_t> sandbox_id_;
// This is just for debugging the map between session ids.
// If we add this to the level 3 session id, then the external session
// id will match the internal session id in the last two digits.
static const OEMCrypto_SESSION kLevel3Offset = 25600;
// For running the unit tests using the level 3 oemcrypto. If the user sets
// the environment FORCE_LEVEL3_OEMCRYPTO, we ignore the level 1 library.