]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-pwd: Remove struct eap_pwd_hdr
authorJouni Malinen <j@w1.fi>
Sat, 19 Nov 2011 14:52:52 +0000 (16:52 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 19 Nov 2011 14:52:52 +0000 (16:52 +0200)
This structure was not really used for anything apart from figuring out
length of the EAP-pwd header (and even that in a way that would not work
with fragmentation). Since the bitfields in the structure could have
been problematic depending on target endianness, remove this unnecessary
structure.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/eap_common/eap_pwd_common.h
src/eap_peer/eap_pwd.c
src/eap_server/eap_server_pwd.c

index 971386d740898daa3bd239b4ff25cbfcb0396d82..4b841b742c6a03eb0245a2016e02db9d3743b51e 100644 (file)
@@ -35,13 +35,8 @@ typedef struct group_definition_ {
 
 /*
  * EAP-pwd header, included on all payloads
+ * L(1 bit) | M(1 bit) | exch(6 bits) | total_length(if L is set)
  */
-struct eap_pwd_hdr {
-       u8 l_bit:1;
-       u8 m_bit:1;
-       u8 exch:6;
-       u8 total_length[0];         /* included when l_bit is set */
-} STRUCT_PACKED;
 
 #define EAP_PWD_OPCODE_ID_EXCH          1
 #define EAP_PWD_OPCODE_COMMIT_EXCH      2
index 6511a665457c093f533076786094d54877bdfa92..1957c82820edf7183a83c2a60024606600d465cc 100644 (file)
@@ -423,8 +423,7 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
        BN_bn2bin(y, element + BN_num_bytes(data->grp->prime) + offset);
 
        resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
-                            sizeof(struct eap_pwd_hdr) +
-                            BN_num_bytes(data->grp->order) +
+                            1 + BN_num_bytes(data->grp->order) +
                             (2 * BN_num_bytes(data->grp->prime)),
                             EAP_CODE_RESPONSE, eap_get_id(reqData));
        if (resp == NULL)
@@ -633,7 +632,7 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
        H_Final(&ctx, conf);
 
        resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
-                            sizeof(struct eap_pwd_hdr) + SHA256_DIGEST_LENGTH,
+                            1 + SHA256_DIGEST_LENGTH,
                             EAP_CODE_RESPONSE, eap_get_id(reqData));
        if (resp == NULL)
                goto fin;
index cf714c5f6b9ac78f32ebbf905e5ee3b2da230a52..4c6f4d1f17e1f6df992fb72eb3ba65544054c838 100644 (file)
@@ -156,8 +156,8 @@ eap_pwd_build_id_req(struct eap_sm *sm, struct eap_pwd_data *data, u8 id)
 
        wpa_printf(MSG_DEBUG, "EAP-pwd: ID/Request");
        req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
-                           sizeof(struct eap_pwd_hdr) +
-                           sizeof(struct eap_pwd_id) + data->id_server_len,
+                           1 + sizeof(struct eap_pwd_id) +
+                           data->id_server_len,
                            EAP_CODE_REQUEST, id);
        if (req == NULL) {
                eap_pwd_state(data, FAILURE);
@@ -257,8 +257,7 @@ eap_pwd_build_commit_req(struct eap_sm *sm, struct eap_pwd_data *data, u8 id)
        BN_bn2bin(y, element + BN_num_bytes(data->grp->prime) + offset);
 
        req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
-                           sizeof(struct eap_pwd_hdr) +
-                           (2 * BN_num_bytes(data->grp->prime)) +
+                           1 + (2 * BN_num_bytes(data->grp->prime)) +
                            BN_num_bytes(data->grp->order),
                            EAP_CODE_REQUEST, id);
        if (req == NULL)
@@ -385,7 +384,7 @@ eap_pwd_build_confirm_req(struct eap_sm *sm, struct eap_pwd_data *data, u8 id)
        os_memcpy(data->my_confirm, conf, SHA256_DIGEST_LENGTH);
 
        req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
-                           sizeof(struct eap_pwd_hdr) + SHA256_DIGEST_LENGTH,
+                           1 + SHA256_DIGEST_LENGTH,
                            EAP_CODE_REQUEST, id);
        if (req == NULL)
                goto fin;