Use a less generic name for IEEE802.11 CRC-32 routine

Hostapd uses 'crc32' name for IEEE802.11 CRC-32 routine. This name is
too generic. Buildroot autobuilder detected build configuration that
failed to build due to the naming conflict: static linking with openssl
using zlib-ng as a zlib provider, e.g. see:
- http://autobuild.buildroot.net/results/9901df820d3afa4cde78e8ad6d62cb8ce7e69fdb/
- http://autobuild.buildroot.net/results/ac19975f0bf77f4a8ca574c374092ba81cd5a332/

Use a less generic name ieee80211_crc32 for IEEE802.11 CRC-32 routine
to avoid such naming conflicts.

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
This commit is contained in:
Sergey Matyukevich 2022-09-05 23:18:23 +03:00 committed by Jouni Malinen
parent c52ec086da
commit 0c7b3814ca
9 changed files with 18 additions and 17 deletions

View file

@ -2365,7 +2365,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
}
os_memcpy(ssid->ssid, pos, ssid->ssid_len);
ssid->ssid_set = 1;
ssid->short_ssid = crc32(ssid->ssid, ssid->ssid_len);
ssid->short_ssid = ieee80211_crc32(ssid->ssid, ssid->ssid_len);
} else if (os_strcmp(buf, "ssid2") == 0) {
struct hostapd_ssid *ssid = &bss->ssid;
size_t slen;
@ -2379,7 +2379,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
os_memcpy(ssid->ssid, str, slen);
ssid->ssid_len = slen;
ssid->ssid_set = 1;
ssid->short_ssid = crc32(ssid->ssid, ssid->ssid_len);
ssid->short_ssid = ieee80211_crc32(ssid->ssid, ssid->ssid_len);
os_free(str);
} else if (os_strcmp(buf, "utf8_ssid") == 0) {
bss->ssid.utf8_ssid = atoi(pos) > 0;

View file

@ -1238,7 +1238,8 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
* Short SSID calculation is identical to FCS and it is defined in
* IEEE P802.11-REVmd/D3.0, 9.4.2.170.3 (Calculating the Short-SSID).
*/
conf->ssid.short_ssid = crc32(conf->ssid.ssid, conf->ssid.ssid_len);
conf->ssid.short_ssid = ieee80211_crc32(conf->ssid.ssid,
conf->ssid.ssid_len);
if (!hostapd_drv_none(hapd)) {
wpa_printf(MSG_DEBUG, "Using interface %s with hwaddr " MACSTR

View file

@ -136,7 +136,7 @@ int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid,
os_memcpy(entry->bssid, bssid, ETH_ALEN);
os_memcpy(&entry->ssid, ssid, sizeof(entry->ssid));
entry->short_ssid = crc32(ssid->ssid, ssid->ssid_len);
entry->short_ssid = ieee80211_crc32(ssid->ssid, ssid->ssid_len);
entry->nr = wpabuf_dup(nr);
if (!entry->nr)

View file

@ -72,7 +72,7 @@ static const u32 crc32_table[256] = {
};
u32 crc32(const u8 *frame, size_t frame_len)
u32 ieee80211_crc32(const u8 *frame, size_t frame_len)
{
size_t i;
u32 crc;

View file

@ -9,6 +9,6 @@
#ifndef CRC32_H
#define CRC32_H
u32 crc32(const u8 *frame, size_t frame_len);
u32 ieee80211_crc32(const u8 *frame, size_t frame_len);
#endif /* CRC32_H */

View file

@ -264,7 +264,7 @@ static void tx_status(struct wlantest *wt, const u8 *data, size_t len, int ack)
static int check_fcs(const u8 *frame, size_t frame_len, const u8 *fcs)
{
if (WPA_GET_LE32(fcs) != crc32(frame, frame_len))
if (WPA_GET_LE32(fcs) != ieee80211_crc32(frame, frame_len))
return -1;
return 0;
}

View file

@ -115,7 +115,7 @@ static void test_vector_ccmp(void)
}
wpa_hexdump(MSG_INFO, "Encrypted MPDU (without FCS)", enc, enc_len);
WPA_PUT_LE32(fcs, crc32(enc, enc_len));
WPA_PUT_LE32(fcs, ieee80211_crc32(enc, enc_len));
wpa_hexdump(MSG_INFO, "FCS", fcs, sizeof(fcs));
wpa_debug_level = MSG_INFO;
@ -244,7 +244,7 @@ static void test_vector_ccmp_pv1(void)
wpa_hexdump(MSG_INFO, "Encrypted Frame Header", enc, 12);
wpa_hexdump(MSG_INFO, "Encrypted Frame Frame Body",
enc + 12, enc_len - 12);
WPA_PUT_LE32(fcs, crc32(enc, enc_len));
WPA_PUT_LE32(fcs, ieee80211_crc32(enc, enc_len));
wpa_hexdump(MSG_INFO, "Encrypted Frame FCS", fcs, sizeof(fcs));
wpa_printf(MSG_INFO,
@ -294,7 +294,7 @@ static void test_vector_ccmp_pv1(void)
wpa_hexdump(MSG_INFO, "Encrypted Frame Header", enc, 18);
wpa_hexdump(MSG_INFO, "Encrypted Frame Frame Body",
enc + 18, enc_len - 18);
WPA_PUT_LE32(fcs, crc32(enc, enc_len));
WPA_PUT_LE32(fcs, ieee80211_crc32(enc, enc_len));
wpa_hexdump(MSG_INFO, "Encrypted Frame FCS", fcs, sizeof(fcs));
wpa_printf(MSG_INFO,
@ -338,7 +338,7 @@ static void test_vector_ccmp_pv1(void)
wpa_hexdump(MSG_INFO, "Encrypted Frame Header", enc, 16);
wpa_hexdump(MSG_INFO, "Encrypted Frame Frame Body",
enc + 16, enc_len - 16);
WPA_PUT_LE32(fcs, crc32(enc, enc_len));
WPA_PUT_LE32(fcs, ieee80211_crc32(enc, enc_len));
wpa_hexdump(MSG_INFO, "Encrypted Frame FCS", fcs, sizeof(fcs));
wpa_debug_level = MSG_INFO;
@ -601,7 +601,7 @@ static int run_gcmp(int idx, const struct gcmp_test *vector)
wpa_printf(MSG_ERROR, "GCMP test mpdu #%d MIC mismatch", idx);
err++;
}
WPA_PUT_LE32(fcs, crc32(enc, enc_len));
WPA_PUT_LE32(fcs, ieee80211_crc32(enc, enc_len));
wpa_hexdump(MSG_INFO, "FCS", fcs, sizeof(fcs));
wpa_debug_level = MSG_INFO;
@ -703,7 +703,7 @@ static int test_vector_gcmp_256(void)
wpa_printf(MSG_ERROR, "GCMP-256 test vector mismatch");
err++;
}
WPA_PUT_LE32(fcs, crc32(enc, enc_len));
WPA_PUT_LE32(fcs, ieee80211_crc32(enc, enc_len));
wpa_hexdump(MSG_INFO, "FCS", fcs, sizeof(fcs));
wpa_debug_level = MSG_INFO;
@ -781,7 +781,7 @@ static int test_vector_ccmp_256(void)
wpa_printf(MSG_ERROR, "CCMP-256 test vector mismatch");
err++;
}
WPA_PUT_LE32(fcs, crc32(enc, enc_len));
WPA_PUT_LE32(fcs, ieee80211_crc32(enc, enc_len));
wpa_hexdump(MSG_INFO, "FCS", fcs, sizeof(fcs));
wpa_debug_level = MSG_INFO;

View file

@ -329,7 +329,7 @@ u8 * tkip_decrypt(const u8 *tk, const struct ieee80211_hdr *hdr,
return NULL;
wep_crypt(rc4key, plain, plain_len);
icv = crc32(plain, plain_len - 4);
icv = ieee80211_crc32(plain, plain_len - 4);
rx_icv = WPA_GET_LE32(plain + plain_len - 4);
if (icv != rx_icv) {
wpa_printf(MSG_INFO, "TKIP ICV mismatch in frame from " MACSTR,
@ -482,7 +482,7 @@ u8 * tkip_encrypt(const u8 *tk, u8 *frame, size_t len, size_t hdrlen, u8 *qos,
os_memcpy(pos, frame + hdrlen, len - hdrlen);
os_memcpy(pos + len - hdrlen, mic, sizeof(mic));
WPA_PUT_LE32(pos + len - hdrlen + sizeof(mic),
crc32(pos, len - hdrlen + sizeof(mic)));
ieee80211_crc32(pos, len - hdrlen + sizeof(mic)));
wep_crypt(rc4key, pos, len - hdrlen + sizeof(mic) + 4);
*encrypted_len = len + 8 + sizeof(mic) + 4;

View file

@ -59,7 +59,7 @@ static int try_wep(const u8 *key, size_t key_len, const u8 *data,
os_memcpy(plain, data, data_len);
wep_crypt(k, plain, data_len);
icv = crc32(plain, data_len - 4);
icv = ieee80211_crc32(plain, data_len - 4);
rx_icv = WPA_GET_LE32(plain + data_len - 4);
if (icv != rx_icv)
return -1;