Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cc36118 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "wifi: change H2E mode API arguemnt to tri-state enumeration" into sc-dev

parents 6b3fb2d7 1fd7bc32
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -54,6 +54,24 @@ interface ISupplicantStaNetwork extends @1.3::ISupplicantStaNetwork {
        GCMP_128 = 1 << 9,
    };

    /**
     * SAE Hash-to-Element mode.
     */
    enum SaeH2eMode : uint8_t {
        /**
         * Hash-to-Element is disabled, only Hunting & Pecking is allowed.
         */
        DISABLED,
        /**
         * Both Hash-to-Element and Hunting & Pecking are allowed.
         */
        H2E_OPTIONAL,
        /**
         * Only Hash-to-Element is allowed.
         */
        H2E_MANDATORY,
    };

    /**
     * Set group cipher mask for the network.
     *
@@ -154,22 +172,16 @@ interface ISupplicantStaNetwork extends @1.3::ISupplicantStaNetwork {
        generates (SupplicantStatus status);

    /**
     * Set whether to enable SAE H2E (Hash-to-Element) only mode.
     *
     * When enabled, only SAE H2E network is allowed; othewise
     * H&P (Hunting and Pecking) and H2E are both allowed.
     * H&P only mode is not supported.
     * If this API is not called before connecting to a SAE
     * network, the behavior is undefined.
     * Set SAE H2E (Hash-to-Element) mode.
     *
     * @param enable true to set, false otherwise.
     * @param mode SAE H2E supporting mode.
     * @return status Status of the operation.
     *         Possible status codes:
     *         |SupplicantStatusCode.SUCCESS|,
     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
     */
    enableSaeH2eOnlyMode(bool enable) generates (SupplicantStatus status);
    setSaeH2eMode(SaeH2eMode mode) generates (SupplicantStatus status);

    /**
     * Set whether to enable SAE PK (Public Key) only mode to enable public AP validation.
+19 −8
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
using ::android::hardware::wifi::supplicant::V1_4::
    ISupplicantStaNetworkCallback;
using ::android::hardware::wifi::V1_0::IWifi;
using ISupplicantStaNetworkV1_4 =
    ::android::hardware::wifi::supplicant::V1_4::ISupplicantStaNetwork;
using SupplicantStatusV1_4 =
    ::android::hardware::wifi::supplicant::V1_4::SupplicantStatus;
using SupplicantStatusCodeV1_4 =
@@ -110,14 +112,23 @@ TEST_P(SupplicantStaNetworkHidlTest, RegisterCallback_1_4) {
}

/*
 * enable SAE H2E (Hash-to-Element) only mode
 * set SAE H2E (Hash-to-Element) mode
 */
TEST_P(SupplicantStaNetworkHidlTest, EnableSaeH2eOnlyMode) {
    v1_4->enableSaeH2eOnlyMode(true, [&](const SupplicantStatusV1_4& status) {
        EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS, status.code);
TEST_P(SupplicantStaNetworkHidlTest, SetSaeH2eMode) {
    v1_4->setSaeH2eMode(ISupplicantStaNetworkV1_4::SaeH2eMode::DISABLED,
                        [&](const SupplicantStatusV1_4& status) {
                            EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS,
                                      status.code);
                        });
    v1_4->enableSaeH2eOnlyMode(false, [&](const SupplicantStatusV1_4& status) {
        EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS, status.code);
    v1_4->setSaeH2eMode(ISupplicantStaNetworkV1_4::SaeH2eMode::H2E_MANDATORY,
                        [&](const SupplicantStatusV1_4& status) {
                            EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS,
                                      status.code);
                        });
    v1_4->setSaeH2eMode(ISupplicantStaNetworkV1_4::SaeH2eMode::H2E_OPTIONAL,
                        [&](const SupplicantStatusV1_4& status) {
                            EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS,
                                      status.code);
                        });
}