Allow Apps to Voluntarily Downgrade to L3 Crypto
This merges the following changes from the Widevine CDM repository: 564f4cc Add CdmClientPropertySet to CDM Adds an interface to the CDM that allows it to query its client for certain properties. In this case, this includes the ability to specify what security level is desired, as well as support for service ceritifcate privacy mode. 9cfbd3e Force Level 3 fallback Adds support for voluntarily invoking L3 crypto to the OEMCrypto wrapper. 95d12c1 Add pointer to CdmClientPropertySet class to OpenSession. Adds support for storing the property set on a session-by-session basis and choosing the appropriate crypto level. 17de442 Add Settable Properties for Clank to Android Adds support for setting the aforementioned properties to the DrmEngine bbe704d Fixes to force fallback to level three security Corrections to invoke provisioning, OEMCrypto API with configured security level rather than the default. Unit tests were also revised. Note that some parts of this are also support for the ability to use a service certificate-based privacy mode. The remaining code for supporting this mode is still forthcoming. Bug: 10109249 Change-Id: I2755e4dea1de3e8a56cff237360298f7b7f1bddc
This commit is contained in:
@@ -88,7 +88,7 @@ class WvCdmEngineTest : public testing::Test {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
cdm_engine_.reset(new CdmEngine());
|
||||
cdm_engine_->OpenSession(g_key_system, &session_id_);
|
||||
cdm_engine_->OpenSession(g_key_system, NULL, &session_id_);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
|
||||
@@ -78,9 +78,11 @@ TEST_F(LicenseTest, DISABLED_PrepareKeyRequest) {
|
||||
std::string signed_request;
|
||||
CdmAppParameterMap app_parameters;
|
||||
std::string server_url;
|
||||
CdmSessionId session_id;
|
||||
license_.PrepareKeyRequest(a2bs_hex(kInitData),
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters,
|
||||
session_id,
|
||||
&signed_request,
|
||||
&server_url);
|
||||
EXPECT_EQ(signed_request, a2bs_hex(kSignedRequest));
|
||||
@@ -90,10 +92,12 @@ TEST_F(LicenseTest, DISABLED_PrepareKeyRequest) {
|
||||
TEST_F(LicenseTest, DISABLED_HandleKeyResponseValid) {
|
||||
std::string signed_request;
|
||||
CdmAppParameterMap app_parameters;
|
||||
CdmSessionId session_id;
|
||||
std::string server_url;
|
||||
license_.PrepareKeyRequest(a2bs_hex(kInitData),
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters,
|
||||
session_id,
|
||||
&signed_request,
|
||||
&server_url);
|
||||
EXPECT_EQ(signed_request, a2bs_hex(kSignedRequest));
|
||||
@@ -104,10 +108,12 @@ TEST_F(LicenseTest, DISABLED_HandleKeyResponseValid) {
|
||||
TEST_F(LicenseTest, DISABLED_HandleKeyResponseInvalid) {
|
||||
std::string signed_request;
|
||||
CdmAppParameterMap app_parameters;
|
||||
CdmSessionId session_id;
|
||||
std::string server_url;
|
||||
license_.PrepareKeyRequest(a2bs_hex(kInitData),
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters,
|
||||
session_id,
|
||||
&signed_request,
|
||||
&server_url);
|
||||
EXPECT_EQ(signed_request, a2bs_hex(kSignedRequest));
|
||||
|
||||
@@ -41,7 +41,7 @@ void UrlRequest::AppendChunkToUpload(const std::string& data) {
|
||||
|
||||
// buffer to store length of chunk
|
||||
memset(buffer_, 0, kHttpBufferSize);
|
||||
snprintf(buffer_, kHttpBufferSize, "%x\r\n", data.size());
|
||||
snprintf(buffer_, kHttpBufferSize, "%zx\r\n", data.size());
|
||||
request_.append(buffer_); // appends size of chunk
|
||||
LOGD("...\r\n%s", request_.c_str());
|
||||
request_.append(data);
|
||||
@@ -61,7 +61,7 @@ void UrlRequest::ConcatenateChunkedResponse(const std::string http_response,
|
||||
// processes chunked encoding
|
||||
size_t chunk_size = 0;
|
||||
size_t chunk_size_pos = chunked_tag_pos + kChunkedTag.size();
|
||||
sscanf(&http_response[chunk_size_pos], "%x", &chunk_size);
|
||||
sscanf(&http_response[chunk_size_pos], "%zx", &chunk_size);
|
||||
if (chunk_size > http_response.size()) {
|
||||
// precaution, in case we misread chunk size
|
||||
LOGE("invalid chunk size %u", chunk_size);
|
||||
@@ -85,7 +85,7 @@ void UrlRequest::ConcatenateChunkedResponse(const std::string http_response,
|
||||
|
||||
// Search for next chunk
|
||||
chunk_size_pos = chunk_pos + chunk_size + kCrLf.size();
|
||||
sscanf(&http_response[chunk_size_pos], "%x", &chunk_size);
|
||||
sscanf(&http_response[chunk_size_pos], "%zx", &chunk_size);
|
||||
if (chunk_size > http_response.size()) {
|
||||
// precaution, in case we misread chunk size
|
||||
LOGE("invalid chunk size %u", chunk_size);
|
||||
|
||||
Reference in New Issue
Block a user