This CL adds usage tables to the OEMCrypto reference implementation (mock) and unit tests. There is also a new parameter called oem_crypto_require_usage_tables that determines if the usage tables are required or not. This is set to true for Android and false for all other platforms. This CL is most of OEMCrypto version 9 updates. This CL is a copy of https://widevine-internal-review.googlesource.com/#/c/9720 https://widevine-internal-review.googlesource.com/#/c/9874 https://widevine-internal-review.googlesource.com/#/c/9873 Change-Id: I78c4f7651306f9f79ba2260c3e04fb1eca7e20e3
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
//
|
|
// Mock implementation of OEMCrypto APIs
|
|
//
|
|
#ifndef WVOEC_MOCK_OEMCRYPTO_KEYBOX_MOCK_H_
|
|
#define WVOEC_MOCK_OEMCRYPTO_KEYBOX_MOCK_H_
|
|
|
|
#include "oemcrypto_key_mock.h"
|
|
|
|
namespace wvoec_mock {
|
|
|
|
const int DEVICE_KEY_LENGTH = 16;
|
|
typedef uint8_t WvKeyboxKey[DEVICE_KEY_LENGTH];
|
|
|
|
const int KEY_DATA_LENGTH = 72;
|
|
typedef uint8_t WvKeyboxKeyData[KEY_DATA_LENGTH];
|
|
|
|
enum KeyboxError { NO_ERROR, BAD_CRC, BAD_MAGIC, OTHER_ERROR };
|
|
|
|
// Widevine keybox
|
|
class WvKeybox {
|
|
public:
|
|
WvKeybox();
|
|
~WvKeybox() {}
|
|
|
|
KeyboxError Validate();
|
|
const std::vector<uint8_t>& device_id() { return device_id_; }
|
|
std::vector<uint8_t>& device_key() { return device_key_; }
|
|
const WvKeyboxKeyData& key_data() { return key_data_; }
|
|
size_t key_data_length() { return KEY_DATA_LENGTH; }
|
|
bool InstallKeybox(const uint8_t* keybox, size_t keyBoxLength);
|
|
|
|
private:
|
|
bool Prepare();
|
|
|
|
bool valid_;
|
|
std::vector<uint8_t> device_id_;
|
|
std::vector<uint8_t> device_key_;
|
|
WvKeyboxKeyData key_data_;
|
|
uint8_t magic_[4];
|
|
uint8_t crc_[4];
|
|
};
|
|
|
|
}; // namespace wvoec_eng
|
|
|
|
#endif // WVOEC_MOCK_OEMCRYPTO_KEYBOX_MOCK_H_
|