Merge "Pack structure OEMCrypto_PST_Report" into lmp-preview-dev

This commit is contained in:
Jeff Tinker
2014-05-31 00:13:03 +00:00
committed by Android (Google) Code Review
5 changed files with 27 additions and 3 deletions

View File

@@ -208,12 +208,13 @@ typedef enum OEMCrypto_Usage_Entry_Status {
*/
typedef struct {
uint8_t signature[20]; // -- HMAC SHA1 of the rest of the report.
int64_t seconds_since_license_received; // now - time_of_license_received
int64_t seconds_since_first_decrypt; // now - time_of_first_decrypt
int64_t seconds_since_last_decrypt; // now - time_of_last_decrypt
uint8_t status; // current status of entry. (OEMCrypto_Usage_Entry_Status)
uint8_t clock_security_level;
uint8_t pst_length;
uint8_t padding; // make int64's word aligned.
int64_t seconds_since_license_received; // now - time_of_license_received
int64_t seconds_since_first_decrypt; // now - time_of_first_decrypt
int64_t seconds_since_last_decrypt; // now - time_of_last_decrypt
uint8_t pst[];
} __attribute__((packed)) OEMCrypto_PST_Report;

View File

@@ -4447,6 +4447,29 @@ TEST_F(OEMCryptoClientTest, SupportsUsageTable) {
}
}
TEST_F(OEMCryptoClientTest, PSTReportSizes) {
if (OEMCrypto_SupportsUsageTable()) {
OEMCrypto_PST_Report report;
uint8_t* location = reinterpret_cast<uint8_t*>(&report);
EXPECT_EQ(48, sizeof(report));
uint8_t *field;
field = reinterpret_cast<uint8_t *>(&report.status);
EXPECT_EQ(20, field - location);
field = reinterpret_cast<uint8_t *>(&report.clock_security_level);
EXPECT_EQ(21, field - location);
field = reinterpret_cast<uint8_t *>(&report.pst_length);
EXPECT_EQ(22, field - location);
field = reinterpret_cast<uint8_t *>(&report.seconds_since_license_received);
EXPECT_EQ(24, field - location);
field = reinterpret_cast<uint8_t *>(&report.seconds_since_first_decrypt);
EXPECT_EQ(32, field - location);
field = reinterpret_cast<uint8_t *>(&report.seconds_since_last_decrypt);
EXPECT_EQ(40, field - location);
field = reinterpret_cast<uint8_t *>(&report.pst);
EXPECT_EQ(48, field - location);
}
}
class DISABLED_UsageTableTest : public DISABLED_GenericDRMTest,
public WithParamInterface<bool> {
public: