commit 7aa35bf6c77f1a4669111c61ebfd59befc33ea22
parent d558724676fab34c12d0a168565f29b80154e72c
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Thu, 29 Nov 2018 14:41:28 -0800
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.
Diffstat:
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/eap-tls-common.c b/src/eap-tls-common.c
@@ -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",
diff --git a/src/eap-tls-common.h b/src/eap-tls-common.h
@@ -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);