Report OEMCrypto's ECC capabilities.
[ Merge of http://go/wvgerrit/110824 ]
When generating a provisioning request, the CDM includes the different
certificate key types that are supported.
This change will enable the reporting of ECC certificate types if
OEMCrypto supports them.
Test: Linux unit tests and Android integration test
Bug: 140813486
Change-Id: I713ff1c469dff5c8a41461727ce63486d962575e
(cherry picked from commit 547d2f8775)
Merged-In: I713ff1c469dff5c8a41461727ce63486d962575e
This commit is contained in:
@@ -116,7 +116,10 @@ const std::string kLicenseRequestSignature = a2bs_hex(
|
||||
const std::string kFakeCoreMessage = a2bs_hex("DEADBEEF");
|
||||
|
||||
const CryptoSession::SupportedCertificateTypes kDefaultSupportedCertTypes = {
|
||||
true, true, true};
|
||||
/* RSA 2048 */ true, /* RSA 3072 */ true,
|
||||
/* RSA CAST */ false,
|
||||
/* ECC 256 */ true, /* ECC 384 */ true,
|
||||
/* ECC 521 */ true};
|
||||
|
||||
const std::string kFakeEntitlementKeyId =
|
||||
a2bs_hex("2a538231c616c67143032a645f9c545d");
|
||||
@@ -171,6 +174,8 @@ class MockInitializationData : public InitializationData {
|
||||
} // namespace
|
||||
|
||||
// Protobuf generated classes
|
||||
using ClientCapabilities =
|
||||
video_widevine::ClientIdentification::ClientCapabilities;
|
||||
using video_widevine::ClientIdentification;
|
||||
using video_widevine::License;
|
||||
using video_widevine::License_KeyContainer;
|
||||
@@ -304,7 +309,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
bool usage_information_support = true;
|
||||
CryptoSession::HdcpCapability current_hdcp_version = HDCP_NO_DIGITAL_OUTPUT;
|
||||
CryptoSession::HdcpCapability max_hdcp_version = HDCP_V2_1;
|
||||
uint32_t crypto_session_api_version = 9;
|
||||
const uint32_t crypto_session_api_version = 16;
|
||||
|
||||
EXPECT_CALL(*crypto_session_, IsOpen()).WillOnce(Return(true));
|
||||
EXPECT_CALL(*crypto_session_, request_id())
|
||||
@@ -315,10 +320,10 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
EXPECT_CALL(*crypto_session_, GetHdcpCapabilities(NotNull(), NotNull()))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(current_hdcp_version),
|
||||
SetArgPointee<1>(max_hdcp_version), Return(NO_ERROR)));
|
||||
// Supported certificates set by SetUp().
|
||||
EXPECT_CALL(*crypto_session_, GetSupportedCertificateTypes(NotNull()));
|
||||
EXPECT_CALL(*crypto_session_, GetApiVersion(NotNull()))
|
||||
.Times(2)
|
||||
.WillRepeatedly(
|
||||
.WillOnce(
|
||||
DoAll(SetArgPointee<0>(crypto_session_api_version), Return(true)));
|
||||
EXPECT_CALL(*clock_, GetCurrentTime()).WillOnce(Return(kLicenseStartTime));
|
||||
EXPECT_CALL(*crypto_session_, GenerateNonce(NotNull()))
|
||||
@@ -379,24 +384,22 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
EXPECT_FALSE(client_id.has_provider_client_token());
|
||||
EXPECT_FALSE(client_id.has_license_counter());
|
||||
|
||||
const ::video_widevine::ClientIdentification_ClientCapabilities&
|
||||
client_capabilities = client_id.client_capabilities();
|
||||
const ClientCapabilities& client_capabilities =
|
||||
client_id.client_capabilities();
|
||||
EXPECT_TRUE(client_capabilities.has_client_token());
|
||||
EXPECT_TRUE(client_capabilities.has_session_token());
|
||||
EXPECT_FALSE(client_capabilities.video_resolution_constraints());
|
||||
EXPECT_EQ(video_widevine::
|
||||
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_V2_1,
|
||||
EXPECT_EQ(ClientCapabilities::HDCP_V2_1,
|
||||
client_capabilities.max_hdcp_version());
|
||||
EXPECT_EQ(crypto_session_api_version,
|
||||
client_capabilities.oem_crypto_api_version());
|
||||
|
||||
EXPECT_THAT(
|
||||
client_capabilities.supported_certificate_key_type(),
|
||||
UnorderedElementsAre(
|
||||
video_widevine::
|
||||
ClientIdentification_ClientCapabilities_CertificateKeyType_RSA_2048,
|
||||
video_widevine::
|
||||
ClientIdentification_ClientCapabilities_CertificateKeyType_RSA_3072));
|
||||
EXPECT_THAT(client_capabilities.supported_certificate_key_type(),
|
||||
UnorderedElementsAre(ClientCapabilities::RSA_2048,
|
||||
ClientCapabilities::RSA_3072,
|
||||
ClientCapabilities::ECC_SECP256R1,
|
||||
ClientCapabilities::ECC_SECP384R1,
|
||||
ClientCapabilities::ECC_SECP521R1));
|
||||
EXPECT_FALSE(client_capabilities.has_resource_rating_tier());
|
||||
|
||||
// Verify Content Identification
|
||||
@@ -425,11 +428,12 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
}
|
||||
|
||||
TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
|
||||
bool usage_information_support = true;
|
||||
CryptoSession::HdcpCapability current_hdcp_version = HDCP_NO_DIGITAL_OUTPUT;
|
||||
CryptoSession::HdcpCapability max_hdcp_version = HDCP_V2_1;
|
||||
uint32_t crypto_session_api_version = 15;
|
||||
uint32_t resource_rating_tier = RESOURCE_RATING_TIER_LOW;
|
||||
const bool usage_information_support = true;
|
||||
const CryptoSession::HdcpCapability current_hdcp_version =
|
||||
HDCP_NO_DIGITAL_OUTPUT;
|
||||
const CryptoSession::HdcpCapability max_hdcp_version = HDCP_V2_1;
|
||||
const uint32_t crypto_session_api_version = 15;
|
||||
const uint32_t resource_rating_tier = RESOURCE_RATING_TIER_LOW;
|
||||
|
||||
EXPECT_CALL(*crypto_session_, IsOpen()).WillOnce(Return(true));
|
||||
EXPECT_CALL(*crypto_session_, request_id())
|
||||
@@ -442,8 +446,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
|
||||
SetArgPointee<1>(max_hdcp_version), Return(NO_ERROR)));
|
||||
EXPECT_CALL(*crypto_session_, GetSupportedCertificateTypes(NotNull()));
|
||||
EXPECT_CALL(*crypto_session_, GetApiVersion(NotNull()))
|
||||
.Times(2)
|
||||
.WillRepeatedly(
|
||||
.WillOnce(
|
||||
DoAll(SetArgPointee<0>(crypto_session_api_version), Return(true)));
|
||||
EXPECT_CALL(*crypto_session_, GetResourceRatingTier(NotNull()))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(resource_rating_tier), Return(true)));
|
||||
@@ -506,24 +509,22 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
|
||||
EXPECT_FALSE(client_id.has_provider_client_token());
|
||||
EXPECT_FALSE(client_id.has_license_counter());
|
||||
|
||||
const ::video_widevine::ClientIdentification_ClientCapabilities&
|
||||
client_capabilities = client_id.client_capabilities();
|
||||
const ClientCapabilities& client_capabilities =
|
||||
client_id.client_capabilities();
|
||||
EXPECT_TRUE(client_capabilities.has_client_token());
|
||||
EXPECT_TRUE(client_capabilities.has_session_token());
|
||||
EXPECT_FALSE(client_capabilities.video_resolution_constraints());
|
||||
EXPECT_EQ(video_widevine::
|
||||
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_V2_1,
|
||||
EXPECT_EQ(ClientCapabilities::HDCP_V2_1,
|
||||
client_capabilities.max_hdcp_version());
|
||||
EXPECT_EQ(crypto_session_api_version,
|
||||
client_capabilities.oem_crypto_api_version());
|
||||
|
||||
EXPECT_THAT(
|
||||
client_capabilities.supported_certificate_key_type(),
|
||||
UnorderedElementsAre(
|
||||
video_widevine::
|
||||
ClientIdentification_ClientCapabilities_CertificateKeyType_RSA_2048,
|
||||
video_widevine::
|
||||
ClientIdentification_ClientCapabilities_CertificateKeyType_RSA_3072));
|
||||
EXPECT_THAT(client_capabilities.supported_certificate_key_type(),
|
||||
UnorderedElementsAre(ClientCapabilities::RSA_2048,
|
||||
ClientCapabilities::RSA_3072,
|
||||
ClientCapabilities::ECC_SECP256R1,
|
||||
ClientCapabilities::ECC_SECP384R1,
|
||||
ClientCapabilities::ECC_SECP521R1));
|
||||
EXPECT_EQ(resource_rating_tier, client_capabilities.resource_rating_tier());
|
||||
|
||||
// Verify Content Identification
|
||||
|
||||
Reference in New Issue
Block a user