Pick widevine oemcrypto-v18 change

No-Typo-Check: From a third party header file
Bug: 260918793
Test: unit tests
Test: atp v2/widevine-eng/drm_compliance
Change-Id: I36effd6a10a99bdb2399ab1f4a0fad026d607c70
This commit is contained in:
Kyle Zhang
2022-12-16 03:21:08 +00:00
parent 4586522c07
commit 11255b7426
105 changed files with 324641 additions and 299787 deletions

View File

@@ -89,6 +89,8 @@ const int kKeyRequestTypeFieldNumber =
::drm_metrics::Attributes::kKeyRequestTypeFieldNumber;
const int kLicenseTypeFieldNumber =
::drm_metrics::Attributes::kLicenseTypeFieldNumber;
const int kOemCryptoSignatureHashAlgorithmFieldNumber =
::drm_metrics::Attributes::kOemCryptoSignatureHashAlgorithmFieldNumber;
} // namespace
// The maximum number of completed sessions that can be stored. More than this
@@ -252,8 +254,6 @@ class CryptoMetrics {
EventMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>
oemcrypto_rewrap_device_rsa_key_30_;
ValueMetric<uint16_t> oemcrypto_security_patch_level_;
EventMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>
oemcrypto_select_key_;
ValueMetric<CdmUsageSupportType> oemcrypto_usage_table_support_;
CounterMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>
oemcrypto_update_usage_table_;
@@ -299,6 +299,12 @@ class CryptoMetrics {
oemcrypto_install_oem_private_key_;
ValueMetric<int> oemcrypto_watermarking_support_;
ValueMetric<int> oemcrypto_production_readiness_;
EventMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>
oemcrypto_get_key_handle_;
CounterMetric<kOemCryptoResultFieldNumber, OEMCryptoResult,
kOemCryptoSignatureHashAlgorithmFieldNumber,
OEMCrypto_SignatureHashAlgorithm>
oemcrypto_get_signature_hash_algorithm_;
}; // class CryptoMetrics
// This class contains session-scoped metrics. All properties and

View File

@@ -105,6 +105,15 @@ void SetAttributeField<drm_metrics::Attributes::kErrorDetailFieldNumber,
attributes->set_error_detail(error_detail);
}
template <>
void SetAttributeField<
drm_metrics::Attributes::kOemCryptoSignatureHashAlgorithmFieldNumber,
OEMCrypto_SignatureHashAlgorithm>(
const OEMCrypto_SignatureHashAlgorithm& algorithm,
drm_metrics::Attributes* attributes) {
attributes->set_oem_crypto_signature_hash_algorithm(algorithm);
}
template <>
void SetAttributeField<0, util::Unused>(const util::Unused&,
drm_metrics::Attributes*) {

View File

@@ -161,8 +161,6 @@ void CryptoMetrics::Serialize(
crypto_metrics->mutable_oemcrypto_rewrap_device_rsa_key_30_time_us());
crypto_metrics->set_allocated_oemcrypto_security_patch_level(
oemcrypto_security_patch_level_.ToProto());
oemcrypto_select_key_.ToProto(
crypto_metrics->mutable_oemcrypto_select_key_time_us());
crypto_metrics->set_allocated_oemcrypto_usage_table_support(
oemcrypto_usage_table_support_.ToProto());
oemcrypto_update_usage_table_.ToProto(
@@ -213,6 +211,10 @@ void CryptoMetrics::Serialize(
oemcrypto_watermarking_support_.ToProto());
crypto_metrics->set_allocated_oemcrypto_production_readiness(
oemcrypto_production_readiness_.ToProto());
oemcrypto_get_key_handle_.ToProto(
crypto_metrics->mutable_oemcrypto_get_key_handle_time_us());
oemcrypto_get_signature_hash_algorithm_.ToProto(
crypto_metrics->mutable_oemcrypto_get_signature_hash_algorithm());
}
SessionMetrics::SessionMetrics() : session_id_(""), completed_(false) {}

View File

@@ -49,6 +49,9 @@ message Attributes {
optional uint32 license_type = 17;
// Error detail supplemental to the error_code field.
optional int32 error_detail = 18;
// The type of hashing algorithm used in signing with a private key. See
// OEMCrypto_SignatureHashAlgorithm in OEMCryptoCENC.h.
optional uint32 oem_crypto_signature_hash_algorithm = 19;
}
// The Counter message is used to store a count value with an associated
@@ -194,6 +197,8 @@ message WvCdmMetrics {
optional ValueMetric oemcrypto_maximum_usage_table_header_size = 84;
optional ValueMetric oemcrypto_watermarking_support = 85;
optional ValueMetric oemcrypto_production_readiness = 86;
repeated DistributionMetric oemcrypto_get_key_handle_time_us = 87;
repeated CounterMetric oemcrypto_get_signature_hash_algorithm = 88;
}
// This contains metrics that were captured within a CdmSession. This contains

View File

@@ -395,13 +395,16 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
kLevelDefault);
crypto_metrics.oemcrypto_security_patch_level_.Record(1.0, 123,
kLevelDefault);
crypto_metrics.oemcrypto_select_key_.Record(1.0, OEMCrypto_ERROR_INIT_FAILED);
crypto_metrics.oemcrypto_supports_usage_table_.Record(
1.0, OEMCrypto_ERROR_INIT_FAILED, kLevelDefault);
crypto_metrics.oemcrypto_update_usage_table_.Record(
1.0, OEMCrypto_ERROR_INIT_FAILED);
crypto_metrics.oemcrypto_wrap_keybox_.Record(1.0,
OEMCrypto_ERROR_INIT_FAILED);
crypto_metrics.oemcrypto_get_key_handle_.Record(1.0,
OEMCrypto_ERROR_INIT_FAILED);
crypto_metrics.oemcrypto_get_signature_hash_algorithm_.Increment(
OEMCrypto_ERROR_INIT_FAILED, OEMCrypto_SHA1);
// Internal OEMCrypto Metrics
crypto_metrics.oemcrypto_initialization_mode_.Record(

View File

@@ -449,7 +449,6 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
crypto_metrics.oemcrypto_rewrap_device_rsa_key_30_.Record(
1.0, OEMCrypto_ERROR_INIT_FAILED);
crypto_metrics.oemcrypto_security_patch_level_.Record(123);
crypto_metrics.oemcrypto_select_key_.Record(1.0, OEMCrypto_ERROR_INIT_FAILED);
crypto_metrics.oemcrypto_update_usage_table_.Increment(
OEMCrypto_ERROR_INIT_FAILED);
crypto_metrics.oemcrypto_create_usage_table_header_.Increment(
@@ -476,6 +475,10 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
crypto_metrics.oemcrypto_watermarking_support_.Record(
OEMCrypto_WatermarkingAlwaysOn);
crypto_metrics.oemcrypto_production_readiness_.Record(OEMCrypto_SUCCESS);
crypto_metrics.oemcrypto_get_key_handle_.Record(1.0,
OEMCrypto_ERROR_INIT_FAILED);
crypto_metrics.oemcrypto_get_signature_hash_algorithm_.Increment(
OEMCrypto_ERROR_INIT_FAILED, OEMCrypto_SHA1);
WvCdmMetrics::CryptoMetrics actual;
crypto_metrics.Serialize(&actual);
@@ -551,7 +554,7 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
EXPECT_GT(actual.oemcrypto_rewrap_device_rsa_key_time_us_size(), 0);
EXPECT_GT(actual.oemcrypto_rewrap_device_rsa_key_30_time_us_size(), 0);
EXPECT_EQ(123, actual.oemcrypto_security_patch_level().int_value());
EXPECT_GT(actual.oemcrypto_select_key_time_us_size(), 0);
EXPECT_GT(actual.oemcrypto_get_key_handle_time_us_size(), 0);
EXPECT_GT(actual.oemcrypto_update_usage_table_size(), 0);
EXPECT_GT(actual.oemcrypto_create_usage_table_header_size(), 0);
EXPECT_GT(actual.oemcrypto_load_usage_table_header_size(), 0);
@@ -571,6 +574,7 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
actual.oemcrypto_watermarking_support().int_value());
EXPECT_EQ(static_cast<int>(OEMCrypto_SUCCESS),
actual.oemcrypto_production_readiness().int_value());
EXPECT_GT(actual.oemcrypto_get_signature_hash_algorithm_size(), 0);
}
} // namespace metrics
} // namespace wvcdm