Regular update
Plugin: 1. Process ECM v3 and send fingerprinting/service_blocking events 2. Rmove unused function Ctr128Add 3. Add support for ECM v3 OEMCrypto: 1. Update API description of OEMCrypto_LoadCasECMKeys 2. Fix android build files for ODK 3. Load content keys to shared memory 4. Move KCB check to LoadCasKeys call 5. Support even/odd content keys to share entitlement key
This commit is contained in:
@@ -85,39 +85,6 @@ void FillEntitledContentKeyObjectFromKeyData(
|
||||
dest->cipher_mode = CipherModeFromKeyData(src.cipher_mode);
|
||||
}
|
||||
|
||||
// Increment the IV based on the number of encrypted block. IV size is assumed
|
||||
// to be 16 bytes.
|
||||
static constexpr uint32_t kIvSizeBytesBytes = 16;
|
||||
static constexpr uint32_t kCencIvSize = 8;
|
||||
static const uint32_t kAesBlockSizeBytes = 16;
|
||||
bool Ctr128Add(size_t block_count, uint8_t* counter) {
|
||||
if (counter == nullptr) return false;
|
||||
if (0 == block_count) return true;
|
||||
|
||||
uint8_t carry = 0;
|
||||
uint8_t n = kIvSizeBytesBytes - 1;
|
||||
// Update the counter one byte at a time.
|
||||
while (n >= kCencIvSize) {
|
||||
// Grab a single byte of the block_count.
|
||||
uint32_t temp = block_count & 0xff;
|
||||
// Add the corresponding byte from the counter value.
|
||||
temp += counter[n];
|
||||
// Add in the carry.
|
||||
temp += carry;
|
||||
// Write back the updated counter byte and set the carry value as needed.
|
||||
counter[n] = temp & 0xff;
|
||||
carry = (temp & 0x100) ? 1 : 0;
|
||||
// Update block_count and set the counter index for the next byte.
|
||||
block_count = block_count >> 8;
|
||||
n--;
|
||||
// Early exit if nothing to do.
|
||||
if (!block_count && !carry) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
shared_mutex CryptoLock::static_field_mutex_;
|
||||
|
||||
Reference in New Issue
Block a user