Clean up some test docs
Some tests were not in a doxygen group, so they were not showing up on the dev site. Bug: 298719677 Change-Id: Ic86b7999ac7ab324eb40a30023b74897f87d97e5
This commit is contained in:
committed by
Robert Shih
parent
05926646f0
commit
d4dae79a0e
@@ -11,6 +11,9 @@ using ::testing::Range;
|
|||||||
|
|
||||||
namespace wvoec {
|
namespace wvoec {
|
||||||
|
|
||||||
|
/// @addtogroup generic
|
||||||
|
/// @{
|
||||||
|
|
||||||
/** If a device can load a private key with the alternate padding schemes, it
|
/** If a device can load a private key with the alternate padding schemes, it
|
||||||
* should support signing with the alternate scheme. */
|
* should support signing with the alternate scheme. */
|
||||||
TEST_F(OEMCryptoLoadsCertificateAlternates, TestSignaturePKCS1) {
|
TEST_F(OEMCryptoLoadsCertificateAlternates, TestSignaturePKCS1) {
|
||||||
@@ -1019,4 +1022,5 @@ TEST_P(OEMCryptoSessionTestLoadCasKeysWithHDCP, CasOnlyLoadCasKeysAPI17) {
|
|||||||
}
|
}
|
||||||
INSTANTIATE_TEST_SUITE_P(TestHDCP, OEMCryptoSessionTestLoadCasKeysWithHDCP,
|
INSTANTIATE_TEST_SUITE_P(TestHDCP, OEMCryptoSessionTestLoadCasKeysWithHDCP,
|
||||||
Range(1, 6));
|
Range(1, 6));
|
||||||
|
/// @}
|
||||||
} // namespace wvoec
|
} // namespace wvoec
|
||||||
|
|||||||
@@ -11,9 +11,12 @@ using ::testing::Range;
|
|||||||
|
|
||||||
namespace wvoec {
|
namespace wvoec {
|
||||||
|
|
||||||
|
/// @addtogroup generic
|
||||||
|
/// @{
|
||||||
|
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyLoad) { EncryptAndLoadKeys(); }
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyLoad) { EncryptAndLoadKeys(); }
|
||||||
|
|
||||||
// Test that the Generic_Encrypt function works correctly.
|
/** Test that the Generic_Encrypt function works correctly. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyEncrypt) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyEncrypt) {
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
unsigned int key_index = 0;
|
unsigned int key_index = 0;
|
||||||
@@ -34,7 +37,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyEncrypt) {
|
|||||||
ASSERT_EQ(expected_encrypted, encrypted);
|
ASSERT_EQ(expected_encrypted, encrypted);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that the Generic_Encrypt function fails when not allowed.
|
/** Test that the Generic_Encrypt function fails when not allowed. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadEncrypt) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadEncrypt) {
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
BadEncrypt(0, OEMCrypto_HMAC_SHA256, buffer_size_);
|
BadEncrypt(0, OEMCrypto_HMAC_SHA256, buffer_size_);
|
||||||
@@ -45,8 +48,8 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadEncrypt) {
|
|||||||
BadEncrypt(3, OEMCrypto_AES_CBC_128_NO_PADDING, buffer_size_);
|
BadEncrypt(3, OEMCrypto_AES_CBC_128_NO_PADDING, buffer_size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that the Generic_Encrypt works if the input and output buffers are the
|
/** Test that the Generic_Encrypt works if the input and output buffers are the
|
||||||
// same.
|
* same. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyEncryptSameBufferAPI12) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyEncryptSameBufferAPI12) {
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
unsigned int key_index = 0;
|
unsigned int key_index = 0;
|
||||||
@@ -87,7 +90,7 @@ TEST_P(
|
|||||||
OEMCrypto_AES_CBC_128_NO_PADDING, buffer.data()));
|
OEMCrypto_AES_CBC_128_NO_PADDING, buffer.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Decrypt works correctly.
|
/** Test Generic_Decrypt works correctly. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecrypt) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecrypt) {
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
unsigned int key_index = 1;
|
unsigned int key_index = 1;
|
||||||
@@ -108,8 +111,8 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecrypt) {
|
|||||||
ASSERT_EQ(clear_buffer_, resultant);
|
ASSERT_EQ(clear_buffer_, resultant);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that Generic_Decrypt works correctly when the input and output buffers
|
/** Test that Generic_Decrypt works correctly when the input and output buffers
|
||||||
// are the same.
|
* are the same. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecryptSameBufferAPI12) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecryptSameBufferAPI12) {
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
unsigned int key_index = 1;
|
unsigned int key_index = 1;
|
||||||
@@ -130,8 +133,8 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecryptSameBufferAPI12) {
|
|||||||
ASSERT_EQ(clear_buffer_, resultant);
|
ASSERT_EQ(clear_buffer_, resultant);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that Generic_Decrypt fails to decrypt to an insecure buffer if the key
|
/** Test that Generic_Decrypt fails to decrypt to an insecure buffer if the key
|
||||||
// requires a secure data path.
|
* requires a secure data path. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericSecureToClear) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericSecureToClear) {
|
||||||
license_messages_.set_control(wvoec::kControlObserveDataPath |
|
license_messages_.set_control(wvoec::kControlObserveDataPath |
|
||||||
wvoec::kControlDataPathSecure);
|
wvoec::kControlDataPathSecure);
|
||||||
@@ -155,7 +158,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericSecureToClear) {
|
|||||||
ASSERT_NE(clear_buffer_, resultant);
|
ASSERT_NE(clear_buffer_, resultant);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that the Generic_Decrypt function fails when not allowed.
|
/** Test that the Generic_Decrypt function fails when not allowed. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadDecrypt) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadDecrypt) {
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
BadDecrypt(1, OEMCrypto_HMAC_SHA256, buffer_size_);
|
BadDecrypt(1, OEMCrypto_HMAC_SHA256, buffer_size_);
|
||||||
@@ -194,7 +197,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeySign) {
|
|||||||
ASSERT_EQ(expected_signature, signature);
|
ASSERT_EQ(expected_signature, signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that the Generic_Sign function fails when not allowed.
|
/** Test that the Generic_Sign function fails when not allowed. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadSign) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadSign) {
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
BadSign(0, OEMCrypto_HMAC_SHA256); // Can't sign with encrypt key.
|
BadSign(0, OEMCrypto_HMAC_SHA256); // Can't sign with encrypt key.
|
||||||
@@ -223,7 +226,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyVerify) {
|
|||||||
signature.data(), signature.size()));
|
signature.data(), signature.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that the Generic_Verify function fails when not allowed.
|
/** Test that the Generic_Verify function fails when not allowed. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadVerify) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadVerify) {
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
BadVerify(0, OEMCrypto_HMAC_SHA256, SHA256_DIGEST_LENGTH, false);
|
BadVerify(0, OEMCrypto_HMAC_SHA256, SHA256_DIGEST_LENGTH, false);
|
||||||
@@ -235,7 +238,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyBadVerify) {
|
|||||||
BadVerify(3, OEMCrypto_AES_CBC_128_NO_PADDING, SHA256_DIGEST_LENGTH, false);
|
BadVerify(3, OEMCrypto_AES_CBC_128_NO_PADDING, SHA256_DIGEST_LENGTH, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Encrypt with the maximum buffer size.
|
/** Test Generic_Encrypt with the maximum buffer size. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyEncryptLargeBuffer) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyEncryptLargeBuffer) {
|
||||||
ResizeBuffer(GetResourceValue(kMaxGenericBuffer));
|
ResizeBuffer(GetResourceValue(kMaxGenericBuffer));
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
@@ -257,7 +260,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyEncryptLargeBuffer) {
|
|||||||
ASSERT_EQ(expected_encrypted, encrypted);
|
ASSERT_EQ(expected_encrypted, encrypted);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Decrypt with the maximum buffer size.
|
/** Test Generic_Decrypt with the maximum buffer size. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecryptLargeBuffer) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecryptLargeBuffer) {
|
||||||
// Some applications are known to pass in a block that is almost 400k.
|
// Some applications are known to pass in a block that is almost 400k.
|
||||||
ResizeBuffer(GetResourceValue(kMaxGenericBuffer));
|
ResizeBuffer(GetResourceValue(kMaxGenericBuffer));
|
||||||
@@ -280,7 +283,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyDecryptLargeBuffer) {
|
|||||||
ASSERT_EQ(clear_buffer_, resultant);
|
ASSERT_EQ(clear_buffer_, resultant);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Sign with the maximum buffer size.
|
/** Test Generic_Sign with the maximum buffer size. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeySignLargeBuffer) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeySignLargeBuffer) {
|
||||||
ResizeBuffer(GetResourceValue(kMaxGenericBuffer));
|
ResizeBuffer(GetResourceValue(kMaxGenericBuffer));
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
@@ -310,7 +313,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeySignLargeBuffer) {
|
|||||||
ASSERT_EQ(expected_signature, signature);
|
ASSERT_EQ(expected_signature, signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Verify with the maximum buffer size.
|
/** Test Generic_Verify with the maximum buffer size. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyVerifyLargeBuffer) {
|
TEST_P(OEMCryptoGenericCryptoTest, GenericKeyVerifyLargeBuffer) {
|
||||||
ResizeBuffer(GetResourceValue(kMaxGenericBuffer));
|
ResizeBuffer(GetResourceValue(kMaxGenericBuffer));
|
||||||
EncryptAndLoadKeys();
|
EncryptAndLoadKeys();
|
||||||
@@ -332,7 +335,7 @@ TEST_P(OEMCryptoGenericCryptoTest, GenericKeyVerifyLargeBuffer) {
|
|||||||
signature.data(), signature.size()));
|
signature.data(), signature.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Encrypt when the key duration has expired.
|
/** Test Generic_Encrypt when the key duration has expired. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, KeyDurationEncrypt) {
|
TEST_P(OEMCryptoGenericCryptoTest, KeyDurationEncrypt) {
|
||||||
license_messages_.core_response()
|
license_messages_.core_response()
|
||||||
.timer_limits.total_playback_duration_seconds = kDuration;
|
.timer_limits.total_playback_duration_seconds = kDuration;
|
||||||
@@ -368,7 +371,7 @@ TEST_P(OEMCryptoGenericCryptoTest, KeyDurationEncrypt) {
|
|||||||
ASSERT_NO_FATAL_FAILURE(session_.TestGetKeyHandleExpired(key_index));
|
ASSERT_NO_FATAL_FAILURE(session_.TestGetKeyHandleExpired(key_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Decrypt when the key duration has expired.
|
/** Test Generic_Decrypt when the key duration has expired. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, KeyDurationDecrypt) {
|
TEST_P(OEMCryptoGenericCryptoTest, KeyDurationDecrypt) {
|
||||||
license_messages_.core_response()
|
license_messages_.core_response()
|
||||||
.timer_limits.total_playback_duration_seconds = kDuration;
|
.timer_limits.total_playback_duration_seconds = kDuration;
|
||||||
@@ -403,7 +406,7 @@ TEST_P(OEMCryptoGenericCryptoTest, KeyDurationDecrypt) {
|
|||||||
ASSERT_NO_FATAL_FAILURE(session_.TestGetKeyHandleExpired(key_index));
|
ASSERT_NO_FATAL_FAILURE(session_.TestGetKeyHandleExpired(key_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Sign when the key duration has expired.
|
/** Test Generic_Sign when the key duration has expired. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, KeyDurationSign) {
|
TEST_P(OEMCryptoGenericCryptoTest, KeyDurationSign) {
|
||||||
license_messages_.core_response()
|
license_messages_.core_response()
|
||||||
.timer_limits.total_playback_duration_seconds = kDuration;
|
.timer_limits.total_playback_duration_seconds = kDuration;
|
||||||
@@ -442,7 +445,7 @@ TEST_P(OEMCryptoGenericCryptoTest, KeyDurationSign) {
|
|||||||
ASSERT_NO_FATAL_FAILURE(session_.TestGetKeyHandleExpired(key_index));
|
ASSERT_NO_FATAL_FAILURE(session_.TestGetKeyHandleExpired(key_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Generic_Verify when the key duration has expired.
|
/** Test Generic_Verify when the key duration has expired. */
|
||||||
TEST_P(OEMCryptoGenericCryptoTest, KeyDurationVerify) {
|
TEST_P(OEMCryptoGenericCryptoTest, KeyDurationVerify) {
|
||||||
license_messages_.core_response()
|
license_messages_.core_response()
|
||||||
.timer_limits.total_playback_duration_seconds = kDuration;
|
.timer_limits.total_playback_duration_seconds = kDuration;
|
||||||
@@ -574,4 +577,4 @@ INSTANTIATE_TEST_SUITE_P(TestAll, OEMCryptoGenericCryptoKeyIdLengthTest,
|
|||||||
Range<uint32_t>(kCoreMessagesAPI, kCurrentAPI + 1));
|
Range<uint32_t>(kCoreMessagesAPI, kCurrentAPI + 1));
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
} // namespace wvoec
|
} // namespace wvoec
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ using ::testing::Range;
|
|||||||
|
|
||||||
namespace wvoec {
|
namespace wvoec {
|
||||||
|
|
||||||
|
/// @addtogroup license
|
||||||
|
/// @{
|
||||||
|
|
||||||
// Function to test APIs that expect a buffer length as input
|
// Function to test APIs that expect a buffer length as input
|
||||||
// by passing huge buffer lengths up to end_buffer_length and test that the API
|
// by passing huge buffer lengths up to end_buffer_length and test that the API
|
||||||
// doesn't crash.
|
// doesn't crash.
|
||||||
|
|||||||
Reference in New Issue
Block a user