3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

hotspot: implement hotspot profile encryption

Using storage_decrypt() hotspot can also support profile encyption.
The hotspot consortium name is used as the 'ssid' since this stays
consistent between hotspot networks for any profile.
This commit is contained in:
James Prestwood 2022-02-03 08:43:09 -08:00 committed by Denis Kenzior
parent 01cd858760
commit 64f225df6e

View File

@ -95,12 +95,17 @@ static struct l_settings *hotspot_network_open(struct network_info *info)
settings = l_settings_new();
if (!l_settings_load_from_file(settings, config->filename)) {
l_settings_free(settings);
return NULL;
}
if (!l_settings_load_from_file(settings, config->filename))
goto error;
if (!storage_decrypt(settings, config->filename, config->name))
goto error;
return settings;
error:
l_settings_free(settings);
return NULL;
}
static void hotspot_network_sync(struct network_info *info,
@ -111,7 +116,12 @@ static void hotspot_network_sync(struct network_info *info,
struct hs20_config *config = l_container_of(info, struct hs20_config,
super);
data = l_settings_to_data(settings, &length);
data = __storage_encrypt(settings, config->name, &length);
if (!data) {
l_error("Unable to sync profile %s", config->filename);
return;
}
write_file(data, length, true, "%s", config->filename);
l_free(data);
}
@ -338,6 +348,11 @@ static struct hs20_config *hs20_config_new(struct l_settings *settings,
goto free_values;
}
if (!storage_decrypt(settings, filename, name)) {
l_error("Could not open hotspot profile %s", filename);
goto free_values;
}
config = l_new(struct hs20_config, 1);
if (hessid_str) {