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");
|
Session& s = createSession("ONE");
|
||||||
s.open();
|
s.open();
|
||||||
s.GenerateDerivedKeys();
|
s.GenerateDerivedKeys();
|
||||||
s.LoadTestKeys(kDuration, 0);
|
s.LoadTestKeys(kDuration, wvoec_mock::kControlNonceEnabled);
|
||||||
uint32_t nonce;
|
uint32_t nonce;
|
||||||
s.GenerateNonce(&nonce);
|
s.GenerateNonce(&nonce);
|
||||||
s.RefreshTestKeys(key_count,
|
s.RefreshTestKeys(key_count, wvoec_mock::kControlNonceEnabled, nonce,
|
||||||
htonl(wvoec_mock::kControlNonceEnabled), nonce,
|
true);
|
||||||
true );
|
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2153,7 +2152,7 @@ class OEMCryptoRefreshKeyTest : public OEMCryptoClientTest {
|
|||||||
s.LoadTestKeys(kDuration, 0);
|
s.LoadTestKeys(kDuration, 0);
|
||||||
uint32_t nonce;
|
uint32_t nonce;
|
||||||
s.GenerateNonce(&nonce);
|
s.GenerateNonce(&nonce);
|
||||||
s.RefreshTestKeys(key_count,0, 0, true );
|
s.RefreshTestKeys(key_count,0, 0, true);
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2161,37 +2160,41 @@ class OEMCryptoRefreshKeyTest : public OEMCryptoClientTest {
|
|||||||
Session& s = createSession("ONE");
|
Session& s = createSession("ONE");
|
||||||
s.open();
|
s.open();
|
||||||
s.GenerateDerivedKeys();
|
s.GenerateDerivedKeys();
|
||||||
s.LoadTestKeys(kDuration, 0);
|
s.LoadTestKeys(kDuration, wvoec_mock::kControlNonceEnabled);
|
||||||
uint32_t nonce = s.get_nonce();
|
uint32_t nonce = s.get_nonce();
|
||||||
s.RefreshTestKeys(key_count,
|
s.RefreshTestKeys(key_count, wvoec_mock::kControlNonceEnabled, nonce,
|
||||||
htonl(wvoec_mock::kControlNonceEnabled), nonce,
|
false);
|
||||||
false );
|
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
void RefreshBadNonce(const int key_count) {
|
void RefreshBadNonce(const int key_count) {
|
||||||
Session& s = createSession("ONE");
|
Session& s = createSession("ONE");
|
||||||
s.open();
|
s.open();
|
||||||
s.GenerateDerivedKeys();
|
s.GenerateDerivedKeys();
|
||||||
s.LoadTestKeys(kDuration, 0);
|
s.LoadTestKeys(kDuration, wvoec_mock::kControlNonceEnabled);
|
||||||
uint32_t nonce;
|
uint32_t nonce;
|
||||||
s.GenerateNonce(&nonce);
|
s.GenerateNonce(&nonce);
|
||||||
nonce = 42;
|
nonce = 42;
|
||||||
s.RefreshTestKeys(key_count,
|
s.RefreshTestKeys(key_count, wvoec_mock::kControlNonceEnabled, nonce,
|
||||||
htonl(wvoec_mock::kControlNonceEnabled), nonce,
|
false);
|
||||||
false );
|
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(OEMCryptoRefreshKeyTest, RefreshKeys) {
|
TEST_F(OEMCryptoRefreshKeyTest, RefreshAllKeys) {
|
||||||
testSetUp();
|
testSetUp();
|
||||||
InstallKeybox(kDefaultKeybox);
|
InstallKeybox(kDefaultKeybox);
|
||||||
RefreshWithNonce(1);
|
RefreshWithNonce(1); // One key control block to refresh all keys.
|
||||||
RefreshWithNonce(kNumKeys);
|
|
||||||
RefreshOldNonce(1);
|
RefreshOldNonce(1);
|
||||||
RefreshOldNonce(kNumKeys);
|
|
||||||
RefreshBadNonce(1);
|
RefreshBadNonce(1);
|
||||||
|
testTearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(OEMCryptoRefreshKeyTest, RefreshEachKeys) {
|
||||||
|
testSetUp();
|
||||||
|
InstallKeybox(kDefaultKeybox);
|
||||||
|
RefreshWithNonce(kNumKeys); // Each key control block updates a different key.
|
||||||
|
RefreshOldNonce(kNumKeys);
|
||||||
RefreshBadNonce(kNumKeys);
|
RefreshBadNonce(kNumKeys);
|
||||||
testTearDown();
|
testTearDown();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user