Source release 18.6.0

This commit is contained in:
Alex Dale
2024-06-27 12:54:34 -07:00
parent 28ec8548c6
commit 20c0587dcb
56 changed files with 1191 additions and 35538 deletions

View File

@@ -690,7 +690,7 @@ CdmResponseType CryptoSession::GetProvisioningToken(
additional_token);
} else if (pre_provision_token_type_ ==
kClientTokenDrmCertificateReprovisioning) {
status = GetTokenFromEmbeddedCertificate(token);
status = GetTokenFromEmbeddedCertificate(requested_security_level, token);
}
metrics_->crypto_session_get_token_.Increment(status);
return status;
@@ -984,6 +984,15 @@ CdmResponseType CryptoSession::Open(
return CdmResponseType(NO_ERROR);
}
CdmResponseType CryptoSession::MarkOfflineSession() {
OEMCryptoResult sts;
WithOecSessionLock("MarkOfflineSession", [&] {
sts = OEMCrypto_MarkOfflineSession(oec_session_id_);
});
if (sts == OEMCrypto_ERROR_NOT_IMPLEMENTED) sts = OEMCrypto_SUCCESS;
return MapOEMCryptoResult(sts, LOAD_KEY_ERROR, "MarkOfflineSession");
}
void CryptoSession::Close() {
LOGV("Closing crypto session: id = %u, open = %s", oec_session_id_,
open_ ? "true" : "false");
@@ -1259,7 +1268,7 @@ CdmResponseType CryptoSession::PrepareAndSignProvisioningRequest(
}
OEMCryptoResult sts;
// TODO: b/305093063 - Refactor to a switch statement to improve readability
// TODO: b/330770643 - Refactor to a switch statement to improve readability
if (pre_provision_token_type_ == kClientTokenKeybox) {
should_specify_algorithm = false;
const CdmResponseType status = GenerateDerivedKeys(message);
@@ -1454,19 +1463,19 @@ CdmResponseType CryptoSession::GetBootCertificateChain(
}
CdmResponseType CryptoSession::GetTokenFromEmbeddedCertificate(
std::string* token) {
RequestedSecurityLevel requested_security_level, std::string* token) {
RETURN_IF_UNINITIALIZED(CRYPTO_SESSION_NOT_INITIALIZED);
RETURN_IF_NULL(token, PARAMETER_NULL);
token->clear();
CdmClientTokenType token_type = kClientTokenUninitialized;
const CdmResponseType sts =
GetProvisioningMethod(requested_security_level_, &token_type);
GetProvisioningMethod(requested_security_level, &token_type);
if (sts != NO_ERROR) {
LOGE("Failed to get token type");
return sts;
}
if (token_type != kClientTokenDrmCertificateReprovisioning) {
token->clear();
return CdmResponseType(NO_ERROR);
}
@@ -1475,7 +1484,7 @@ CdmResponseType CryptoSession::GetTokenFromEmbeddedCertificate(
OEMCryptoResult status =
WithOecReadLock("GetTokenFromEmbeddedCertificate - attempt 1", [&] {
return OEMCrypto_GetEmbeddedDrmCertificate(
reinterpret_cast<uint8_t*>(&embedded_certificate.front()),
MutableStringDataPointer(&embedded_certificate),
&certificate_length);
});
@@ -1484,26 +1493,27 @@ CdmResponseType CryptoSession::GetTokenFromEmbeddedCertificate(
status =
WithOecReadLock("GetTokenFromEmbeddedCertificate - attempt 2", [&] {
return OEMCrypto_GetEmbeddedDrmCertificate(
reinterpret_cast<uint8_t*>(&embedded_certificate.front()),
MutableStringDataPointer(&embedded_certificate),
&certificate_length);
});
}
if (status == OEMCrypto_SUCCESS) {
// TODO: b/312782308 - Store embedded certificate as SignedDrmCertificate
video_widevine_client::sdk::HashedFile hashed_file;
video_widevine_client::sdk::File file;
embedded_certificate.resize(certificate_length);
if (hashed_file.ParseFromString(embedded_certificate) &&
file.ParseFromString(hashed_file.file())) {
*token = file.device_certificate().certificate();
return CdmResponseType(NO_ERROR);
}
if (status != OEMCrypto_SUCCESS) {
return MapOEMCryptoResult(status, GET_TOKEN_FROM_EMBEDDED_CERT_ERROR,
"GetTokenFromEmbeddedCertificate");
}
embedded_certificate.resize(certificate_length);
token->clear();
return MapOEMCryptoResult(status, GET_TOKEN_FROM_EMBEDDED_CERT_ERROR,
"GetTokenFromEmbeddedCertificate");
// TODO: b/312782308 - Store embedded certificate as SignedDrmCertificate
video_widevine_client::sdk::HashedFile hashed_file;
video_widevine_client::sdk::File file;
if (!hashed_file.ParseFromString(embedded_certificate) ||
!file.ParseFromString(hashed_file.file())) {
LOGE("Failed to parse embedded certificate");
return CdmResponseType(GET_TOKEN_FROM_EMBEDDED_CERT_ERROR);
}
*token = file.device_certificate().certificate();
return CdmResponseType(NO_ERROR);
}
CdmResponseType CryptoSession::GetDeviceInformation(