Pick widevine oemcrypto-v18 change
No-Typo-Check: From a third party header file Bug: 260918793 Test: unit tests Test: atp v2/widevine-eng/drm_compliance Change-Id: I36effd6a10a99bdb2399ab1f4a0fad026d607c70
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "service_certificate.h"
|
||||
|
||||
#include "cdm_random.h"
|
||||
#include "crypto_key.h"
|
||||
#include "crypto_session.h"
|
||||
#include "license_protocol.pb.h"
|
||||
@@ -238,27 +239,11 @@ CdmResponseType ServiceCertificate::EncryptClientId(
|
||||
encrypted_client_id->set_provider_id(provider_id_);
|
||||
encrypted_client_id->set_service_certificate_serial_number(serial_number_);
|
||||
|
||||
std::string iv(KEY_IV_SIZE, 0);
|
||||
std::string key(SERVICE_KEY_SIZE, 0);
|
||||
|
||||
CdmResponseType status = crypto_session->GetRandom(
|
||||
key.size(), reinterpret_cast<uint8_t*>(&key[0]));
|
||||
|
||||
if (status != NO_ERROR) {
|
||||
LOGE("GetRandom failed for key: status = %d", static_cast<int>(status));
|
||||
return (status == RANDOM_GENERATION_ERROR)
|
||||
? CdmResponseType(CLIENT_ID_GENERATE_RANDOM_ERROR)
|
||||
: status;
|
||||
}
|
||||
|
||||
status =
|
||||
crypto_session->GetRandom(iv.size(), reinterpret_cast<uint8_t*>(&iv[0]));
|
||||
|
||||
if (status != NO_ERROR) {
|
||||
LOGE("GetRandom failed for IV: status = %d", static_cast<int>(status));
|
||||
return (status == RANDOM_GENERATION_ERROR)
|
||||
? CdmResponseType(CLIENT_ID_GENERATE_RANDOM_ERROR)
|
||||
: status;
|
||||
std::string iv = wvutil::CdmRandom::RandomData(KEY_IV_SIZE);
|
||||
std::string key = wvutil::CdmRandom::RandomData(SERVICE_KEY_SIZE);
|
||||
if (key.length() != SERVICE_KEY_SIZE || iv.length() != KEY_IV_SIZE) {
|
||||
LOGE("RandomData failed for key or iv.");
|
||||
return CdmResponseType(CLIENT_ID_GENERATE_RANDOM_ERROR);
|
||||
}
|
||||
std::string id, enc_id, enc_key;
|
||||
clear_client_id->SerializeToString(&id);
|
||||
|
||||
Reference in New Issue
Block a user