BCC extraction tool calls OEMCrypto_GetDeviceInformation() to read verified device info from TEE. If the verified device info is not available, (e.g. not implemented), it falls back to using OS properties. This CL changes the tool used by widevine internally. Another CL will update the tool for factory use. Test: Ran the tool on Pixel 7 w/wo verified device info being present Bug: 263312447 Change-Id: I71a48cc210f6a6f26f339f512a1851237ba94172
68 lines
2.3 KiB
C++
68 lines
2.3 KiB
C++
// Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine License
|
|
// Agreement.
|
|
|
|
#ifndef WIDEVINE_OEMCRYPTO_INTERFACE_H_
|
|
#define WIDEVINE_OEMCRYPTO_INTERFACE_H_
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "OEMCryptoCENC.h"
|
|
|
|
namespace widevine {
|
|
|
|
struct VerifiedDeviceInfo {
|
|
std::vector<uint8_t> device_info;
|
|
// Used by Interface of Remote Provisioning Component (IRPC) v3 for CSR
|
|
// uploading
|
|
std::vector<uint8_t> signed_csr_payload;
|
|
};
|
|
|
|
class OEMCryptoInterface {
|
|
public:
|
|
OEMCryptoInterface() = default;
|
|
OEMCryptoInterface(const OEMCryptoInterface&) = delete;
|
|
OEMCryptoInterface& operator=(const OEMCryptoInterface&) = delete;
|
|
virtual ~OEMCryptoInterface();
|
|
|
|
// Initializes this interface by providing path to the OEMCrypto library.
|
|
bool Init(const std::string& oemcrypto_path);
|
|
|
|
// Retrieves the boot certificate chain from OEMCrypto implementation.
|
|
OEMCryptoResult GetBcc(std::vector<uint8_t>& bcc);
|
|
|
|
// Retrieves the build information of the OEMCrypto library from OEMCrypto
|
|
// implementation.
|
|
OEMCryptoResult GetOEMCryptoBuildInfo(std::string& build_info);
|
|
|
|
// Retrieves the verified device information of the OEMCrypto library from
|
|
// OEMCrypto implementation.
|
|
OEMCryptoResult GetVerifiedDeviceInformation(
|
|
VerifiedDeviceInfo& verified_device_info);
|
|
|
|
private:
|
|
typedef OEMCryptoResult (*Initialize_t)();
|
|
typedef OEMCryptoResult (*Terminate_t)();
|
|
typedef OEMCryptoResult (*GetBootCertificateChain_t)(
|
|
uint8_t* bcc, size_t* bcc_size, uint8_t* additional_signature,
|
|
size_t* additional_signature_size);
|
|
typedef OEMCryptoResult (*BuildInformation_t)(char* buffer,
|
|
size_t* buffer_length);
|
|
typedef OEMCryptoResult (*GetDeviceInformation_t)(
|
|
uint8_t* device_info, size_t* device_info_length,
|
|
uint8_t* signed_csr_payload, size_t* signed_csr_payload_length);
|
|
|
|
Initialize_t Initialize = nullptr;
|
|
Terminate_t Terminate = nullptr;
|
|
GetBootCertificateChain_t GetBootCertificateChain = nullptr;
|
|
BuildInformation_t BuildInformation = nullptr;
|
|
GetDeviceInformation_t GetDeviceInformation = nullptr;
|
|
|
|
void* handle_ = nullptr;
|
|
};
|
|
|
|
} // namespace widevine
|
|
|
|
#endif // WIDEVINE_OEMCRYPTO_INTERFACE_H_
|