am 15cf441d: Fix RefreshKey Test
* commit '15cf441d17e98f5d0b89f2510b8f852a7108d298': Fix RefreshKey Test
This commit is contained in:
@@ -2137,12 +2137,11 @@ class OEMCryptoRefreshKeyTest : public OEMCryptoClientTest {
|
||||
Session& s = createSession("ONE");
|
||||
s.open();
|
||||
s.GenerateDerivedKeys();
|
||||
s.LoadTestKeys(kDuration, 0);
|
||||
s.LoadTestKeys(kDuration, wvoec_mock::kControlNonceEnabled);
|
||||
uint32_t nonce;
|
||||
s.GenerateNonce(&nonce);
|
||||
s.RefreshTestKeys(key_count,
|
||||
htonl(wvoec_mock::kControlNonceEnabled), nonce,
|
||||
true );
|
||||
s.RefreshTestKeys(key_count, wvoec_mock::kControlNonceEnabled, nonce,
|
||||
true);
|
||||
s.close();
|
||||
}
|
||||
|
||||
@@ -2153,7 +2152,7 @@ class OEMCryptoRefreshKeyTest : public OEMCryptoClientTest {
|
||||
s.LoadTestKeys(kDuration, 0);
|
||||
uint32_t nonce;
|
||||
s.GenerateNonce(&nonce);
|
||||
s.RefreshTestKeys(key_count,0, 0, true );
|
||||
s.RefreshTestKeys(key_count,0, 0, true);
|
||||
s.close();
|
||||
}
|
||||
|
||||
@@ -2161,37 +2160,41 @@ class OEMCryptoRefreshKeyTest : public OEMCryptoClientTest {
|
||||
Session& s = createSession("ONE");
|
||||
s.open();
|
||||
s.GenerateDerivedKeys();
|
||||
s.LoadTestKeys(kDuration, 0);
|
||||
s.LoadTestKeys(kDuration, wvoec_mock::kControlNonceEnabled);
|
||||
uint32_t nonce = s.get_nonce();
|
||||
s.RefreshTestKeys(key_count,
|
||||
htonl(wvoec_mock::kControlNonceEnabled), nonce,
|
||||
false );
|
||||
s.RefreshTestKeys(key_count, wvoec_mock::kControlNonceEnabled, nonce,
|
||||
false);
|
||||
s.close();
|
||||
}
|
||||
void RefreshBadNonce(const int key_count) {
|
||||
Session& s = createSession("ONE");
|
||||
s.open();
|
||||
s.GenerateDerivedKeys();
|
||||
s.LoadTestKeys(kDuration, 0);
|
||||
s.LoadTestKeys(kDuration, wvoec_mock::kControlNonceEnabled);
|
||||
uint32_t nonce;
|
||||
s.GenerateNonce(&nonce);
|
||||
nonce = 42;
|
||||
s.RefreshTestKeys(key_count,
|
||||
htonl(wvoec_mock::kControlNonceEnabled), nonce,
|
||||
false );
|
||||
s.RefreshTestKeys(key_count, wvoec_mock::kControlNonceEnabled, nonce,
|
||||
false);
|
||||
s.close();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
TEST_F(OEMCryptoRefreshKeyTest, RefreshKeys) {
|
||||
TEST_F(OEMCryptoRefreshKeyTest, RefreshAllKeys) {
|
||||
testSetUp();
|
||||
InstallKeybox(kDefaultKeybox);
|
||||
RefreshWithNonce(1);
|
||||
RefreshWithNonce(kNumKeys);
|
||||
RefreshWithNonce(1); // One key control block to refresh all keys.
|
||||
RefreshOldNonce(1);
|
||||
RefreshOldNonce(kNumKeys);
|
||||
RefreshBadNonce(1);
|
||||
testTearDown();
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoRefreshKeyTest, RefreshEachKeys) {
|
||||
testSetUp();
|
||||
InstallKeybox(kDefaultKeybox);
|
||||
RefreshWithNonce(kNumKeys); // Each key control block updates a different key.
|
||||
RefreshOldNonce(kNumKeys);
|
||||
RefreshBadNonce(kNumKeys);
|
||||
testTearDown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user