3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

eap-tls-common: Introduce variant data and reset API

This commit is contained in:
Tim Kourt 2018-11-29 14:41:40 -08:00 committed by Denis Kenzior
parent bb98101bd4
commit 779f668ab9
2 changed files with 22 additions and 2 deletions

View File

@ -112,6 +112,7 @@ struct eap_tls_state {
char *passphrase;
const struct eap_tls_variant_ops *variant_ops;
void *variant_data;
};
static void __eap_tls_common_state_reset(struct eap_tls_state *eap_tls)
@ -145,6 +146,18 @@ static void __eap_tls_common_state_reset(struct eap_tls_state *eap_tls)
}
}
bool eap_tls_common_state_reset(struct eap_state *eap)
{
struct eap_tls_state *eap_tls = eap_get_data(eap);
__eap_tls_common_state_reset(eap_tls);
if (eap_tls->variant_ops->reset)
eap_tls->variant_ops->reset(eap_tls->variant_data);
return true;
}
void eap_tls_common_state_free(struct eap_state *eap)
{
struct eap_tls_state *eap_tls = eap_get_data(eap);
@ -153,6 +166,9 @@ void eap_tls_common_state_free(struct eap_state *eap)
eap_set_data(eap, NULL);
if (eap_tls->variant_ops->destroy)
eap_tls->variant_ops->destroy(eap_tls->variant_data);
l_free(eap_tls->ca_cert);
l_free(eap_tls->client_cert);
l_free(eap_tls->client_key);
@ -767,7 +783,8 @@ int eap_tls_common_settings_check(struct l_settings *settings,
bool eap_tls_common_settings_load(struct eap_state *eap,
struct l_settings *settings, const char *prefix,
const struct eap_tls_variant_ops *variant_ops)
const struct eap_tls_variant_ops *variant_ops,
void *variant_data)
{
struct eap_tls_state *eap_tls;
char setting_key[72];
@ -776,6 +793,7 @@ bool eap_tls_common_settings_load(struct eap_state *eap,
eap_tls->version_negotiated = EAP_TLS_VERSION_NOT_NEGOTIATED;
eap_tls->variant_ops = variant_ops;
eap_tls->variant_data = variant_data;
snprintf(setting_key, sizeof(setting_key), "%sCACert", prefix);
eap_tls->ca_cert = l_settings_get_string(settings, "Security",

View File

@ -49,6 +49,7 @@ struct eap_tls_variant_ops {
void (*destroy)(void *variant_data);
};
bool eap_tls_common_state_reset(struct eap_state *eap);
void eap_tls_common_state_free(struct eap_state *eap);
void eap_tls_common_set_completed(struct eap_state *eap);
@ -65,4 +66,5 @@ int eap_tls_common_settings_check(struct l_settings *settings,
struct l_queue **out_missing);
bool eap_tls_common_settings_load(struct eap_state *eap,
struct l_settings *settings, const char *prefix,
const struct eap_tls_variant_ops *variant_ops);
const struct eap_tls_variant_ops *variant_ops,
void *variant_data);