Merge "KeyMint: more warnings around non-secure test impl" into main
diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
index 140b956..aaf436f 100644
--- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
+++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
@@ -1095,6 +1095,37 @@
}
+/**
+ * VSR-5.3.14-012 MUST support at least eight LE concurrent connections with
+ * three in peripheral role.
+ */
+// @VsrTest = 5.3.14-012
+TEST_P(BluetoothAidlTest, Vsr_BlE_Connection_Requirement) {
+ std::vector<uint8_t> version_event;
+ send_and_wait_for_cmd_complete(ReadLocalVersionInformationBuilder::Create(),
+ version_event);
+ auto version_view = ReadLocalVersionInformationCompleteView::Create(
+ CommandCompleteView::Create(EventView::Create(PacketView<true>(
+ std::make_shared<std::vector<uint8_t>>(version_event)))));
+ ASSERT_TRUE(version_view.IsValid());
+ ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, version_view.GetStatus());
+ auto version = version_view.GetLocalVersionInformation();
+ if (version.hci_version_ < ::bluetooth::hci::HciVersion::V_5_0) {
+ // This test does not apply to controllers below 5.0
+ return;
+ };
+
+ int max_connections = ::android::base::GetIntProperty(
+ "bluetooth.core.le.max_number_of_concurrent_connections", -1);
+ if (max_connections == -1) {
+ // With the property not set the default minimum of 8 will be used
+ ALOGI("Max number of LE concurrent connections isn't set");
+ return;
+ }
+ ALOGI("Max number of LE concurrent connections = %d", max_connections);
+ ASSERT_GE(max_connections, 8);
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BluetoothAidlTest);
INSTANTIATE_TEST_SUITE_P(PerInstance, BluetoothAidlTest,
testing::ValuesIn(android::getAidlHalInstanceNames(
diff --git a/bluetooth/finder/aidl/vts/VtsHalBluetoothFinderTargetTest.cpp b/bluetooth/finder/aidl/vts/VtsHalBluetoothFinderTargetTest.cpp
index fee9e242..be07a7d 100644
--- a/bluetooth/finder/aidl/vts/VtsHalBluetoothFinderTargetTest.cpp
+++ b/bluetooth/finder/aidl/vts/VtsHalBluetoothFinderTargetTest.cpp
@@ -18,7 +18,6 @@
#include <aidl/Vintf.h>
#include <aidl/android/hardware/bluetooth/finder/IBluetoothFinder.h>
#include <android-base/logging.h>
-#include <android-base/properties.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <binder/IServiceManager.h>
@@ -72,12 +71,6 @@
return bluetooth_finder->getPoweredOffFinderMode(status);
}
-TEST_P(BluetoothFinderTest, PropertyIsSet) {
- ASSERT_EQ(
- android::base::GetProperty("ro.bluetooth.finder.supported", "false"),
- "true");
-}
-
TEST_P(BluetoothFinderTest, SendEidsSingle) {
ScopedAStatus status = sendEids(1);
ASSERT_TRUE(status.isOk());
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index b65218f..65a4645 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -22,6 +22,7 @@
#include <algorithm>
#include <iostream>
#include <map>
+#include <set>
#include <openssl/curve25519.h>
#include <openssl/ec.h>
@@ -3588,6 +3589,42 @@
}
/*
+ * SigningOperationsTest.HmacMessageDigestUnique
+ *
+ * Verifies that HMAC with different keys gives different results.
+ */
+TEST_P(SigningOperationsTest, HmacMessageDigestUnique) {
+ for (int key_len : {64, 128, 192, 256, 512}) {
+ for (int msg_len = 0; msg_len <= 30; msg_len += 10) {
+ string message = string(msg_len, 'x');
+ for (auto digest : ValidDigests(false /* withNone */, false /* withMD5 */)) {
+ SCOPED_TRACE(testing::Message() << "Digest::" << digest << "::MsgLen::" << msg_len);
+
+ int count = 10;
+ std::set<string> results;
+ for (int ii = 0; ii < count; ii++) {
+ ASSERT_EQ(ErrorCode::OK,
+ GenerateKey(AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .HmacKey(key_len)
+ .Digest(digest)
+ .Authorization(TAG_MIN_MAC_LENGTH, 160)))
+ << "Failed to create HMAC key with digest " << digest;
+ string signature = MacMessage(message, digest, 160);
+ EXPECT_EQ(160U / 8U, signature.size())
+ << "Failed to sign with HMAC key with digest " << digest;
+ CheckedDeleteKey();
+ results.insert(signature);
+ }
+ EXPECT_EQ(results.size(), count)
+ << "HMAC of a message '" << message << "' with " << count
+ << " fresh keys only gave " << results.size() << " distinct results";
+ }
+ }
+ }
+}
+
+/*
* SigningOperationsTest.HmacSha256TooLargeMacLength
*
* Verifies that HMAC fails in the correct way when asked to generate a MAC larger than the