From patchwork Mon Sep 5 20:18:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 1674436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Gt5NXAzq; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=GB/E8VZH; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MM0PT1K34z1yhP for ; Tue, 6 Sep 2022 06:24:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7bmEbGBTLpIAekMUOMi8+tavP1ZwJT4gPN5UFx1VVMk=; b=Gt5NXAzq+28eAM FqOULYy2IHv7gc96EeoplfVGmpKLkHGYQtoeNA8JbC+dlzhGLKhxTDvOSlAMgTkidHNzofD49Eb35 UwrH0Z9gp8Tv6zQCu2ZBva2Bn2aSLsmFsn4F+j7Iuu5/9KsZneUpy24oVgRY67Z3oEVQs9LXkLUtP n6S1uFUCdgXxwvIHCPGLikRXdezQtjyuAbsZpuqLoQXIJH2TGdWYGmUuE/uiRFLv2rjU7C4lEeDsF bU21yxrTp/T1vuoGAhopeN6lwUyepQdn6spJ+6u5dP+RB606S60eeWxh5CYAJrJbuLCl3xc7FBJq6 moKgXTMtssRit5KRLcfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVIcf-00ALmB-IF; Mon, 05 Sep 2022 20:23:12 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVIYB-00AEcl-A5 for hostap@lists.infradead.org; Mon, 05 Sep 2022 20:18:33 +0000 Received: by mail-lj1-x22a.google.com with SMTP id bn9so10232017ljb.6 for ; Mon, 05 Sep 2022 13:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=Jl7a0exKuCAQffvUjCTEv/FtI32QDl13N8L8mYEVrx0=; b=GB/E8VZHpM9xUzm3zmEW5TnRVne47+DiVtEBKEbd9c7stupi1QnYA+0JNxMb6WkYjO Dn9+eliupBCqC4lb5iz3LciXh84dTfLt6PSSPn4N11ZzikgwMlZ1Mvn66lX9Zi58lkZX FJVxaWe/ekxal3V4fUBhVBL1e+ac5gkMsxpjS6ZNuktP6azLaGjOaLv/FvMY/glsGkCX +T3uYhegiTV3ZYqplhq+wH8zDWESuQBRIlVinRs9sffdPUFojtiLjBbTZcPbuUFrg6uA 8Nnl9DZymUzPFQZSFCqm845vgLNlifhHfS7Bk62bXu8Ele6ckKEIJQrhojVVUSnYA89D l9Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=Jl7a0exKuCAQffvUjCTEv/FtI32QDl13N8L8mYEVrx0=; b=VMai/hID4IIK8SaNlNeRNjoTNS8El58bNThK6iqnCWfgebxwAn33JqtgqNkbgr9Ajf uOFbkxc1RJmSejc4nnElckcTeSqzNMVp5zKh094Q01rJJLvGHYnOnkC6x6VtT7EDl0z5 0dGYQwHQkYB9VGBSKbPyBlEh/YW6x0pO2OWEgMlbysSvYiuIVRnnH9rPPijelTqDHDy4 XcfSuTpoRYx/4qqlUdXyqVMJNb9F08Rl6+9vI1r2bPZwmWOlyoYSc1lZxTXn8cCDGT8n UkRJN+6Or3UlU7F/RF9SYK/fluO325+fGBSeZbopbb4B/PAC4vw9h1ohjxR/E317b8sS utoQ== X-Gm-Message-State: ACgBeo1NHDpWixWkOdztIIj4qa4yMY5M365Bp/azlVr/eYLWRjFdCAkb 7wnWdNie+nK1Lhrrt8eonANXisoqJHU= X-Google-Smtp-Source: AA6agR47AuKQKD07wo8B98c35k00pOCkVwAxQO+xaJC5qxkCmjGvh7uSZC/9/oQ2HVtzQyF3q7HqlQ== X-Received: by 2002:a2e:a552:0:b0:25e:6fa1:a6c4 with SMTP id e18-20020a2ea552000000b0025e6fa1a6c4mr14315880ljn.90.1662409106214; Mon, 05 Sep 2022 13:18:26 -0700 (PDT) Received: from localhost.localdomain ([5.188.167.245]) by smtp.googlemail.com with ESMTPSA id d15-20020ac244cf000000b00494643db68bsm1295711lfm.78.2022.09.05.13.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 13:18:25 -0700 (PDT) From: Sergey Matyukevich To: hostap@lists.infradead.org Cc: Sergey Matyukevich Subject: [PATCH 1/1] Use a less generic name for IEEE802.11 CRC-32 routine Date: Mon, 5 Sep 2022 23:18:23 +0300 Message-Id: <20220905201823.1590570-1-geomatsi@gmail.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_131831_513986_FEC127F4 X-CRM114-Status: GOOD ( 17.71 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 wi [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:22a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [geomatsi[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- hostapd/config_file.c | 4 ++-- src/ap/hostapd.c | 2 +- src/ap/neighbor_db.c | 2 +- src/utils/crc32.c | 2 +- src/utils/crc32.h | 2 +- wlantest/process.c | 2 +- wlantest/test_vectors.c | 14 +++++++------- wlantest/tkip.c | 4 ++-- wlantest/wep.c | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index b04c65570..5715ded42 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -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; diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 05faa0f14..99df96c69 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1238,7 +1238,7 @@ 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 diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c index 52f25eb7a..5b276e8da 100644 --- a/src/ap/neighbor_db.c +++ b/src/ap/neighbor_db.c @@ -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) diff --git a/src/utils/crc32.c b/src/utils/crc32.c index 12d9e2a70..371254994 100644 --- a/src/utils/crc32.c +++ b/src/utils/crc32.c @@ -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; diff --git a/src/utils/crc32.h b/src/utils/crc32.h index dc31399be..71a19dc5f 100644 --- a/src/utils/crc32.h +++ b/src/utils/crc32.h @@ -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 */ diff --git a/wlantest/process.c b/wlantest/process.c index 4d174bada..92dd0a6d8 100644 --- a/wlantest/process.c +++ b/wlantest/process.c @@ -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; } diff --git a/wlantest/test_vectors.c b/wlantest/test_vectors.c index 7f39c4264..8270d31ad 100644 --- a/wlantest/test_vectors.c +++ b/wlantest/test_vectors.c @@ -114,7 +114,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; @@ -243,7 +243,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, @@ -293,7 +293,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, @@ -337,7 +337,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; @@ -598,7 +598,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; @@ -700,7 +700,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; @@ -778,7 +778,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; diff --git a/wlantest/tkip.c b/wlantest/tkip.c index 843f6518a..201561150 100644 --- a/wlantest/tkip.c +++ b/wlantest/tkip.c @@ -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; diff --git a/wlantest/wep.c b/wlantest/wep.c index 50e371fc5..6f8f13ac3 100644 --- a/wlantest/wep.c +++ b/wlantest/wep.c @@ -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;