Add unit test to verify signature

Merge from widevine repo of http://go/wvgerrit/21521

On devices that use provisioning 3.0, the function
OEMCrypto_GenerateSignature will only be used for a license renewal.
This CL adds a call to OEMCrypto_GenerateSignature to the refresh key
tests.  Otherwise, there would be no coverage at all for that
function.

Change-Id: Icbd568eea3f9f256cc9b0b441f7907b316bb5b69
This commit is contained in:
Fred Gylys-Colwell
2016-11-28 21:54:03 -08:00
parent 47f454839e
commit a200710d53
3 changed files with 28 additions and 0 deletions

View File

@@ -1155,6 +1155,7 @@ TEST_P(SessionTestRefreshKeyTest, RefreshWithNonce) {
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys("", new_mac_keys_));
uint32_t nonce;
s.GenerateNonce(&nonce);
ASSERT_NO_FATAL_FAILURE(s.VerifyClientSignature());
ASSERT_NO_FATAL_FAILURE(s.RefreshTestKeys(
num_keys_, wvoec_mock::kControlNonceEnabled, nonce, OEMCrypto_SUCCESS));
}
@@ -1168,6 +1169,7 @@ TEST_P(SessionTestRefreshKeyTest, RefreshNoNonce) {
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys("", new_mac_keys_));
uint32_t nonce;
s.GenerateNonce(&nonce);
ASSERT_NO_FATAL_FAILURE(s.VerifyClientSignature());
ASSERT_NO_FATAL_FAILURE(
s.RefreshTestKeys(num_keys_, 0, 0, OEMCrypto_SUCCESS));
}
@@ -1181,6 +1183,7 @@ TEST_P(SessionTestRefreshKeyTest, RefreshOldNonce) {
ASSERT_NO_FATAL_FAILURE(s.EncryptAndSign());
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys("", new_mac_keys_));
uint32_t nonce = s.get_nonce();
ASSERT_NO_FATAL_FAILURE(s.VerifyClientSignature());
ASSERT_NO_FATAL_FAILURE(
s.RefreshTestKeys(num_keys_, wvoec_mock::kControlNonceEnabled, nonce,
OEMCrypto_ERROR_INVALID_NONCE));
@@ -1196,6 +1199,7 @@ TEST_P(SessionTestRefreshKeyTest, RefreshBadNonce) {
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys("", new_mac_keys_));
uint32_t nonce;
s.GenerateNonce(&nonce);
ASSERT_NO_FATAL_FAILURE(s.VerifyClientSignature());
nonce ^= 42;
ASSERT_NO_FATAL_FAILURE(
s.RefreshTestKeys(num_keys_, wvoec_mock::kControlNonceEnabled, nonce,
@@ -1213,6 +1217,7 @@ TEST_P(SessionTestRefreshKeyTest, RefreshLargeBuffer) {
ASSERT_NO_FATAL_FAILURE(s.LoadTestKeys("", new_mac_keys_));
uint32_t nonce;
s.GenerateNonce(&nonce);
ASSERT_NO_FATAL_FAILURE(s.VerifyClientSignature(kMaxMessageSize));
ASSERT_NO_FATAL_FAILURE(s.RefreshTestKeys(
num_keys_, wvoec_mock::kControlNonceEnabled, nonce, OEMCrypto_SUCCESS));
}