Merge from Widevine repo of http://go/wvgerrit/47860 This CL updates the copyright notice to indicate that files shared with partners are shared under the Widevine Master License Agreement. bug: 77926774 test: comment change only Change-Id: I0423668111578b80fb39a932d763df2827e2dfc3
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
//
|
|
// Mock implementation of OEMCrypto APIs
|
|
//
|
|
#ifndef OEMCRYPTO_KEYBOX_MOCK_H_
|
|
#define 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];
|
|
};
|
|
|
|
class WvTestKeybox : public WvKeybox {
|
|
public:
|
|
WvTestKeybox();
|
|
};
|
|
|
|
} // namespace wvoec_mock
|
|
|
|
#endif // OEMCRYPTO_KEYBOX_MOCK_H_
|