Source release v3.0.3

This commit is contained in:
Joey Parrish
2015-11-09 16:40:25 -08:00
parent 7a64ef6641
commit 3d5571eaa1
6 changed files with 25 additions and 27 deletions

View File

@@ -1,2 +1,2 @@
// Widevine CE CDM Version
#define CDM_VERSION "v3.0.2-0-g161de1b-ce"
#define CDM_VERSION "v3.0.3-0-g226db8b-ce"

View File

@@ -408,12 +408,6 @@ Cdm::Status CdmImpl::update(const std::string& session_id,
return kInvalidAccess;
}
bool predicted_to_be_server_cert_response =
property_set_.use_privacy_mode() &&
property_set_.service_certificate().empty();
(void)predicted_to_be_server_cert_response;
// predicted_to_be_server_cert_response is now used when assertions are off.
// NOTE: If the CdmSession object recognizes that this is not the first
// AddKey(), it will internally delegate to RenewKey().
CdmKeySetId key_set_id = session_id;
@@ -422,7 +416,7 @@ Cdm::Status CdmImpl::update(const std::string& session_id,
if (result == NEED_KEY) {
// We just provisioned a server certificate.
assert(predicted_to_be_server_cert_response);
assert(property_set_.use_privacy_mode());
// The cert is now available to all sessions in this CDM instance.
// This is consistent with the behavior of the Chrome CDM.
@@ -450,10 +444,7 @@ Cdm::Status CdmImpl::update(const std::string& session_id,
MessageType message_type = kLicenseRequest;
listener_->onMessage(session_id, message_type, key_request);
return kSuccess;
}
assert(!predicted_to_be_server_cert_response);
if (result != KEY_ADDED) {
} else if (result != KEY_ADDED) {
LOGE("Unexpected error %d", result);
return kUnexpectedError;
}

View File

@@ -299,12 +299,18 @@ CdmResponseType CdmEngine::AddKey(const CdmSessionId& session_id,
CdmResponseType sts = iter->second->AddKey(key_data, key_set_id);
if (KEY_ADDED != sts) {
LOGE("CdmEngine::AddKey: keys not added, result = %d", sts);
return sts;
switch (sts) {
case KEY_ADDED:
break;
case NEED_KEY:
LOGI("CdmEngine::AddKey: service certificate loaded, no key added");
break;
default:
LOGE("CdmEngine::AddKey: keys not added, result = %d", sts);
break;
}
return KEY_ADDED;
return sts;
}
CdmResponseType CdmEngine::RestoreKey(const CdmSessionId& session_id,

View File

@@ -228,6 +228,7 @@ bool PSSVerify(const uint8_t *message, size_t messageLength,
}
// Verify db
dbMask[0] &= 0x7F;
for (int i = 0; i < dbLength - kPssSaltLength - 1; i++) {
if (dbMask[i] != 0) {
return false;

View File

@@ -1557,6 +1557,7 @@ OEMCryptoResult OEMCrypto_LoadTestRSAKey();
* Returns:
* OEMCrypto_SUCCESS success
* OEMCrypto_ERROR_INVALID_SESSION
* OEMCrypto_ERROR_INVALID_CONTEXT
* OEMCrypto_ERROR_SHORT_BUFFER if the signature buffer is too small.
* OEMCrypto_ERROR_INVALID_RSA_KEY
* OEMCrypto_ERROR_INSUFFICIENT_RESOURCES

View File

@@ -678,7 +678,7 @@ class Session {
}
void RefreshTestKeys(const size_t key_count, uint32_t control_bits,
uint32_t nonce, bool expect_good) {
uint32_t nonce, OEMCryptoResult expected_result) {
// Note: we store the message in encrypted_license_, but the refresh key
// message is not actually encrypted. It is, however, signed.
FillRefreshMessage(key_count, control_bits, nonce);
@@ -688,17 +688,13 @@ class Session {
OEMCryptoResult sts = OEMCrypto_RefreshKeys(
session_id(), message_ptr(), sizeof(MessageData), &signature_[0],
signature_.size(), key_count, key_array);
if (expect_good) {
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
} else {
ASSERT_NE(OEMCrypto_SUCCESS, sts);
}
ASSERT_EQ(expected_result, sts);
TestDecryptCTR();
sleep(kShortSleep); // Should still be valid key.
TestDecryptCTR(false);
sleep(kShortSleep + kLongSleep); // Should be after first expiration.
if (expect_good) {
if (expected_result == OEMCrypto_SUCCESS) {
TestDecryptCTR(false, OEMCrypto_SUCCESS);
} else {
TestDecryptCTR(false, OEMCrypto_ERROR_UNKNOWN_FAILURE);
@@ -2157,7 +2153,8 @@ TEST_P(SessionTestRefreshKeyTest, RefreshWithNonce) {
s.LoadTestKeys("", new_mac_keys_);
uint32_t nonce;
s.GenerateNonce(&nonce);
s.RefreshTestKeys(num_keys_, wvoec_mock::kControlNonceEnabled, nonce, true);
s.RefreshTestKeys(num_keys_, wvoec_mock::kControlNonceEnabled, nonce,
OEMCrypto_SUCCESS);
}
TEST_P(SessionTestRefreshKeyTest, RefreshNoNonce) {
@@ -2169,7 +2166,7 @@ TEST_P(SessionTestRefreshKeyTest, RefreshNoNonce) {
s.LoadTestKeys("", new_mac_keys_);
uint32_t nonce;
s.GenerateNonce(&nonce);
s.RefreshTestKeys(num_keys_, 0, 0, true);
s.RefreshTestKeys(num_keys_, 0, 0, OEMCrypto_SUCCESS);
}
TEST_P(SessionTestRefreshKeyTest, RefreshOldNonce) {
@@ -2181,7 +2178,8 @@ TEST_P(SessionTestRefreshKeyTest, RefreshOldNonce) {
s.EncryptAndSign();
s.LoadTestKeys("", new_mac_keys_);
uint32_t nonce = s.get_nonce();
s.RefreshTestKeys(num_keys_, wvoec_mock::kControlNonceEnabled, nonce, false);
s.RefreshTestKeys(num_keys_, wvoec_mock::kControlNonceEnabled, nonce,
OEMCrypto_ERROR_INVALID_NONCE);
}
TEST_P(SessionTestRefreshKeyTest, RefreshBadNonce) {
@@ -2195,7 +2193,8 @@ TEST_P(SessionTestRefreshKeyTest, RefreshBadNonce) {
uint32_t nonce;
s.GenerateNonce(&nonce);
nonce ^= 42;
s.RefreshTestKeys(num_keys_, wvoec_mock::kControlNonceEnabled, nonce, false);
s.RefreshTestKeys(num_keys_, wvoec_mock::kControlNonceEnabled, nonce,
OEMCrypto_ERROR_INVALID_NONCE);
}
// Of only one key control block in the refesh, we update all the keys.