Reformat wv core/src files

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

Clang-format has been run on files in core/src. clang-format has been turned
off for some blocks but otherwise no other changes have been made.

Bug: 134365840
Test: WV unit/integration tests
Change-Id: I6e509f25136f84d37de3d920084302f0f2c23dc4
This commit is contained in:
Rahul Frias
2019-06-03 17:14:18 -07:00
parent 47c2068d6a
commit a178eed57d
20 changed files with 713 additions and 760 deletions

View File

@@ -16,6 +16,8 @@ namespace {
// Root certificate for all Google/Widevine certificates. I.e. all service
// certificates and DRM certificates are signed by this cert, or have this cert
// as the root of a signing chain.
// clang-format off
static const unsigned char kRootCertForProd[] = {
0x0a, 0x9c, 0x03, 0x08, 0x00, 0x12, 0x01, 0x00,
0x18, 0xdd, 0x94, 0x88, 0x8b, 0x05, 0x22, 0x8e,
@@ -119,6 +121,7 @@ static const unsigned char kRootCertForProd[] = {
0xa2, 0xe6, 0x80, 0x74, 0x55, 0x06, 0x49, 0xd5,
0x02, 0x0c
};
// clang-format on
} // namespace
@@ -228,23 +231,22 @@ CdmResponseType ServiceCertificate::EncryptClientId(
std::string iv(KEY_IV_SIZE, 0);
std::string key(SERVICE_KEY_SIZE, 0);
CdmResponseType status =
crypto_session->GetRandom(key.size(),
reinterpret_cast<uint8_t*>(&key[0]));
CdmResponseType status = crypto_session->GetRandom(
key.size(), reinterpret_cast<uint8_t*>(&key[0]));
if (status != NO_ERROR) {
LOGE("ServiceCertificate::EncryptClientId: GetRandom error: %d", status);
return status == RANDOM_GENERATION_ERROR ?
CLIENT_ID_GENERATE_RANDOM_ERROR : status;
return status == RANDOM_GENERATION_ERROR ? CLIENT_ID_GENERATE_RANDOM_ERROR
: status;
}
status = crypto_session->GetRandom(iv.size(),
reinterpret_cast<uint8_t*>(&iv[0]));
status =
crypto_session->GetRandom(iv.size(), reinterpret_cast<uint8_t*>(&iv[0]));
if (status != NO_ERROR) {
LOGE("ServiceCertificate::EncryptClientId: GetRandom error: %d", status);
return status == RANDOM_GENERATION_ERROR ?
CLIENT_ID_GENERATE_RANDOM_ERROR : status;
return status == RANDOM_GENERATION_ERROR ? CLIENT_ID_GENERATE_RANDOM_ERROR
: status;
}
std::string id, enc_id, enc_key;
clear_client_id->SerializeToString(&id);
@@ -254,8 +256,7 @@ CdmResponseType ServiceCertificate::EncryptClientId(
if (!aes.Encrypt(id, &enc_id, &iv)) return CLIENT_ID_AES_ENCRYPT_ERROR;
CdmResponseType encrypt_result = EncryptRsaOaep(key, &enc_key);
if (encrypt_result != NO_ERROR)
return encrypt_result;
if (encrypt_result != NO_ERROR) return encrypt_result;
encrypted_client_id->set_encrypted_client_id_iv(iv);
encrypted_client_id->set_encrypted_privacy_key(enc_key);
@@ -274,8 +275,8 @@ bool ServiceCertificate::GetRequest(CdmKeyMessage* request) {
return true;
}
CdmResponseType ServiceCertificate::ParseResponse(
const std::string& response, std::string* certificate) {
CdmResponseType ServiceCertificate::ParseResponse(const std::string& response,
std::string* certificate) {
if (response.empty()) {
LOGE("ServiceCertificate::ParseResponse: empty response");
return EMPTY_RESPONSE_ERROR_1;
@@ -312,6 +313,4 @@ CdmResponseType ServiceCertificate::ParseResponse(
return NO_ERROR;
}
} // namespace wvcdm