Merge "Test loading second call to LoadKeys fails" into qt-dev am: a1e94e2eb1
am: 4e75bcfce8
Change-Id: I97d50a3137867235c1fcc20e449ce54460dbbaf8
This commit is contained in:
@@ -636,6 +636,7 @@ OEMCryptoResult SessionContext::LoadKeys(
|
||||
break;
|
||||
}
|
||||
}
|
||||
encryption_key_.clear();
|
||||
return OEMCrypto_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -906,6 +906,24 @@ TEST_F(OEMCryptoSessionTests, LoadKeyNoNonce) {
|
||||
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys());
|
||||
}
|
||||
|
||||
// Verify that a second license may be not be loaded in a session.
|
||||
TEST_F(OEMCryptoSessionTests, LoadKeyNoNonceTwice) {
|
||||
Session s;
|
||||
ASSERT_NO_FATAL_FAILURE(s.open());
|
||||
ASSERT_NO_FATAL_FAILURE(InstallTestSessionKeys(&s));
|
||||
ASSERT_NO_FATAL_FAILURE(s.FillSimpleMessage(kDuration, 0, 42));
|
||||
ASSERT_NO_FATAL_FAILURE(s.EncryptAndSign());
|
||||
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys());
|
||||
ASSERT_NO_FATAL_FAILURE(s.EncryptAndSign());
|
||||
ASSERT_NE(
|
||||
OEMCrypto_SUCCESS,
|
||||
OEMCrypto_LoadKeys(s.session_id(), s.message_ptr(), s.message_size(),
|
||||
s.signature().data(), s.signature().size(),
|
||||
s.enc_mac_keys_iv_substr(), s.enc_mac_keys_substr(),
|
||||
s.num_keys(), s.key_array(), s.pst_substr(),
|
||||
GetSubstring(), OEMCrypto_ContentLicense));
|
||||
}
|
||||
|
||||
// Verify that a license may be loaded with a nonce.
|
||||
TEST_F(OEMCryptoSessionTests, LoadKeyWithNonce) {
|
||||
Session s;
|
||||
@@ -917,6 +935,24 @@ TEST_F(OEMCryptoSessionTests, LoadKeyWithNonce) {
|
||||
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys());
|
||||
}
|
||||
|
||||
// Verify that a second license may be not be loaded in a session.
|
||||
TEST_F(OEMCryptoSessionTests, LoadKeyWithNonceTwice) {
|
||||
Session s;
|
||||
ASSERT_NO_FATAL_FAILURE(s.open());
|
||||
ASSERT_NO_FATAL_FAILURE(InstallTestSessionKeys(&s));
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
s.FillSimpleMessage(0, wvoec::kControlNonceEnabled, s.get_nonce()));
|
||||
ASSERT_NO_FATAL_FAILURE(s.EncryptAndSign());
|
||||
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys());
|
||||
ASSERT_NE(
|
||||
OEMCrypto_SUCCESS,
|
||||
OEMCrypto_LoadKeys(s.session_id(), s.message_ptr(), s.message_size(),
|
||||
s.signature().data(), s.signature().size(),
|
||||
s.enc_mac_keys_iv_substr(), s.enc_mac_keys_substr(),
|
||||
s.num_keys(), s.key_array(), s.pst_substr(),
|
||||
GetSubstring(), OEMCrypto_ContentLicense));
|
||||
}
|
||||
|
||||
// This asks for several nonce. This simulates several license requests being
|
||||
// lost. OEMCrypto is required to keep up to four nonce in the nonce table.
|
||||
TEST_F(OEMCryptoSessionTests, LoadKeySeveralNonce) {
|
||||
|
||||
Reference in New Issue
Block a user