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

Commit 2f82923c authored by Vamsi Krishna's avatar Vamsi Krishna Committed by Sunil Ravi
Browse files

wifi: Add required API to connect to FILS enabled APs

Add support to configure FILS key_mgmt types while adding
configurations for FILS enabled APs. FILS defines two different
AKM suites, one based on SHA256 and the other based on SHA384.
Also add API to enable ERP keys generation while connecting FILS
enabled APs. Once generated, the ERP keys can be used to make faster
connections to the FILS enabled APs which are within the same realm
as that of the AP with which the ERP keys are generated.

FILS also provides provision to exchange Higher Layer Packets(HLPs)
along with association request and association response frames. Add
API to configure HLP packets that can be sent with Association
request while connecting to FILS enabled APs. Also add API to flush the
HLP packets that were already configured during previous connection
requests.

Bug: 143259898
Test: WiFi basic sanity test
Test: VTS test
Change-Id: If5cb0c112d46fa8695b4517f42cb7c6706970751
parent 09e4f297
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -659,9 +659,9 @@ a3eddd9bbdc87e8c22764070037dd1154f1cf006e6fba93364c4f85d4c134a19 android.hardwar
c67aaf26a7a40d14ea61e70e20afacbd0bb906df1704d585ac8599fbb69dd44b android.hardware.wifi.hostapd@1.2::IHostapd
11f6448d15336361180391c8ebcdfd2d7cf77b3782d577e594d583aadc9c2877 android.hardware.wifi.hostapd@1.2::types
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
c72cb37b3f66ef65aeb5c6438a3fbe17bbe847fdf62d1a76eafd7f3a8a526105 android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
168480869108d9c21bd09eb6ac550a2149b7f794ad05a16ae99e1628c75a5eb2 android.hardware.wifi.supplicant@1.3::ISupplicantStaIfaceCallback
8835e9799cddf7c239f60beff467cbdf164331f70a8b6c06ed78982d7810d835 android.hardware.wifi.supplicant@1.3::ISupplicantStaNetwork
8aed0a8e03e7a67bfdfb78ad7529a9ae95bea36e6060473b204c89d772522126 android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
def77c7db95d374f11a111bfc4ed60f92451303642a43276c4e291988fcee625 android.hardware.wifi.supplicant@1.3::ISupplicantStaIfaceCallback
62cf050c593c1ec34b49178b5bdde72dd9b80d9bad3eb184e4f0cd564d28678c android.hardware.wifi.supplicant@1.3::ISupplicantStaNetwork
91015479f5a0fba9872e98d3cca4680995de64f42ae71461b4b7e5acc5a196ab android.hardware.wifi.supplicant@1.3::types
##
# BEGIN Radio HAL Merge Conflict Avoidance Buffer - STOPSHIP if present
+29 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import @1.0::SupplicantStatus;
import @1.2::ISupplicantStaIface;
import ISupplicantStaNetwork;
import ISupplicantStaIfaceCallback;
import @1.0::MacAddress;

/**
 * Interface exposed by the supplicant for each station mode network
@@ -90,4 +91,32 @@ interface ISupplicantStaIface extends @1.2::ISupplicantStaIface {
     */
    getKeyMgmtCapabilities_1_3()
        generates (SupplicantStatus status, bitfield<KeyMgmtMask> keyMgmtMask);

    /**
     * Flush FILS HLP IEs
     * Use this to flush all the HLP IEs in wpa_supplicant
     *
     * @return status Status of the operation.
     *         Possible status codes:
     *         |SupplicantStatusCode.SUCCESS|,
     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
     *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
     *         |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
     */
    filsHlpFlushRequest() generates (SupplicantStatus status);

    /**
     * Add FILS HLP IEs
     * Use this to add a HLP IE to wpa_supplicant
     *
     * @param dst_mac MAC address of the destination
     * @param pkt The contents of the HLP IE starting from ethertype
     * @return status Status of the operation.
     *         Possible status codes:
     *         |SupplicantStatusCode.SUCCESS|,
     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
     *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
     *         |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
     */
    filsHlpAddRequest(MacAddress dst_mac, vec<uint8_t> pkt) generates (SupplicantStatus status);
};
+26 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@
package android.hardware.wifi.supplicant@1.3;

import @1.2::ISupplicantStaIfaceCallback;
import @1.0::ISupplicantStaIfaceCallback.State;
import @1.0::Bssid;
import @1.0::SupplicantNetworkId;
import @1.0::Ssid;

/**
 * Callback Interface exposed by the supplicant service
@@ -190,4 +194,26 @@ interface ISupplicantStaIfaceCallback extends @1.2::ISupplicantStaIfaceCallback
     * Indicates an EAP authentication failure.
     */
    oneway onEapFailure_1_3(uint32_t errorCode);

    /**
     * Used to indicate a state change event on this particular iface. If this
     * event is triggered by a particular network, the |SupplicantNetworkId|,
     * |ssid|, |bssid| parameters must indicate the parameters of the network/AP
     * which caused this state transition.
     *
     * @param newState New State of the interface. This must be one of the |State|
     *        values above.
     * @param bssid BSSID of the corresponding AP which caused this state
     *        change event. This must be zero'ed if this event is not
     *        specific to a particular network.
     * @param id ID of the corresponding network which caused this
     *        state change event. This must be invalid (UINT32_MAX) if this
     *        event is not specific to a particular network.
     * @param ssid SSID of the corresponding network which caused this state
     *        change event. This must be empty if this event is not specific
     *        to a particular network.
     * @param filsHlpSent If FILS HLP IEs were included in this association.
     */
    oneway onStateChanged_1_3(State newState, Bssid bssid, SupplicantNetworkId id, Ssid ssid,
        bool filsHlpSent);
};
+20 −0
Original line number Diff line number Diff line
@@ -44,6 +44,14 @@ interface ISupplicantStaNetwork extends @1.2::ISupplicantStaNetwork {
         * WAPI Cert
         */
        WAPI_CERT = 1 << 13,
        /**
         * FILS shared key authentication with sha-256
         */
        FILS_SHA256 = 1 << 18,
        /**
         * FILS shared key authentication with sha-384
         */
        FILS_SHA384 = 1 << 19,
    };

    /**
@@ -268,4 +276,16 @@ interface ISupplicantStaNetwork extends @1.2::ISupplicantStaNetwork {
     * @return authAlgMask Combination of |AuthAlgMask| values.
     */
    getAuthAlg_1_3() generates (SupplicantStatus status, bitfield<AuthAlgMask> authAlgMask);

    /**
     * Enable EAP ERP for this network.
     *
     * @param enable true to set, false otherwise.
     * @return status Status of the operation.
     *         Possible status codes:
     *         |SupplicantStatusCode.SUCCESS|,
     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
     */
    setEapErp(bool enable) generates (SupplicantStatus status);
};
+83 −0
Original line number Diff line number Diff line
@@ -261,6 +261,12 @@ class IfaceCallback : public ISupplicantStaIfaceCallback {
        const ISupplicantStaIfaceCallback::BssTmData& /* data */) override {
        return Void();
    }
    Return<void> onStateChanged_1_3(
        ISupplicantStaIfaceCallback::State /* newState */,
        const hidl_array<uint8_t, 6>& /*bssid */, uint32_t /* id */,
        const hidl_vec<uint8_t>& /* ssid */, bool /* filsHlpSent */) override {
        return Void();
    }
};

class IfacePmkCacheCallback : public IfaceCallback {
@@ -506,6 +512,83 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) {
        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
    });
}

/*
 * FilsHlpAddRequest
 */
TEST_P(SupplicantStaIfaceHidlTest, FilsHlpAddRequest) {
    uint32_t keyMgmtMask = 0;
    uint8_t destMacAddr[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
    std::vector<uint8_t> pktBuffer = {
        0x08, 0x00, 0x45, 0x10, 0x01, 0x3a, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
        0x39, 0xa4, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x44,
        0x00, 0x43, 0x01, 0x26, 0x77, 0x1e, 0x01, 0x01, 0x06, 0x00, 0x81, 0xf9,
        0xf7, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xc3,
        0x65, 0xca, 0x34, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x63, 0x82, 0x53, 0x63, 0x35, 0x01, 0x01, 0x3d,
        0x07, 0x01, 0x86, 0xc3, 0x65, 0xca, 0x34, 0x63, 0x39, 0x02, 0x05, 0xdc,
        0x3c, 0x0e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2d, 0x64, 0x68,
        0x63, 0x70, 0x2d, 0x52, 0x37, 0x0a, 0x01, 0x03, 0x06, 0x0f, 0x1a, 0x1c,
        0x33, 0x3a, 0x3b, 0x2b, 0xff, 0x00};

    sta_iface_->getKeyMgmtCapabilities_1_3(
        [&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            keyMgmtMask = keyMgmtMaskInternal;
        });

    SupplicantStatusCode expectedStatusCode =
        (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
                        ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384))
            ? SupplicantStatusCode::SUCCESS
            : SupplicantStatusCode::FAILURE_UNKNOWN;

    sta_iface_->filsHlpAddRequest(
        destMacAddr, pktBuffer,
        [expectedStatusCode](const SupplicantStatus& status) {
            EXPECT_EQ(expectedStatusCode, status.code);
        });
}

/*
 * FilsHlpFlushRequest
 */
TEST_P(SupplicantStaIfaceHidlTest, FilsHlpFlushRequest) {
    uint32_t keyMgmtMask = 0;
    sta_iface_->getKeyMgmtCapabilities_1_3(
        [&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            keyMgmtMask = keyMgmtMaskInternal;
        });

    SupplicantStatusCode expectedStatusCode =
        (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
                        ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384))
            ? SupplicantStatusCode::SUCCESS
            : SupplicantStatusCode::FAILURE_UNKNOWN;

    sta_iface_->filsHlpFlushRequest(
        [expectedStatusCode](const SupplicantStatus& status) {
            EXPECT_EQ(expectedStatusCode, status.code);
        });
}
INSTANTIATE_TEST_CASE_P(
    PerInstance, SupplicantStaIfaceHidlTest,
    testing::Combine(
Loading