Merge "Don't add offsets to ion handles" into jb-mr2-dev

This commit is contained in:
Jeff Tinker
2013-04-20 00:16:02 +00:00
committed by Android (Google) Code Review
15 changed files with 63 additions and 41 deletions

View File

@@ -101,7 +101,7 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE],
CdmResponseType res = mCDM->Decrypt(mSessionId, false, keyId,
source + offset,
subSample.mNumBytesOfClearData,
ivVector, 0, dest + offset);
ivVector, 0, dest, offset);
if (!isCdmResponseTypeSuccess(res)) {
ALOGE("Decrypt error result in session %s during unencrypted block: %d",
@@ -119,7 +119,8 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE],
CdmResponseType res = mCDM->Decrypt(mSessionId, true, keyId,
source + offset,
subSample.mNumBytesOfEncryptedData,
ivVector, encrypted_offset % 16, dest + offset);
ivVector, encrypted_offset % 16, dest,
offset);
if (!isCdmResponseTypeSuccess(res)) {
ALOGE("Decrypt error result in session %s during encrypted block: %d",

View File

@@ -23,10 +23,10 @@ using namespace wvdrm;
class MockCDM : public WvContentDecryptionModule {
public:
MOCK_METHOD8(Decrypt, CdmResponseType(const CdmSessionId&, bool, const KeyId&,
MOCK_METHOD9(Decrypt, CdmResponseType(const CdmSessionId&, bool, const KeyId&,
const uint8_t*, size_t,
const std::vector<uint8_t>&, size_t,
void*));
void*, size_t));
MOCK_METHOD1(QueryStatus, CdmResponseType(CdmQueryMap*));
};
@@ -101,22 +101,22 @@ TEST_F(WVCryptoPluginTest, AttemptsToDecrypt) {
EXPECT_CALL(cdm, Decrypt(ElementsAreArray(sessionId, kSessionIdSize), true,
ElementsAreArray(keyId, KEY_ID_SIZE), in, 16,
ElementsAreArray(iv, KEY_IV_SIZE), 0, out))
ElementsAreArray(iv, KEY_IV_SIZE), 0, out, 0))
.WillOnce(Return(wvcdm::NO_ERROR));
EXPECT_CALL(cdm, Decrypt(ElementsAreArray(sessionId, kSessionIdSize), false,
ElementsAreArray(keyId, KEY_ID_SIZE), in + 16, 16,
ElementsAreArray(iv, KEY_IV_SIZE), 0, out + 16))
ElementsAreArray(iv, KEY_IV_SIZE), 0, out, 16))
.WillOnce(Return(wvcdm::NO_ERROR));
EXPECT_CALL(cdm, Decrypt(ElementsAreArray(sessionId, kSessionIdSize), true,
ElementsAreArray(keyId, KEY_ID_SIZE), in + 32, 24,
ElementsAreArray(iv, KEY_IV_SIZE), 0, out + 32))
ElementsAreArray(iv, KEY_IV_SIZE), 0, out, 32))
.WillOnce(Return(wvcdm::NO_ERROR));
EXPECT_CALL(cdm, Decrypt(ElementsAreArray(sessionId, kSessionIdSize), true,
ElementsAreArray(keyId, KEY_ID_SIZE), in + 56, 8,
ElementsAreArray(iv, KEY_IV_SIZE), 8, out + 56))
ElementsAreArray(iv, KEY_IV_SIZE), 8, out, 56))
.WillOnce(Return(wvcdm::NO_ERROR));
}
@@ -130,4 +130,4 @@ TEST_F(WVCryptoPluginTest, AttemptsToDecrypt) {
"WVCryptoPlugin decrypted the wrong number of bytes";
EXPECT_EQ(0u, errorDetailMessage.size()) <<
"WVCryptoPlugin reported a detailed error message.";
}
}