]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use a less generic name for IEEE802.11 CRC-32 routine
authorSergey Matyukevich <geomatsi@gmail.com>
Mon, 5 Sep 2022 20:18:23 +0000 (23:18 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 16 Sep 2022 18:39:47 +0000 (21:39 +0300)
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>
hostapd/config_file.c
src/ap/hostapd.c
src/ap/neighbor_db.c
src/utils/crc32.c
src/utils/crc32.h
wlantest/process.c
wlantest/test_vectors.c
wlantest/tkip.c
wlantest/wep.c

index b04c65570e506596253361e1757e64321c516974..5715ded42936df20ebd2ce510f85172f905d7795 100644 (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;
index 05faa0f143d58b51cf01f4e1f50116783d805306..3681df6a7c03ef881d2d6ccfd0f6eb99fdc992f1 100644 (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
index 52f25eb7afb12f0798760c7cca5e23c2ac54cc9c..5b276e8da7851553a536f29e583ced8132eab609 100644 (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)
index 12d9e2a7008ed96c4b47fffa1147533bc4a80211..3712549945dc4c60040573c5fde3fde2ed76818a 100644 (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;
index dc31399beb638e65858a287e3adb29413a8873c6..71a19dc5fcc3293f1e85fa1909c40409486c4956 100644 (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 */
index 4d174bada947c5402f7ce720d283b89a6e899984..92dd0a6d801dbef9eff3b227cd857847b6fac721 100644 (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;
 }
index 800d3655705f1a32f5f365b25ebfbecede9c5835..2f52df6cdfd2f2936fffe5bde5c8bd1bb7aaeecd 100644 (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;
index 843f6518a382de0b2c53fef91363a4067d3a1daf..201561150c654255a87d7c0f766d9e8c4cc03406 100644 (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;
index 50e371fc51033f40b4acff59949caa0ea486a525..6f8f13ac3c6ff0239429f82f55cf1353320966d0 100644 (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;