Structure alignment

양승용 joshua.yang at samsung.com
Wed Jun 1 02:02:36 EDT 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