mka: Remove cs_len argument from the set_current_cipher_suite functions
This is a known constant value (CS_ID_LEN, i.e., the length of the EUI64 identifier) and does not need to be provided separately in these function calls. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
This commit is contained in:
parent
46bbda2b83
commit
ec958aee32
8 changed files with 13 additions and 20 deletions
|
@ -3317,11 +3317,9 @@ struct wpa_driver_ops {
|
||||||
* set_current_cipher_suite - Set current cipher suite
|
* set_current_cipher_suite - Set current cipher suite
|
||||||
* @priv: Private driver interface data
|
* @priv: Private driver interface data
|
||||||
* @cs: EUI64 identifier
|
* @cs: EUI64 identifier
|
||||||
* @cs_len: Length of the cs buffer in octets
|
|
||||||
* Returns: 0 on success, -1 on failure (or if not supported)
|
* Returns: 0 on success, -1 on failure (or if not supported)
|
||||||
*/
|
*/
|
||||||
int (*set_current_cipher_suite)(void *priv, const u8 *cs,
|
int (*set_current_cipher_suite)(void *priv, const u8 *cs);
|
||||||
size_t cs_len);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enable_controlled_port - Set controlled port status
|
* enable_controlled_port - Set controlled port status
|
||||||
|
|
|
@ -485,15 +485,13 @@ static int macsec_qca_set_replay_protect(void *priv, Boolean enabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int macsec_qca_set_current_cipher_suite(void *priv, const u8 *cs,
|
static int macsec_qca_set_current_cipher_suite(void *priv, const u8 *cs)
|
||||||
size_t cs_len)
|
|
||||||
{
|
{
|
||||||
u8 default_cs_id[] = CS_ID_GCM_AES_128;
|
u8 default_cs_id[] = CS_ID_GCM_AES_128;
|
||||||
|
|
||||||
if (cs_len != CS_ID_LEN ||
|
if (os_memcmp(cs, default_cs_id, CS_ID_LEN) != 0) {
|
||||||
os_memcmp(cs, default_cs_id, cs_len) != 0) {
|
|
||||||
wpa_hexdump(MSG_ERROR, "macsec: NOT supported CipherSuite",
|
wpa_hexdump(MSG_ERROR, "macsec: NOT supported CipherSuite",
|
||||||
cs, cs_len);
|
cs, CS_ID_LEN);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,8 +198,7 @@ SM_STATE(CP, SECURED)
|
||||||
|
|
||||||
/* NOTE: now no other than default cipher suiter(AES-GCM-128) */
|
/* NOTE: now no other than default cipher suiter(AES-GCM-128) */
|
||||||
os_memcpy(sm->current_cipher_suite, sm->cipher_suite, CS_ID_LEN);
|
os_memcpy(sm->current_cipher_suite, sm->cipher_suite, CS_ID_LEN);
|
||||||
secy_cp_control_current_cipher_suite(sm->kay, sm->current_cipher_suite,
|
secy_cp_control_current_cipher_suite(sm->kay, sm->current_cipher_suite);
|
||||||
CS_ID_LEN);
|
|
||||||
|
|
||||||
sm->confidentiality_offset = sm->cipher_offset;
|
sm->confidentiality_offset = sm->cipher_offset;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct ieee802_1x_kay_ctx {
|
||||||
int (*macsec_deinit)(void *ctx);
|
int (*macsec_deinit)(void *ctx);
|
||||||
int (*enable_protect_frames)(void *ctx, Boolean enabled);
|
int (*enable_protect_frames)(void *ctx, Boolean enabled);
|
||||||
int (*set_replay_protect)(void *ctx, Boolean enabled, u32 window);
|
int (*set_replay_protect)(void *ctx, Boolean enabled, u32 window);
|
||||||
int (*set_current_cipher_suite)(void *ctx, const u8 *cs, size_t cs_len);
|
int (*set_current_cipher_suite)(void *ctx, const u8 *cs);
|
||||||
int (*enable_controlled_port)(void *ctx, Boolean enabled);
|
int (*enable_controlled_port)(void *ctx, Boolean enabled);
|
||||||
int (*get_receive_lowest_pn)(void *ctx, u32 channel, u8 an,
|
int (*get_receive_lowest_pn)(void *ctx, u32 channel, u8 an,
|
||||||
u32 *lowest_pn);
|
u32 *lowest_pn);
|
||||||
|
|
|
@ -66,7 +66,7 @@ int secy_cp_control_replay(struct ieee802_1x_kay *kay, Boolean enabled, u32 win)
|
||||||
|
|
||||||
|
|
||||||
int secy_cp_control_current_cipher_suite(struct ieee802_1x_kay *kay,
|
int secy_cp_control_current_cipher_suite(struct ieee802_1x_kay *kay,
|
||||||
const u8 *cs, size_t cs_len)
|
const u8 *cs)
|
||||||
{
|
{
|
||||||
struct ieee802_1x_kay_ctx *ops;
|
struct ieee802_1x_kay_ctx *ops;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ int secy_cp_control_current_cipher_suite(struct ieee802_1x_kay *kay,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ops->set_current_cipher_suite(ops->ctx, cs, cs_len);
|
return ops->set_current_cipher_suite(ops->ctx, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ int secy_cp_control_validate_frames(struct ieee802_1x_kay *kay,
|
||||||
int secy_cp_control_protect_frames(struct ieee802_1x_kay *kay, Boolean flag);
|
int secy_cp_control_protect_frames(struct ieee802_1x_kay *kay, Boolean flag);
|
||||||
int secy_cp_control_replay(struct ieee802_1x_kay *kay, Boolean flag, u32 win);
|
int secy_cp_control_replay(struct ieee802_1x_kay *kay, Boolean flag, u32 win);
|
||||||
int secy_cp_control_current_cipher_suite(struct ieee802_1x_kay *kay,
|
int secy_cp_control_current_cipher_suite(struct ieee802_1x_kay *kay,
|
||||||
const u8 *cs, size_t cs_len);
|
const u8 *cs);
|
||||||
int secy_cp_control_confidentiality_offset(struct ieee802_1x_kay *kay,
|
int secy_cp_control_confidentiality_offset(struct ieee802_1x_kay *kay,
|
||||||
enum confidentiality_offset co);
|
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, Boolean flag);
|
||||||
|
|
|
@ -733,12 +733,11 @@ static inline int wpa_drv_set_replay_protect(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int wpa_drv_set_current_cipher_suite(struct wpa_supplicant *wpa_s,
|
static inline int wpa_drv_set_current_cipher_suite(struct wpa_supplicant *wpa_s,
|
||||||
const u8 *cs, size_t cs_len)
|
const u8 *cs)
|
||||||
{
|
{
|
||||||
if (!wpa_s->driver->set_current_cipher_suite)
|
if (!wpa_s->driver->set_current_cipher_suite)
|
||||||
return -1;
|
return -1;
|
||||||
return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs,
|
return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs);
|
||||||
cs_len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s,
|
static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s,
|
||||||
|
|
|
@ -50,10 +50,9 @@ static int wpas_set_replay_protect(void *wpa_s, Boolean enabled, u32 window)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int wpas_set_current_cipher_suite(void *wpa_s, const u8 *cs,
|
static int wpas_set_current_cipher_suite(void *wpa_s, const u8 *cs)
|
||||||
size_t cs_len)
|
|
||||||
{
|
{
|
||||||
return wpa_drv_set_current_cipher_suite(wpa_s, cs, cs_len);
|
return wpa_drv_set_current_cipher_suite(wpa_s, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue