Move CRC-32 routine from wlantest to src/utils

This allows the CRC-32 routine to be shared for other purposes in
addition to the WEP/TKIP/FCS within wlantest.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-09-02 16:16:50 +03:00 committed by Jouni Malinen
parent a8ef83f49d
commit e2991ee580
9 changed files with 20 additions and 3 deletions

View file

@ -17,6 +17,7 @@ LIB_OBJS= \
base64.o \ base64.o \
bitfield.o \ bitfield.o \
common.o \ common.o \
crc32.o \
ip_addr.o \ ip_addr.o \
radiotap.o \ radiotap.o \
trace.o \ trace.o \

View file

@ -9,6 +9,7 @@
#include "utils/includes.h" #include "utils/includes.h"
#include "utils/common.h" #include "utils/common.h"
#include "utils/crc32.h"
/* /*
* IEEE 802.11 FCS CRC32 * IEEE 802.11 FCS CRC32

14
src/utils/crc32.h Normal file
View file

@ -0,0 +1,14 @@
/*
* 32-bit CRC for FCS calculation
* Copyright (c) 2010, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#ifndef CRC32_H
#define CRC32_H
u32 crc32(const u8 *frame, size_t frame_len);
#endif /* CRC32_H */

View file

@ -69,7 +69,6 @@ OBJS += rx_ip.o
OBJS += rx_tdls.o OBJS += rx_tdls.o
OBJS += bss.o OBJS += bss.o
OBJS += sta.o OBJS += sta.o
OBJS += crc32.o
OBJS += ccmp.o OBJS += ccmp.o
OBJS += tkip.o OBJS += tkip.o
OBJS += ctrl.o OBJS += ctrl.o
@ -81,7 +80,6 @@ OBJS += gcmp.o
LIBS += -lpcap LIBS += -lpcap
TOBJS += test_vectors.o TOBJS += test_vectors.o
TOBJS += crc32.o
TOBJS += ccmp.o TOBJS += ccmp.o
TOBJS += tkip.o TOBJS += tkip.o
TOBJS += wep.o TOBJS += wep.o

View file

@ -9,6 +9,7 @@
#include "utils/includes.h" #include "utils/includes.h"
#include "utils/common.h" #include "utils/common.h"
#include "utils/crc32.h"
#include "utils/radiotap.h" #include "utils/radiotap.h"
#include "utils/radiotap_iter.h" #include "utils/radiotap_iter.h"
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"

View file

@ -9,6 +9,7 @@
#include "utils/includes.h" #include "utils/includes.h"
#include "utils/common.h" #include "utils/common.h"
#include "utils/crc32.h"
#include "utils/eloop.h" #include "utils/eloop.h"
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "wlantest.h" #include "wlantest.h"

View file

@ -9,6 +9,7 @@
#include "utils/includes.h" #include "utils/includes.h"
#include "utils/common.h" #include "utils/common.h"
#include "utils/crc32.h"
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "wlantest.h" #include "wlantest.h"

View file

@ -9,6 +9,7 @@
#include "utils/includes.h" #include "utils/includes.h"
#include "utils/common.h" #include "utils/common.h"
#include "utils/crc32.h"
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "wlantest.h" #include "wlantest.h"

View file

@ -237,7 +237,6 @@ void wlantest_process(struct wlantest *wt, const u8 *data, size_t len);
void wlantest_process_prism(struct wlantest *wt, const u8 *data, size_t len); void wlantest_process_prism(struct wlantest *wt, const u8 *data, size_t len);
void wlantest_process_80211(struct wlantest *wt, const u8 *data, size_t len); void wlantest_process_80211(struct wlantest *wt, const u8 *data, size_t len);
void wlantest_process_wired(struct wlantest *wt, const u8 *data, size_t len); void wlantest_process_wired(struct wlantest *wt, const u8 *data, size_t len);
u32 crc32(const u8 *frame, size_t frame_len);
int monitor_init(struct wlantest *wt, const char *ifname); int monitor_init(struct wlantest *wt, const char *ifname);
int monitor_init_wired(struct wlantest *wt, const char *ifname); int monitor_init_wired(struct wlantest *wt, const char *ifname);
void monitor_deinit(struct wlantest *wt); void monitor_deinit(struct wlantest *wt);