This is a merge from the widevine repository of http://go/wvgerrit/13923 Switch openssl to use the EVP interface for aes-ctr-128 http://go/wvgerrit/13979 Add Test Certificate to OEMCrypto Mock http://go/wvgerrit/13978 Add Test Keybox to Level 3 OEMCrypto http://go/wvgerrit/13873 Enable OEMCrypto Unit Tests This CL adds a main program to oemcrypto_test.cpp, which filters out tests that are not supported on the specified platform. It also adds LoadTestKeybox to the mock. This allows oemcrypto unit tests to be run on devices that have production keybox. It also allows the same set of unit tests to work on Android and on non-Android platforms. b/18962381 Use test certificate (partial fix) b/19867990 Separate cast receiver tests Change-Id: If89c31530103ed85aa37d7379bd5b4dc2a927f38
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
//
|
|
// 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_
|