Revise cdm signing api and test
[ Merge of http://go/wvgerrit/178131 ] Bug: 279671867 Bug: 279672538 Test: com.google.android.wvts Change-Id: If2e2c6d250c0379c217b3f9b21efb197c9ae4fd6 (cherry picked from commit 1e05d16ddeaeff5de994e30aa713cd74bed21400)
This commit is contained in:
@@ -2341,7 +2341,7 @@ void CdmEngine::SetFastOtaKeyboxFallbackDurationRules() {
|
||||
system_fallback_policy->SetFastBackoffDurationRules();
|
||||
}
|
||||
|
||||
CdmResponseType CdmEngine::SignRSA(const std::string& wrapped_key,
|
||||
CdmResponseType CdmEngine::SignRsa(const std::string& wrapped_key,
|
||||
const std::string& message,
|
||||
std::string* signature,
|
||||
RSA_Padding_Scheme padding_scheme) {
|
||||
@@ -2355,9 +2355,13 @@ CdmResponseType CdmEngine::SignRSA(const std::string& wrapped_key,
|
||||
|
||||
// Retrieve the cdm session
|
||||
std::shared_ptr<CdmSession> session;
|
||||
if (!session_map_.FindSession(session_id, &session)) {
|
||||
LOGE("Session not found: session_id = %s", IdToString(session_id));
|
||||
return CdmResponseType(SESSION_NOT_FOUND_24);
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock(session_map_lock_);
|
||||
if (!session_map_.FindSession(session_id, &session)) {
|
||||
LOGE("Session not found: session_id = %s", IdToString(session_id));
|
||||
CloseSession(session_id);
|
||||
return CdmResponseType(SESSION_NOT_FOUND_24);
|
||||
}
|
||||
}
|
||||
|
||||
// Load cast private key for signing
|
||||
@@ -2365,13 +2369,15 @@ CdmResponseType CdmEngine::SignRSA(const std::string& wrapped_key,
|
||||
sts = session->LoadCastPrivateKey(key);
|
||||
if (sts != NO_ERROR) {
|
||||
LOGE("LoadCastPrivateKey failed, status: %d", static_cast<int>(sts));
|
||||
CloseSession(session_id);
|
||||
return sts;
|
||||
}
|
||||
|
||||
// Generate Rsa signature for cast message
|
||||
sts = session->GenerateRSASignature(message, signature, padding_scheme);
|
||||
sts = session->GenerateRsaSignature(message, signature, padding_scheme);
|
||||
if (sts != NO_ERROR) {
|
||||
LOGE("GenerateRSASignature failed, status: %d", static_cast<int>(sts));
|
||||
LOGE("GenerateRsaSignature failed, status: %d", static_cast<int>(sts));
|
||||
CloseSession(session_id);
|
||||
return sts;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user