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:
@@ -617,7 +617,7 @@ class Adapter {
|
||||
}
|
||||
level1_valid_ = true;
|
||||
const uint32_t kMinimumVersion = 8;
|
||||
const uint32_t kMaximumVersion = 14;
|
||||
const uint32_t kMaximumVersion = 15;
|
||||
level1_.version = kMinimumVersion;
|
||||
LOOKUP_ALL(8, Initialize, OEMCrypto_Initialize);
|
||||
LOOKUP_ALL(8, APIVersion, OEMCrypto_APIVersion);
|
||||
|
||||
@@ -21,7 +21,8 @@ bool KeyControlBlock::Validate() {
|
||||
memcmp(verification_, "kc11", 4) && // add in version 11 api
|
||||
memcmp(verification_, "kc12", 4) && // add in version 12 api
|
||||
memcmp(verification_, "kc13", 4) && // add in version 13 api
|
||||
memcmp(verification_, "kc14", 4)) { // add in version 14 api
|
||||
memcmp(verification_, "kc14", 4) && // add in version 14 api
|
||||
memcmp(verification_, "kc15", 4)) { // add in version 15 api
|
||||
LOGE("KCB: BAD verification string: %4.4s", verification_);
|
||||
valid_ = false;
|
||||
} else {
|
||||
|
||||
@@ -1115,7 +1115,7 @@ extern "C" OEMCryptoResult OEMCrypto_DeriveKeysFromSessionKey(
|
||||
return OEMCrypto_SUCCESS;
|
||||
}
|
||||
|
||||
extern "C" uint32_t OEMCrypto_APIVersion() { return 14; }
|
||||
extern "C" uint32_t OEMCrypto_APIVersion() { return 15; }
|
||||
|
||||
extern "C" uint8_t OEMCrypto_Security_Patch_Level() {
|
||||
uint8_t security_patch_level = crypto_engine->config_security_patch_level();
|
||||
|
||||
@@ -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