]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mka: Remove cs_len argument from the set_current_cipher_suite functions
authorSabrina Dubroca <sd@queasysnail.net>
Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 28 Aug 2016 17:55:34 +0000 (20:55 +0300)
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>
src/drivers/driver.h
src/drivers/driver_macsec_qca.c
src/pae/ieee802_1x_cp.c
src/pae/ieee802_1x_kay.h
src/pae/ieee802_1x_secy_ops.c
src/pae/ieee802_1x_secy_ops.h
wpa_supplicant/driver_i.h
wpa_supplicant/wpas_kay.c

index a5c5c1b3025ebfd6a57b83477ba7b643c4a86d3d..591943d18f1cc991d71709ab5c1c7eacf2851b9c 100644 (file)
@@ -3317,11 +3317,9 @@ struct wpa_driver_ops {
         * set_current_cipher_suite - Set current cipher suite
         * @priv: Private driver interface data
         * @cs: EUI64 identifier
-        * @cs_len: Length of the cs buffer in octets
         * Returns: 0 on success, -1 on failure (or if not supported)
         */
-       int (*set_current_cipher_suite)(void *priv, const u8 *cs,
-                                       size_t cs_len);
+       int (*set_current_cipher_suite)(void *priv, const u8 *cs);
 
        /**
         * enable_controlled_port - Set controlled port status
index 3eae2f89d20e80ddfd9da1ef5a08634988e9c54e..0c9c7274693e1fd6314104833236c88a3f1584b3 100644 (file)
@@ -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,
-                                              size_t cs_len)
+static int macsec_qca_set_current_cipher_suite(void *priv, const u8 *cs)
 {
        u8 default_cs_id[] = CS_ID_GCM_AES_128;
 
-       if (cs_len != CS_ID_LEN ||
-           os_memcmp(cs, default_cs_id, cs_len) != 0) {
+       if (os_memcmp(cs, default_cs_id, CS_ID_LEN) != 0) {
                wpa_hexdump(MSG_ERROR, "macsec: NOT supported CipherSuite",
-                           cs, cs_len);
+                           cs, CS_ID_LEN);
                return -1;
        }
 
index cf43c594c4022870185bfef9f1b0a0c522e8bd71..83fd5ed73953cce227c9e5ad395bfcd5024a4c3d 100644 (file)
@@ -198,8 +198,7 @@ SM_STATE(CP, SECURED)
 
        /* NOTE: now no other than default cipher suiter(AES-GCM-128) */
        os_memcpy(sm->current_cipher_suite, sm->cipher_suite, CS_ID_LEN);
-       secy_cp_control_current_cipher_suite(sm->kay, sm->current_cipher_suite,
-                                            CS_ID_LEN);
+       secy_cp_control_current_cipher_suite(sm->kay, sm->current_cipher_suite);
 
        sm->confidentiality_offset = sm->cipher_offset;
 
index ea15335fa3db6d26f15bd12b51ccbb75b6867bbf..ada2882d82671c7da605e9698ef5f97947f1cb3c 100644 (file)
@@ -61,7 +61,7 @@ struct ieee802_1x_kay_ctx {
        int (*macsec_deinit)(void *ctx);
        int (*enable_protect_frames)(void *ctx, Boolean enabled);
        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 (*get_receive_lowest_pn)(void *ctx, u32 channel, u8 an,
                                     u32 *lowest_pn);
index fbe05dc35d7cb2a1ce4df284a21af01b3a86289f..8a6f05ae6ba1532529582bfcd7f162ef8dc0f56b 100644 (file)
@@ -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,
-                                        const u8 *cs, size_t cs_len)
+                                        const u8 *cs)
 {
        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 ops->set_current_cipher_suite(ops->ctx, cs, cs_len);
+       return ops->set_current_cipher_suite(ops->ctx, cs);
 }
 
 
index 295b823a9d7f33f24f1b07bdeb2b047576051f99..c9fd33f545e853f41cb9e6c1669f4108a8700892 100644 (file)
@@ -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_replay(struct ieee802_1x_kay *kay, Boolean flag, u32 win);
 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,
                                           enum confidentiality_offset co);
 int secy_cp_control_enable_port(struct ieee802_1x_kay *kay, Boolean flag);
index 7a16b7aa39c1163863179ed3d5b3912ea4b5c4cd..63b225a1911bbf631daa2eee2ffa4320033f3c58 100644 (file)
@@ -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,
-                                                  const u8 *cs, size_t cs_len)
+                                                  const u8 *cs)
 {
        if (!wpa_s->driver->set_current_cipher_suite)
                return -1;
-       return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs,
-                                                      cs_len);
+       return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs);
 }
 
 static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s,
index 0b876008d5822abbe91bf397a9a1db67e561496f..7e1b51a61fabc25f4f39c69973521faa266ea017 100644 (file)
@@ -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,
-                                        size_t cs_len)
+static int wpas_set_current_cipher_suite(void *wpa_s, const u8 *cs)
 {
-       return wpa_drv_set_current_cipher_suite(wpa_s, cs, cs_len);
+       return wpa_drv_set_current_cipher_suite(wpa_s, cs);
 }