]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-SIM/AKA: Separate identity for MK derivation
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 8 Dec 2017 15:05:40 +0000 (17:05 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 21 Jan 2018 09:28:53 +0000 (11:28 +0200)
This allows a separate configuration parameter (imsi_identity) to be
used in EAP-SIM/AKA/AKA' profiles to override the identity used in MK
derivation for the case where the identity is expected to be from the
last AT_IDENTITY attribute (or EAP-Response/Identity if AT_IDENTITY was
not used). This may be needed to avoid sending out an unprotected
permanent identity information over-the-air and if the EAP-SIM/AKA
server ends up using a value based on the real IMSI during the internal
key derivation operation (that does not expose the data to others).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/eap_peer/eap_aka.c
src/eap_peer/eap_config.h
src/eap_peer/eap_sim.c
wpa_supplicant/config.c
wpa_supplicant/config_file.c
wpa_supplicant/config_winreg.c

index f7e3cd6b8974c4e3adc2d7e1d05e7218a49b6859..7a6bfc99f0c3fc7119274c584db195f2b7e71e91 100644 (file)
@@ -1025,8 +1025,17 @@ static struct wpabuf * eap_aka_process_challenge(struct eap_sm *sm,
        } else if (data->pseudonym) {
                identity = data->pseudonym;
                identity_len = data->pseudonym_len;
-       } else
-               identity = eap_get_config_identity(sm, &identity_len);
+       } else {
+               struct eap_peer_config *config;
+
+               config = eap_get_config(sm);
+               if (config && config->imsi_identity) {
+                       identity = config->imsi_identity;
+                       identity_len = config->imsi_identity_len;
+               } else {
+                       identity = eap_get_config_identity(sm, &identity_len);
+               }
+       }
        wpa_hexdump_ascii(MSG_DEBUG, "EAP-AKA: Selected identity for MK "
                          "derivation", identity, identity_len);
        if (data->eap_method == EAP_TYPE_AKA_PRIME) {
index 16521c3a180d2a37da8d092d3e462a1166fe7a0a..d416afd56d59f27ab72b46e5ffed170f86e06049 100644 (file)
@@ -46,6 +46,9 @@ struct eap_peer_config {
         */
        size_t anonymous_identity_len;
 
+       u8 *imsi_identity;
+       size_t imsi_identity_len;
+
        /**
         * password - Password string for EAP
         *
index 25f592cded5dad2fca64ea642349a21ccf1b41a0..cd687cbf8849f0876bbb55d1652c8576d58a472b 100644 (file)
@@ -767,8 +767,17 @@ static struct wpabuf * eap_sim_process_challenge(struct eap_sm *sm,
        } else if (data->pseudonym) {
                identity = data->pseudonym;
                identity_len = data->pseudonym_len;
-       } else
-               identity = eap_get_config_identity(sm, &identity_len);
+       } else {
+               struct eap_peer_config *config;
+
+               config = eap_get_config(sm);
+               if (config && config->imsi_identity) {
+                       identity = config->imsi_identity;
+                       identity_len = config->imsi_identity_len;
+               } else {
+                       identity = eap_get_config_identity(sm, &identity_len);
+               }
+       }
        wpa_hexdump_ascii(MSG_DEBUG, "EAP-SIM: Selected identity for MK "
                          "derivation", identity, identity_len);
        eap_sim_derive_mk(identity, identity_len, data->nonce_mt,
index 0ee4d2f4cb6fa4da76ee815eba68425e9aa3a7a9..c13383d8035bab27fd734c63bdb967aba0636da0 100644 (file)
@@ -2154,6 +2154,7 @@ static const struct parse_data ssid_fields[] = {
        { FUNC(eap) },
        { STR_LENe(identity) },
        { STR_LENe(anonymous_identity) },
+       { STR_LENe(imsi_identity) },
        { FUNC_KEY(password) },
        { STRe(ca_cert) },
        { STRe(ca_path) },
@@ -2412,6 +2413,7 @@ static void eap_peer_config_free(struct eap_peer_config *eap)
        os_free(eap->eap_methods);
        bin_clear_free(eap->identity, eap->identity_len);
        os_free(eap->anonymous_identity);
+       os_free(eap->imsi_identity);
        bin_clear_free(eap->password, eap->password_len);
        os_free(eap->ca_cert);
        os_free(eap->ca_path);
index 370fe2af0b42b594d6af4ca100a7a58b05d249ab..6f2161ea63898f4fe11cb703e81f62f5c85a7f36 100644 (file)
@@ -760,6 +760,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
        write_eap(f, ssid);
        STR(identity);
        STR(anonymous_identity);
+       STR(imsi_identity);
        STR(password);
        STR(ca_cert);
        STR(ca_path);
index 24f496b103735ecc531cb478059261d469196c96..0ba1aa5e8bed76993ae577407590419f545f6f50 100644 (file)
@@ -880,6 +880,7 @@ static int wpa_config_write_network(HKEY hk, struct wpa_ssid *ssid, int id)
        write_eap(netw, ssid);
        STR(identity);
        STR(anonymous_identity);
+       STR(imsi_identity);
        STR(password);
        STR(ca_cert);
        STR(ca_path);