Merge "OEMCrypto Unit Test Fix: Do Not Derive Keys Immediately" into rvc-dev am: 729723b3d2 am: b349680d3f am: 00792ac231 am: 1c7dab441a
Change-Id: I1bada2a5657eb38a8271d2da2199b145a8966d6c
This commit is contained in:
@@ -1009,7 +1009,7 @@ void Session::GenerateDerivedKeysFromSessionKey() {
|
|||||||
// Uses test certificate.
|
// Uses test certificate.
|
||||||
vector<uint8_t> session_key;
|
vector<uint8_t> session_key;
|
||||||
vector<uint8_t> enc_session_key;
|
vector<uint8_t> enc_session_key;
|
||||||
if (public_rsa_ == nullptr) PreparePublicKey();
|
ASSERT_NE(public_rsa_, nullptr) << "No public RSA key loaded in test code.";
|
||||||
// A failure here probably indicates that there is something wrong with the
|
// A failure here probably indicates that there is something wrong with the
|
||||||
// test program and its dependency on BoringSSL.
|
// test program and its dependency on BoringSSL.
|
||||||
ASSERT_TRUE(GenerateRSASessionKey(&session_key, &enc_session_key));
|
ASSERT_TRUE(GenerateRSASessionKey(&session_key, &enc_session_key));
|
||||||
@@ -1297,12 +1297,11 @@ void Session::VerifyRSASignature(const vector<uint8_t>& message,
|
|||||||
const uint8_t* signature,
|
const uint8_t* signature,
|
||||||
size_t signature_length,
|
size_t signature_length,
|
||||||
RSA_Padding_Scheme padding_scheme) {
|
RSA_Padding_Scheme padding_scheme) {
|
||||||
EXPECT_TRUE(nullptr != public_rsa_)
|
ASSERT_NE(public_rsa_, nullptr) << "No public RSA key loaded in test code.";
|
||||||
<< "No public RSA key loaded in test code.\n";
|
|
||||||
|
|
||||||
EXPECT_EQ(static_cast<size_t>(RSA_size(public_rsa_)), signature_length)
|
ASSERT_EQ(static_cast<size_t>(RSA_size(public_rsa_)), signature_length)
|
||||||
<< "Signature size is wrong. " << signature_length << ", should be "
|
<< "Signature size is wrong. " << signature_length << ", should be "
|
||||||
<< RSA_size(public_rsa_) << "\n";
|
<< RSA_size(public_rsa_);
|
||||||
|
|
||||||
if (padding_scheme == kSign_RSASSA_PSS) {
|
if (padding_scheme == kSign_RSASSA_PSS) {
|
||||||
boringssl_ptr<EVP_PKEY, EVP_PKEY_free> pkey(EVP_PKEY_new());
|
boringssl_ptr<EVP_PKEY, EVP_PKEY_free> pkey(EVP_PKEY_new());
|
||||||
|
|||||||
@@ -81,6 +81,6 @@ void SessionUtil::InstallTestRSAKey(Session* s) {
|
|||||||
ASSERT_NO_FATAL_FAILURE(s->InstallRSASessionTestKey(wrapped_rsa_key_));
|
ASSERT_NO_FATAL_FAILURE(s->InstallRSASessionTestKey(wrapped_rsa_key_));
|
||||||
}
|
}
|
||||||
// Test RSA key should be loaded.
|
// Test RSA key should be loaded.
|
||||||
ASSERT_NO_FATAL_FAILURE(s->GenerateDerivedKeysFromSessionKey());
|
ASSERT_NO_FATAL_FAILURE(s->PreparePublicKey());
|
||||||
}
|
}
|
||||||
} // namespace wvoec
|
} // namespace wvoec
|
||||||
|
|||||||
@@ -688,6 +688,7 @@ TEST_F(OEMCryptoProv30Test, GetCertOnlyAPI16) {
|
|||||||
ASSERT_NO_FATAL_FAILURE(s.open());
|
ASSERT_NO_FATAL_FAILURE(s.open());
|
||||||
// Install the DRM Cert's RSA key.
|
// Install the DRM Cert's RSA key.
|
||||||
ASSERT_NO_FATAL_FAILURE(s.InstallRSASessionTestKey(wrapped_rsa_key_));
|
ASSERT_NO_FATAL_FAILURE(s.InstallRSASessionTestKey(wrapped_rsa_key_));
|
||||||
|
ASSERT_NO_FATAL_FAILURE(s.PreparePublicKey());
|
||||||
// Request the OEM Cert. -- This should NOT load the OEM Private key.
|
// Request the OEM Cert. -- This should NOT load the OEM Private key.
|
||||||
vector<uint8_t> public_cert;
|
vector<uint8_t> public_cert;
|
||||||
size_t public_cert_length = 0;
|
size_t public_cert_length = 0;
|
||||||
@@ -4885,6 +4886,7 @@ class LicenseWithUsageEntry {
|
|||||||
ASSERT_NO_FATAL_FAILURE(session_.open());
|
ASSERT_NO_FATAL_FAILURE(session_.open());
|
||||||
ASSERT_NO_FATAL_FAILURE(session_.ReloadUsageEntry());
|
ASSERT_NO_FATAL_FAILURE(session_.ReloadUsageEntry());
|
||||||
ASSERT_NO_FATAL_FAILURE(util->InstallTestRSAKey(&session_));
|
ASSERT_NO_FATAL_FAILURE(util->InstallTestRSAKey(&session_));
|
||||||
|
ASSERT_NO_FATAL_FAILURE(session_.GenerateDerivedKeysFromSessionKey());
|
||||||
ASSERT_EQ(OEMCrypto_SUCCESS, license_messages_.LoadResponse());
|
ASSERT_EQ(OEMCrypto_SUCCESS, license_messages_.LoadResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6008,6 +6010,7 @@ TEST_P(OEMCryptoUsageTableTest, ReloadUsageTableWithSkew) {
|
|||||||
old_usage_entry_1.data(),
|
old_usage_entry_1.data(),
|
||||||
old_usage_entry_1.size()));
|
old_usage_entry_1.size()));
|
||||||
ASSERT_NO_FATAL_FAILURE(InstallTestRSAKey(&s));
|
ASSERT_NO_FATAL_FAILURE(InstallTestRSAKey(&s));
|
||||||
|
ASSERT_NO_FATAL_FAILURE(s.GenerateDerivedKeysFromSessionKey());
|
||||||
ASSERT_EQ(OEMCrypto_SUCCESS, entry.license_messages().LoadResponse());
|
ASSERT_EQ(OEMCrypto_SUCCESS, entry.license_messages().LoadResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user