Merge changes I10f0c1bc,I4abad9d6,Ic1d42756 into tm-dev am: d210233e58

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/17300766

Change-Id: Idef2f4b8dfb60bead7bdaa8f370b2ebf853e045c
This commit is contained in:
Rahul Frias
2022-03-22 23:06:57 +00:00
committed by Automerger Merge Worker
3 changed files with 17 additions and 7 deletions

View File

@@ -1447,8 +1447,13 @@ CdmResponseType CryptoSession::GetBootCertificateChain(
&additional_signature_length);
});
}
return MapOEMCryptoResult(sts, GET_BOOT_CERTIFICATE_CHAIN_ERROR,
"GetBootCertificateChain");
if (sts != OEMCrypto_SUCCESS) {
return MapOEMCryptoResult(sts, GET_BOOT_CERTIFICATE_CHAIN_ERROR,
"GetBootCertificateChain");
}
bcc->resize(bcc_length);
additional_signature->resize(additional_signature_length);
return NO_ERROR;
}
CdmResponseType CryptoSession::GenerateCertificateKeyPair(
@@ -1494,6 +1499,11 @@ CdmResponseType CryptoSession::GenerateCertificateKeyPair(
&wrapped_private_key_length, &oemcrypto_key_type),
metrics_, oemcrypto_generate_certificate_key_pair_, status);
});
if (status != OEMCrypto_SUCCESS) {
return MapOEMCryptoResult(status, GENERATE_CERTIFICATE_KEY_PAIR_ERROR,
"GenerateCertificateKeyPair");
}
public_key->resize(public_key_length);
public_key_signature->resize(public_key_signature_length);
wrapped_private_key->resize(wrapped_private_key_length);
@@ -1505,13 +1515,10 @@ CdmResponseType CryptoSession::GenerateCertificateKeyPair(
} else {
LOGE("Unexpected key type returned from GenerateCertificateKeyPair: %d",
static_cast<int>(oemcrypto_key_type));
return MapOEMCryptoResult(status,
GENERATE_CERTIFICATE_KEY_PAIR_UNKNOWN_TYPE_ERROR,
"GenerateCertificateKeyPair");
return GENERATE_CERTIFICATE_KEY_PAIR_UNKNOWN_TYPE_ERROR;
}
return MapOEMCryptoResult(status, GENERATE_CERTIFICATE_KEY_PAIR_ERROR,
"GenerateCertificateKeyPair");
return NO_ERROR;
}
CdmResponseType CryptoSession::LoadOemCertificatePrivateKey(

View File

@@ -1407,6 +1407,7 @@ Session::Session()
Session::~Session() {
if (!forced_session_id_ && open_) close();
if (public_rsa_) RSA_free(public_rsa_);
if (public_ec_) EC_KEY_free(public_ec_);
}
void Session::open() {

View File

@@ -1340,6 +1340,8 @@ TEST_F(OEMCryptoProv40Test, GenerateCertificateKeyPairSuccess) {
} else if (key_type == OEMCrypto_PrivateKeyType::OEMCrypto_ECC_Private_Key) {
ASSERT_NO_FATAL_FAILURE(
s.SetEcPublicKey(public_key.data(), public_key_size));
} else {
FAIL() << "Unknown private key type: " << static_cast<int>(key_type);
}
}