Merge oemcrypto fuzz tests to sc-widevine-release branch
Merge from Widevine repo of http://go/wvgerrit/131308 These tests will be released on the sc-widevine-release branch, but not as part of the initial Android S release. Change-Id: I6dae85fe72c6d09759e43c5e40bbc0776b57b089
This commit is contained in:
@@ -22,4 +22,45 @@ std::vector<std::vector<uint8_t>> SplitInput(const uint8_t* data, size_t size) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void OEMCryptoLicenseAPIFuzz::LoadLicense() {
|
||||
license_messages_.SignAndVerifyRequest();
|
||||
license_messages_.CreateDefaultResponse();
|
||||
license_messages_.EncryptAndSignResponse();
|
||||
OEMCryptoResult sts = license_messages_.LoadResponse();
|
||||
CheckStatusAndExitFuzzerOnFailure(sts, OEMCrypto_SUCCESS);
|
||||
}
|
||||
|
||||
void OEMCryptoProvisioningAPIFuzz::LoadProvisioning() {
|
||||
provisioning_messages_.SignAndVerifyRequest();
|
||||
provisioning_messages_.CreateDefaultResponse();
|
||||
provisioning_messages_.EncryptAndSignResponse();
|
||||
OEMCryptoResult sts = provisioning_messages_.LoadResponse();
|
||||
CheckStatusAndExitFuzzerOnFailure(sts, OEMCrypto_SUCCESS);
|
||||
}
|
||||
|
||||
void LicenseWithUsageEntryFuzz::CreateUsageTableHeader() {
|
||||
size_t header_buffer_length = 0;
|
||||
OEMCryptoResult sts =
|
||||
OEMCrypto_CreateUsageTableHeader(nullptr, &header_buffer_length);
|
||||
encrypted_usage_header_.resize(header_buffer_length);
|
||||
sts = OEMCrypto_CreateUsageTableHeader(encrypted_usage_header_.data(),
|
||||
&header_buffer_length);
|
||||
CheckStatusAndExitFuzzerOnFailure(sts, OEMCrypto_SUCCESS);
|
||||
}
|
||||
|
||||
void LicenseWithUsageEntryFuzz::LoadLicense() {
|
||||
license_messages_.SignAndVerifyRequest();
|
||||
license_messages_.CreateDefaultResponse();
|
||||
license_messages_.EncryptAndSignResponse();
|
||||
OEMCryptoResult sts = license_messages_.LoadResponse();
|
||||
CheckStatusAndExitFuzzerOnFailure(sts, OEMCrypto_SUCCESS);
|
||||
}
|
||||
|
||||
void CheckStatusAndExitFuzzerOnFailure(OEMCryptoResult result,
|
||||
OEMCryptoResult expected_status) {
|
||||
if (result != expected_status) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
} // namespace wvoec
|
||||
|
||||
Reference in New Issue
Block a user