Fix OEMCrypto test issues identified by Coverity

Change-Id: Ic9f4982bf022292d10a0a88f10648a46077ec0cf
This commit is contained in:
Ian Benz
2024-01-19 23:28:28 +00:00
committed by Robert Shih
parent 28c2345413
commit 35cf9c2f99
7 changed files with 38 additions and 36 deletions

View File

@@ -1269,13 +1269,13 @@ TEST_F(OEMCryptoLoadsCertificate, RSAPerformance) {
}
auto delta_time = clock.now() - start_time;
const double provision_time =
delta_time / std::chrono::milliseconds(1) / count;
delta_time / std::chrono::milliseconds(1) / static_cast<double>(count);
Session session;
ASSERT_NO_FATAL_FAILURE(CreateWrappedDRMKey());
start_time = clock.now();
count = 0;
while (clock.now() - start_time < kTestDuration) {
do {
Session s;
ASSERT_NO_FATAL_FAILURE(s.open());
ASSERT_NO_FATAL_FAILURE(s.LoadWrappedRsaDrmKey(wrapped_drm_key_));
@@ -1309,10 +1309,10 @@ TEST_F(OEMCryptoLoadsCertificate, RSAPerformance) {
signature.data(), &signature_length, kSign_RSASSA_PSS);
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
count++;
}
} while (clock.now() - start_time < kTestDuration);
delta_time = clock.now() - start_time;
const double license_request_time =
delta_time / std::chrono::milliseconds(1) / count;
delta_time / std::chrono::milliseconds(1) / static_cast<double>(count);
Session s;
ASSERT_NO_FATAL_FAILURE(s.open());
@@ -1345,17 +1345,18 @@ TEST_F(OEMCryptoLoadsCertificate, RSAPerformance) {
"b9f58fc1dacbf74b59d354a1e62cfa0e"
"bf");
start_time = clock.now();
while (clock.now() - start_time < kTestDuration) {
count = 0;
do {
ASSERT_EQ(OEMCrypto_SUCCESS,
OEMCrypto_DeriveKeysFromSessionKey(
s.session_id(), enc_session_key.data(),
enc_session_key.size(), mac_context.data(),
mac_context.size(), enc_context.data(), enc_context.size()));
count++;
}
} while (clock.now() - start_time < kTestDuration);
delta_time = clock.now() - start_time;
const double derive_keys_time =
delta_time / std::chrono::milliseconds(1) / count;
delta_time / std::chrono::milliseconds(1) / static_cast<double>(count);
OEMCrypto_Security_Level level = OEMCrypto_SecurityLevel();
printf(