diff --git a/libwvdrmengine/oemcrypto/test/Android.mk b/libwvdrmengine/oemcrypto/test/Android.mk index 71368e90..be56d7e2 100644 --- a/libwvdrmengine/oemcrypto/test/Android.mk +++ b/libwvdrmengine/oemcrypto/test/Android.mk @@ -8,9 +8,6 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE_TAGS := tests -# Define CAN_INSTALL_KEYBOX and the unit test will install a known keybox and test decryption. -LOCAL_CFLAGS += -DCAN_INSTALL_KEYBOX - LOCAL_C_INCLUDES += \ bionic \ external/gtest/include \ diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp index 9ecd2f95..1b386aa3 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp @@ -1738,14 +1738,6 @@ TEST_F(OEMCryptoClientTest, GenerateDerivedKeys) { testTearDown(); } -// Define CAN_INSTALL_KEYBOX if you are compiling with the reference -// implementation of OEMCrypto, or if your version of OEMCrypto supports -// OEMCrypto_InstallKeybox with a clear keybox. -// The Below tests are based on a specific keybox which is installed for testing. -// They are disabled by default. Just because you can install a test keybox, -// does not mean you want to install a test keybox. -#if defined(CAN_INSTALL_KEYBOX) - /////////////////////////////////////////////////// // AddKey Tests /////////////////////////////////////////////////// @@ -1926,6 +1918,34 @@ TEST_F(DISABLED_TestKeybox, LoadKeyWithNonce) { testTearDown(); } +TEST_F(DISABLED_TestKeybox, LoadKeyWithNoMAC) { + testSetUp(); + InstallKeybox(kDefaultKeybox, true); + Session& s = createSession("ONE"); + s.open(); + + s.GenerateDerivedKeys(); + + MessageData data; + s.FillSimpleMessage(&data, 0, 0, 0); + + MessageData encrypted; + s.EncryptMessage(data, &encrypted); + std::vector signature; + s.ServerSignMessage(encrypted, &signature); + OEMCrypto_KeyObject key_array[kNumKeys]; + const uint8_t* message_ptr = reinterpret_cast(&encrypted); + s.FillKeyArray(encrypted, key_array); + OEMCryptoResult sts = OEMCrypto_LoadKeys(s.session_id(), + message_ptr, sizeof(encrypted), + &signature[0], signature.size(), + NULL, NULL, + kNumKeys, key_array); + ASSERT_EQ(OEMCrypto_SUCCESS, sts); + s.close(); + testTearDown(); +} + /* The Bad Range tests verify that OEMCrypto_LoadKeys checks the range of all the pointers. It should reject a message if the pointer does not point into the message buffer */ @@ -3719,5 +3739,4 @@ TEST_F(DISABLED_GenericDRMTest, KeyDurationVerify) { s.close(); testTearDown(); } -#endif // CAN_INSTALL_KEYBOX } // namespace wvoec