|
|
|
@@ -53,7 +53,6 @@ static const SecurityLevel kSwSecureCrypto = SecurityLevel::SW_SECURE_CRYPTO;
|
|
|
|
* Ensure drm factory supports module UUID Scheme
|
|
|
|
* Ensure drm factory supports module UUID Scheme
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, VendorUuidSupported) {
|
|
|
|
TEST_P(DrmHalTest, VendorUuidSupported) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
auto res = drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kVideoMp4, kSwSecureCrypto);
|
|
|
|
auto res = drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kVideoMp4, kSwSecureCrypto);
|
|
|
|
ALOGI("kVideoMp4 = %s res %d", kVideoMp4, (bool)res);
|
|
|
|
ALOGI("kVideoMp4 = %s res %d", kVideoMp4, (bool)res);
|
|
|
|
EXPECT_TRUE(res);
|
|
|
|
EXPECT_TRUE(res);
|
|
|
|
@@ -63,7 +62,6 @@ TEST_P(DrmHalTest, VendorUuidSupported) {
|
|
|
|
* Ensure drm factory doesn't support an invalid scheme UUID
|
|
|
|
* Ensure drm factory doesn't support an invalid scheme UUID
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, InvalidPluginNotSupported) {
|
|
|
|
TEST_P(DrmHalTest, InvalidPluginNotSupported) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
const uint8_t kInvalidUUID[16] = {
|
|
|
|
const uint8_t kInvalidUUID[16] = {
|
|
|
|
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
|
|
|
|
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
|
|
|
|
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};
|
|
|
|
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};
|
|
|
|
@@ -74,7 +72,6 @@ TEST_P(DrmHalTest, InvalidPluginNotSupported) {
|
|
|
|
* Ensure drm factory doesn't support an empty UUID
|
|
|
|
* Ensure drm factory doesn't support an empty UUID
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, EmptyPluginUUIDNotSupported) {
|
|
|
|
TEST_P(DrmHalTest, EmptyPluginUUIDNotSupported) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
hidl_array<uint8_t, 16> emptyUUID;
|
|
|
|
hidl_array<uint8_t, 16> emptyUUID;
|
|
|
|
memset(emptyUUID.data(), 0, 16);
|
|
|
|
memset(emptyUUID.data(), 0, 16);
|
|
|
|
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(emptyUUID, kVideoMp4, kSwSecureCrypto));
|
|
|
|
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(emptyUUID, kVideoMp4, kSwSecureCrypto));
|
|
|
|
@@ -84,7 +81,6 @@ TEST_P(DrmHalTest, EmptyPluginUUIDNotSupported) {
|
|
|
|
* Ensure drm factory doesn't support an invalid mime type
|
|
|
|
* Ensure drm factory doesn't support an invalid mime type
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, BadMimeNotSupported) {
|
|
|
|
TEST_P(DrmHalTest, BadMimeNotSupported) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kBadMime, kSwSecureCrypto));
|
|
|
|
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kBadMime, kSwSecureCrypto));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -101,7 +97,6 @@ TEST_P(DrmHalTest, BadMimeNotSupported) {
|
|
|
|
* that is delivered back to the HAL.
|
|
|
|
* that is delivered back to the HAL.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, DoProvisioning) {
|
|
|
|
TEST_P(DrmHalTest, DoProvisioning) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
hidl_string certificateType;
|
|
|
|
hidl_string certificateType;
|
|
|
|
hidl_string certificateAuthority;
|
|
|
|
hidl_string certificateAuthority;
|
|
|
|
hidl_vec<uint8_t> provisionRequest;
|
|
|
|
hidl_vec<uint8_t> provisionRequest;
|
|
|
|
@@ -138,7 +133,6 @@ TEST_P(DrmHalTest, DoProvisioning) {
|
|
|
|
* A get key request should fail if no sessionId is provided
|
|
|
|
* A get key request should fail if no sessionId is provided
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, GetKeyRequestNoSession) {
|
|
|
|
TEST_P(DrmHalTest, GetKeyRequestNoSession) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
SessionId invalidSessionId;
|
|
|
|
SessionId invalidSessionId;
|
|
|
|
hidl_vec<uint8_t> initData;
|
|
|
|
hidl_vec<uint8_t> initData;
|
|
|
|
KeyedVector optionalParameters;
|
|
|
|
KeyedVector optionalParameters;
|
|
|
|
@@ -156,7 +150,6 @@ TEST_P(DrmHalTest, GetKeyRequestNoSession) {
|
|
|
|
* invalid mime type
|
|
|
|
* invalid mime type
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, GetKeyRequestBadMime) {
|
|
|
|
TEST_P(DrmHalTest, GetKeyRequestBadMime) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
auto sessionId = openSession();
|
|
|
|
auto sessionId = openSession();
|
|
|
|
hidl_vec<uint8_t> initData;
|
|
|
|
hidl_vec<uint8_t> initData;
|
|
|
|
KeyedVector optionalParameters;
|
|
|
|
KeyedVector optionalParameters;
|
|
|
|
@@ -193,7 +186,6 @@ void checkKeySetIdState(Status status, OfflineLicenseState state) {
|
|
|
|
* Test drm plugin offline key support
|
|
|
|
* Test drm plugin offline key support
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, OfflineLicenseTest) {
|
|
|
|
TEST_P(DrmHalTest, OfflineLicenseTest) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
auto sessionId = openSession();
|
|
|
|
auto sessionId = openSession();
|
|
|
|
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, KeyType::OFFLINE);
|
|
|
|
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, KeyType::OFFLINE);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -233,7 +225,6 @@ TEST_P(DrmHalTest, OfflineLicenseTest) {
|
|
|
|
* Test drm plugin offline key state
|
|
|
|
* Test drm plugin offline key state
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, OfflineLicenseStateTest) {
|
|
|
|
TEST_P(DrmHalTest, OfflineLicenseStateTest) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
auto sessionId = openSession();
|
|
|
|
auto sessionId = openSession();
|
|
|
|
DrmHalVTSVendorModule_V1::ContentConfiguration content = getContent(KeyType::OFFLINE);
|
|
|
|
DrmHalVTSVendorModule_V1::ContentConfiguration content = getContent(KeyType::OFFLINE);
|
|
|
|
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, content, KeyType::OFFLINE);
|
|
|
|
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, content, KeyType::OFFLINE);
|
|
|
|
@@ -258,7 +249,6 @@ TEST_P(DrmHalTest, OfflineLicenseStateTest) {
|
|
|
|
* Negative offline license test. Remove empty keySetId
|
|
|
|
* Negative offline license test. Remove empty keySetId
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, RemoveEmptyKeySetId) {
|
|
|
|
TEST_P(DrmHalTest, RemoveEmptyKeySetId) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
KeySetId emptyKeySetId;
|
|
|
|
KeySetId emptyKeySetId;
|
|
|
|
Status err = drmPlugin->removeOfflineLicense(emptyKeySetId);
|
|
|
|
Status err = drmPlugin->removeOfflineLicense(emptyKeySetId);
|
|
|
|
EXPECT_EQ(Status::BAD_VALUE, err);
|
|
|
|
EXPECT_EQ(Status::BAD_VALUE, err);
|
|
|
|
@@ -268,7 +258,6 @@ TEST_P(DrmHalTest, RemoveEmptyKeySetId) {
|
|
|
|
* Negative offline license test. Get empty keySetId state
|
|
|
|
* Negative offline license test. Get empty keySetId state
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, GetEmptyKeySetIdState) {
|
|
|
|
TEST_P(DrmHalTest, GetEmptyKeySetIdState) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
KeySetId emptyKeySetId;
|
|
|
|
KeySetId emptyKeySetId;
|
|
|
|
auto res = drmPlugin->getOfflineLicenseState(emptyKeySetId, checkKeySetIdState<Status::BAD_VALUE, OfflineLicenseState::UNKNOWN>);
|
|
|
|
auto res = drmPlugin->getOfflineLicenseState(emptyKeySetId, checkKeySetIdState<Status::BAD_VALUE, OfflineLicenseState::UNKNOWN>);
|
|
|
|
EXPECT_OK(res);
|
|
|
|
EXPECT_OK(res);
|
|
|
|
@@ -278,7 +267,6 @@ TEST_P(DrmHalTest, GetEmptyKeySetIdState) {
|
|
|
|
* Test that the plugin returns valid connected and max HDCP levels
|
|
|
|
* Test that the plugin returns valid connected and max HDCP levels
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, GetHdcpLevels) {
|
|
|
|
TEST_P(DrmHalTest, GetHdcpLevels) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
auto res = drmPlugin->getHdcpLevels_1_2(
|
|
|
|
auto res = drmPlugin->getHdcpLevels_1_2(
|
|
|
|
[&](StatusV1_2 status, const HdcpLevel &connectedLevel,
|
|
|
|
[&](StatusV1_2 status, const HdcpLevel &connectedLevel,
|
|
|
|
const HdcpLevel &maxLevel) {
|
|
|
|
const HdcpLevel &maxLevel) {
|
|
|
|
@@ -294,7 +282,6 @@ TEST_P(DrmHalTest, GetHdcpLevels) {
|
|
|
|
* the listener gets them.
|
|
|
|
* the listener gets them.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, ListenerKeysChange) {
|
|
|
|
TEST_P(DrmHalTest, ListenerKeysChange) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
sp<DrmHalPluginListener> listener = new DrmHalPluginListener();
|
|
|
|
sp<DrmHalPluginListener> listener = new DrmHalPluginListener();
|
|
|
|
auto res = drmPlugin->setListener(listener);
|
|
|
|
auto res = drmPlugin->setListener(listener);
|
|
|
|
EXPECT_OK(res);
|
|
|
|
EXPECT_OK(res);
|
|
|
|
@@ -326,7 +313,6 @@ TEST_P(DrmHalTest, ListenerKeysChange) {
|
|
|
|
* Positive decrypt test. "Decrypt" a single clear segment
|
|
|
|
* Positive decrypt test. "Decrypt" a single clear segment
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, ClearSegmentTest) {
|
|
|
|
TEST_P(DrmHalTest, ClearSegmentTest) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
for (const auto& config : contentConfigurations) {
|
|
|
|
for (const auto& config : contentConfigurations) {
|
|
|
|
for (const auto& key : config.keys) {
|
|
|
|
for (const auto& key : config.keys) {
|
|
|
|
const size_t kSegmentSize = 1024;
|
|
|
|
const size_t kSegmentSize = 1024;
|
|
|
|
@@ -354,7 +340,6 @@ TEST_P(DrmHalTest, ClearSegmentTest) {
|
|
|
|
* Verify data matches.
|
|
|
|
* Verify data matches.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, EncryptedAesCtrSegmentTest) {
|
|
|
|
TEST_P(DrmHalTest, EncryptedAesCtrSegmentTest) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
for (const auto& config : contentConfigurations) {
|
|
|
|
for (const auto& config : contentConfigurations) {
|
|
|
|
for (const auto& key : config.keys) {
|
|
|
|
for (const auto& key : config.keys) {
|
|
|
|
const size_t kSegmentSize = 1024;
|
|
|
|
const size_t kSegmentSize = 1024;
|
|
|
|
@@ -381,7 +366,6 @@ TEST_P(DrmHalTest, EncryptedAesCtrSegmentTest) {
|
|
|
|
* Negative decrypt test. Decrypted frame too large to fit in output buffer
|
|
|
|
* Negative decrypt test. Decrypted frame too large to fit in output buffer
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, ErrorFrameTooLarge) {
|
|
|
|
TEST_P(DrmHalTest, ErrorFrameTooLarge) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
for (const auto& config : contentConfigurations) {
|
|
|
|
for (const auto& config : contentConfigurations) {
|
|
|
|
for (const auto& key : config.keys) {
|
|
|
|
for (const auto& key : config.keys) {
|
|
|
|
const size_t kSegmentSize = 1024;
|
|
|
|
const size_t kSegmentSize = 1024;
|
|
|
|
@@ -407,7 +391,6 @@ TEST_P(DrmHalTest, ErrorFrameTooLarge) {
|
|
|
|
* Negative decrypt test. Decrypt without loading keys.
|
|
|
|
* Negative decrypt test. Decrypt without loading keys.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalTest, EncryptedAesCtrSegmentTestNoKeys) {
|
|
|
|
TEST_P(DrmHalTest, EncryptedAesCtrSegmentTestNoKeys) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
for (const auto& config : contentConfigurations) {
|
|
|
|
for (const auto& config : contentConfigurations) {
|
|
|
|
for (const auto& key : config.keys) {
|
|
|
|
for (const auto& key : config.keys) {
|
|
|
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
|
|
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
|
|
|
@@ -433,7 +416,6 @@ TEST_P(DrmHalTest, EncryptedAesCtrSegmentTestNoKeys) {
|
|
|
|
* Ensure clearkey drm factory doesn't support security level higher than supported
|
|
|
|
* Ensure clearkey drm factory doesn't support security level higher than supported
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalClearkeyTest, BadLevelNotSupported) {
|
|
|
|
TEST_P(DrmHalClearkeyTest, BadLevelNotSupported) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
const SecurityLevel kHwSecureAll = SecurityLevel::HW_SECURE_ALL;
|
|
|
|
const SecurityLevel kHwSecureAll = SecurityLevel::HW_SECURE_ALL;
|
|
|
|
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kVideoMp4, kHwSecureAll));
|
|
|
|
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kVideoMp4, kHwSecureAll));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -442,7 +424,6 @@ TEST_P(DrmHalClearkeyTest, BadLevelNotSupported) {
|
|
|
|
* Test resource contention during attempt to generate key request
|
|
|
|
* Test resource contention during attempt to generate key request
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalClearkeyTest, GetKeyRequestResourceContention) {
|
|
|
|
TEST_P(DrmHalClearkeyTest, GetKeyRequestResourceContention) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
Status status = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorResourceContention);
|
|
|
|
Status status = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorResourceContention);
|
|
|
|
EXPECT_EQ(Status::OK, status);
|
|
|
|
EXPECT_EQ(Status::OK, status);
|
|
|
|
auto sessionId = openSession();
|
|
|
|
auto sessionId = openSession();
|
|
|
|
@@ -464,7 +445,6 @@ TEST_P(DrmHalClearkeyTest, GetKeyRequestResourceContention) {
|
|
|
|
* Test clearkey plugin offline key with mock error
|
|
|
|
* Test clearkey plugin offline key with mock error
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalClearkeyTest, OfflineLicenseInvalidState) {
|
|
|
|
TEST_P(DrmHalClearkeyTest, OfflineLicenseInvalidState) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
auto sessionId = openSession();
|
|
|
|
auto sessionId = openSession();
|
|
|
|
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, KeyType::OFFLINE);
|
|
|
|
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, KeyType::OFFLINE);
|
|
|
|
Status status = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorInvalidState);
|
|
|
|
Status status = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorInvalidState);
|
|
|
|
@@ -486,7 +466,6 @@ TEST_P(DrmHalClearkeyTest, OfflineLicenseInvalidState) {
|
|
|
|
* Test SessionLostState is triggered on error
|
|
|
|
* Test SessionLostState is triggered on error
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalClearkeyTest, SessionLostState) {
|
|
|
|
TEST_P(DrmHalClearkeyTest, SessionLostState) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
sp<DrmHalPluginListener> listener = new DrmHalPluginListener();
|
|
|
|
sp<DrmHalPluginListener> listener = new DrmHalPluginListener();
|
|
|
|
auto res = drmPlugin->setListener(listener);
|
|
|
|
auto res = drmPlugin->setListener(listener);
|
|
|
|
EXPECT_OK(res);
|
|
|
|
EXPECT_OK(res);
|
|
|
|
@@ -507,7 +486,6 @@ TEST_P(DrmHalClearkeyTest, SessionLostState) {
|
|
|
|
* Negative decrypt test. Decrypt with invalid key.
|
|
|
|
* Negative decrypt test. Decrypt with invalid key.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalClearkeyTest, DecryptWithEmptyKey) {
|
|
|
|
TEST_P(DrmHalClearkeyTest, DecryptWithEmptyKey) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
|
|
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
|
|
|
const Pattern noPattern = {0, 0};
|
|
|
|
const Pattern noPattern = {0, 0};
|
|
|
|
const uint32_t kClearBytes = 512;
|
|
|
|
const uint32_t kClearBytes = 512;
|
|
|
|
@@ -545,7 +523,6 @@ TEST_P(DrmHalClearkeyTest, DecryptWithEmptyKey) {
|
|
|
|
* Negative decrypt test. Decrypt with a key exceeds AES_BLOCK_SIZE.
|
|
|
|
* Negative decrypt test. Decrypt with a key exceeds AES_BLOCK_SIZE.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TEST_P(DrmHalClearkeyTest, DecryptWithKeyTooLong) {
|
|
|
|
TEST_P(DrmHalClearkeyTest, DecryptWithKeyTooLong) {
|
|
|
|
RETURN_IF_SKIPPED;
|
|
|
|
|
|
|
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
|
|
|
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
|
|
|
const Pattern noPattern = {0, 0};
|
|
|
|
const Pattern noPattern = {0, 0};
|
|
|
|
const uint32_t kClearBytes = 512;
|
|
|
|
const uint32_t kClearBytes = 512;
|
|
|
|
|