Expect Provisioning ID length of upto 64 bytes

[ Merge of http://go/wvgerrit/95508 ]

The provisioning ID length will be 32 bytes when the device supports a
keybox or OEM certificates and does not implement |OEMCrypto_GetDeviceId|.
If a device supports OEM Certificates and implements |OEMCrypto_GetDeviceId|
it may be an arbitrary length upto 64 bytes.

Bug: 150393659
Test: WV unit/integration tests
Change-Id: I5e4dbc8f2f9ca326425d0313f4823b72bd6ac7c0
This commit is contained in:
Rahul Frias
2020-03-10 18:20:53 -07:00
parent b8570949e4
commit a42273e67f
2 changed files with 19 additions and 4 deletions

View File

@@ -89,7 +89,20 @@ class CryptoSession {
virtual bool GetApiMinorVersion(SecurityLevel requested_level,
uint32_t* minor_version);
// This method will return, for devices with a
// * keybox: the 32 byte device ID from the keybox.
// * OEM certificate:
// - that implements |OEMCrypto_GetDeviceID|: the (1 to 64 byte) device ID.
// - that does not implement |OEMCrypto_GetDeviceID|: the OEM public
// certificate.
virtual CdmResponseType GetInternalDeviceUniqueId(std::string* device_id);
// This method will return, for devices with a
// * keybox: the 32 byte device ID from the keybox.
// * OEM certificate:
// - that implements |OEMCrypto_GetDeviceID|: the (1 to 64 byte) device ID.
// - that does not implement |OEMCrypto_GetDeviceID|: the 32 byte hash
// of the OEM public certificate.
virtual CdmResponseType GetExternalDeviceUniqueId(std::string* device_id);
virtual bool GetSystemId(uint32_t* system_id);
virtual CdmResponseType GetProvisioningId(std::string* provisioning_id);

View File

@@ -4795,6 +4795,7 @@ TEST_F(WvCdmRequestLicenseTest, QueryStatus) {
decryptor_->QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_DEVICE_ID,
&value));
EXPECT_LT(0u, value.size());
EXPECT_LE(value.size(), 64u) << "device id size: " << value.size();
EXPECT_EQ(wvcdm::NO_ERROR,
decryptor_->QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_SYSTEM_ID,
@@ -4808,8 +4809,8 @@ TEST_F(WvCdmRequestLicenseTest, QueryStatus) {
EXPECT_EQ(wvcdm::NO_ERROR,
decryptor_->QueryStatus(kLevelDefault,
wvcdm::QUERY_KEY_PROVISIONING_ID, &value));
EXPECT_TRUE(16u == value.size() || 32u == value.size())
<< "provisioning id size: " << value.size();
EXPECT_LT(0u, value.size());
EXPECT_LE(value.size(), 64u) << "provisioning id size: " << value.size();
EXPECT_EQ(wvcdm::NO_ERROR,
decryptor_->QueryStatus(
@@ -4942,6 +4943,7 @@ TEST_F(WvCdmRequestLicenseTest, QueryStatusL3) {
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->QueryStatus(
kLevel3, wvcdm::QUERY_KEY_DEVICE_ID, &value));
EXPECT_LT(0u, value.size());
EXPECT_LE(value.size(), 64u) << "device id size: " << value.size();
EXPECT_EQ(wvcdm::NO_ERROR,
decryptor_->QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_SYSTEM_ID,
@@ -4972,8 +4974,8 @@ TEST_F(WvCdmRequestLicenseTest, QueryStatusL3) {
EXPECT_EQ(wvcdm::NO_ERROR,
decryptor_->QueryStatus(kLevel3, wvcdm::QUERY_KEY_PROVISIONING_ID,
&value));
EXPECT_TRUE(16u == value.size() || 32u == value.size())
<< "provisioning id size: " << value.size();
EXPECT_LT(0u, value.size());
EXPECT_LE(value.size(), 64u) << "provisioning id size: " << value.size();
EXPECT_EQ(wvcdm::NO_ERROR,
decryptor_->QueryStatus(