Add Sandbox ID support
Merge from master branch of Widevine repo of http://go/wvgerrit/66078 Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64022 This CL updates OEMCrypto ref code, unit tests, and core code for setting the sandbox id before initializing OEMCrypto. Test: unit tests only Test: tested as part of http://go/ag/5501993 Bug: 115834255 Change-Id: Id9831680fe4db1c69413815931cae4bc80df0c01
This commit is contained in:
@@ -29,6 +29,7 @@ void DeviceFeatures::Initialize(bool is_cast_receiver,
|
||||
supports_rsa_3072 = false;
|
||||
api_version = 0;
|
||||
derive_key_method = NO_METHOD;
|
||||
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
||||
if (OEMCrypto_SUCCESS != OEMCrypto_Initialize()) {
|
||||
printf("OEMCrypto_Initialize failed. All tests will fail.\n");
|
||||
return;
|
||||
|
||||
@@ -716,6 +716,8 @@ static const uint8_t kTestKeyRSAEuler_2048[] = {
|
||||
0x33, 0xe0, 0xdb, 0x03,
|
||||
};
|
||||
|
||||
static const uint8_t kTestSandbox[] = { 0x01, 0x02, 0x03 };
|
||||
|
||||
} // namespace wvoec
|
||||
|
||||
#endif // CDM_OEC_TEST_DATA_H_
|
||||
|
||||
@@ -95,6 +95,7 @@ class OEMCryptoClientTest : public ::testing::Test, public SessionUtil {
|
||||
const ::testing::TestInfo* const test_info =
|
||||
::testing::UnitTest::GetInstance()->current_test_info();
|
||||
LOGD("Running test %s.%s", test_info->test_case_name(), test_info->name());
|
||||
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
||||
}
|
||||
|
||||
@@ -225,6 +226,7 @@ TEST_F(OEMCryptoClientTest, CheckMaxNumberOfSessionsAPI10) {
|
||||
TEST_F(OEMCryptoClientTest, NormalInitTermination) {
|
||||
// Should be able to terminate OEMCrypto, and then restart it.
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Terminate());
|
||||
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
||||
}
|
||||
|
||||
@@ -4629,6 +4631,7 @@ class UsageTableTest : public GenericCryptoTest {
|
||||
}
|
||||
|
||||
virtual void Restart() {
|
||||
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
||||
EnsureTestKeys();
|
||||
ASSERT_NO_FATAL_FAILURE(session_.open());
|
||||
|
||||
@@ -23,7 +23,10 @@ namespace wvoec {
|
||||
// These tests are required for LollyPop Android devices.
|
||||
class OEMCryptoAndroidLMPTest : public ::testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() { ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize()); }
|
||||
virtual void SetUp() {
|
||||
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
||||
}
|
||||
|
||||
virtual void TearDown() { OEMCrypto_Terminate(); }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user