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

eap-tls-common: Introduce eap_tls_variant_ops

eap_tls_variant_ops will allow methods such as TTLS, PEAP,
etc. to specify their own handlers for the Phase 2 operations.
This commit is contained in:
Tim Kourt 2018-11-29 14:41:28 -08:00 committed by Denis Kenzior
parent d558724676
commit 7aa35bf6c7
2 changed files with 17 additions and 4 deletions

View File

@ -82,6 +82,8 @@ struct eap_tls_state {
char *client_cert;
char *client_key;
char *passphrase;
const struct eap_tls_variant_ops *variant_ops;
};
static void __eap_tls_common_state_reset(struct eap_tls_state *eap_tls)
@ -222,8 +224,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)
struct l_settings *settings, const char *prefix,
const struct eap_tls_variant_ops *variant_ops)
{
struct eap_tls_state *eap_tls;
char setting_key[72];
@ -231,6 +233,7 @@ bool eap_tls_common_settings_load(struct eap_state *eap,
eap_tls = l_new(struct eap_tls_state, 1);
eap_tls->version_negotiated = EAP_TLS_VERSION_NOT_NEGOTIATED;
eap_tls->variant_ops = variant_ops;
snprintf(setting_key, sizeof(setting_key), "%sCACert", prefix);
eap_tls->ca_cert = l_settings_get_string(settings, "Security",

View File

@ -39,6 +39,16 @@ enum eap_tls_version {
EAP_TLS_VERSION_NOT_NEGOTIATED = 0x08,
};
struct eap_tls_variant_ops {
enum eap_tls_version version_max_supported;
bool (*tunnel_ready)(struct eap_state *eap, const char *peer_identity);
bool (*tunnel_handle_request)(struct eap_state *eap,
const uint8_t *data, size_t data_len);
void (*reset)(void *variant_data);
void (*destroy)(void *variant_data);
};
void eap_tls_common_state_free(struct eap_state *eap);
int eap_tls_common_settings_check(struct l_settings *settings,
@ -46,5 +56,5 @@ int eap_tls_common_settings_check(struct l_settings *settings,
const char *prefix,
struct l_queue **out_missing);
bool eap_tls_common_settings_load(struct eap_state *eap,
struct l_settings *settings,
const char *prefix);
struct l_settings *settings, const char *prefix,
const struct eap_tls_variant_ops *variant_ops);