Update oemcrypto_test.cpp
This is a merge from the Widevine repo of these three CLs: http://go/wvgerrit/18008 Update OEMCrypto Performance Unit Test http://go/wvgerrit/17901 Remove static initialization for member variable http://go/wvgerrit/17214 Lengthen allowed time for simultaneous decrypt There's also some code cleanup from http://go/wvgerrit/17971. Change-Id: I81e1366594e1dbe65260aad96d9c8f77a116f508
This commit is contained in:
@@ -1135,7 +1135,7 @@ TEST_F(OEMCryptoSessionTests, SimultaneousDecrypt) {
|
||||
}
|
||||
for (int i = 0; i < 8; i++) {
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].GenerateTestSessionKeys());
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].FillSimpleMessage(kDuration, 0,
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].FillSimpleMessage(kLongDuration, 0,
|
||||
s[i].get_nonce()));
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].EncryptAndSign());
|
||||
}
|
||||
@@ -1158,14 +1158,14 @@ TEST_F(OEMCryptoSessionTests, SimultaneousDecryptWithLostMessage) {
|
||||
}
|
||||
for (int i = 0; i < 8; i++) {
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].GenerateTestSessionKeys());
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].FillSimpleMessage(kDuration, 0,
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].FillSimpleMessage(kLongDuration, 0,
|
||||
s[i].get_nonce()));
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].EncryptAndSign());
|
||||
}
|
||||
// First set of messages are lost. Generate second set.
|
||||
for (int i = 0; i < 8; i++) {
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].GenerateTestSessionKeys());
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].FillSimpleMessage(kDuration, 0,
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].FillSimpleMessage(kLongDuration, 0,
|
||||
s[i].get_nonce()));
|
||||
ASSERT_NO_FATAL_FAILURE(s[i].EncryptAndSign());
|
||||
}
|
||||
@@ -1293,7 +1293,7 @@ class OEMCryptoSessionTestsDecryptTests
|
||||
}
|
||||
|
||||
void TestDecryptCENC(const vector<uint8_t>& key,
|
||||
const vector<uint8_t>& encryptionIv,
|
||||
const vector<uint8_t>& /* encryptionIv */,
|
||||
const vector<uint8_t>& encryptedData,
|
||||
const vector<uint8_t>& unencryptedData) {
|
||||
OEMCryptoResult sts;
|
||||
@@ -1615,8 +1615,8 @@ TEST_P(OEMCryptoSessionTestsDecryptTests, DecryptCENCPerformance) {
|
||||
s.license().keys[0].cipher_mode = GetParam().mode;
|
||||
ASSERT_NO_FATAL_FAILURE(s.EncryptAndSign());
|
||||
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys());
|
||||
vector<uint8_t> keyId = wvcdm::a2b_hex("000000000000000000000000");
|
||||
sts = OEMCrypto_SelectKey(s.session_id(), &keyId[0], keyId.size());
|
||||
sts = OEMCrypto_SelectKey(s.session_id(), s.license().keys[0].key_id,
|
||||
s.license().keys[0].key_id_length);
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
|
||||
vector<uint8_t> encryptionIv =
|
||||
wvcdm::a2b_hex("719dbcb253b2ec702bb8c1b1bc2f3bc6");
|
||||
@@ -3191,6 +3191,10 @@ TEST_F(OEMCryptoCastReceiverTest, TestSignaturePKCS1_15_20) {
|
||||
|
||||
class GenericCryptoTest : public OEMCryptoSessionTests {
|
||||
protected:
|
||||
// buffer_size_ must be a multiple of encryption block size, 16. We'll use a
|
||||
// reasonable number of blocks for most of the tests.
|
||||
GenericCryptoTest() : buffer_size_(160) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
OEMCryptoSessionTests::SetUp();
|
||||
ASSERT_NO_FATAL_FAILURE(session_.open());
|
||||
@@ -3331,7 +3335,7 @@ class GenericCryptoTest : public OEMCryptoSessionTests {
|
||||
}
|
||||
|
||||
// This must be a multiple of encryption block size.
|
||||
size_t buffer_size_ = 160;
|
||||
size_t buffer_size_;
|
||||
vector<uint8_t> clear_buffer_;
|
||||
vector<uint8_t> encrypted_buffer_;
|
||||
uint8_t iv_[wvcdm::KEY_IV_SIZE];
|
||||
|
||||
Reference in New Issue
Block a user