eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

eap-tls-common.h (3450B)


      1 /*
      2  *
      3  *  Wireless daemon for Linux
      4  *
      5  *  Copyright (C) 2018-2019  Intel Corporation. All rights reserved.
      6  *
      7  *  This library is free software; you can redistribute it and/or
      8  *  modify it under the terms of the GNU Lesser General Public
      9  *  License as published by the Free Software Foundation; either
     10  *  version 2.1 of the License, or (at your option) any later version.
     11  *
     12  *  This library is distributed in the hope that it will be useful,
     13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15  *  Lesser General Public License for more details.
     16  *
     17  *  You should have received a copy of the GNU Lesser General Public
     18  *  License along with this library; if not, write to the Free Software
     19  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20  *
     21  */
     22 
     23 typedef struct l_settings *(*eap_tls_session_cache_load_func_t)(void);
     24 typedef void (*eap_tls_session_cache_sync_func_t)(const struct l_settings *);
     25 
     26 enum eap_tls_version {
     27 	EAP_TLS_VERSION_0               = 0x00,
     28 	EAP_TLS_VERSION_1               = 0x01,
     29 	EAP_TLS_VERSION_MASK            = 0x07,
     30 	EAP_TLS_VERSION_NOT_NEGOTIATED  = 0x08,
     31 };
     32 
     33 struct eap_tls_variant_ops {
     34 	enum eap_tls_version version_max_supported;
     35 
     36 	bool (*tunnel_ready)(struct eap_state *eap, const char *peer_identity,
     37 				bool resumed);
     38 	bool (*tunnel_handle_request)(struct eap_state *eap,
     39 					const uint8_t *data, size_t data_len);
     40 	void (*reset)(void *variant_data);
     41 	void (*destroy)(void *variant_data);
     42 };
     43 
     44 bool eap_tls_common_state_reset(struct eap_state *eap);
     45 void eap_tls_common_state_free(struct eap_state *eap);
     46 
     47 void eap_tls_common_set_completed(struct eap_state *eap);
     48 void eap_tls_common_set_phase2_failed(struct eap_state *eap);
     49 
     50 void eap_tls_common_handle_request(struct eap_state *eap,
     51 					const uint8_t *pkt, size_t len);
     52 void eap_tls_common_handle_retransmit(struct eap_state *eap,
     53 						const uint8_t *pkt, size_t len);
     54 
     55 struct l_certchain *eap_tls_load_client_cert(struct l_settings *settings,
     56 						const char *value,
     57 						const char *passphrase,
     58 						bool *out_is_encrypted);
     59 struct l_key *eap_tls_load_priv_key(struct l_settings *settings,
     60 					const char *value,
     61 					const char *passphrase,
     62 					bool *out_is_encrypted);
     63 
     64 int eap_tls_common_settings_check(struct l_settings *settings,
     65 						struct l_queue *secrets,
     66 						const char *prefix,
     67 						struct l_queue **out_missing);
     68 bool eap_tls_common_settings_load(struct eap_state *eap,
     69 				struct l_settings *settings, const char *prefix,
     70 				const struct eap_tls_variant_ops *variant_ops,
     71 				void *variant_data);
     72 void eap_tls_common_set_keys(struct eap_state *eap,
     73 				struct l_certchain *client_cert,
     74 				struct l_key *client_key);
     75 
     76 void eap_tls_common_send_empty_response(struct eap_state *eap);
     77 enum eap_tls_version eap_tls_common_get_negotiated_version(
     78 							struct eap_state *eap);
     79 void *eap_tls_common_get_variant_data(struct eap_state *eap);
     80 
     81 bool eap_tls_common_tunnel_prf_get_bytes(struct eap_state *eap,
     82 						bool use_master_secret,
     83 						const char *label,
     84 						uint8_t *buf, size_t len);
     85 void eap_tls_common_tunnel_send(struct eap_state *eap, const uint8_t *data,
     86 							size_t data_len);
     87 void eap_tls_common_tunnel_close(struct eap_state *eap);
     88 
     89 void eap_tls_set_session_cache_ops(eap_tls_session_cache_load_func_t load,
     90 					eap_tls_session_cache_sync_func_t sync);
     91 void eap_tls_forget_peer(const char *peer_id);