Refactor OEMCrypto mock and its unit tests
This is a copy of the Widevine CL: https://widevine-internal-review.googlesource.com/#/c/9708/ This CL refactors some of code in oemcrypto/mock and oemcrypto/test in preparation for adding usage table code. Change-Id: I7e58c8ecd6d92b3e177cb915733212fcad645485
This commit is contained in:
@@ -74,7 +74,7 @@ KeyboxError WvKeybox::Validate() {
|
||||
WidevineKeybox keybox;
|
||||
memset(&keybox, 0, sizeof(keybox));
|
||||
memcpy(keybox.device_id_, &device_id_[0], device_id_.size());
|
||||
memcpy(keybox.device_key_, &device_key_.value()[0], sizeof(keybox.device_key_));
|
||||
memcpy(keybox.device_key_, &device_key_[0], sizeof(keybox.device_key_));
|
||||
memcpy(keybox.data_, key_data_, sizeof(keybox.data_));
|
||||
memcpy(keybox.magic_, magic_, sizeof(keybox.magic_));
|
||||
|
||||
@@ -99,9 +99,8 @@ bool WvKeybox::InstallKeybox(const uint8_t* buffer, size_t keyBoxLength) {
|
||||
= strnlen(reinterpret_cast<const char*>(keybox->device_id_), 32);
|
||||
device_id_.assign(keybox->device_id_,
|
||||
keybox->device_id_ + device_id_length);
|
||||
device_key_.setValue(reinterpret_cast<const char*>(keybox->device_key_),
|
||||
sizeof(keybox->device_key_));
|
||||
device_key_.setType(KEYTYPE_DEVICE);
|
||||
device_key_.assign(keybox->device_key_,
|
||||
keybox->device_key_ + sizeof(keybox->device_key_));
|
||||
memcpy(key_data_, keybox->data_, sizeof(keybox->data_));
|
||||
memcpy(magic_, keybox->magic_, sizeof(keybox->magic_));
|
||||
memcpy(crc_, keybox->crc_, sizeof(keybox->crc_));
|
||||
|
||||
Reference in New Issue
Block a user