Structure alignment

양승용 joshua.yang
Tue May 31 23:02:36 PDT 2005


Hi all

In wpa.h (0.4.1 release)

I have seen the following line

struct ieee802_1x_eapol_key {
    u8 type;
    u16 key_length;
    /* does not repeat within the life of the keying material used to
     * encrypt the Key field; 64-bit NTP timestamp MAY be used here */
    u8 replay_counter[IEEE8021X_REPLAY_COUNTER_LEN];
    ...
}

which in not 16bit aligned. If wpa_supplicant is built with visual c++ 6.0, It will cause problem

I suggest that the above structure may be

struct ieee802_1x_eapol_key {
    u8 type;
    u8 key_length[2];
    /* does not repeat within the life of the keying material used to
     * encrypt the Key field; 64-bit NTP timestamp MAY be used here */
    u8 replay_counter[IEEE8021X_REPLAY_COUNTER_LEN];
    ...
}

in code which is dealing with above structure.

memcpy key_length to temporary u16 variable and convert temporary variable to host order variable.

...

=====================================================
??????(?)
??? ??? ??? 261-8 ???? 5? ?????
?????? XIA ??   ? ? ?
Tel. 02-390-8077     Fax. 02)390-8099
Hp. 016-383-6558     Email. joshua.yang at samsung.com
=====================================================



More information about the Hostap mailing list