Correct comments and nits from other reviews

Merge from Widevine repo of http://go/wvgerrit/23436

This change is just comment changes: minor rewording and grammar
fixes.

Change-Id: I4cb2ef77715623fdb2567f5b504ffaceb937a480
This commit is contained in:
Fred Gylys-Colwell
2017-01-30 14:18:15 -08:00
parent e4231fea3b
commit eeaaf311e1
10 changed files with 23 additions and 18 deletions

View File

@@ -96,7 +96,7 @@ extern "C" OEMCryptoResult OEMCrypto_OpenSession(OEMCrypto_SESSION* session) {
"(OEMCrypto_SESSION *session)\n"); "(OEMCrypto_SESSION *session)\n");
} }
if (!crypto_engine) { if (!crypto_engine) {
LOGE("OEMCrypto_OpenSession: OEMCrypto Not Initialized."); LOGE("OEMCrypto_OpenSession: OEMCrypto not initialized.");
return OEMCrypto_ERROR_UNKNOWN_FAILURE; return OEMCrypto_ERROR_UNKNOWN_FAILURE;
} }
if (crypto_engine->GetNumberOfOpenSessions() >= if (crypto_engine->GetNumberOfOpenSessions() >=
@@ -118,7 +118,7 @@ extern "C" OEMCryptoResult OEMCrypto_CloseSession(OEMCrypto_SESSION session) {
"(OEMCrypto_SESSION session)\n"); "(OEMCrypto_SESSION session)\n");
} }
if (!crypto_engine) { if (!crypto_engine) {
LOGE("OEMCrypto_CloseSession: OEMCrypto Not Initialized."); LOGE("OEMCrypto_CloseSession: OEMCrypto not initialized.");
return OEMCrypto_ERROR_UNKNOWN_FAILURE; return OEMCrypto_ERROR_UNKNOWN_FAILURE;
} }
if (!crypto_engine->DestroySession((SessionId)session)) { if (!crypto_engine->DestroySession((SessionId)session)) {
@@ -148,7 +148,7 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateDerivedKeys(
} }
} }
if (!crypto_engine) { if (!crypto_engine) {
LOGE("OEMCrypto_GenerateDerivedKeys: OEMCrypto Not Initialized."); LOGE("OEMCrypto_GenerateDerivedKeys: OEMCrypto not initialized.");
return OEMCrypto_ERROR_UNKNOWN_FAILURE; return OEMCrypto_ERROR_UNKNOWN_FAILURE;
} }
if (!crypto_engine->config_supports_keybox()) { if (!crypto_engine->config_supports_keybox()) {
@@ -195,7 +195,7 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateNonce(OEMCrypto_SESSION session,
"(OEMCrypto_SESSION session,\n"); "(OEMCrypto_SESSION session,\n");
} }
if (!crypto_engine) { if (!crypto_engine) {
LOGE("OEMCrypto_GenerateNonce: OEMCrypto Not Initialized."); LOGE("OEMCrypto_GenerateNonce: OEMCrypto not initialized.");
return OEMCrypto_ERROR_UNKNOWN_FAILURE; return OEMCrypto_ERROR_UNKNOWN_FAILURE;
} }
SessionContext* session_ctx = crypto_engine->FindSession(session); SessionContext* session_ctx = crypto_engine->FindSession(session);
@@ -1575,6 +1575,7 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Verify(
signature, signature_length); signature, signature_length);
} }
// TODO(fredgc): remove this.
extern "C" OEMCryptoResult OEMCrypto_UpdateUsageTable() { extern "C" OEMCryptoResult OEMCrypto_UpdateUsageTable() {
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) { if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
LOGI("-- OEMCryptoResult OEMCrypto_UpdateUsageTable();\n"); LOGI("-- OEMCryptoResult OEMCrypto_UpdateUsageTable();\n");

View File

@@ -1,4 +1,4 @@
// Copyright 2013 Google Inc. All Rights Reserved. // Copyright 2017 Google Inc. All Rights Reserved.
// //
// Mock implementation of OEMCrypto APIs // Mock implementation of OEMCrypto APIs
// //

View File

@@ -1,4 +1,4 @@
// Copyright 2013 Google Inc. All Rights Reserved. // Copyright 2017 Google Inc. All Rights Reserved.
// //
// Mock implementation of OEMCrypto APIs // Mock implementation of OEMCrypto APIs
// //

View File

@@ -2,6 +2,9 @@
// //
// Mock implementation of OEMCrypto APIs // Mock implementation of OEMCrypto APIs
// //
// This is from the v12 version of oemcrypto usage tables. It is used for
// devices that upgrade from v12 to v13 in the field, and need to convert from
// the old type of usage table to the new.
#include "oemcrypto_old_usage_table_mock.h" #include "oemcrypto_old_usage_table_mock.h"
#include <string.h> #include <string.h>

View File

@@ -1,4 +1,4 @@
// Copyright 2013 Google Inc. All Rights Reserved. // Copyright 2017 Google Inc. All Rights Reserved.
// //
// Mock implementation of OEMCrypto APIs // Mock implementation of OEMCrypto APIs
// //
@@ -172,7 +172,7 @@ bool SessionContext::RSADeriveKeys(
} }
session_key_.resize(decrypted_size); session_key_.resize(decrypted_size);
if (decrypted_size != static_cast<int>(wvcdm::KEY_SIZE)) { if (decrypted_size != static_cast<int>(wvcdm::KEY_SIZE)) {
LOGE("[RSADeriveKeys(): error. session key is wrong size: %d.]", LOGE("[RSADeriveKeys(): error. Session key is wrong size: %d.]",
decrypted_size); decrypted_size);
dump_openssl_error(); dump_openssl_error();
session_key_.clear(); session_key_.clear();
@@ -575,7 +575,7 @@ bool SessionContext::InstallRSAEncryptedKey(
} }
encryption_key_.resize(decrypted_size); encryption_key_.resize(decrypted_size);
if (decrypted_size != static_cast<int>(wvcdm::KEY_SIZE)) { if (decrypted_size != static_cast<int>(wvcdm::KEY_SIZE)) {
LOGE("[RSADeriveKeys(): error. session key is wrong size: %d.]", LOGE("[RSADeriveKeys(): error. Session key is wrong size: %d.]",
decrypted_size); decrypted_size);
dump_openssl_error(); dump_openssl_error();
encryption_key_.clear(); encryption_key_.clear();

View File

@@ -1,4 +1,4 @@
// Copyright 2013 Google Inc. All Rights Reserved. // Copyright 2017 Google Inc. All Rights Reserved.
// //
// Mock implementation of OEMCrypto APIs // Mock implementation of OEMCrypto APIs
// //

View File

@@ -1,4 +1,4 @@
// Copyright 2013 Google Inc. All Rights Reserved. // Copyright 2017 Google Inc. All Rights Reserved.
// //
// Mock implementation of OEMCrypto APIs // Mock implementation of OEMCrypto APIs
// //

View File

@@ -1,4 +1,4 @@
// Copyright 2013 Google Inc. All Rights Reserved. // Copyright 2017 Google Inc. All Rights Reserved.
// //
// Mock implementation of OEMCrypto APIs // Mock implementation of OEMCrypto APIs
// //

View File

@@ -276,7 +276,7 @@ class Session {
void ReloadUsageEntry() { LoadUsageEntry(*this); } void ReloadUsageEntry() { LoadUsageEntry(*this); }
// Update the usage entry and save the header to the specified buffer. // Update the usage entry and save the header to the specified buffer.
void UpdateUsageEntry(std::vector<uint8_t>* header_buffer); void UpdateUsageEntry(std::vector<uint8_t>* header_buffer);
// Deactivate this sessions usage entry. // Deactivate this session's usage entry.
void DeactivateUsageEntry(const std::string& pst, void DeactivateUsageEntry(const std::string& pst,
OEMCryptoResult expect_result = OEMCrypto_SUCCESS); OEMCryptoResult expect_result = OEMCrypto_SUCCESS);
// The usage entry number for this session's usage entry. // The usage entry number for this session's usage entry.

View File

@@ -2419,7 +2419,7 @@ TEST_F(OEMCryptoLoadsCertificate, TestLargeRSAKey3072) {
ASSERT_NO_FATAL_FAILURE(s.TestDecryptCTR()); ASSERT_NO_FATAL_FAILURE(s.TestDecryptCTR());
} }
// Deivces that load certificates, should at least support RSA 2048 keys. // Devices that load certificates, should at least support RSA 2048 keys.
TEST_F(OEMCryptoLoadsCertificate, SupportsCertificatesAPI13) { TEST_F(OEMCryptoLoadsCertificate, SupportsCertificatesAPI13) {
ASSERT_NE(0, ASSERT_NE(0,
OEMCrypto_Supports_RSA_2048bit & OEMCrypto_SupportedCertificates()) OEMCrypto_Supports_RSA_2048bit & OEMCrypto_SupportedCertificates())
@@ -5473,9 +5473,10 @@ TEST_F(UsageTableTest, VerifyUsageTimes) {
s.TestDecryptCTR(false, OEMCrypto_ERROR_UNKNOWN_FAILURE)); s.TestDecryptCTR(false, OEMCrypto_ERROR_UNKNOWN_FAILURE));
} }
// This is a special case where a collection of licenses can be shared with // This is a special case where a group of assets can be licensed with a master
// multiple devices. In order for this to work, a single session must first // key. In order for this to work, a single session must first load a device
// load a device specific license, and then a shared content license. // specific license, and then a shared content license. This shared license is
// sometimes called an embedded license.
TEST_F(UsageTableTest, LoadSharedLicense) { TEST_F(UsageTableTest, LoadSharedLicense) {
std::string pst = "my_pst"; std::string pst = "my_pst";
Session s; Session s;
@@ -5490,7 +5491,7 @@ TEST_F(UsageTableTest, LoadSharedLicense) {
// The second set of keys are in the shared license. They will have the // The second set of keys are in the shared license. They will have the
// same mac keys as the original license, so we leave that alone. // same mac keys as the original license, so we leave that alone.
// We given them different key ids so we can test that they were loaded. // They are given different key ids so we can test that they were loaded.
// For this test, we leave the key content the same -- in real life it // For this test, we leave the key content the same -- in real life it
// will be different. // will be different.
for (unsigned int i = 0; i < s.num_keys(); i++) { for (unsigned int i = 0; i < s.num_keys(); i++) {