}
-static int hapd_enable_protect_frames(void *priv, Boolean enabled)
+static int hapd_enable_protect_frames(void *priv, bool enabled)
{
struct hostapd_data *hapd = priv;
}
-static int hapd_enable_encrypt(void *priv, Boolean enabled)
+static int hapd_enable_encrypt(void *priv, bool enabled)
{
struct hostapd_data *hapd = priv;
}
-static int hapd_set_replay_protect(void *priv, Boolean enabled, u32 window)
+static int hapd_set_replay_protect(void *priv, bool enabled, u32 window)
{
struct hostapd_data *hapd = priv;
}
-static int hapd_enable_controlled_port(void *priv, Boolean enabled)
+static int hapd_enable_controlled_port(void *priv, bool enabled)
{
struct hostapd_data *hapd = priv;
wpa_hexdump(MSG_DEBUG, "Derived CKN", ckn->name, ckn->len);
res = ieee802_1x_kay_create_mka(hapd->kay, ckn, cak, 0, EAP_EXCHANGE,
- TRUE);
+ true);
fail:
bin_clear_free(msk, sizeof(*msk));
ckn->len = hapd->conf->mka_ckn_len;;
os_memcpy(ckn->name, hapd->conf->mka_ckn, ckn->len);
- res = ieee802_1x_kay_create_mka(hapd->kay, ckn, cak, 0, PSK, TRUE);
+ res = ieee802_1x_kay_create_mka(hapd->kay, ckn, cak, 0, PSK, true);
if (res)
goto free_cak;
#ifdef CONFIG_MACSEC
struct macsec_init_params {
- Boolean always_include_sci;
- Boolean use_es;
- Boolean use_scb;
+ bool always_include_sci;
+ bool use_es;
+ bool use_scb;
};
#endif /* CONFIG_MACSEC */
/**
* enable_protect_frames - Set protect frames status
* @priv: Private driver interface data
- * @enabled: TRUE = protect frames enabled
- * FALSE = protect frames disabled
+ * @enabled: true = protect frames enabled
+ * false = protect frames disabled
* Returns: 0 on success, -1 on failure (or if not supported)
*/
- int (*enable_protect_frames)(void *priv, Boolean enabled);
+ int (*enable_protect_frames)(void *priv, bool enabled);
/**
* enable_encrypt - Set encryption status
* @priv: Private driver interface data
- * @enabled: TRUE = encrypt outgoing traffic
- * FALSE = integrity-only protection on outgoing traffic
+ * @enabled: true = encrypt outgoing traffic
+ * false = integrity-only protection on outgoing traffic
* Returns: 0 on success, -1 on failure (or if not supported)
*/
- int (*enable_encrypt)(void *priv, Boolean enabled);
+ int (*enable_encrypt)(void *priv, bool enabled);
/**
* set_replay_protect - Set replay protect status and window size
* @priv: Private driver interface data
- * @enabled: TRUE = replay protect enabled
- * FALSE = replay protect disabled
+ * @enabled: true = replay protect enabled
+ * false = replay protect disabled
* @window: replay window size, valid only when replay protect enabled
* Returns: 0 on success, -1 on failure (or if not supported)
*/
- int (*set_replay_protect)(void *priv, Boolean enabled, u32 window);
+ int (*set_replay_protect)(void *priv, bool enabled, u32 window);
/**
* set_current_cipher_suite - Set current cipher suite
/**
* enable_controlled_port - Set controlled port status
* @priv: Private driver interface data
- * @enabled: TRUE = controlled port enabled
- * FALSE = controlled port disabled
+ * @enabled: true = controlled port enabled
+ * false = controlled port disabled
* Returns: 0 on success, -1 on failure (or if not supported)
*/
- int (*enable_controlled_port)(void *priv, Boolean enabled);
+ int (*enable_controlled_port)(void *priv, bool enabled);
/**
* get_receive_lowest_pn - Get receive lowest pn
int parent_ifi;
int use_pae_group_addr;
- Boolean created_link;
+ bool created_link;
- Boolean controlled_port_enabled;
- Boolean controlled_port_enabled_set;
+ bool controlled_port_enabled;
+ bool controlled_port_enabled_set;
- Boolean protect_frames;
- Boolean protect_frames_set;
+ bool protect_frames;
+ bool protect_frames_set;
- Boolean encrypt;
- Boolean encrypt_set;
+ bool encrypt;
+ bool encrypt_set;
- Boolean replay_protect;
- Boolean replay_protect_set;
+ bool replay_protect;
+ bool replay_protect_set;
u32 replay_window;
u8 encoding_sa;
- Boolean encoding_sa_set;
+ bool encoding_sa_set;
};
rtnl_link_put(change);
- drv->controlled_port_enabled_set = FALSE;
+ drv->controlled_port_enabled_set = false;
}
if (drv->protect_frames_set) {
if (err < 0)
return err;
- drv->protect_frames_set = FALSE;
- drv->encrypt_set = FALSE;
- drv->replay_protect_set = FALSE;
+ drv->protect_frames_set = false;
+ drv->encrypt_set = false;
+ drv->replay_protect_set = false;
return 0;
}
/**
* macsec_drv_enable_protect_frames - Set protect frames status
* @priv: Private driver interface data
- * @enabled: TRUE = protect frames enabled
- * FALSE = protect frames disabled
+ * @enabled: true = protect frames enabled
+ * false = protect frames disabled
* Returns: 0 on success, -1 on failure (or if not supported)
*/
-static int macsec_drv_enable_protect_frames(void *priv, Boolean enabled)
+static int macsec_drv_enable_protect_frames(void *priv, bool enabled)
{
struct macsec_drv_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s -> %s", __func__, enabled ? "TRUE" : "FALSE");
- drv->protect_frames_set = TRUE;
+ drv->protect_frames_set = true;
drv->protect_frames = enabled;
return try_commit(drv);
/**
* macsec_drv_enable_encrypt - Set protect frames status
* @priv: Private driver interface data
- * @enabled: TRUE = protect frames enabled
- * FALSE = protect frames disabled
+ * @enabled: true = protect frames enabled
+ * false = protect frames disabled
* Returns: 0 on success, -1 on failure (or if not supported)
*/
-static int macsec_drv_enable_encrypt(void *priv, Boolean enabled)
+static int macsec_drv_enable_encrypt(void *priv, bool enabled)
{
struct macsec_drv_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s -> %s", __func__, enabled ? "TRUE" : "FALSE");
- drv->encrypt_set = TRUE;
+ drv->encrypt_set = true;
drv->encrypt = enabled;
return try_commit(drv);
/**
* macsec_drv_set_replay_protect - Set replay protect status and window size
* @priv: Private driver interface data
- * @enabled: TRUE = replay protect enabled
- * FALSE = replay protect disabled
+ * @enabled: true = replay protect enabled
+ * false = replay protect disabled
* @window: replay window size, valid only when replay protect enabled
* Returns: 0 on success, -1 on failure (or if not supported)
*/
-static int macsec_drv_set_replay_protect(void *priv, Boolean enabled,
+static int macsec_drv_set_replay_protect(void *priv, bool enabled,
u32 window)
{
struct macsec_drv_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s -> %s, %u", __func__,
enabled ? "TRUE" : "FALSE", window);
- drv->replay_protect_set = TRUE;
+ drv->replay_protect_set = true;
drv->replay_protect = enabled;
if (enabled)
drv->replay_window = window;
/**
* macsec_drv_enable_controlled_port - Set controlled port status
* @priv: Private driver interface data
- * @enabled: TRUE = controlled port enabled
- * FALSE = controlled port disabled
+ * @enabled: true = controlled port enabled
+ * false = controlled port disabled
* Returns: 0 on success, -1 on failure (or if not supported)
*/
-static int macsec_drv_enable_controlled_port(void *priv, Boolean enabled)
+static int macsec_drv_enable_controlled_port(void *priv, bool enabled)
{
struct macsec_drv_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s -> %s", __func__, enabled ? "TRUE" : "FALSE");
drv->controlled_port_enabled = enabled;
- drv->controlled_port_enabled_set = TRUE;
+ drv->controlled_port_enabled_set = true;
return try_commit(drv);
}
static int set_active_rx_sa(const struct macsec_genl_ctx *ctx, int ifindex,
- u64 sci, unsigned char an, Boolean state)
+ u64 sci, unsigned char an, bool state)
{
struct nl_msg *msg;
struct nlattr *nest;
SCI2STR(sa->sc->sci.addr, sa->sc->sci.port));
return set_active_rx_sa(ctx, drv->ifi, mka_sci_u64(&sa->sc->sci),
- sa->an, TRUE);
+ sa->an, true);
}
SCI2STR(sa->sc->sci.addr, sa->sc->sci.port));
return set_active_rx_sa(ctx, drv->ifi, mka_sci_u64(&sa->sc->sci),
- sa->an, FALSE);
+ sa->an, false);
}
sci = mka_sci_u64(&sc->sci);
rtnl_link_macsec_set_sci(link, sci);
- drv->created_link = TRUE;
+ drv->created_link = true;
err = rtnl_link_add(drv->sk, link, NLM_F_CREATE);
if (err == -NLE_BUSY) {
wpa_printf(MSG_INFO,
DRV_PREFIX "link already exists, using it");
- drv->created_link = FALSE;
+ drv->created_link = false;
} else if (err < 0) {
rtnl_link_put(link);
wpa_printf(MSG_ERROR, DRV_PREFIX "couldn't create link: err %d",
static int set_active_tx_sa(const struct macsec_genl_ctx *ctx, int ifindex,
- unsigned char an, Boolean state)
+ unsigned char an, bool state)
{
struct nl_msg *msg;
struct nlattr *nest;
SCISTR, drv->ifname, sa->an,
SCI2STR(sa->sc->sci.addr, sa->sc->sci.port));
- ret = set_active_tx_sa(ctx, drv->ifi, sa->an, TRUE);
+ ret = set_active_tx_sa(ctx, drv->ifi, sa->an, true);
if (ret < 0) {
wpa_printf(MSG_ERROR, DRV_PREFIX "failed to enable txsa");
return ret;
}
- drv->encoding_sa_set = TRUE;
+ drv->encoding_sa_set = true;
drv->encoding_sa = sa->an;
return try_commit(drv);
SCISTR, drv->ifname, sa->an,
SCI2STR(sa->sc->sci.addr, sa->sc->sci.port));
- return set_active_tx_sa(ctx, drv->ifi, sa->an, FALSE);
+ return set_active_tx_sa(ctx, drv->ifi, sa->an, false);
}
u32 secy_id;
/* shadow */
- Boolean always_include_sci;
- Boolean use_es;
- Boolean use_scb;
- Boolean protect_frames;
- Boolean replay_protect;
+ bool always_include_sci;
+ bool use_es;
+ bool use_scb;
+ bool protect_frames;
+ bool replay_protect;
u32 replay_window;
struct channel_map receive_channel_map[MAXSC];
wpa_printf(MSG_INFO, "%s: secy_id=%d", __func__, drv->secy_id);
/* Enable Secy and Let EAPoL bypass */
- ret = nss_macsec_secy_en_set(drv->secy_id, TRUE);
+ ret = nss_macsec_secy_en_set(drv->secy_id, true);
if (ret)
wpa_printf(MSG_ERROR, "nss_macsec_secy_en_set: FAIL");
static void __macsec_drv_deinit(struct macsec_qca_data *drv)
{
- nss_macsec_secy_en_set(drv->secy_id, FALSE);
+ nss_macsec_secy_en_set(drv->secy_id, false);
nss_macsec_secy_rx_sc_del_all(drv->secy_id);
nss_macsec_secy_tx_sc_del_all(drv->secy_id);
}
}
-static int macsec_qca_enable_protect_frames(void *priv, Boolean enabled)
+static int macsec_qca_enable_protect_frames(void *priv, bool enabled)
{
struct macsec_qca_data *drv = priv;
int ret = 0;
}
-static int macsec_qca_set_replay_protect(void *priv, Boolean enabled,
+static int macsec_qca_set_replay_protect(void *priv, bool enabled,
unsigned int window)
{
struct macsec_qca_data *drv = priv;
}
-static int macsec_qca_enable_controlled_port(void *priv, Boolean enabled)
+static int macsec_qca_enable_controlled_port(void *priv, bool enabled)
{
struct macsec_qca_data *drv = priv;
int ret = 0;
struct macsec_qca_data *drv = priv;
int ret = 0;
u32 next_pn = 0;
- bool enabled = FALSE;
+ bool enabled = false;
u32 win;
u32 channel;
struct macsec_qca_data *drv = priv;
int ret = 0;
u32 sc_ch = 0;
- bool in_use = FALSE;
+ bool in_use = false;
for (sc_ch = 0; sc_ch < MAXSC; sc_ch++) {
ret = nss_macsec_secy_rx_sc_in_used_get(drv->secy_id, sc_ch,
sa->an);
ret += nss_macsec_secy_rx_sa_en_set(drv->secy_id, channel, sa->an,
- TRUE);
+ true);
return ret;
}
sa->an);
ret += nss_macsec_secy_rx_sa_en_set(drv->secy_id, channel, sa->an,
- FALSE);
+ false);
return ret;
}
{
struct macsec_qca_data *drv = priv;
u32 sc_ch = 0;
- bool in_use = FALSE;
+ bool in_use = false;
for (sc_ch = 0; sc_ch < MAXSC; sc_ch++) {
if (nss_macsec_secy_tx_sc_in_used_get(drv->secy_id, sc_ch,
sa->an);
ret += nss_macsec_secy_tx_sa_en_set(drv->secy_id, channel, sa->an,
- TRUE);
+ true);
return ret;
}
sa->an);
ret += nss_macsec_secy_tx_sa_en_set(drv->secy_id, channel, sa->an,
- FALSE);
+ false);
return ret;
}
CP_SECURED, CP_RECEIVE, CP_RECEIVING, CP_READY, CP_TRANSMIT,
CP_TRANSMITTING, CP_ABANDON, CP_RETIRE
} CP_state;
- Boolean changed;
+ bool changed;
/* CP -> Client */
- Boolean port_valid;
+ bool port_valid;
/* Logon -> CP */
enum connect_type connect;
/* KaY -> CP */
- Boolean chgd_server; /* clear by CP */
- Boolean elected_self;
+ bool chgd_server; /* clear by CP */
+ bool elected_self;
enum confidentiality_offset cipher_offset;
u64 cipher_suite;
- Boolean new_sak; /* clear by CP */
+ bool new_sak; /* clear by CP */
struct ieee802_1x_mka_ki distributed_ki;
u8 distributed_an;
- Boolean using_receive_sas;
- Boolean all_receiving;
- Boolean server_transmitting;
- Boolean using_transmit_sa;
+ bool using_receive_sas;
+ bool all_receiving;
+ bool server_transmitting;
+ bool using_transmit_sa;
/* CP -> KaY */
struct ieee802_1x_mka_ki *lki;
u8 lan;
- Boolean ltx;
- Boolean lrx;
+ bool ltx;
+ bool lrx;
struct ieee802_1x_mka_ki *oki;
u8 oan;
- Boolean otx;
- Boolean orx;
+ bool otx;
+ bool orx;
/* CP -> SecY */
- Boolean protect_frames;
+ bool protect_frames;
enum validate_frames validate_frames;
- Boolean replay_protect;
+ bool replay_protect;
u32 replay_window;
u64 current_cipher_suite;
enum confidentiality_offset confidentiality_offset;
- Boolean controlled_port_enabled;
+ bool controlled_port_enabled;
/* SecY -> CP */
- Boolean port_enabled; /* SecY->CP */
+ bool port_enabled; /* SecY->CP */
/* private */
u32 transmit_when;
{
SM_ENTRY(CP, INIT);
- sm->controlled_port_enabled = FALSE;
+ sm->controlled_port_enabled = false;
secy_cp_control_enable_port(sm->kay, sm->controlled_port_enabled);
- sm->port_valid = FALSE;
+ sm->port_valid = false;
os_free(sm->lki);
sm->lki = NULL;
- sm->ltx = FALSE;
- sm->lrx = FALSE;
+ sm->ltx = false;
+ sm->lrx = false;
os_free(sm->oki);
sm->oki = NULL;
- sm->otx = FALSE;
- sm->orx = FALSE;
+ sm->otx = false;
+ sm->orx = false;
- sm->port_enabled = TRUE;
- sm->chgd_server = FALSE;
+ sm->port_enabled = true;
+ sm->chgd_server = false;
}
{
SM_ENTRY(CP, CHANGE);
- sm->port_valid = FALSE;
- sm->controlled_port_enabled = FALSE;
+ sm->port_valid = false;
+ sm->controlled_port_enabled = false;
secy_cp_control_enable_port(sm->kay, sm->controlled_port_enabled);
if (sm->lki)
*/
os_free(sm->oki);
sm->oki = NULL;
- sm->otx = FALSE;
- sm->orx = FALSE;
+ sm->otx = false;
+ sm->orx = false;
sm->oan = 0;
ieee802_1x_kay_set_old_sa_attr(sm->kay, sm->oki, sm->oan,
sm->otx, sm->orx);
os_free(sm->lki);
sm->lki = NULL;
- sm->lrx = FALSE;
- sm->ltx = FALSE;
+ sm->lrx = false;
+ sm->ltx = false;
sm->lan = 0;
ieee802_1x_kay_set_latest_sa_attr(sm->kay, sm->lki, sm->lan,
sm->ltx, sm->lrx);
{
SM_ENTRY(CP, ALLOWED);
- sm->protect_frames = FALSE;
- sm->replay_protect = FALSE;
+ sm->protect_frames = false;
+ sm->replay_protect = false;
sm->validate_frames = Checked;
- sm->port_valid = FALSE;
- sm->controlled_port_enabled = TRUE;
+ sm->port_valid = false;
+ sm->controlled_port_enabled = true;
secy_cp_control_enable_port(sm->kay, sm->controlled_port_enabled);
secy_cp_control_protect_frames(sm->kay, sm->protect_frames);
{
SM_ENTRY(CP, AUTHENTICATED);
- sm->protect_frames = FALSE;
- sm->replay_protect = FALSE;
+ sm->protect_frames = false;
+ sm->replay_protect = false;
sm->validate_frames = Checked;
- sm->port_valid = FALSE;
- sm->controlled_port_enabled = TRUE;
+ sm->port_valid = false;
+ sm->controlled_port_enabled = true;
secy_cp_control_enable_port(sm->kay, sm->controlled_port_enabled);
secy_cp_control_protect_frames(sm->kay, sm->protect_frames);
{
SM_ENTRY(CP, SECURED);
- sm->chgd_server = FALSE;
+ sm->chgd_server = false;
sm->protect_frames = sm->kay->macsec_protect;
sm->replay_protect = sm->kay->macsec_replay_protect;
sm->confidentiality_offset = sm->cipher_offset;
- sm->port_valid = TRUE;
+ sm->port_valid = true;
secy_cp_control_confidentiality_offset(sm->kay,
sm->confidentiality_offset);
}
os_memcpy(sm->lki, &sm->distributed_ki, sizeof(*sm->lki));
sm->lan = sm->distributed_an;
- sm->ltx = FALSE;
- sm->lrx = FALSE;
+ sm->ltx = false;
+ sm->lrx = false;
ieee802_1x_kay_set_latest_sa_attr(sm->kay, sm->lki, sm->lan,
sm->ltx, sm->lrx);
ieee802_1x_kay_create_sas(sm->kay, sm->lki);
ieee802_1x_kay_enable_rx_sas(sm->kay, sm->lki);
- sm->new_sak = FALSE;
- sm->all_receiving = FALSE;
+ sm->new_sak = false;
+ sm->all_receiving = false;
}
{
SM_ENTRY(CP, RECEIVING);
- sm->lrx = TRUE;
+ sm->lrx = true;
ieee802_1x_kay_set_latest_sa_attr(sm->kay, sm->lki, sm->lan,
sm->ltx, sm->lrx);
sm->transmit_when = sm->transmit_delay;
* but the CP will transmit from RECEIVING to READY under
* the !electedSelf when KaY is not key server */
ieee802_1x_cp_sm_step(sm);
- sm->using_receive_sas = FALSE;
- sm->server_transmitting = FALSE;
+ sm->using_receive_sas = false;
+ sm->server_transmitting = false;
}
{
SM_ENTRY(CP, TRANSMIT);
- sm->controlled_port_enabled = TRUE;
+ sm->controlled_port_enabled = true;
secy_cp_control_enable_port(sm->kay, sm->controlled_port_enabled);
- sm->ltx = TRUE;
+ sm->ltx = true;
ieee802_1x_kay_set_latest_sa_attr(sm->kay, sm->lki, sm->lan,
sm->ltx, sm->lrx);
ieee802_1x_kay_enable_tx_sas(sm->kay, sm->lki);
- sm->all_receiving = FALSE;
- sm->server_transmitting = FALSE;
+ sm->all_receiving = false;
+ sm->server_transmitting = false;
}
{
SM_ENTRY(CP, TRANSMITTING);
sm->retire_when = sm->orx ? sm->retire_delay : 0;
- sm->otx = FALSE;
+ sm->otx = false;
ieee802_1x_kay_set_old_sa_attr(sm->kay, sm->oki, sm->oan,
sm->otx, sm->orx);
ieee802_1x_kay_enable_new_info(sm->kay);
eloop_cancel_timeout(ieee802_1x_cp_retire_when_timeout, sm, NULL);
eloop_register_timeout(sm->retire_when / 1000, 0,
ieee802_1x_cp_retire_when_timeout, sm, NULL);
- sm->using_transmit_sa = FALSE;
+ sm->using_transmit_sa = false;
}
SM_STATE(CP, ABANDON)
{
SM_ENTRY(CP, ABANDON);
- sm->lrx = FALSE;
+ sm->lrx = false;
ieee802_1x_kay_set_latest_sa_attr(sm->kay, sm->lki, sm->lan,
sm->ltx, sm->lrx);
ieee802_1x_kay_delete_sas(sm->kay, sm->lki);
ieee802_1x_kay_set_old_sa_attr(sm->kay, sm->oki, sm->oan,
sm->otx, sm->orx);
sm->lki = NULL;
- sm->ltx = FALSE;
- sm->lrx = FALSE;
+ sm->ltx = false;
+ sm->lrx = false;
sm->lan = 0;
ieee802_1x_kay_set_latest_sa_attr(sm->kay, sm->lki, sm->lan,
sm->ltx, sm->lrx);
sm->kay = kay;
- sm->port_valid = FALSE;
+ sm->port_valid = false;
- sm->chgd_server = FALSE;
+ sm->chgd_server = false;
sm->protect_frames = kay->macsec_protect;
sm->validate_frames = kay->macsec_validate;
sm->replay_protect = kay->macsec_replay_protect;
sm->replay_window = kay->macsec_replay_window;
- sm->controlled_port_enabled = FALSE;
+ sm->controlled_port_enabled = false;
sm->lki = NULL;
- sm->lrx = FALSE;
- sm->ltx = FALSE;
+ sm->lrx = false;
+ sm->ltx = false;
sm->oki = NULL;
- sm->orx = FALSE;
- sm->otx = FALSE;
+ sm->orx = false;
+ sm->otx = false;
sm->current_cipher_suite = default_cs_id;
sm->cipher_suite = default_cs_id;
sm->transmit_delay = MKA_LIFE_TIME;
sm->retire_delay = MKA_SAK_RETIRE_TIME;
sm->CP_state = CP_BEGIN;
- sm->changed = FALSE;
+ sm->changed = false;
wpa_printf(MSG_DEBUG, "CP: state machine created");
{
struct ieee802_1x_cp_sm *sm = cp_ctx;
- sm->chgd_server = TRUE;
+ sm->chgd_server = true;
}
/**
* ieee802_1x_cp_set_electedself -
*/
-void ieee802_1x_cp_set_electedself(void *cp_ctx, Boolean status)
+void ieee802_1x_cp_set_electedself(void *cp_ctx, bool status)
{
struct ieee802_1x_cp_sm *sm = cp_ctx;
sm->elected_self = status;
void ieee802_1x_cp_signal_newsak(void *cp_ctx)
{
struct ieee802_1x_cp_sm *sm = cp_ctx;
- sm->new_sak = TRUE;
+ sm->new_sak = true;
}
/**
* ieee802_1x_cp_set_usingreceivesas -
*/
-void ieee802_1x_cp_set_usingreceivesas(void *cp_ctx, Boolean status)
+void ieee802_1x_cp_set_usingreceivesas(void *cp_ctx, bool status)
{
struct ieee802_1x_cp_sm *sm = cp_ctx;
sm->using_receive_sas = status;
/**
* ieee802_1x_cp_set_allreceiving -
*/
-void ieee802_1x_cp_set_allreceiving(void *cp_ctx, Boolean status)
+void ieee802_1x_cp_set_allreceiving(void *cp_ctx, bool status)
{
struct ieee802_1x_cp_sm *sm = cp_ctx;
sm->all_receiving = status;
/**
* ieee802_1x_cp_set_servertransmitting -
*/
-void ieee802_1x_cp_set_servertransmitting(void *cp_ctx, Boolean status)
+void ieee802_1x_cp_set_servertransmitting(void *cp_ctx, bool status)
{
struct ieee802_1x_cp_sm *sm = cp_ctx;
sm->server_transmitting = status;
/**
* ieee802_1x_cp_set_usingtransmitsas -
*/
-void ieee802_1x_cp_set_usingtransmitas(void *cp_ctx, Boolean status)
+void ieee802_1x_cp_set_usingtransmitas(void *cp_ctx, bool status)
{
struct ieee802_1x_cp_sm *sm = cp_ctx;
sm->using_transmit_sa = status;
void ieee802_1x_cp_connect_authenticated(void *cp_ctx);
void ieee802_1x_cp_connect_secure(void *cp_ctx);
void ieee802_1x_cp_signal_chgdserver(void *cp_ctx);
-void ieee802_1x_cp_set_electedself(void *cp_ctx, Boolean status);
+void ieee802_1x_cp_set_electedself(void *cp_ctx, bool status);
void ieee802_1x_cp_set_ciphersuite(void *cp_ctx, u64 cs);
void ieee802_1x_cp_set_offset(void *cp_ctx, enum confidentiality_offset offset);
void ieee802_1x_cp_signal_newsak(void *cp_ctx);
void ieee802_1x_cp_set_distributedki(void *cp_ctx,
const struct ieee802_1x_mka_ki *dki);
void ieee802_1x_cp_set_distributedan(void *cp_ctx, u8 an);
-void ieee802_1x_cp_set_usingreceivesas(void *cp_ctx, Boolean status);
-void ieee802_1x_cp_set_allreceiving(void *cp_ctx, Boolean status);
-void ieee802_1x_cp_set_servertransmitting(void *cp_ctx, Boolean status);
-void ieee802_1x_cp_set_usingtransmitas(void *cp_ctx, Boolean status);
+void ieee802_1x_cp_set_usingreceivesas(void *cp_ctx, bool status);
+void ieee802_1x_cp_set_allreceiving(void *cp_ctx, bool status);
+void ieee802_1x_cp_set_servertransmitting(void *cp_ctx, bool status);
+void ieee802_1x_cp_set_usingtransmitas(void *cp_ctx, bool status);
#endif /* IEEE802_1X_CP_H */
/**
* ieee802_1x_kay_is_in_potential_peer
*/
-static Boolean
+static bool
ieee802_1x_kay_is_in_potential_peer(
struct ieee802_1x_mka_participant *participant, const u8 *mi)
{
/**
* ieee802_1x_kay_is_in_live_peer
*/
-static Boolean
+static bool
ieee802_1x_kay_is_in_live_peer(
struct ieee802_1x_mka_participant *participant, const u8 *mi)
{
}
-static Boolean sci_equal(const struct ieee802_1x_mka_sci *a,
- const struct ieee802_1x_mka_sci *b)
+static bool sci_equal(const struct ieee802_1x_mka_sci *a,
+ const struct ieee802_1x_mka_sci *b)
{
return os_memcmp(a, b, sizeof(struct ieee802_1x_mka_sci)) == 0;
}
psa->sc = psc;
os_get_time(&psa->created_time);
- psa->in_use = FALSE;
+ psa->in_use = false;
dl_list_add(&psc->sa_list, &psa->list);
wpa_printf(MSG_DEBUG,
os_memcpy(&psc->sci, psci, sizeof(psc->sci));
os_get_time(&psc->created_time);
- psc->receiving = FALSE;
+ psc->receiving = false;
dl_list_init(&psc->sa_list);
wpa_printf(MSG_DEBUG, "KaY: Create receive SC: SCI %s",
os_memcpy(peer->mi, mi, MI_LEN);
peer->mn = mn;
peer->expire = time(NULL) + MKA_LIFE_TIME / 1000;
- peer->sak_used = FALSE;
+ peer->sak_used = false;
peer->missing_sak_use_count = 0;
return peer;
/**
* ieee802_1x_mka_basic_body_present -
*/
-static Boolean
+static bool
ieee802_1x_mka_basic_body_present(
struct ieee802_1x_mka_participant *participant)
{
- return TRUE;
+ return true;
}
}
-static Boolean
+static bool
reset_participant_mi(struct ieee802_1x_mka_participant *participant)
{
if (os_get_random(participant->mi, sizeof(participant->mi)) < 0)
- return FALSE;
+ return false;
participant->mn = 0;
- return TRUE;
+ return true;
}
peer->macsec_desired = body->macsec_desired;
peer->macsec_capability = body->macsec_capability;
- peer->is_key_server = (Boolean) body->key_server;
+ peer->is_key_server = body->key_server;
peer->key_server_priority = body->priority;
} else if (peer->mn < be_to_host32(body->actor_mn)) {
peer->mn = be_to_host32(body->actor_mn);
peer->macsec_desired = body->macsec_desired;
peer->macsec_capability = body->macsec_capability;
- peer->is_key_server = (Boolean) body->key_server;
+ peer->is_key_server = body->key_server;
peer->key_server_priority = body->priority;
} else {
wpa_printf(MSG_WARNING,
/**
* ieee802_1x_mka_live_peer_body_present
*/
-static Boolean
+static bool
ieee802_1x_mka_live_peer_body_present(
struct ieee802_1x_mka_participant *participant)
{
/**
* ieee802_1x_mka_potential_peer_body_present
*/
-static Boolean
+static bool
ieee802_1x_mka_potential_peer_body_present(
struct ieee802_1x_mka_participant *participant)
{
/**
* ieee802_1x_mka_i_in_peerlist -
*/
-static Boolean
+static bool
ieee802_1x_mka_i_in_peerlist(struct ieee802_1x_mka_participant *participant,
const u8 *mka_msg, size_t msg_len)
{
left_len, MKA_HDR_LEN,
MKA_ALIGN_LENGTH(body_len),
DEFAULT_ICV_LEN);
- return FALSE;
+ return false;
}
if (body_type != MKA_LIVE_PEER_LIST &&
if (mn == participant->mn ||
(participant->mn > 1 &&
mn == participant->mn - 1))
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
struct ieee802_1x_kay_peer *peer;
size_t body_len;
size_t i;
- Boolean is_included;
+ bool is_included;
is_included = ieee802_1x_kay_is_in_live_peer(
participant, participant->current_peer_id.mi);
/**
* ieee802_1x_mka_sak_use_body_present
*/
-static Boolean
+static bool
ieee802_1x_mka_sak_use_body_present(
struct ieee802_1x_mka_participant *participant)
{
set_mka_param_body_len(body, length - MKA_HDR_LEN);
if (length == MKA_HDR_LEN) {
- body->ptx = TRUE;
- body->prx = TRUE;
+ body->ptx = true;
+ body->prx = true;
body->lan = 0;
- body->lrx = FALSE;
- body->ltx = FALSE;
- body->delay_protect = FALSE;
+ body->lrx = false;
+ body->ltx = false;
+ body->delay_protect = false;
return 0;
}
if (llpn > kay->pn_exhaustion) {
wpa_printf(MSG_WARNING,
"KaY: My LLPN exhaustion");
- participant->new_sak = TRUE;
+ participant->new_sak = true;
}
} else {
if (olpn > kay->pn_exhaustion) {
wpa_printf(MSG_WARNING,
"KaY: My OLPN exhaustion");
- participant->new_sak = TRUE;
+ participant->new_sak = true;
}
}
}
body->oan = participant->oan;
if (participant->oki.kn != participant->lki.kn &&
participant->oki.kn != 0) {
- body->otx = TRUE;
- body->orx = TRUE;
+ body->otx = true;
+ body->orx = true;
os_memcpy(body->osrv_mi, participant->oki.mi,
sizeof(body->osrv_mi));
body->okn = host_to_be32(participant->oki.kn);
} else {
- body->otx = FALSE;
- body->orx = FALSE;
+ body->otx = false;
+ body->orx = false;
}
/* set CP's variable */
if (body->ltx) {
- kay->tx_enable = TRUE;
- kay->port_enable = TRUE;
+ kay->tx_enable = true;
+ kay->port_enable = true;
}
if (body->lrx)
- kay->rx_enable = TRUE;
+ kay->rx_enable = true;
ieee802_1x_mka_dump_sak_use_body(body);
return 0;
*/
if (participant->is_key_server) {
struct ieee802_1x_kay_peer *peer_iter;
- Boolean all_receiving = TRUE;
+ bool all_receiving = true;
/* Distributed keys are equal from above comparison. */
- peer->sak_used = TRUE;
+ peer->sak_used = true;
dl_list_for_each(peer_iter, &participant->live_peers,
struct ieee802_1x_kay_peer, list) {
if (!peer_iter->sak_used) {
- all_receiving = FALSE;
+ all_receiving = false;
break;
}
}
if (all_receiving) {
- participant->to_dist_sak = FALSE;
- ieee802_1x_cp_set_allreceiving(kay->cp, TRUE);
+ participant->to_dist_sak = false;
+ ieee802_1x_cp_set_allreceiving(kay->cp, true);
ieee802_1x_cp_sm_step(kay->cp);
}
} else if (peer->is_key_server) {
if (body->ltx) {
- ieee802_1x_cp_set_servertransmitting(kay->cp, TRUE);
+ ieee802_1x_cp_set_servertransmitting(kay->cp, true);
ieee802_1x_cp_sm_step(kay->cp);
}
}
* has already been exhausted.
*/
if (participant->is_key_server && lpn > kay->pn_exhaustion) {
- participant->new_sak = TRUE;
+ participant->new_sak = true;
wpa_printf(MSG_WARNING, "KaY: Peer LPN exhaustion");
}
if (body->delay_protect) {
struct receive_sc *rxsc;
struct receive_sa *rxsa;
- Boolean found = FALSE;
+ bool found = false;
dl_list_for_each(rxsc, &participant->rxsc_list,
struct receive_sc, list) {
dl_list_for_each(rxsa, &rxsc->sa_list,
struct receive_sa, list) {
if (sa_key && rxsa->pkey == sa_key) {
- found = TRUE;
+ found = true;
break;
}
}
/**
* ieee802_1x_mka_dist_sak_body_present
*/
-static Boolean
+static bool
ieee802_1x_mka_dist_sak_body_present(
struct ieee802_1x_mka_participant *participant)
{
*/
static void ieee802_1x_kay_init_data_key(struct data_key *pkey)
{
- pkey->transmits = TRUE;
- pkey->receives = TRUE;
+ pkey->transmits = true;
+ pkey->receives = true;
os_get_time(&pkey->created_time);
pkey->next_pn = 1;
}
if (body_len == 0) {
- kay->authenticated = TRUE;
- kay->secured = FALSE;
- kay->failed = FALSE;
- participant->advised_desired = FALSE;
+ kay->authenticated = true;
+ kay->secured = false;
+ kay->failed = false;
+ participant->advised_desired = false;
ieee802_1x_cp_connect_authenticated(kay->cp);
ieee802_1x_cp_sm_step(kay->cp);
wpa_printf(MSG_WARNING, "KaY: The Key server advise no MACsec");
- participant->to_use_sak = FALSE;
+ participant->to_use_sak = false;
return 0;
}
- participant->advised_desired = TRUE;
- kay->authenticated = FALSE;
- kay->secured = TRUE;
- kay->failed = FALSE;
+ participant->advised_desired = true;
+ kay->authenticated = false;
+ kay->secured = true;
+ kay->failed = false;
ieee802_1x_cp_connect_secure(kay->cp);
ieee802_1x_cp_sm_step(kay->cp);
ieee802_1x_cp_sm_step(kay->cp);
kay->rcvd_keys++;
- participant->to_use_sak = TRUE;
+ participant->to_use_sak = true;
return 0;
}
/**
* ieee802_1x_mka_icv_body_present
*/
-static Boolean
+static bool
ieee802_1x_mka_icv_body_present(struct ieee802_1x_mka_participant *participant)
{
- return TRUE;
+ return true;
}
int (*body_rx)(struct ieee802_1x_mka_participant *participant,
const u8 *mka_msg, size_t msg_len);
int (*body_length)(struct ieee802_1x_mka_participant *participant);
- Boolean (*body_present)(struct ieee802_1x_mka_participant *participant);
+ bool (*body_present)(struct ieee802_1x_mka_participant *participant);
};
dl_list_for_each(peer, &participant->live_peers,
struct ieee802_1x_kay_peer, list)
- peer->sak_used = FALSE;
+ peer->sak_used = false;
kay->dist_kn++;
kay->dist_an++;
struct ieee802_1x_kay_peer *peer;
struct ieee802_1x_kay_peer *key_server = NULL;
struct ieee802_1x_kay *kay = participant->kay;
- Boolean i_is_key_server;
+ bool i_is_key_server;
int priority_comparison;
if (participant->is_obliged_key_server) {
- participant->new_sak = TRUE;
- participant->to_dist_sak = FALSE;
- ieee802_1x_cp_set_electedself(kay->cp, TRUE);
+ participant->new_sak = true;
+ participant->to_dist_sak = false;
+ ieee802_1x_cp_set_electedself(kay->cp, true);
return 0;
}
}
/* elect the key server between me and the above elected peer */
- i_is_key_server = FALSE;
+ i_is_key_server = false;
if (key_server && participant->can_be_key_server) {
struct ieee802_1x_kay_peer tmp;
os_memcpy(&tmp.sci, &kay->actor_sci, sizeof(tmp.sci));
priority_comparison = compare_priorities(&tmp, key_server);
if (priority_comparison < 0) {
- i_is_key_server = TRUE;
+ i_is_key_server = true;
} else if (priority_comparison == 0) {
wpa_printf(MSG_WARNING,
"KaY: Cannot elect key server between me and peer, duplicate MAC detected");
key_server = NULL;
}
} else if (participant->can_be_key_server) {
- i_is_key_server = TRUE;
+ i_is_key_server = true;
}
if (i_is_key_server) {
- ieee802_1x_cp_set_electedself(kay->cp, TRUE);
+ ieee802_1x_cp_set_electedself(kay->cp, true);
if (!sci_equal(&kay->key_server_sci, &kay->actor_sci)) {
ieee802_1x_cp_signal_chgdserver(kay->cp);
ieee802_1x_cp_sm_step(kay->cp);
}
- participant->is_key_server = TRUE;
- participant->principal = TRUE;
- participant->new_sak = TRUE;
+ participant->is_key_server = true;
+ participant->principal = true;
+ participant->new_sak = true;
wpa_printf(MSG_DEBUG, "KaY: I am elected as key server");
- participant->to_dist_sak = FALSE;
- participant->is_elected = TRUE;
+ participant->to_dist_sak = false;
+ participant->is_elected = true;
os_memcpy(&kay->key_server_sci, &kay->actor_sci,
sizeof(kay->key_server_sci));
wpa_printf(MSG_DEBUG,
"KaY: Peer %s was elected as the key server",
mi_txt(key_server->mi));
- ieee802_1x_cp_set_electedself(kay->cp, FALSE);
+ ieee802_1x_cp_set_electedself(kay->cp, false);
if (!sci_equal(&kay->key_server_sci, &key_server->sci)) {
ieee802_1x_cp_signal_chgdserver(kay->cp);
ieee802_1x_cp_sm_step(kay->cp);
}
- participant->is_key_server = FALSE;
- participant->principal = TRUE;
- participant->is_elected = TRUE;
+ participant->is_key_server = false;
+ participant->principal = true;
+ participant->is_elected = true;
os_memcpy(&kay->key_server_sci, &key_server->sci,
sizeof(kay->key_server_sci));
kay->key_server_priority = key_server->key_server_priority;
} else {
- participant->principal = FALSE;
- participant->is_key_server = FALSE;
- participant->is_elected = FALSE;
+ participant->principal = false;
+ participant->is_key_server = false;
+ participant->is_elected = false;
}
return 0;
struct ieee802_1x_kay *kay = participant->kay;
struct ieee802_1x_kay_peer *peer;
enum macsec_cap less_capability;
- Boolean has_peer;
+ bool has_peer;
if (!participant->is_key_server)
return -1;
/* key server self is MACsec-desired and requesting MACsec */
if (!kay->macsec_desired) {
- participant->advised_desired = FALSE;
+ participant->advised_desired = false;
return -1;
}
if (kay->macsec_capable == MACSEC_CAP_NOT_IMPLEMENTED) {
- participant->advised_desired = FALSE;
+ participant->advised_desired = false;
return -1;
}
less_capability = kay->macsec_capable;
/* at least one of peers is MACsec-desired and requesting MACsec */
- has_peer = FALSE;
+ has_peer = false;
dl_list_for_each(peer, &participant->live_peers,
struct ieee802_1x_kay_peer, list) {
if (!peer->macsec_desired)
less_capability = (less_capability < peer->macsec_capability) ?
less_capability : peer->macsec_capability;
- has_peer = TRUE;
+ has_peer = true;
}
if (has_peer) {
- participant->advised_desired = TRUE;
+ participant->advised_desired = true;
participant->advised_capability = less_capability;
- kay->authenticated = FALSE;
- kay->secured = TRUE;
- kay->failed = FALSE;
+ kay->authenticated = false;
+ kay->secured = true;
+ kay->failed = false;
ieee802_1x_cp_connect_secure(kay->cp);
ieee802_1x_cp_sm_step(kay->cp);
} else {
- participant->advised_desired = FALSE;
+ participant->advised_desired = false;
participant->advised_capability = MACSEC_CAP_NOT_IMPLEMENTED;
- participant->to_use_sak = FALSE;
- kay->authenticated = TRUE;
- kay->secured = FALSE;
- kay->failed = FALSE;
+ participant->to_use_sak = false;
+ kay->authenticated = true;
+ kay->secured = false;
+ kay->failed = false;
kay->ltx_kn = 0;
kay->ltx_an = 0;
kay->lrx_kn = 0;
l2_packet_send(kay->l2_mka, NULL, 0, wpabuf_head(buf), wpabuf_len(buf));
wpabuf_free(buf);
- kay->active = TRUE;
- participant->active = TRUE;
+ kay->active = true;
+ participant->active = true;
return 0;
}
struct ieee802_1x_kay *kay;
struct ieee802_1x_kay_peer *peer, *pre_peer;
time_t now = time(NULL);
- Boolean lp_changed;
+ bool lp_changed;
struct receive_sc *rxsc, *pre_rxsc;
struct transmit_sa *txsa, *pre_txsa;
}
}
- lp_changed = FALSE;
+ lp_changed = false;
dl_list_for_each_safe(peer, pre_peer, &participant->live_peers,
struct ieee802_1x_kay_peer, list) {
if (now > peer->expire) {
}
dl_list_del(&peer->list);
os_free(peer);
- lp_changed = TRUE;
+ lp_changed = true;
}
}
if (lp_changed) {
if (dl_list_empty(&participant->live_peers)) {
- participant->advised_desired = FALSE;
+ participant->advised_desired = false;
participant->advised_capability =
MACSEC_CAP_NOT_IMPLEMENTED;
- participant->to_use_sak = FALSE;
- participant->ltx = FALSE;
- participant->lrx = FALSE;
- participant->otx = FALSE;
- participant->orx = FALSE;
- participant->is_key_server = FALSE;
- participant->is_elected = FALSE;
- kay->authenticated = FALSE;
- kay->secured = FALSE;
- kay->failed = FALSE;
+ participant->to_use_sak = false;
+ participant->ltx = false;
+ participant->lrx = false;
+ participant->otx = false;
+ participant->orx = false;
+ participant->is_key_server = false;
+ participant->is_elected = false;
+ kay->authenticated = false;
+ kay->secured = false;
+ kay->failed = false;
kay->ltx_kn = 0;
kay->ltx_an = 0;
kay->lrx_kn = 0;
if (participant->new_sak && participant->is_key_server) {
if (!ieee802_1x_kay_generate_new_sak(participant))
- participant->to_dist_sak = TRUE;
+ participant->to_dist_sak = true;
- participant->new_sak = FALSE;
+ participant->new_sak = false;
}
if (participant->retry_count < MAX_RETRY_CNT ||
return;
delete_mka:
- kay->authenticated = FALSE;
- kay->secured = FALSE;
- kay->failed = TRUE;
+ kay->authenticated = false;
+ kay->secured = false;
+ kay->failed = true;
ieee802_1x_kay_delete_mka(kay, &participant->ckn);
}
{
struct transmit_sa *psa;
- key->tx_latest = TRUE;
- key->rx_latest = TRUE;
+ key->tx_latest = true;
+ key->rx_latest = true;
psa = os_zalloc(sizeof(*psa));
if (!psa) {
if (key->confidentiality_offset >= CONFIDENTIALITY_OFFSET_0 &&
key->confidentiality_offset <= CONFIDENTIALITY_OFFSET_50)
- psa->confidentiality = TRUE;
+ psa->confidentiality = true;
else
- psa->confidentiality = FALSE;
+ psa->confidentiality = false;
psa->an = an;
ieee802_1x_kay_use_data_key(key);
psa->sc = psc;
os_get_time(&psa->created_time);
- psa->in_use = FALSE;
+ psa->in_use = false;
dl_list_add(&psc->sa_list, &psa->list);
wpa_printf(MSG_DEBUG,
os_memcpy(&psc->sci, sci, sizeof(psc->sci));
os_get_time(&psc->created_time);
- psc->transmitting = FALSE;
- psc->encoding_sa = FALSE;
- psc->enciphering_sa = FALSE;
+ psc->transmitting = false;
+ psc->encoding_sa = false;
+ psc->enciphering_sa = false;
dl_list_init(&psc->sa_list);
wpa_printf(MSG_DEBUG, "KaY: Create transmit SC - SCI: %s",
*/
int ieee802_1x_kay_set_latest_sa_attr(struct ieee802_1x_kay *kay,
struct ieee802_1x_mka_ki *lki, u8 lan,
- Boolean ltx, Boolean lrx)
+ bool ltx, bool lrx)
{
struct ieee802_1x_mka_participant *principal;
*/
int ieee802_1x_kay_set_old_sa_attr(struct ieee802_1x_kay *kay,
struct ieee802_1x_mka_ki *oki,
- u8 oan, Boolean otx, Boolean orx)
+ u8 oan, bool otx, bool orx)
{
struct ieee802_1x_mka_participant *principal;
latest_sak = NULL;
dl_list_for_each(sa_key, &principal->sak_list, struct data_key, list) {
if (is_ki_equal(&sa_key->key_identifier, lki)) {
- sa_key->rx_latest = TRUE;
- sa_key->tx_latest = TRUE;
+ sa_key->rx_latest = true;
+ sa_key->tx_latest = true;
latest_sak = sa_key;
- principal->to_use_sak = TRUE;
+ principal->to_use_sak = true;
} else {
- sa_key->rx_latest = FALSE;
- sa_key->tx_latest = FALSE;
+ sa_key->rx_latest = false;
+ sa_key->tx_latest = false;
}
}
if (!latest_sak) {
dl_list_for_each(txsa, &principal->txsc->sa_list, struct transmit_sa,
list) {
if (is_ki_equal(&txsa->pkey->key_identifier, lki)) {
- txsa->in_use = TRUE;
+ txsa->in_use = true;
secy_enable_transmit_sa(kay, txsa);
ieee802_1x_cp_set_usingtransmitas(
- principal->kay->cp, TRUE);
+ principal->kay->cp, true);
ieee802_1x_cp_sm_step(principal->kay->cp);
}
}
dl_list_for_each(rxsa, &rxsc->sa_list, struct receive_sa, list)
{
if (is_ki_equal(&rxsa->pkey->key_identifier, lki)) {
- rxsa->in_use = TRUE;
+ rxsa->in_use = true;
secy_enable_receive_sa(kay, rxsa);
ieee802_1x_cp_set_usingreceivesas(
- principal->kay->cp, TRUE);
+ principal->kay->cp, true);
ieee802_1x_cp_sm_step(principal->kay->cp);
}
}
u8 body_type;
int i;
const u8 *pos;
- Boolean handled[256];
- Boolean bad_sak_use = FALSE; /* Error detected while processing SAK Use
- * parameter set */
- Boolean i_in_peerlist, is_in_live_peer, is_in_potential_peer;
+ bool handled[256];
+ bool bad_sak_use = false; /* Error detected while processing SAK Use
+ * parameter set */
+ bool i_in_peerlist, is_in_live_peer, is_in_potential_peer;
wpa_printf(MSG_DEBUG, "KaY: Decode received MKPDU (ifname=%s)",
kay->if_name);
* Each parameter set should be present only once.
*/
for (i = 0; i < 256; i++)
- handled[i] = FALSE;
+ handled[i] = false;
- handled[0] = TRUE;
+ handled[0] = true;
for (; left_len > MKA_HDR_LEN + DEFAULT_ICV_LEN;
pos += body_len + MKA_HDR_LEN,
left_len -= body_len + MKA_HDR_LEN) {
continue;
}
- handled[body_type] = TRUE;
+ handled[body_type] = true;
if (body_type < ARRAY_SIZE(mka_body_handler) &&
mka_body_handler[body_type].body_rx) {
if (mka_body_handler[body_type].body_rx
* that it somehow processes DIST-SAK before
* SAK-USE, just ignore SAK-USE failures if
* DIST-SAK is also present in this MKPDU. */
- bad_sak_use = TRUE;
+ bad_sak_use = true;
}
} else {
wpa_printf(MSG_ERROR,
* from 'potential_peers' to 'live_peers'. */
}
- kay->active = TRUE;
+ kay->active = true;
participant->retry_count = 0;
- participant->active = TRUE;
+ participant->active = true;
return 0;
}
*/
struct ieee802_1x_kay *
ieee802_1x_kay_init(struct ieee802_1x_kay_ctx *ctx, enum macsec_policy policy,
- Boolean macsec_replay_protect, u32 macsec_replay_window,
+ bool macsec_replay_protect, u32 macsec_replay_window,
u16 port, u8 priority, const char *ifname, const u8 *addr)
{
struct ieee802_1x_kay *kay;
kay->ctx = ctx;
- kay->enable = TRUE;
- kay->active = FALSE;
+ kay->enable = true;
+ kay->active = false;
- kay->authenticated = FALSE;
- kay->secured = FALSE;
- kay->failed = FALSE;
+ kay->authenticated = false;
+ kay->secured = false;
+ kay->failed = false;
kay->policy = policy;
os_strlcpy(kay->if_name, ifname, IFNAMSIZ);
if (policy == DO_NOT_SECURE ||
kay->macsec_capable == MACSEC_CAP_NOT_IMPLEMENTED) {
kay->macsec_capable = MACSEC_CAP_NOT_IMPLEMENTED;
- kay->macsec_desired = FALSE;
- kay->macsec_protect = FALSE;
- kay->macsec_encrypt = FALSE;
+ kay->macsec_desired = false;
+ kay->macsec_protect = false;
+ kay->macsec_encrypt = false;
kay->macsec_validate = Disabled;
- kay->macsec_replay_protect = FALSE;
+ kay->macsec_replay_protect = false;
kay->macsec_replay_window = 0;
kay->macsec_confidentiality = CONFIDENTIALITY_NONE;
kay->mka_hello_time = MKA_HELLO_TIME;
} else {
- kay->macsec_desired = TRUE;
- kay->macsec_protect = TRUE;
+ kay->macsec_desired = true;
+ kay->macsec_protect = true;
if (kay->macsec_capable >= MACSEC_CAP_INTEG_AND_CONF &&
policy == SHOULD_ENCRYPT) {
- kay->macsec_encrypt = TRUE;
+ kay->macsec_encrypt = true;
kay->macsec_confidentiality = CONFIDENTIALITY_OFFSET_0;
} else { /* SHOULD_SECURE */
- kay->macsec_encrypt = FALSE;
+ kay->macsec_encrypt = false;
kay->macsec_confidentiality = CONFIDENTIALITY_NONE;
}
kay->macsec_validate = Strict;
ieee802_1x_kay_create_mka(struct ieee802_1x_kay *kay,
const struct mka_key_name *ckn,
const struct mka_key *cak, u32 life,
- enum mka_created_mode mode, Boolean is_authenticator)
+ enum mka_created_mode mode, bool is_authenticator)
{
struct ieee802_1x_mka_participant *participant;
unsigned int usecs;
switch (mode) {
case EAP_EXCHANGE:
if (is_authenticator) {
- participant->is_obliged_key_server = TRUE;
- participant->can_be_key_server = TRUE;
- participant->is_key_server = TRUE;
- participant->principal = TRUE;
+ participant->is_obliged_key_server = true;
+ participant->can_be_key_server = true;
+ participant->is_key_server = true;
+ participant->principal = true;
os_memcpy(&kay->key_server_sci, &kay->actor_sci,
sizeof(kay->key_server_sci));
kay->key_server_priority = kay->actor_priority;
- participant->is_elected = TRUE;
+ participant->is_elected = true;
} else {
- participant->is_obliged_key_server = FALSE;
- participant->can_be_key_server = FALSE;
- participant->is_key_server = FALSE;
- participant->is_elected = TRUE;
+ participant->is_obliged_key_server = false;
+ participant->can_be_key_server = false;
+ participant->is_key_server = false;
+ participant->is_elected = true;
}
break;
default:
- participant->is_obliged_key_server = FALSE;
- participant->can_be_key_server = TRUE;
- participant->is_key_server = TRUE;
- participant->is_elected = FALSE;
+ participant->is_obliged_key_server = false;
+ participant->can_be_key_server = true;
+ participant->is_key_server = true;
+ participant->is_elected = false;
break;
}
- participant->cached = FALSE;
+ participant->cached = false;
- participant->active = FALSE;
- participant->participant = FALSE;
- participant->retain = FALSE;
+ participant->active = false;
+ participant->participant = false;
+ participant->retain = false;
participant->activate = DEFAULT;
if (participant->is_key_server)
- participant->principal = TRUE;
+ participant->principal = true;
dl_list_init(&participant->live_peers);
dl_list_init(&participant->potential_peers);
wpa_printf(MSG_DEBUG, "KaY: Selected random MI: %s",
mi_txt(participant->mi));
- participant->lrx = FALSE;
- participant->ltx = FALSE;
- participant->orx = FALSE;
- participant->otx = FALSE;
- participant->to_dist_sak = FALSE;
- participant->to_use_sak = FALSE;
- participant->new_sak = FALSE;
+ participant->lrx = false;
+ participant->ltx = false;
+ participant->orx = false;
+ participant->otx = false;
+ participant->to_dist_sak = false;
+ participant->to_use_sak = false;
+ participant->new_sak = false;
dl_list_init(&participant->sak_list);
participant->new_key = NULL;
dl_list_init(&participant->rxsc_list);
* ieee802_1x_kay_mka_participate -
*/
void ieee802_1x_kay_mka_participate(struct ieee802_1x_kay *kay,
- struct mka_key_name *ckn,
- Boolean status)
+ struct mka_key_name *ckn, bool status)
{
struct ieee802_1x_mka_participant *participant;
if (!participant)
return -1;
- participant->new_sak = TRUE;
+ participant->new_sak = true;
wpa_printf(MSG_DEBUG, "KaY: new SAK signal");
return 0;
return -2;
if (cs_index == 0)
- kay->macsec_desired = FALSE;
+ kay->macsec_desired = false;
kay->macsec_csindex = cs_index;
kay->macsec_capable = cipher_suite_tbl[kay->macsec_csindex].capable;
participant = ieee802_1x_kay_get_principal_participant(kay);
if (participant) {
wpa_printf(MSG_INFO, "KaY: Cipher Suite changed");
- participant->new_sak = TRUE;
+ participant->new_sak = true;
}
return 0;
}
-static const char * true_false(Boolean val)
+static const char * true_false(bool val)
{
return val ? "true" : "false";
}
}
-static char * mka_mib_peer(struct dl_list *peers, Boolean live, char *buf,
+static char * mka_mib_peer(struct dl_list *peers, bool live, char *buf,
char *end)
{
char *pos = buf;
pos2 += res;
pos = pos2;
- pos = mka_mib_peer(&p->live_peers, TRUE, pos, end);
- pos = mka_mib_peer(&p->potential_peers, FALSE, pos, end);
+ pos = mka_mib_peer(&p->live_peers, true, pos, end);
+ pos = mka_mib_peer(&p->potential_peers, false, pos, end);
}
return pos - buf;
struct ieee802_1x_mka_ki key_identifier;
enum confidentiality_offset confidentiality_offset;
u8 an;
- Boolean transmits;
- Boolean receives;
+ bool transmits;
+ bool receives;
struct os_time created_time;
u32 next_pn;
/* not defined data */
- Boolean rx_latest;
- Boolean tx_latest;
+ bool rx_latest;
+ bool tx_latest;
int user;
/* TransmitSC in IEEE Std 802.1AE-2006, Figure 10-6 */
struct transmit_sc {
struct ieee802_1x_mka_sci sci; /* const SCI sci */
- Boolean transmitting; /* bool transmitting (read only) */
+ bool transmitting; /* bool transmitting (read only) */
struct os_time created_time; /* Time createdTime */
/* TransmitSA in IEEE Std 802.1AE-2006, Figure 10-6 */
struct transmit_sa {
- Boolean in_use; /* bool inUse (read only) */
+ bool in_use; /* bool inUse (read only) */
u32 next_pn; /* PN nextPN (read only) */
struct os_time created_time; /* Time createdTime */
- Boolean enable_transmit; /* bool EnableTransmit */
+ bool enable_transmit; /* bool EnableTransmit */
u8 an;
- Boolean confidentiality;
+ bool confidentiality;
struct data_key *pkey;
struct transmit_sc *sc;
/* ReceiveSC in IEEE Std 802.1AE-2006, Figure 10-6 */
struct receive_sc {
struct ieee802_1x_mka_sci sci; /* const SCI sci */
- Boolean receiving; /* bool receiving (read only) */
+ bool receiving; /* bool receiving (read only) */
struct os_time created_time; /* Time createdTime */
/* ReceiveSA in IEEE Std 802.1AE-2006, Figure 10-6 */
struct receive_sa {
- Boolean enable_receive; /* bool enableReceive */
- Boolean in_use; /* bool inUse (read only) */
+ bool enable_receive; /* bool enableReceive */
+ bool in_use; /* bool inUse (read only) */
u32 next_pn; /* PN nextPN (read only) */
u32 lowest_pn; /* PN lowestPN (read only) */
int (*macsec_init)(void *ctx, struct macsec_init_params *params);
int (*macsec_deinit)(void *ctx);
int (*macsec_get_capability)(void *priv, enum macsec_cap *cap);
- int (*enable_protect_frames)(void *ctx, Boolean enabled);
- int (*enable_encrypt)(void *ctx, Boolean enabled);
- int (*set_replay_protect)(void *ctx, Boolean enabled, u32 window);
+ int (*enable_protect_frames)(void *ctx, bool enabled);
+ int (*enable_encrypt)(void *ctx, bool enabled);
+ int (*set_replay_protect)(void *ctx, bool enabled, u32 window);
int (*set_current_cipher_suite)(void *ctx, u64 cs);
- int (*enable_controlled_port)(void *ctx, Boolean enabled);
+ int (*enable_controlled_port)(void *ctx, bool enabled);
int (*get_receive_lowest_pn)(void *ctx, struct receive_sa *sa);
int (*get_transmit_next_pn)(void *ctx, struct transmit_sa *sa);
int (*set_transmit_next_pn)(void *ctx, struct transmit_sa *sa);
};
struct ieee802_1x_kay {
- Boolean enable;
- Boolean active;
+ bool enable;
+ bool active;
- Boolean authenticated;
- Boolean secured;
- Boolean failed;
+ bool authenticated;
+ bool secured;
+ bool failed;
struct ieee802_1x_mka_sci actor_sci;
u8 actor_priority;
u8 key_server_priority;
enum macsec_cap macsec_capable;
- Boolean macsec_desired;
- Boolean macsec_protect;
- Boolean macsec_encrypt;
- Boolean macsec_replay_protect;
+ bool macsec_desired;
+ bool macsec_protect;
+ bool macsec_encrypt;
+ bool macsec_replay_protect;
u32 macsec_replay_window;
enum validate_frames macsec_validate;
enum confidentiality_offset macsec_confidentiality;
/* not defined in IEEE802.1X */
struct ieee802_1x_kay_ctx *ctx;
- Boolean is_key_server;
- Boolean is_obliged_key_server;
+ bool is_key_server;
+ bool is_obliged_key_server;
char if_name[IFNAMSIZ];
unsigned int macsec_csindex; /* MACsec cipher suite table index */
u8 algo_agility[4];
u32 pn_exhaustion;
- Boolean port_enable;
- Boolean rx_enable;
- Boolean tx_enable;
+ bool port_enable;
+ bool rx_enable;
+ bool tx_enable;
struct dl_list participant_list;
enum macsec_policy policy;
struct ieee802_1x_kay *
ieee802_1x_kay_init(struct ieee802_1x_kay_ctx *ctx, enum macsec_policy policy,
- Boolean macsec_replay_protect, u32 macsec_replay_window,
+ bool macsec_replay_protect, u32 macsec_replay_window,
u16 port, u8 priority, const char *ifname, const u8 *addr);
void ieee802_1x_kay_deinit(struct ieee802_1x_kay *kay);
const struct mka_key_name *ckn,
const struct mka_key *cak,
u32 life, enum mka_created_mode mode,
- Boolean is_authenticator);
+ bool is_authenticator);
void ieee802_1x_kay_delete_mka(struct ieee802_1x_kay *kay,
struct mka_key_name *ckn);
void ieee802_1x_kay_mka_participate(struct ieee802_1x_kay *kay,
struct mka_key_name *ckn,
- Boolean status);
+ bool status);
int ieee802_1x_kay_new_sak(struct ieee802_1x_kay *kay);
int ieee802_1x_kay_change_cipher_suite(struct ieee802_1x_kay *kay,
unsigned int cs_index);
int ieee802_1x_kay_set_latest_sa_attr(struct ieee802_1x_kay *kay,
struct ieee802_1x_mka_ki *lki, u8 lan,
- Boolean ltx, Boolean lrx);
+ bool ltx, bool lrx);
int ieee802_1x_kay_set_old_sa_attr(struct ieee802_1x_kay *kay,
struct ieee802_1x_mka_ki *oki,
- u8 oan, Boolean otx, Boolean orx);
+ u8 oan, bool otx, bool orx);
int ieee802_1x_kay_create_sas(struct ieee802_1x_kay *kay,
struct ieee802_1x_mka_ki *lki);
int ieee802_1x_kay_delete_sas(struct ieee802_1x_kay *kay,
u8 mi[MI_LEN];
u32 mn;
time_t expire;
- Boolean is_key_server;
+ bool is_key_server;
u8 key_server_priority;
- Boolean macsec_desired;
+ bool macsec_desired;
enum macsec_cap macsec_capability;
- Boolean sak_used;
+ bool sak_used;
int missing_sak_use_count;
struct dl_list list;
};
/* used for active and potential participant */
struct mka_key_name ckn;
struct mka_key cak;
- Boolean cached;
+ bool cached;
/* used by management to monitor and control activation */
- Boolean active;
- Boolean participant;
- Boolean retain;
+ bool active;
+ bool participant;
+ bool retain;
enum mka_created_mode mode;
enum activate_ctrl { DEFAULT, DISABLED, ON_OPER_UP, ALWAYS } activate;
/* used for active participant */
- Boolean principal;
+ bool principal;
struct dl_list live_peers;
struct dl_list potential_peers;
struct ieee802_1x_mka_ki lki;
u8 lan;
- Boolean ltx;
- Boolean lrx;
+ bool ltx;
+ bool lrx;
struct ieee802_1x_mka_ki oki;
u8 oan;
- Boolean otx;
- Boolean orx;
+ bool otx;
+ bool orx;
- Boolean is_key_server;
- Boolean is_obliged_key_server;
- Boolean can_be_key_server;
- Boolean is_elected;
+ bool is_key_server;
+ bool is_obliged_key_server;
+ bool can_be_key_server;
+ bool is_elected;
struct dl_list sak_list;
struct dl_list rxsc_list;
time_t cak_life;
time_t mka_life;
- Boolean to_dist_sak;
- Boolean to_use_sak;
- Boolean new_sak;
+ bool to_dist_sak;
+ bool to_use_sak;
+ bool new_sak;
- Boolean advised_desired;
+ bool advised_desired;
enum macsec_cap advised_capability;
struct data_key *new_key;
}
-int secy_cp_control_protect_frames(struct ieee802_1x_kay *kay, Boolean enabled)
+int secy_cp_control_protect_frames(struct ieee802_1x_kay *kay, bool enabled)
{
struct ieee802_1x_kay_ctx *ops;
}
-int secy_cp_control_encrypt(struct ieee802_1x_kay *kay, Boolean enabled)
+int secy_cp_control_encrypt(struct ieee802_1x_kay *kay, bool enabled)
{
struct ieee802_1x_kay_ctx *ops;
}
-int secy_cp_control_replay(struct ieee802_1x_kay *kay, Boolean enabled, u32 win)
+int secy_cp_control_replay(struct ieee802_1x_kay *kay, bool enabled, u32 win)
{
struct ieee802_1x_kay_ctx *ops;
}
-int secy_cp_control_enable_port(struct ieee802_1x_kay *kay, Boolean enabled)
+int secy_cp_control_enable_port(struct ieee802_1x_kay *kay, bool enabled)
{
struct ieee802_1x_kay_ctx *ops;
return -1;
}
- rxsa->enable_receive = TRUE;
+ rxsa->enable_receive = true;
return ops->enable_receive_sa(ops->ctx, rxsa);
}
return -1;
}
- rxsa->enable_receive = FALSE;
+ rxsa->enable_receive = false;
return ops->disable_receive_sa(ops->ctx, rxsa);
}
return -1;
}
- txsa->enable_transmit = TRUE;
+ txsa->enable_transmit = true;
return ops->enable_transmit_sa(ops->ctx, txsa);
}
return -1;
}
- txsa->enable_transmit = FALSE;
+ txsa->enable_transmit = false;
return ops->disable_transmit_sa(ops->ctx, txsa);
}
return -1;
}
- params.use_es = FALSE;
- params.use_scb = FALSE;
- params.always_include_sci = TRUE;
+ params.use_es = false;
+ params.use_scb = false;
+ params.always_include_sci = true;
ret = ops->macsec_init(ops->ctx, ¶ms);
/****** CP -> SecY ******/
int secy_cp_control_validate_frames(struct ieee802_1x_kay *kay,
enum validate_frames vf);
-int secy_cp_control_protect_frames(struct ieee802_1x_kay *kay, Boolean flag);
-int secy_cp_control_encrypt(struct ieee802_1x_kay *kay, Boolean enabled);
-int secy_cp_control_replay(struct ieee802_1x_kay *kay, Boolean flag, u32 win);
+int secy_cp_control_protect_frames(struct ieee802_1x_kay *kay, bool flag);
+int secy_cp_control_encrypt(struct ieee802_1x_kay *kay, bool enabled);
+int secy_cp_control_replay(struct ieee802_1x_kay *kay, bool flag, u32 win);
int secy_cp_control_current_cipher_suite(struct ieee802_1x_kay *kay, u64 cs);
int secy_cp_control_confidentiality_offset(struct ieee802_1x_kay *kay,
enum confidentiality_offset co);
-int secy_cp_control_enable_port(struct ieee802_1x_kay *kay, Boolean flag);
+int secy_cp_control_enable_port(struct ieee802_1x_kay *kay, bool flag);
/****** KaY -> SecY *******/
int secy_get_capability(struct ieee802_1x_kay *kay, enum macsec_cap *cap);
}
static inline int wpa_drv_enable_protect_frames(struct wpa_supplicant *wpa_s,
- Boolean enabled)
+ bool enabled)
{
if (!wpa_s->driver->enable_protect_frames)
return -1;
}
static inline int wpa_drv_enable_encrypt(struct wpa_supplicant *wpa_s,
- Boolean enabled)
+ bool enabled)
{
if (!wpa_s->driver->enable_encrypt)
return -1;
}
static inline int wpa_drv_set_replay_protect(struct wpa_supplicant *wpa_s,
- Boolean enabled, u32 window)
+ bool enabled, u32 window)
{
if (!wpa_s->driver->set_replay_protect)
return -1;
}
static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s,
- Boolean enabled)
+ bool enabled)
{
if (!wpa_s->driver->enable_controlled_port)
return -1;
}
-static int wpas_enable_protect_frames(void *wpa_s, Boolean enabled)
+static int wpas_enable_protect_frames(void *wpa_s, bool enabled)
{
return wpa_drv_enable_protect_frames(wpa_s, enabled);
}
-static int wpas_enable_encrypt(void *wpa_s, Boolean enabled)
+static int wpas_enable_encrypt(void *wpa_s, bool enabled)
{
return wpa_drv_enable_encrypt(wpa_s, enabled);
}
-static int wpas_set_replay_protect(void *wpa_s, Boolean enabled, u32 window)
+static int wpas_set_replay_protect(void *wpa_s, bool enabled, u32 window)
{
return wpa_drv_set_replay_protect(wpa_s, enabled, window);
}
}
-static int wpas_enable_controlled_port(void *wpa_s, Boolean enabled)
+static int wpas_enable_controlled_port(void *wpa_s, bool enabled)
{
return wpa_drv_enable_controlled_port(wpa_s, enabled);
}
wpa_hexdump(MSG_DEBUG, "Derived CKN", ckn->name, ckn->len);
res = ieee802_1x_kay_create_mka(wpa_s->kay, ckn, cak, 0,
- EAP_EXCHANGE, FALSE);
+ EAP_EXCHANGE, false);
fail:
if (msk) {
ckn->len = ssid->mka_ckn_len;
os_memcpy(ckn->name, ssid->mka_ckn, ckn->len);
- res = ieee802_1x_kay_create_mka(wpa_s->kay, ckn, cak, 0, PSK, FALSE);
+ res = ieee802_1x_kay_create_mka(wpa_s->kay, ckn, cak, 0, PSK, false);
if (res)
goto free_cak;