* commit '5a4134e85231bccaa3dcf2bffae1d1d5eb2e0501': Add unit test for empty mac key
This commit is contained in:
@@ -8,9 +8,6 @@ LOCAL_SRC_FILES:= \
|
|||||||
|
|
||||||
LOCAL_MODULE_TAGS := tests
|
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 += \
|
LOCAL_C_INCLUDES += \
|
||||||
bionic \
|
bionic \
|
||||||
external/gtest/include \
|
external/gtest/include \
|
||||||
|
|||||||
@@ -1738,14 +1738,6 @@ TEST_F(OEMCryptoClientTest, GenerateDerivedKeys) {
|
|||||||
testTearDown();
|
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
|
// AddKey Tests
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
@@ -1926,6 +1918,34 @@ TEST_F(DISABLED_TestKeybox, LoadKeyWithNonce) {
|
|||||||
testTearDown();
|
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<uint8_t> signature;
|
||||||
|
s.ServerSignMessage(encrypted, &signature);
|
||||||
|
OEMCrypto_KeyObject key_array[kNumKeys];
|
||||||
|
const uint8_t* message_ptr = reinterpret_cast<const uint8_t*>(&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
|
/* The Bad Range tests verify that OEMCrypto_LoadKeys checks the range
|
||||||
of all the pointers. It should reject a message if the pointer does
|
of all the pointers. It should reject a message if the pointer does
|
||||||
not point into the message buffer */
|
not point into the message buffer */
|
||||||
@@ -3719,5 +3739,4 @@ TEST_F(DISABLED_GenericDRMTest, KeyDurationVerify) {
|
|||||||
s.close();
|
s.close();
|
||||||
testTearDown();
|
testTearDown();
|
||||||
}
|
}
|
||||||
#endif // CAN_INSTALL_KEYBOX
|
|
||||||
} // namespace wvoec
|
} // namespace wvoec
|
||||||
|
|||||||
Reference in New Issue
Block a user