Source release 18.5.0
This commit is contained in:
@@ -37,9 +37,19 @@ class WvGenericCryptoTest : public WvCdmTestBaseWithEngine {
|
||||
|
||||
void SetUp() override {
|
||||
WvCdmTestBase::SetUp();
|
||||
if (!wvoec::global_features.generic_crypto) {
|
||||
GTEST_SKIP() << "Test for devices with generic crypto API only";
|
||||
}
|
||||
// TODO: b/305093063 - Remove when Drm Reprovisioning server is implemented.
|
||||
if (wvoec::global_features.provisioning_method ==
|
||||
OEMCrypto_DrmReprovisioning) {
|
||||
GTEST_SKIP()
|
||||
<< "Skipping until Drm Reprovisioning server support is implemented.";
|
||||
}
|
||||
EnsureProvisioned();
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.OpenSession());
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.FetchLicense());
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
|
||||
ency_id_ = "encrypt-key-----";
|
||||
ency_key_ = a2b_hex("0102030405060708090a0b0c0d0e0f10");
|
||||
@@ -64,7 +74,11 @@ class WvGenericCryptoTest : public WvCdmTestBaseWithEngine {
|
||||
iv_ = std::string(iv_vector_.begin(), iv_vector_.end());
|
||||
}
|
||||
|
||||
void TearDown() override { holder_.CloseSession(); }
|
||||
void TearDown() override {
|
||||
// TODO: b/305093063 - Remove when Drm Reprovisioning server is implemented.
|
||||
if (IsSkipped()) return;
|
||||
holder_.CloseSession();
|
||||
}
|
||||
|
||||
protected:
|
||||
LicenseHolder holder_;
|
||||
@@ -89,12 +103,7 @@ class WvGenericCryptoTest : public WvCdmTestBaseWithEngine {
|
||||
std::string iv_;
|
||||
};
|
||||
|
||||
TEST_F(WvGenericCryptoTest, LoadSpecialKeys) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericEncryptGood) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
std::string encrypted = Aes128CbcEncrypt(ency_key_, in_vector_, iv_vector_);
|
||||
std::string out_buffer;
|
||||
EXPECT_EQ(NO_ERROR, cdm_engine_.GenericEncrypt(
|
||||
@@ -104,7 +113,6 @@ TEST_F(WvGenericCryptoTest, GenericEncryptGood) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericEncryptNoKey) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
std::string encrypted = Aes128CbcEncrypt(ency_key_, in_vector_, iv_vector_);
|
||||
std::string out_buffer;
|
||||
KeyId key_id("no_key");
|
||||
@@ -115,7 +123,6 @@ TEST_F(WvGenericCryptoTest, GenericEncryptNoKey) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericEncryptKeyNotAllowed) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
// Trying to use Decrypt key to encrypt, which is not allowed.
|
||||
KeyId key_id = dency_id_;
|
||||
std::string encrypted = Aes128CbcEncrypt(dency_key_, in_vector_, iv_vector_);
|
||||
@@ -128,7 +135,6 @@ TEST_F(WvGenericCryptoTest, GenericEncryptKeyNotAllowed) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericDecryptGood) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
std::string decrypted = Aes128CbcDecrypt(dency_key_, in_vector_, iv_vector_);
|
||||
std::string out_buffer;
|
||||
EXPECT_EQ(NO_ERROR, cdm_engine_.GenericDecrypt(
|
||||
@@ -138,7 +144,6 @@ TEST_F(WvGenericCryptoTest, GenericDecryptGood) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericDecryptNoKey) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
std::string decrypted = Aes128CbcDecrypt(dency_key_, in_vector_, iv_vector_);
|
||||
std::string out_buffer;
|
||||
KeyId key_id = "no_key";
|
||||
@@ -149,7 +154,6 @@ TEST_F(WvGenericCryptoTest, GenericDecryptNoKey) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericDecryptKeyNotAllowed) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
// Trying to use Encrypt key to decrypt, which is not allowed.
|
||||
KeyId key_id = ency_id_;
|
||||
std::string decrypted = Aes128CbcDecrypt(ency_key_, in_vector_, iv_vector_);
|
||||
@@ -162,7 +166,6 @@ TEST_F(WvGenericCryptoTest, GenericDecryptKeyNotAllowed) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericSignGood) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
std::string out_buffer;
|
||||
std::string signature = SignHMAC(in_buffer_, siggy_key_);
|
||||
EXPECT_EQ(NO_ERROR, cdm_engine_.GenericSign(
|
||||
@@ -172,7 +175,6 @@ TEST_F(WvGenericCryptoTest, GenericSignGood) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericSignKeyNotAllowed) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
// Wrong key
|
||||
std::string key_id = vou_id_;
|
||||
std::string out_buffer;
|
||||
@@ -185,7 +187,6 @@ TEST_F(WvGenericCryptoTest, GenericSignKeyNotAllowed) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericVerifyGood) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
std::string signature = SignHMAC(in_buffer_, vou_key_);
|
||||
EXPECT_EQ(NO_ERROR, cdm_engine_.GenericVerify(
|
||||
holder_.session_id(), in_buffer_, vou_id_,
|
||||
@@ -193,7 +194,6 @@ TEST_F(WvGenericCryptoTest, GenericVerifyGood) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericVerifyKeyNotAllowed) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
// Wrong key
|
||||
std::string key_id = siggy_id_;
|
||||
std::string signature = SignHMAC(in_buffer_, siggy_key_);
|
||||
@@ -203,7 +203,6 @@ TEST_F(WvGenericCryptoTest, GenericVerifyKeyNotAllowed) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericVerifyBadSignature) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
std::string signature(MAC_KEY_SIZE, 's');
|
||||
// OEMCrypto error is OEMCrypto_ERROR_SIGNATURE_FAILURE
|
||||
EXPECT_EQ(UNKNOWN_ERROR, cdm_engine_.GenericVerify(
|
||||
@@ -212,7 +211,6 @@ TEST_F(WvGenericCryptoTest, GenericVerifyBadSignature) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericEncryptDecrypt) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
std::string encrypted = Aes128CbcEncrypt(both_key_, in_vector_, iv_vector_);
|
||||
std::string out_buffer;
|
||||
EXPECT_EQ(NO_ERROR, cdm_engine_.GenericEncrypt(
|
||||
@@ -228,8 +226,6 @@ TEST_F(WvGenericCryptoTest, GenericEncryptDecrypt) {
|
||||
}
|
||||
|
||||
TEST_F(WvGenericCryptoTest, GenericSignVerify) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder_.LoadLicense());
|
||||
|
||||
std::string out_buffer;
|
||||
std::string signature = SignHMAC(in_buffer_, sign_and_verify_key_);
|
||||
EXPECT_EQ(NO_ERROR, cdm_engine_.GenericSign(
|
||||
|
||||
Reference in New Issue
Block a user