Merge "Restrict CAS unit tests to devices that support CAS" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-05-09 09:34:55 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 0 deletions

View File

@@ -63,6 +63,10 @@ void DeviceFeatures::Initialize() {
OEMCrypto_Generic_Encrypt(session, buffer, 0, iv,
OEMCrypto_AES_CBC_128_NO_PADDING, buffer));
printf("generic_crypto = %s.\n", generic_crypto ? "true" : "false");
supports_cas =
(OEMCrypto_ERROR_NOT_IMPLEMENTED !=
OEMCrypto_LoadCasECMKeys(session, nullptr, 0, nullptr, nullptr));
printf("supports_cas = %s.\n", supports_cas ? "true" : "false");
OEMCrypto_CloseSession(session);
api_version = OEMCrypto_APIVersion();
printf("api_version = %u.\n", api_version);
@@ -137,6 +141,7 @@ std::string DeviceFeatures::RestrictFilter(const std::string& initial_filter) {
FilterOut(&filter, "OEMCryptoLoadsCert*");
if (!generic_crypto) FilterOut(&filter, "*GenericCrypto*");
if (!cast_receiver) FilterOut(&filter, "*CastReceiver*");
if (!supports_cas) FilterOut(&filter, "*CasOnly*");
if (derive_key_method == NO_METHOD) FilterOut(&filter, "*SessionTest*");
if (provisioning_method
!= OEMCrypto_OEMCertificate) FilterOut(&filter, "*Prov30*");

View File

@@ -51,6 +51,7 @@ class DeviceFeatures {
uint32_t resource_rating; // Device's resource rating tier.
bool supports_crc; // Supported decrypt hash type CRC.
bool test_secure_buffers; // If we can create a secure buffer for testing.
bool supports_cas; // Device supports CAS (Condition Access System).
uint32_t api_version;
OEMCrypto_ProvisioningMethod provisioning_method;