Update API version to 15
Merge from master branch of Widevine repo of http://go/wvgerrit/66064 Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63063 This is in the reference code for OEMCrypto, and in the unit tetss. Bug: 111939411 Test: unit tests Test: tested as part of http://go/ag/5501993 Change-Id: I2cc2e7028f62d1c375eb632452eef94566fa9ae3
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "OEMCryptoCENC.h"
|
||||
@@ -482,15 +483,12 @@ void Session::FillSimpleMessage(uint32_t duration, uint32_t control,
|
||||
sizeof(license_.keys[i].key_iv)));
|
||||
EXPECT_EQ(1, GetRandBytes(license_.keys[i].control_iv,
|
||||
sizeof(license_.keys[i].control_iv)));
|
||||
if (global_features.api_version == 14) {
|
||||
// For version 14, we require OEMCrypto to handle kc14 for all licenses.
|
||||
memcpy(license_.keys[i].control.verification, "kc14", 4);
|
||||
} else if (global_features.api_version == 13) {
|
||||
// For version 13, we require OEMCrypto to handle kc13 for all licenses.
|
||||
memcpy(license_.keys[i].control.verification, "kc13", 4);
|
||||
} else if (global_features.api_version == 12) {
|
||||
// For version 12, we require OEMCrypto to handle kc12 for all licenses.
|
||||
memcpy(license_.keys[i].control.verification, "kc12", 4);
|
||||
if (global_features.api_version >= 12) {
|
||||
// For version 12 and above, we require OEMCrypto to handle kcNN for all
|
||||
// licenses.
|
||||
std::stringstream stream;
|
||||
stream << "kc" << global_features.api_version;
|
||||
memcpy(license_.keys[i].control.verification, stream.str().c_str(), 4);
|
||||
} else if (control & wvoec::kControlSecurityPatchLevelMask) {
|
||||
// For versions before 12, we require the special key control block only
|
||||
// when there are newer features present.
|
||||
@@ -529,15 +527,12 @@ void Session::FillSimpleEntitlementMessage(
|
||||
sizeof(license_.keys[i].key_iv)));
|
||||
EXPECT_EQ(1, GetRandBytes(license_.keys[i].control_iv,
|
||||
sizeof(license_.keys[i].control_iv)));
|
||||
if (global_features.api_version == 14) {
|
||||
// For version 13, we require OEMCrypto to handle kc14 for all licenses.
|
||||
memcpy(license_.keys[i].control.verification, "kc14", 4);
|
||||
} else if (global_features.api_version == 13) {
|
||||
// For version 13, we require OEMCrypto to handle kc13 for all licenses.
|
||||
memcpy(license_.keys[i].control.verification, "kc13", 4);
|
||||
} else if (global_features.api_version == 12) {
|
||||
// For version 12, we require OEMCrypto to handle kc12 for all licenses.
|
||||
memcpy(license_.keys[i].control.verification, "kc12", 4);
|
||||
if (global_features.api_version >= 12) {
|
||||
// For version 12 and above, we require OEMCrypto to handle kcNN for all
|
||||
// licenses.
|
||||
std::stringstream stream;
|
||||
stream << "kc" << global_features.api_version;
|
||||
memcpy(license_.keys[i].control.verification, stream.str().c_str(), 4);
|
||||
} else if (control & wvoec::kControlSecurityPatchLevelMask) {
|
||||
// For versions before 12, we require the special key control block only
|
||||
// when there are newer features present.
|
||||
@@ -565,15 +560,13 @@ void Session::FillRefreshMessage(size_t key_count, uint32_t control_bits,
|
||||
encrypted_license().keys[i].key_id_length = license_.keys[i].key_id_length;
|
||||
memcpy(encrypted_license().keys[i].key_id, license_.keys[i].key_id,
|
||||
encrypted_license().keys[i].key_id_length);
|
||||
if (global_features.api_version == 14) {
|
||||
// For version 14, we require OEMCrypto to handle kc14 for all licenses.
|
||||
memcpy(encrypted_license().keys[i].control.verification, "kc14", 4);
|
||||
} else if (global_features.api_version == 13) {
|
||||
// For version 13, we require OEMCrypto to handle kc13 for all licenses.
|
||||
memcpy(encrypted_license().keys[i].control.verification, "kc13", 4);
|
||||
} else if (global_features.api_version == 12) {
|
||||
// For version 12, we require OEMCrypto to handle kc12 for all licenses.
|
||||
memcpy(encrypted_license().keys[i].control.verification, "kc12", 4);
|
||||
if (global_features.api_version >= 12) {
|
||||
// For version 12 and above, we require OEMCrypto to handle kcNN for all
|
||||
// licenses.
|
||||
std::stringstream stream;
|
||||
stream << "kc" << global_features.api_version;
|
||||
memcpy(encrypted_license().keys[i].control.verification,
|
||||
stream.str().c_str(), 4);
|
||||
} else {
|
||||
// For versions before 12, we require the special key control block only
|
||||
// when there are newer features present.
|
||||
|
||||
@@ -113,7 +113,7 @@ TEST_F(OEMCryptoClientTest, VersionNumber) {
|
||||
cout << " OEMCrypto does not support usage tables." << endl;
|
||||
}
|
||||
ASSERT_GE(version, 8u);
|
||||
ASSERT_LE(version, 14u);
|
||||
ASSERT_LE(version, 15u);
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoClientTest, ProvisioningDeclaredAPI12) {
|
||||
@@ -1196,7 +1196,7 @@ TEST_P(SessionTestAlternateVerification, LoadKeys) {
|
||||
// the current API + 2. We use +2 because we want to test at least 1
|
||||
// future API, and the ::testing::Range is not inclusive.
|
||||
INSTANTIATE_TEST_CASE_P(TestAll, SessionTestAlternateVerification,
|
||||
Range(8, 14 + 2));
|
||||
Range(8, 15 + 2));
|
||||
|
||||
TEST_F(OEMCryptoSessionTests, LoadKeysBadSignature) {
|
||||
Session s;
|
||||
|
||||
@@ -153,7 +153,7 @@ class OEMCryptoAndroidQTest : public OEMCryptoAndroidOCTest {};
|
||||
|
||||
TEST_F(OEMCryptoAndroidQTest, MinVersionNumber14) {
|
||||
uint32_t version = OEMCrypto_APIVersion();
|
||||
ASSERT_GE(version, 14u);
|
||||
ASSERT_GE(version, 15u);
|
||||
}
|
||||
|
||||
} // namespace wvoec
|
||||
|
||||
Reference in New Issue
Block a user