Merge cdm changes to android repo
Bug: 251924225 Test: GtsMediaTestCases Change-Id: I1b4e64c0abf701fe1f5017f14dc72b72c3ea6770
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
//
|
||||
#include <gtest/gtest.h>
|
||||
#include <time.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -153,7 +154,9 @@ class RoundTrip {
|
||||
encrypted_response_data_(),
|
||||
required_message_size_(0),
|
||||
required_core_message_size_(0),
|
||||
required_request_signature_size_(0) {}
|
||||
required_request_signature_size_(0),
|
||||
encrypted_response_length_(0),
|
||||
response_signature_length_(0) {}
|
||||
virtual ~RoundTrip() {}
|
||||
|
||||
// Have OEMCrypto sign a request message and then verify the signature and the
|
||||
@@ -230,6 +233,11 @@ class RoundTrip {
|
||||
// Find the given pointer in the response_data_.
|
||||
virtual OEMCrypto_Substring FindSubstring(const void* pointer, size_t length);
|
||||
|
||||
// Set EncryptAndSignResponse output lengths for later verification.
|
||||
void SetEncryptAndSignResponseLengths();
|
||||
// Verify EncryptAndSignResponse output lengths are unchanged.
|
||||
void VerifyEncryptAndSignResponseLengths() const;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member variables.
|
||||
Session* session_;
|
||||
@@ -244,6 +252,11 @@ class RoundTrip {
|
||||
std::vector<uint8_t> response_signature_;
|
||||
std::string serialized_core_message_;
|
||||
std::vector<uint8_t> encrypted_response_;
|
||||
|
||||
private:
|
||||
// EncryptAndSignResponse output lengths.
|
||||
size_t encrypted_response_length_;
|
||||
size_t response_signature_length_;
|
||||
};
|
||||
|
||||
class ProvisioningRoundTrip
|
||||
@@ -486,7 +499,7 @@ class EntitledMessage {
|
||||
void SetEntitledKeySession(uint32_t key_session) {
|
||||
entitled_key_session_ = key_session;
|
||||
}
|
||||
void LoadKeys(OEMCryptoResult expected_sts);
|
||||
void LoadKeys(bool expected_success);
|
||||
OEMCryptoResult LoadKeys(const vector<uint8_t>& message);
|
||||
OEMCryptoResult LoadKeys();
|
||||
void EncryptContentKey();
|
||||
@@ -721,6 +734,19 @@ class Session {
|
||||
// Only one of RSA or EC should be set.
|
||||
std::unique_ptr<util::RsaPublicKey> public_rsa_;
|
||||
std::unique_ptr<util::EccPublicKey> public_ec_;
|
||||
// In provisioning 4.0, the shared session key is derived from either
|
||||
// 1. (client side) client private key + server ephemeral public key, or
|
||||
// 2. (server side) server ephemeral private key + client public key
|
||||
// Encryption key and mac keys are derived from the shared session key, and
|
||||
// are inserted in to the default license response which simulates the
|
||||
// response from a license server. In order for these keys to be deterministic
|
||||
// across multiple test calls of GenerateDerivedKeysFromSessionKey(), which
|
||||
// simulates how the server derives keys, the ephemeral keys used by the
|
||||
// "server" need to be stored for re-use.
|
||||
static std::unordered_map<
|
||||
util::EccCurve, std::unique_ptr<util::EccPrivateKey>, std::hash<int>>
|
||||
server_ephemeral_keys_;
|
||||
static std::mutex ephemeral_key_map_lock_;
|
||||
vector<uint8_t> pst_report_buffer_;
|
||||
MessageData license_ = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user