mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
eap-tls-common: Introduce variant data and reset API
This commit is contained in:
parent
bb98101bd4
commit
779f668ab9
@ -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",
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user