diff --git a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp index f5c5f3ab..7a316f37 100644 --- a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp +++ b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp @@ -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); diff --git a/libwvdrmengine/oemcrypto/ref/src/oemcrypto_key_ref.cpp b/libwvdrmengine/oemcrypto/ref/src/oemcrypto_key_ref.cpp index 557cb6fb..cc08c27f 100644 --- a/libwvdrmengine/oemcrypto/ref/src/oemcrypto_key_ref.cpp +++ b/libwvdrmengine/oemcrypto/ref/src/oemcrypto_key_ref.cpp @@ -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 { diff --git a/libwvdrmengine/oemcrypto/ref/src/oemcrypto_ref.cpp b/libwvdrmengine/oemcrypto/ref/src/oemcrypto_ref.cpp index 9ddf2c98..cd0959bf 100644 --- a/libwvdrmengine/oemcrypto/ref/src/oemcrypto_ref.cpp +++ b/libwvdrmengine/oemcrypto/ref/src/oemcrypto_ref.cpp @@ -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(); diff --git a/libwvdrmengine/oemcrypto/test/oec_session_util.cpp b/libwvdrmengine/oemcrypto/test/oec_session_util.cpp index 64907fb8..ae4b19ab 100644 --- a/libwvdrmengine/oemcrypto/test/oec_session_util.cpp +++ b/libwvdrmengine/oemcrypto/test/oec_session_util.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #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. diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp index 48b7bf4e..7fa092ad 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp @@ -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; diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test_android.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test_android.cpp index 9b06368c..21da36c7 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test_android.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test_android.cpp @@ -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