diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-01-05 01:42:16 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-01-05 01:42:16 +0000 |
commit | 35c661da8eccdd22b1f856e265af108b6d6490cf (patch) | |
tree | e01c053acae1329279e989ceffce0840eb3970fd /target/linux/package | |
parent | be333fdd0a4d3ecce9370e7a1e6efbf4d43551a4 (diff) |
add bcm43xx
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2836 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/package')
-rw-r--r-- | target/linux/package/Config.in | 1 | ||||
-rw-r--r-- | target/linux/package/Makefile | 2 | ||||
-rw-r--r-- | target/linux/package/bcm43xx-dscape/Config.in | 13 | ||||
-rw-r--r-- | target/linux/package/bcm43xx-dscape/Makefile | 61 | ||||
-rw-r--r-- | target/linux/package/bcm43xx-dscape/fwcutter/Makefile | 32 | ||||
-rw-r--r-- | target/linux/package/bcm43xx-dscape/fwcutter/fwcutter.c | 562 | ||||
-rw-r--r-- | target/linux/package/bcm43xx-dscape/fwcutter/fwcutter_list.h | 810 | ||||
-rw-r--r-- | target/linux/package/bcm43xx-dscape/fwcutter/md5.c | 253 | ||||
-rw-r--r-- | target/linux/package/bcm43xx-dscape/fwcutter/md5.h | 16 | ||||
-rw-r--r-- | target/linux/package/bcm43xx-dscape/ipkg/kmod-bcm43xx-dscape.control | 4 |
10 files changed, 1754 insertions, 0 deletions
diff --git a/target/linux/package/Config.in b/target/linux/package/Config.in index 068024b14..f28b05c50 100644 --- a/target/linux/package/Config.in +++ b/target/linux/package/Config.in @@ -1,4 +1,5 @@ source "target/linux/package/alsa/Config.in" +source "target/linux/package/bcm43xx-dscape/Config.in" source "target/linux/package/diag/Config.in" source "target/linux/package/fuse/Config.in" source "target/linux/package/hostap/Config.in" diff --git a/target/linux/package/Makefile b/target/linux/package/Makefile index de24c77c2..059a67d8a 100644 --- a/target/linux/package/Makefile +++ b/target/linux/package/Makefile @@ -6,6 +6,7 @@ package-$(BR2_PACKAGE_KMOD_ALSA) += alsa endif package-$(BR2_PACKAGE_KMOD_FUSE) += fuse package-$(BR2_PACKAGE_KMOD_HOSTAP) += hostap +package-$(BR2_PACKAGE_KMOD_BCM43XX_DSCAPE) += bcm43xx-dscape package-$(BR2_PACKAGE_KMOD_IEEE80211_DSCAPE) += ieee80211-dscape package-$(BR2_PACKAGE_KMOD_MADWIFI) += madwifi package-$(BR2_PACKAGE_KMOD_MINI_FO) += mini_fo @@ -14,6 +15,7 @@ package-$(BR2_PACKAGE_KMOD_SHFS) += shfs package-$(BR2_PACKAGE_KMOD_SPCA5XX) += spca5xx package-$(BR2_PACKAGE_KMOD_SWITCH) += switch package-y += base-files +bcm43xx-dscape-compile: ieee80211-dscape-compile ifeq ($(BOARD)-$(KERNEL),brcm-2.4) package-$(BR2_PACKAGE_KMOD_DIAG) += diag diff --git a/target/linux/package/bcm43xx-dscape/Config.in b/target/linux/package/bcm43xx-dscape/Config.in new file mode 100644 index 000000000..b3bd6f6b9 --- /dev/null +++ b/target/linux/package/bcm43xx-dscape/Config.in @@ -0,0 +1,13 @@ +config BR2_PACKAGE_KMOD_BCM43XX_DSCAPE + prompt "kmod-bcm43xx-dscape............... Free Broadcom 43xx wireless driver (devicescape stack)" + tristate + depends BR2_LINUX_2_6_BRCM + depends BR2_PACKAGE_KMOD_IEEE80211_DSCAPE + default m if CONFIG_DEVEL + default n + help + Free driver for the Broadcom 43xx wireless chipset + This driver uses the DeviceScape 802.11 stack + + http://bcm43xx.berlios.de + diff --git a/target/linux/package/bcm43xx-dscape/Makefile b/target/linux/package/bcm43xx-dscape/Makefile new file mode 100644 index 000000000..efdede616 --- /dev/null +++ b/target/linux/package/bcm43xx-dscape/Makefile @@ -0,0 +1,61 @@ +# $Id$ + +include $(TOPDIR)/rules.mk +include ../../rules.mk + +PKG_NAME := bcm43xx-dscape +PKG_VERSION := 20060104 +PKG_RELEASE := 1 + +PKG_SOURCE_URL := http://ftp.berlios.de/pub/bcm43xx/snapshots/bcm43xx +PKG_SOURCE := $(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_CAT := bzcat + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +FIRMWARE_BLOB := wl_apsta-3.130.20.0.o +FIRMWARE_BLOB_URL := http://downloads.openwrt.org/sources +FIRMWARE_BLOB_MD5SUM := e08665c5c5b66beb9c3b2dd54aa80cb3 + +include $(TOPDIR)/package/rules.mk + +$(eval $(call PKG_template,KMOD_BCM43XX_DSCAPE,kmod-$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)+0.$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE)))) + +ifeq ($(KERNEL_DIR),) +KERNEL_DIR:=$(LINUX_DIR) +endif +KERNEL_VERSION=$(shell echo "$(LINUX_VERSION)" | cut -d. -f1,2) + +$(PKG_BUILD_DIR)/.configured: + touch $@ + +$(PKG_BUILD_DIR)/fwcutter/.built: + mkdir -p $(PKG_BUILD_DIR)/fwcutter + cp ./fwcutter/* $(PKG_BUILD_DIR)/fwcutter/ + $(SCRIPT_DIR)/download.pl "$(PKG_BUILD_DIR)/fwcutter" "$(FIRMWARE_BLOB)" "$(FIRMWARE_BLOB_MD5SUM)" $(FIRMWARE_BLOB_URL) + $(MAKE) -C $(PKG_BUILD_DIR)/fwcutter + $(PKG_BUILD_DIR)/fwcutter/fwcutter -w $(PKG_BUILD_DIR)/fwcutter $(PKG_BUILD_DIR)/fwcutter/$(FIRMWARE_BLOB) + touch $@ + +$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/fwcutter/.built + $(MAKE) -C "$(KERNEL_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + PATH="$(TARGET_PATH)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/ieee80211-dscape -I$(KERNEL_DIR)/include -DBCM47XX=1" \ + modules + touch $@ + +$(IPKG_KMOD_BCM43XX_DSCAPE): + install -m0755 -d $(IDIR_KMOD_BCM43XX_DSCAPE)/lib/modules/$(LINUX_VERSION) + install -m0755 -d $(IDIR_KMOD_BCM43XX_DSCAPE)/etc/modules.d + ( \ + echo 80211; \ + echo rate_control; \ + echo bcm43xx; \ + ) >& $(IDIR_KMOD_BCM43XX_DSCAPE)/etc/modules.d/50-bcm43xx + cp -fpR $(PKG_BUILD_DIR)/*.ko $(IDIR_KMOD_BCM43XX_DSCAPE)/lib/modules/$(LINUX_VERSION) + install -m0755 -d $(IDIR_KMOD_BCM43XX_DSCAPE)/lib/firmware + cp -fpR $(PKG_BUILD_DIR)/fwcutter/*.fw $(IDIR_KMOD_BCM43XX_DSCAPE)/lib/firmware/ + $(IPKG_BUILD) $(IDIR_KMOD_BCM43XX_DSCAPE) $(PACKAGE_DIR) diff --git a/target/linux/package/bcm43xx-dscape/fwcutter/Makefile b/target/linux/package/bcm43xx-dscape/fwcutter/Makefile new file mode 100644 index 000000000..6402dca85 --- /dev/null +++ b/target/linux/package/bcm43xx-dscape/fwcutter/Makefile @@ -0,0 +1,32 @@ +VERSION = 0.0.1 + +FIRMWARE_INSTALL_DIR ?= /lib/firmware + +CC = cc +PREFIX = /usr/local +CFLAGS = -std=c99 -O2 -fomit-frame-pointer -Wall -pedantic -D_BSD_SOURCE +LDFLAGS = + + +OBJECTS = fwcutter.o md5.o + +CFLAGS += -DFWCUTTER_VERSION_=$(VERSION) + +all: fwcutter + +fwcutter: $(OBJECTS) + $(CC) $(CFLAGS) -o fwcutter $(OBJECTS) $(LDFLAGS) + +install: all + -install -o 0 -g 0 -m 755 fwcutter $(PREFIX)/bin/ + +clean: + -rm -f *~ *.o *.orig *.rej *.fw fwcutter + +installfw: + -if ! [ -d $(FIRMWARE_INSTALL_DIR) ]; then mkdir $(FIRMWARE_INSTALL_DIR); fi + -install -o 0 -g 0 -m 600 bcm43xx_*.fw $(FIRMWARE_INSTALL_DIR) + +# dependencies +fwcutter.o: md5.h fwcutter_list.h +md5.o: md5.h diff --git a/target/linux/package/bcm43xx-dscape/fwcutter/fwcutter.c b/target/linux/package/bcm43xx-dscape/fwcutter/fwcutter.c new file mode 100644 index 000000000..ea98880df --- /dev/null +++ b/target/linux/package/bcm43xx-dscape/fwcutter/fwcutter.c @@ -0,0 +1,562 @@ +/* + * firmware cutter for broadcom 43xx wireless driver files + * + * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, + * 2005 Michael Buesch <mbuesch@freenet.de> + * 2005 Alex Beregszaszi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + + +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#include <stdio.h> + +typedef unsigned char byte; + +#define DRIVER_UNSUPPORTED 0x01 /* no support for this driver file */ +#define BYTE_ORDER_BIG_ENDIAN 0x02 /* ppc driver files */ +#define BYTE_ORDER_LITTLE_ENDIAN 0x04 /* x86, mips driver files */ + +#define MISSING_INITVAL_08 0x10 /* initval 8 is missing */ +#define MISSING_INITVAL_80211_A 0x20 /* initvals 3,7,9,10 (802.11a cards) are empty */ + +#define FIRMWARE_UCODE_OFFSET 100 +#define FIRMWARE_UNDEFINED 0 +#define FIRMWARE_PCM_4 4 +#define FIRMWARE_PCM_5 5 +#define FIRMWARE_UCODE_2 (FIRMWARE_UCODE_OFFSET + 2) +#define FIRMWARE_UCODE_4 (FIRMWARE_UCODE_OFFSET + 4) +#define FIRMWARE_UCODE_5 (FIRMWARE_UCODE_OFFSET + 5) +#define FIRMWARE_UCODE_11 (FIRMWARE_UCODE_OFFSET + 11) + + +#define fwcutter_stringify_1(x) #x +#define fwcutter_stringify(x) fwcutter_stringify_1(x) +#define FWCUTTER_VERSION fwcutter_stringify(FWCUTTER_VERSION_) + +#include "md5.h" +#include "fwcutter_list.h" + + +struct cmdline_args { + const char *infile; + const char *postfix; + const char *target_dir; + int identify_only; +}; + +static struct cmdline_args cmdargs; +int big_endian_cpu; + + +static void write_little_endian(FILE *f, byte *buffer, int len) +{ + byte swapbuf[4]; + + while (len > 0) { + swapbuf[0] = buffer[3]; swapbuf[1] = buffer[2]; + swapbuf[2] = buffer[1]; swapbuf[3] = buffer[0]; + fwrite(swapbuf, 4, 1, f); + buffer = buffer + 4; + len = len - 4; + } +} + +static void write_big_endian(FILE *f, byte *buffer, int len) +{ + while (len > 0) { + fwrite(buffer, 4, 1, f); + buffer = buffer + 4; + len = len - 4; + } +} + +static void write_fw(const char *outfilename, uint8_t flags, byte *data, int len) +{ + FILE* fw; + char outfile[2048]; + + snprintf(outfile, sizeof(outfile), + "%s/%s", cmdargs.target_dir, outfilename); + + fw = fopen(outfile, "w"); + if (!fw) { + perror(outfile); + exit(1); + } + + if (flags & BYTE_ORDER_LITTLE_ENDIAN) + write_little_endian(fw, data, len); + else if (flags & BYTE_ORDER_BIG_ENDIAN) + write_big_endian(fw, data, len); + else + printf("unknown byteorder...\n"); + + fflush(fw); + fclose(fw); +} + +static void write_iv(uint8_t flags, byte *data) +{ + FILE* fw; + char ivfilename[2048]; + int i; + + for (i = 1; i <= 10; i++) { + + if ((flags & MISSING_INITVAL_08) && (i==8)) { + printf("*****: Sorry, initval08 is not available in driver file \"%s\".\n", cmdargs.infile); + printf("*****: Extracting firmware from an old driver is bad. Choose a more recent one.\n"); + printf("*****: Luckily bcm43xx driver doesn't include initval08 uploads at the moment.\n"); + printf("*****: But this can be added in the future...\n"); + i++; + } + + snprintf(ivfilename, sizeof(ivfilename), + "%s/bcm43xx_initval%02d%s.fw", + cmdargs.target_dir, i, cmdargs.postfix); + fw = fopen(ivfilename, "w"); + + if (!fw) { + perror(ivfilename); + exit(1); + } + + printf("extracting bcm43xx_initval%02d%s.fw ...\n", i, cmdargs.postfix); + + while (1) { + + if ((data[0]==0xff) && (data[1]==0xff) && (data[2]==0x00) && (data[3]==0x00)) { + data = data + 8; + break; + } + + if (flags & BYTE_ORDER_LITTLE_ENDIAN) + fprintf(fw, "%c%c%c%c%c%c%c%c", + data[1], data[0], /* offset */ + data[3], data[2], /* size */ + data[7], data[6], data[5], data[4]); /* value */ + else if (flags & BYTE_ORDER_BIG_ENDIAN) + fprintf(fw, "%c%c%c%c%c%c%c%c", + data[0], data[1], /* offset */ + data[2], data[3], /* size */ + data[4], data[5], data[6], data[7]); /* value */ + else { + printf("unknown byteorder...\n"); + exit(1); + } + + data = data + 8; + } + fflush(fw); + fclose(fw); + } +} + +static byte* read_file(const char* filename) +{ + FILE* file; + long len; + byte* data; + + file = fopen(filename, "rb"); + if (!file) { + perror(filename); + exit(1); + } + if (fseek(file, 0, SEEK_END)) { + perror("cannot seek"); + exit(1); + } + len = ftell(file); + fseek(file, 0, SEEK_SET); + data = malloc(len); + if (!data) { + fputs("out of memory\n", stderr); + exit(1); + } + if (fread(data, 1, len, file) != len) { + perror("cannot read"); + exit(1); + } + fclose(file); + return data; +} + +static void extract_fw(uint8_t fwtype, uint8_t flags, uint32_t pos, uint32_t length) +{ + byte* filedata; + char outfile[1024]; + + switch (fwtype) { + case FIRMWARE_UCODE_2: + case FIRMWARE_UCODE_4: + case FIRMWARE_UCODE_5: + case FIRMWARE_UCODE_11: + snprintf(outfile, sizeof(outfile), "bcm43xx_microcode%i%s.fw", + fwtype - FIRMWARE_UCODE_OFFSET, cmdargs.postfix); + break; + case FIRMWARE_PCM_4: + case FIRMWARE_PCM_5: + snprintf(outfile, sizeof(outfile), "bcm43xx_pcm%i%s.fw", + fwtype, cmdargs.postfix); + break; + default: + snprintf(outfile, sizeof(outfile), "bcm43xx_unknown.fw"); + } + + if (length > 0) { + printf("extracting %s ...\n", outfile); + filedata = read_file(cmdargs.infile); + write_fw(outfile, flags, filedata + pos, length); + free(filedata); + } else { + printf("*****: Sorry, it's not posible to extract \"%s\".\n", outfile); + printf("*****: Extracting firmware from an old driver is bad. Choose a more recent one.\n"); + + switch (fwtype) { + case FIRMWARE_UCODE_2: + printf("*****: bcm43xx driver will not work with with core revision 2.\n"); + break; + case FIRMWARE_UCODE_4: + printf("*****: bcm43xx driver will not work with with core revision 4.\n"); + break; + case FIRMWARE_UCODE_5: + printf("*****: bcm43xx driver will not work with with core revision 5 or higher.\n"); + break; + case FIRMWARE_UCODE_11: + printf("*****: Luckily bcm43xx driver doesn't include microcode11 uploads at the moment.\n"); + printf("*****: But this can be added in the future...\n"); + break; + case FIRMWARE_PCM_4: + printf("*****: bcm43xx driver will not work with with core revision 4 or smaller.\n"); + break; + case FIRMWARE_PCM_5: + printf("*****: bcm43xx driver will not work with with core revision 5 or higher.\n"); + break; + } + } +} + +static void extract_iv(uint8_t flags, uint32_t pos) +{ + byte* filedata; + + if (pos > 0) { + filedata = read_file(cmdargs.infile); + write_iv(flags, filedata + pos); + free(filedata); + } +} + +static void print_banner(void) +{ + printf("fwcutter " FWCUTTER_VERSION "\n"); +} + +static void print_file(const struct file *file) +{ + printf("%s\t", file->name); + if (strlen(file->name) < 8) + printf("\t"); + + printf("%s\t", file->version); + if (strlen(file->version) < 8) + printf("\t"); + if (strlen(file->version) < 16) + printf("\t"); + + if (!(file->flags & DRIVER_UNSUPPORTED)) { + if (file->flags & MISSING_INITVAL_80211_A) + printf("b/g "); + else + printf("a/b/g"); + } + + printf(" %s", file->md5); + printf("\n"); +} + +static void print_supported_files(void) +{ + int i; + + print_banner(); + printf("\nExtracting firmware is possible from these binary driver files:\n\n"); + printf("<filename>\t<version>\t <802.11><MD5 checksum>\n\n"); + for (i = 0; i < FILES; i++) { + if (files[i].flags & DRIVER_UNSUPPORTED) + continue; + print_file(&files[i]); + } + printf("\n\nExtracting firmware is IMPOSSIBLE from these binary driver files:\n\n"); + printf("<filename>\t<version>\t <MD5 checksum>\n\n"); + for (i = 0; i < FILES; i++) { + if (!(files[i].flags & DRIVER_UNSUPPORTED)) + continue; + print_file(&files[i]); + } +} + +static const struct file * find_file(FILE *fd) +{ + unsigned char buffer[16384], signature[16]; + struct MD5Context md5c; + char md5sig[33]; + int i; + + MD5Init(&md5c); + while ((i = (int) fread(buffer, 1, sizeof(buffer), fd)) > 0) + MD5Update(&md5c, buffer, (unsigned) i); + MD5Final(signature, &md5c); + + snprintf(md5sig, sizeof(md5sig), + "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", + signature[0], signature[1], signature[2], signature[3], + signature[4], signature[5], signature[6], signature[7], + signature[8], signature[9], signature[10], signature[11], + signature[12], signature[13], signature[14], signature[15]); + + for (i = 0; i < FILES; ++i) { + if (strcasecmp(md5sig, files[i].md5) == 0) { + if (files[i].flags & DRIVER_UNSUPPORTED) { + printf("Extracting firmware from this file is IMPOSSIBLE. (too old)\n"); + return 0; + } + printf("fwcutter can cut the firmware out of %s\n", cmdargs.infile); + printf(" filename : %s\n", files[i].name); + printf(" version : %s\n", files[i].version); + printf(" MD5 : %s\n\n", files[i].md5); + if (files[i].flags & MISSING_INITVAL_80211_A) { + printf("WARNING! This firmware doesn't include support for 802.11a cards.\n"); + printf("WARNING! Use this firmware only for 802.11b/g cards.\n\n"); + } + return &(files[i]); + } + } + printf("Sorry, the input file is either wrong or not supported by fwcutter.\n"); + printf("I can't find the MD5sum %s :(\n", md5sig); + + return 0; +} + +static void get_endianess(void) +{ + const unsigned char x[] = { 0xde, 0xad, 0xbe, 0xef, }; + const uint32_t *p = (uint32_t *)x; + + if (*p == 0xdeadbeef) { + big_endian_cpu = 1; + } else if (*p == 0xefbeadde) { + big_endian_cpu = 0; + } else { + printf("Confused: NUXI endian machine??\n"); + exit(-1); + } +} + +static void print_usage(int argc, char *argv[]) +{ + print_banner(); + printf("\nUsage: %s [OPTION] [driver.sys]\n", argv[0]); + printf(" -l|--list List supported driver versions\n"); + printf(" -i|--identify Only identify the driver file (don't extract)\n"); + printf(" -w|--target-dir DIR Extract and write firmware to DIR\n"); + printf(" -p|--postfix \".FOO\" Postfix for firmware filenames (.FOO.fw)\n"); + printf(" -v|--version Print fwcutter version\n"); + printf(" -h|--help Print this help\n"); + printf("\nExample: %s bcmwl5.sys\n" + " to extract the firmware blobs from bcmwl5.sys\n", argv[0]); +} + +#define ARG_MATCH 0 +#define ARG_NOMATCH 1 +#define ARG_ERROR -1 + +static int do_cmp_arg(char **argv, int *pos, + const char *template, + int allow_merged, + char **param) +{ + char *arg; + char *next_arg; + size_t arg_len, template_len; + + arg = argv[*pos]; + next_arg = argv[*pos + 1]; + arg_len = strlen(arg); + template_len = strlen(template); + + if (param) { + /* Maybe we have a merged parameter here. + * A merged parameter is "-pfoobar" for example. + */ + if (allow_merged && arg_len > template_len) { + if (memcmp(arg, template, template_len) == 0) { + *param = arg + template_len; + return ARG_MATCH; + } + return ARG_NOMATCH; + } else if (arg_len != template_len) + return ARG_NOMATCH; + *param = next_arg; + } + if (strcmp(arg, template) == 0) { + if (param) { + /* Skip the parameter on the next iteration. */ + (*pos)++; + if (*param == 0) { + printf("%s needs a parameter\n", arg); + return ARG_ERROR; + } + } + return ARG_MATCH; + } + + return ARG_NOMATCH; +} + +/* Simple and lean command line argument parsing. */ +static int cmp_arg(char **argv, int *pos, + const char *long_template, + const char *short_template, + char **param) +{ + int err; + + if (long_template) { + err = do_cmp_arg(argv, pos, long_template, 0, param); + if (err == ARG_MATCH || err == ARG_ERROR) + return err; + } + err = ARG_NOMATCH; + if (short_template) + err = do_cmp_arg(argv, pos, short_template, 1, param); + return err; +} + +static int parse_args(int argc, char *argv[]) +{ + int i, res; + char *param; + + if (argc < 2) + goto out_usage; + for (i = 1; i < argc; i++) { + res = cmp_arg(argv, &i, "--list", "-l", 0); + if (res == ARG_MATCH) { + print_supported_files(); + return 1; + } else if (res == ARG_ERROR) + goto out; + + res = cmp_arg(argv, &i, "--version", "-v", 0); + if (res == ARG_MATCH) { + print_banner(); + return 1; + } else if (res == ARG_ERROR) + goto out; + + res = cmp_arg(argv, &i, "--help", "-h", 0); + if (res == ARG_MATCH) + goto out_usage; + else if (res == ARG_ERROR) + goto out; + + res = cmp_arg(argv, &i, "--identify", "-i", 0); + if (res == ARG_MATCH) { + cmdargs.identify_only = 1; + continue; + } else if (res == ARG_ERROR) + goto out; + + res = cmp_arg(argv, &i, "--target-dir", "-w", ¶m); + if (res == ARG_MATCH) { + cmdargs.target_dir = param; + continue; + } else if (res == ARG_ERROR) + goto out; + + res = cmp_arg(argv, &i, "--postfix", "-p", ¶m); + if (res == ARG_MATCH) { + cmdargs.postfix = param; + continue; + } else if (res == ARG_ERROR) + goto out; + + cmdargs.infile = argv[i]; + break; + } + + if (!cmdargs.infile) + goto out_usage; + return 0; + +out_usage: + print_usage(argc, argv); +out: + return -1; +} + +int main(int argc, char *argv[]) +{ + FILE *fd; + const struct file *file; + int err; + + get_endianess(); + + cmdargs.target_dir = "."; + cmdargs.postfix = ""; + err = parse_args(argc, argv); + if (err == 1) + return 0; + else if (err != 0) + return err; + + fd = fopen(cmdargs.infile, "rb"); + if (!fd) { + fprintf(stderr, "Cannot open input file %s\n", cmdargs.infile); + return 2; + } + + err = -1; + file = find_file(fd); + if (!file) + goto out_close; + if (cmdargs.identify_only) { + err = 0; + goto out_close; + } + + extract_fw(FIRMWARE_UCODE_2, file->flags, file->uc2_pos, file->uc2_length); + extract_fw(FIRMWARE_UCODE_4, file->flags, file->uc4_pos, file->uc4_length); + extract_fw(FIRMWARE_UCODE_5, file->flags, file->uc5_pos, file->uc5_length); + extract_fw(FIRMWARE_UCODE_11, file->flags, file->uc11_pos, file->uc11_length); + extract_fw(FIRMWARE_PCM_4, file->flags, file->pcm4_pos, file->pcm4_length); + extract_fw(FIRMWARE_PCM_5, file->flags, file->pcm5_pos, file->pcm5_length); + extract_iv(file->flags, file->iv_pos); + + err = 0; +out_close: + fclose(fd); + + return err; +} diff --git a/target/linux/package/bcm43xx-dscape/fwcutter/fwcutter_list.h b/target/linux/package/bcm43xx-dscape/fwcutter/fwcutter_list.h new file mode 100644 index 000000000..e855b6d6d --- /dev/null +++ b/target/linux/package/bcm43xx-dscape/fwcutter/fwcutter_list.h @@ -0,0 +1,810 @@ + +static const struct file { + const char *name; + const char *version; + const char *md5; + const uint8_t flags; + const uint32_t iv_pos; + const uint32_t uc2_pos; + const uint32_t uc2_length; + const uint32_t uc4_pos; + const uint32_t uc4_length; + const uint32_t uc5_pos; + const uint32_t uc5_length; + const uint32_t uc11_pos; + const uint32_t uc11_length; + const uint32_t pcm4_pos; + const uint32_t pcm4_length; + const uint32_t pcm5_pos; + const uint32_t pcm5_length; +} files[] = +{ + { + .name = "AppleAirPort2", + .version = "3.30.15.p3 (3.1.1b2)", + .md5 = "a8275cc50107a13b5be15d067b2245a0", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x42550, + .uc2_pos = 0x45630, .uc2_length = 0x3d88, + .uc4_pos = 0x493bc, .uc4_length = 0x44a0, + .uc5_pos = 0x4d860, .uc5_length = 0x4ec0, + .pcm4_pos = 0x52724, .pcm4_length = 0x478, + .pcm5_pos = 0x52ba0, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.30.15.p3 (3.1.2b3)", + .md5 = "55134c1298abaa85f190331f016d4d36", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x42c24, + .uc2_pos = 0x45d04, .uc2_length = 0x3d88, + .uc4_pos = 0x49a90, .uc4_length = 0x44a0, + .uc5_pos = 0x4df34, .uc5_length = 0x4ec0, + .pcm4_pos = 0x52df8, .pcm4_length = 0x478, + .pcm5_pos = 0x53274, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.30.15.p7 (3.2)", + .md5 = "e74e8d2df2e4eb97e28602f3b2dd4647", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x40efc, + .uc2_pos = 0x43fdc, .uc2_length = 0x3d88, + .uc4_pos = 0x47d68, .uc4_length = 0x44a0, + .uc5_pos = 0x4c20c, .uc5_length = 0x4ec0, + .pcm4_pos = 0x510d0, .pcm4_length = 0x478, + .pcm5_pos = 0x5154c, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.30.15.p8 (3.3b1)", /* 01/19/2004 */ + .md5 = "87c74c55d2501d2e968f8c132e160b6e", + .flags = BYTE_ORDER_BIG_ENDIAN, + .iv_pos = 0x41c8c, + .uc2_pos = 0x43fe4, .uc2_length = 0x3d88, + .uc4_pos = 0x47d70, .uc4_length = 0x44b2, + .uc5_pos = 0x4c214, .uc5_length = 0x4ec0, + .pcm4_pos = 0x510d8, .pcm4_length = 0x478, + .pcm5_pos = 0x51554, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.50.37.p4 (3.4.2b1)", + .md5 = "1739c357ade1d04c9be47e8604afb1c2", + .flags = BYTE_ORDER_BIG_ENDIAN, + .iv_pos = 0x4f2b8, + .uc2_pos = 0x52da0, .uc2_length = 0x3d30, + .uc4_pos = 0x56ad4, .uc4_length = 0x45c8, + .uc5_pos = 0x5b0a0, .uc5_length = 0x5500, + .pcm4_pos = 0x605a4, .pcm4_length = 0x478, + .pcm5_pos = 0x60a20, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.50.37.p4 (3.4.3f1)", /* 09/29/2004 */ + .md5 = "c672b8c218c5dc4a55060bdfa9f58a69", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x4f378, + .uc2_pos = 0x52e60, .uc2_length = 0x3d30, + .uc4_pos = 0x56b94, .uc4_length = 0x45c8, + .uc5_pos = 0x5b160, .uc5_length = 0x5500, + .pcm4_pos = 0x60664, .pcm4_length = 0x478, + .pcm5_pos = 0x60ae0, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.50.37.p4 (3.4.4f5)", + .md5 = "2c388e3e8ea9310a58cf76a3757e8ccc", + .flags = BYTE_ORDER_BIG_ENDIAN, + .iv_pos = 0x4f5f0, + .uc2_pos = 0x530d8, .uc2_length = 0x3d30, + .uc4_pos = 0x56e0c, .uc4_length = 0x45c8, + .uc5_pos = 0x5b3d8, .uc5_length = 0x5500, + .pcm4_pos = 0x608dc, .pcm4_length = 0x478, + .pcm5_pos = 0x60d58, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.50.37.p4 (3.4.4f5)", + .md5 = "3860545266b554d2955664db55452f5a", + .flags = BYTE_ORDER_BIG_ENDIAN, + .iv_pos = 0x4f5f0, + .uc2_pos = 0x530d8, .uc2_length = 0x3d30, + .uc4_pos = 0x56e0c, .uc4_length = 0x45c8, + .uc5_pos = 0x5b3d8, .uc5_length = 0x5500, + .pcm4_pos = 0x608dc, .pcm4_length = 0x478, + .pcm5_pos = 0x60d58, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.50.37.p6 (3.5f1)", + .md5 = "a62e35ee9956b286c46b145d35bd6e0c", + .flags = BYTE_ORDER_BIG_ENDIAN, + .iv_pos = 0x4f9b8, + .uc2_pos = 0x534a0, .uc2_length = 0x3d30, + .uc4_pos = 0x571d4, .uc4_length = 0x45c8, + .uc5_pos = 0x5b7a0, .uc5_length = 0x5500, + .pcm4_pos = 0x60ca4, .pcm4_length = 0x478, + .pcm5_pos = 0x61120, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.50.37.p6 (3.5f1)", + .md5 = "b6f3d2437c40277c197f0afcf12208e9", + .flags = BYTE_ORDER_BIG_ENDIAN, + .iv_pos = 0x4f9b8, + .uc2_pos = 0x534a0, .uc2_length = 0x3d30, + .uc4_pos = 0x571d4, .uc4_length = 0x45c8, + .uc5_pos = 0x5b7a0, .uc5_length = 0x5500, + .pcm4_pos = 0x60ca4, .pcm4_length = 0x478, + .pcm5_pos = 0x61120, .pcm5_length = 0x478, + }, + { + .name = "AppleAirPort2", + .version = "3.90.34.0.p11 (400.17)", /* 09/13/2005 (??) */ + .md5 = "ca0f34df2f0bfb8b5cfd83b5848d2bf5", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_80211_A, + .iv_pos = 0x4ff2c, /* A-PHY init vals empty */ + .uc2_pos = 0x5181c, .uc2_length = 0x3f48, + .uc4_pos = 0x55764, .uc4_length = 0x4df0, + .uc5_pos = 0x5a554, .uc5_length = 0x57e0, + .pcm4_pos = 0x5fd34, .pcm4_length = 0x520, + .pcm5_pos = 0x60254, .pcm5_length = 0x520, + }, + { + .name = "AppleAirPort2", + .version = "3.90.34.0.p11 (400.17)", + .md5 = "dc3a69aac95c68fe8edc760e39bbb2c9", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_80211_A, + .iv_pos = 0x50efc, /* A-PHY init vals empty */ + .uc2_pos = 0x527ec, .uc2_length = 0x3f48, + .uc4_pos = 0x56734, .uc4_length = 0x4df0, + .uc5_pos = 0x5b524, .uc5_length = 0x57e0, + .pcm4_pos = 0x60d04, .pcm4_length = 0x520, + .pcm5_pos = 0x61224, .pcm5_length = 0x520, + }, + { + .name = "AppleAirPort2", + .version = "3.90.34.0.p13 (401.2)", /* 07/10/2005 */ + .md5 = "6ecf38e5ab6997c7ec483c0d637f5c68", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_80211_A, + .iv_pos = 0x50fcc, /* A-PHY init vals empty */ + .uc2_pos = 0x528bc, .uc2_length = 0x3f48, + .uc4_pos = 0x56804, .uc4_length = 0x4df0, + .uc5_pos = 0x5b5f4, .uc5_length = 0x57e0, + .pcm4_pos = 0x60dd4, .pcm4_length = 0x520, + .pcm5_pos = 0x612f4, .pcm5_length = 0x520, + }, + { + .name = "AppleAirPort2", + .version = "3.90.34.0.p16 (404.2)", + .md5 = "7200d1aef5f413ebc811046d068b40dc", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_80211_A, + .iv_pos = 0x511ec, /* A-PHY init vals empty */ + .uc2_pos = 0x52adc, .uc2_length = 0x3f48, + .uc4_pos = 0x56a24, .uc4_length = 0x4df0, + .uc5_pos = 0x5b814, .uc5_length = 0x57f0, + .pcm4_pos = 0x61004, .pcm4_length = 0x520, + .pcm5_pos = 0x61524, .pcm5_length = 0x520, + }, + { + .name = "AppleAirPort2", + .version = "3.90.34.0.p16 (404.2)", + .md5 = "86cc708e8df3b035a1dbea41ac4eb7d2", + .flags = BYTE_ORDER_BIG_ENDIAN | + MISSING_INITVAL_80211_A, + .iv_pos = 0x5021c, /* A-PHY init vals empty */ + .uc2_pos = 0x51b0c, .uc2_length = 0x3f48, + .uc4_pos = 0x55a54, .uc4_length = 0x4df0, + .uc5_pos = 0x5a844, .uc5_length = 0x57f0, + .pcm4_pos = 0x60034, .pcm4_length = 0x520, + .pcm5_pos = 0x60554, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.10.8.0", /* 10/04/2002 */ + .md5 = "288923b401e87ef76b7ae2652601ee47", + .flags = DRIVER_UNSUPPORTED, /* file differs from later ones */ + }, + { + .name = "bcmwl5.sys", + .version = "3.10.53.6", /* 04/28/2003 */ + .md5 = "b43c593fd7c2a47cdc40580fe341f674", + .flags = DRIVER_UNSUPPORTED, /* file differs from later ones */ + }, + { + .name = "bcmwl5.sys", + .version = "3.20.23.0", /* 06/13/2003 */ + .md5 = "1b1cf5e962c15abca83d1ef2b3906e2f", /* pcm5 not available, driver is too old */ + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x2a1d0, + .uc2_pos = 0x2d228, .uc2_length = 0x3da8, + .uc4_pos = 0x30fd8, .uc4_length = 0x4470, + .uc5_pos = 0x35450, .uc5_length = 0x4ba0, + .pcm4_pos = 0x39ff8, .pcm4_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.30.15.0", /* 07/17/2003 */ + .md5 = "ebf36d658d0da5b1ea667fa403919c26", + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x2c658, + .uc2_pos = 0x2f738, .uc2_length = 0x3d88, + .uc4_pos = 0x334c8, .uc4_length = 0x44a0, + .uc5_pos = 0x37970, .uc5_length = 0x4ec0, + .pcm4_pos = 0x3c838, .pcm4_length = 0x478, + .pcm5_pos = 0x3ccb8, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.40.20.0", /* 09/24/2003 */ + .md5 = "0c3fc803184f6f85e665dd012611225b", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x302f0, + .uc2_pos = 0x33d88, .uc2_length = 0x3db8, + .uc4_pos = 0x37b48, .uc4_length = 0x45d8, + .uc5_pos = 0x3c128, .uc5_length = 0x5050, + .pcm4_pos = 0x41180, .pcm4_length = 0x478, + .pcm5_pos = 0x41600, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.40.25.3", /* 10/28/2003 */ + .md5 = "5e58a3148b98c9f356cde6049435cb21", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x30970, + .uc2_pos = 0x34408, .uc2_length = 0x3db0, + .uc4_pos = 0x381c0, .uc4_length = 0x45d0, + .uc5_pos = 0x3c798, .uc5_length = 0x5050, + .pcm4_pos = 0x417f0, .pcm4_length = 0x478, + .pcm5_pos = 0x41c70, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.40.73.0", /* 06/25/2004 */ + .md5 = "52d67c5465c01913b03b7daca0cc4077", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x37398, + .uc2_pos = 0x3ae30, .uc2_length = 0x3ff0, + .uc4_pos = 0x3ee28, .uc4_length = 0x47f0, + .uc5_pos = 0x43620, .uc5_length = 0x5260, + .pcm4_pos = 0x48888, .pcm4_length = 0x478, + .pcm5_pos = 0x48d08, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.40.100.0", /* 02/07/2004 */ + .md5 = "431195b941dff794f23c2077fcbf8377", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x34d18, + .uc2_pos = 0x387b0, .uc2_length = 0x3ff0, + .uc4_pos = 0x3c7a8, .uc4_length = 0x47f0, + .uc5_pos = 0x40fa0, .uc5_length = 0x5260, + .pcm4_pos = 0x46208, .pcm4_length = 0x478, + .pcm5_pos = 0x46688, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.50.21.11", /* 02/19/2004 */ + .md5 = "ae96075a3aed5c40f1ead477ea94acd7", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x33370, + .uc2_pos = 0x36e58, .uc2_length = 0x3e00, + .uc4_pos = 0x3ac60, .uc4_length = 0x4628, + .uc5_pos = 0x3f290, .uc5_length = 0x5548, + .pcm4_pos = 0x447e0, .pcm4_length = 0x478, + .pcm5_pos = 0x44c60, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.60.7.0", /* 03/22/2004 */ + .md5 = "c5616736df4e83930780dca5795387ca", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3b988, + .uc2_pos = 0x3f580, .uc2_length = 0x3e08, + .uc4_pos = 0x43390, .uc4_length = 0x4e58, + .uc5_pos = 0x481f0, .uc5_length = 0x5608, + .pcm4_pos = 0x4d800, .pcm4_length = 0x478, + .pcm5_pos = 0x4dc80, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.60.7.5", /* 06/07/2004 */ + .md5 = "d2ae116c741c215ef3ef68603db9917f", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3b988, + .uc2_pos = 0x3f580, .uc2_length = 0x3e08, + .uc4_pos = 0x43390, .uc4_length = 0x4e58, + .uc5_pos = 0x481f0, .uc5_length = 0x5608, + .pcm4_pos = 0x4d800, .pcm4_length = 0x478, + .pcm5_pos = 0x4dc80, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.70.12.0", /* 06/02/2004 */ + .md5 = "d409b089370486521d5408baed9bffde", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x39480, + .uc2_pos = 0x3d0c8, .uc2_length = 0x3e80, + .uc4_pos = 0x40f50, .uc4_length = 0x4ed0, + .uc5_pos = 0x45e28, .uc5_length = 0x5680, + .pcm4_pos = 0x4b4b0, .pcm4_length = 0x478, + .pcm5_pos = 0x4b930, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.70.17.0", /* 06/25/2004 */ + .md5 = "d87b4e14e890091d8e64fb5c570cf192", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x39600, + .uc2_pos = 0x3d248, .uc2_length = 0x3e80, + .uc4_pos = 0x410d0, .uc4_length = 0x4ed0, + .uc5_pos = 0x45fa8, .uc5_length = 0x5680, + .pcm4_pos = 0x4b630, .pcm4_length = 0x478, + .pcm5_pos = 0x4bab0, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.70.22.0", /* 10/20/2004 */ + .md5 = "185a6dc6d655dc31c0b228cc94fb99ac", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x39a88, + .uc2_pos = 0x3d6d0, .uc2_length = 0x3e80, + .uc4_pos = 0x41558, .uc4_length = 0x4ed0, + .uc5_pos = 0x46430, .uc5_length = 0x5680, + .pcm4_pos = 0x4bab8, .pcm4_length = 0x478, + .pcm5_pos = 0x4bf38, .pcm5_length = 0x478, + }, + { + .name = "bcmwl5.sys", + .version = "3.90.41.1", /* 07/04/2005 */ + .md5 = "0a87541dd24c6f046a4bf8f671f74de2", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3bec8, + .uc2_pos = 0x3fb38, .uc2_length = 0x3f48, + .uc4_pos = 0x43a88, .uc4_length = 0x4df0, + .uc5_pos = 0x48880, .uc5_length = 0x57e0, + .pcm4_pos = 0x4e068, .pcm4_length = 0x520, + .pcm5_pos = 0x4e590, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.100.35.0", /* 11/27/2004 */ + .md5 = "c3ab2d6954c7b5103770832a3a6a591b", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3de80, + .uc2_pos = 0x41af0, .uc2_length = 0x3f58, + .uc4_pos = 0x45a50, .uc4_length = 0x4df8, + .uc5_pos = 0x4a850, .uc5_length = 0x57f8, + .pcm4_pos = 0x50050, .pcm4_length = 0x520, + .pcm5_pos = 0x50578, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.100.35.1", /* 02/10/2005 */ + .md5 = "da7ca369a1a3593ceac85dec2d267a08", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3df00, + .uc2_pos = 0x41b70, .uc2_length = 0x3f58, + .uc4_pos = 0x45ad0, .uc4_length = 0x4df8, + .uc5_pos = 0x4a8d0, .uc5_length = 0x57f8, + .pcm4_pos = 0x500d0, .pcm4_length = 0x520, + .pcm5_pos = 0x505f8, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.100.46.0", /* 12/22/2004 */ + .md5 = "38ca1443660d0f5f06887c6a2e692aeb", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3de80, + .uc2_pos = 0x41af0, .uc2_length = 0x3f58, + .uc4_pos = 0x45a50, .uc4_length = 0x4df8, + .uc5_pos = 0x4a850, .uc5_length = 0x57f8, + .pcm4_pos = 0x50050, .pcm4_length = 0x520, + .pcm5_pos = 0x50578, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.100.64.0", /* 02/11/2005 */ + .md5 = "e7debb46b9ef1f28932e533be4a3d1a9", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3e980, + .uc2_pos = 0x425f0, .uc2_length = 0x3f58, + .uc4_pos = 0x46550, .uc4_length = 0x4e00, + .uc5_pos = 0x4b358, .uc5_length = 0x5800, + .pcm4_pos = 0x50b60, .pcm4_length = 0x520, + .pcm5_pos = 0x51088, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.100.64.50", /* 04/05/2005 */ + .md5 = "4b3e367b829b9b2c0c088909a617e04e", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3e900, + .uc2_pos = 0x42570, .uc2_length = 0x3f58, + .uc4_pos = 0x464d0, .uc4_length = 0x4e00, + .uc5_pos = 0x4b2d8, .uc5_length = 0x5800, + .pcm4_pos = 0x50ae0, .pcm4_length = 0x520, + .pcm5_pos = 0x51008, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.100.65.1", /* 04/21/2005 */ + .md5 = "d5f1ab1aab8b81bca6f19da9554a267a", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3e980, + .uc2_pos = 0x425f0, .uc2_length = 0x3f58, + .uc4_pos = 0x46550, .uc4_length = 0x4e00, + .uc5_pos = 0x4b358, .uc5_length = 0x5800, + .pcm4_pos = 0x50b60, .pcm4_length = 0x520, + .pcm5_pos = 0x51088, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.120.27.0", /* 05/19/2005 */ + .md5 = "8d49f11238815a320880fee9f98b2c92", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3f700, + .uc2_pos = 0x43370, .uc2_length = 0x3f68, + .uc4_pos = 0x472e0, .uc4_length = 0x4e10, + .uc5_pos = 0x4c0f8, .uc5_length = 0x5800, + .pcm4_pos = 0x51900, .pcm4_length = 0x520, + .pcm5_pos = 0x51e28, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5.sys", + .version = "3.140.16.0", /* 07/21/2005 */ + .md5 = "fa4a4a50b4b2647afedc676cc68c69cc", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3f700, + .uc2_pos = 0x43370, .uc2_length = 0x3f68, + .uc4_pos = 0x472e0, .uc4_length = 0x4e10, + .uc5_pos = 0x4c0f8, .uc5_length = 0x5800, + .pcm4_pos = 0x51900, .pcm4_length = 0x520, + .pcm5_pos = 0x51e28, .pcm5_length = 0x520, + }, + { + .name = "bcmwl564.sys", + .version = "3.70.17.5", /* 09/21/2004 */ + .md5 = "f5590c8784b91dfd9ee092d3040b6e40", /* for 64bit machines */ + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x566f0, + .uc2_pos = 0x5a360, .uc2_length = 0x3e80, + .uc4_pos = 0x5e1f0, .uc4_length = 0x4ed0, + .uc5_pos = 0x630d0, .uc5_length = 0x5680, + .pcm4_pos = 0x68760, .pcm4_length = 0x478, + .pcm5_pos = 0x68be0, .pcm5_length = 0x478, + }, + { + .name = "bcmwl564.sys", + .version = "3.100.64.10", /* 05/12/2005 */ + .md5 = "b8d76da338ecf2c650f5f7ca226ccf89", /* for 64bit machines */ + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x50bf0, + .uc2_pos = 0x54860, .uc2_length = 0x3f58, + .uc4_pos = 0x587c0, .uc4_length = 0x4e00, + .uc5_pos = 0x5d5d0, .uc5_length = 0x5800, + .pcm4_pos = 0x62de0, .pcm4_length = 0x520, + .pcm5_pos = 0x63310, .pcm5_length = 0x520, + }, + { + .name = "bcmwl5a.sys", + .version = "3.90.16.0", /* 12/06/2004 */ + .md5 = "e6d927deea6c75bddf84080e6c3837b7", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3b4c8, + .uc2_pos = 0x3f138, .uc2_length = 0x3f48, + .uc4_pos = 0x43088, .uc4_length = 0x4de8, + .uc5_pos = 0x47e78, .uc5_length = 0x57d8, + .pcm4_pos = 0x4d658, .pcm4_length = 0x520, + .pcm5_pos = 0x4db80, .pcm5_length = 0x520, + }, + { + .name = "d11ucode.o", + .version = "3.31.16.0 ?", /*FIXME: version correct? */ + .md5 = "31e6cac8a8129bf8f91291293e017329", + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x40, + .uc2_pos = 0x3120, .uc2_length = 0x3d88, + .uc4_pos = 0x6eac, .uc4_length = 0x44a0, + .uc5_pos = 0xb350, .uc5_length = 0x4ec0, + .pcm4_pos = 0x10214, .pcm4_length = 0x478, + .pcm5_pos = 0x10690, .pcm5_length = 0x478, + }, + { + .name = "d11ucode.o", + .version = "3.60.7.0 ? (1.3.2)", /* no version number found */ + .md5 = "7774e5dda1daa2b3f83d279552ca1cc4", /* but same fw files are also */ + .flags = BYTE_ORDER_LITTLE_ENDIAN, /* in bcmwl5.sys 3.60.7.0 */ + .iv_pos = 0x40, + .uc2_pos = 0x3c38, .uc2_length = 0x3e08, + .uc4_pos = 0x7a44, .uc4_length = 0x4e58, + .uc5_pos = 0xc8a0, .uc5_length = 0x5608, + .pcm4_pos = 0x11eac, .pcm4_length = 0x478, + .pcm5_pos = 0x12328, .pcm5_length = 0x478, + }, + { + .name = "d11ucode.o", + .version = "3.90.7.0 ? (3.90.RC7)", /* 10/14/2004 */ + .md5 = "b2580361620881b06fa810422ec8b7ce", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x60, + .uc2_pos = 0x3cd0, .uc2_length = 0x3ec0, + .uc4_pos = 0x7b94, .uc4_length = 0x4d60, + .uc5_pos = 0xc8f8, .uc5_length = 0x5750, + .pcm4_pos = 0x1204c, .pcm4_length = 0x520, + .pcm5_pos = 0x12570, .pcm5_length = 0x520, + }, + { + .name = "d11ucode.o", + .version = "3.90.37.0", + .md5 = "2543935259739a8a879ccb8386647ac7", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x60, + .uc2_pos = 0x3cd0, .uc2_length = 0x3f48, + .uc4_pos = 0x7c1c, .uc4_length = 0x4df0, + .uc5_pos = 0xca10, .uc5_length = 0x57e0, + .pcm4_pos = 0x121f4, .pcm4_length = 0x520, + .pcm5_pos = 0x12718, .pcm5_length = 0x520, + }, + { + .name = "wl.o", + .version = "3.31.15.0", /* 07/28/2003 */ + .md5 = "a85af65b5ae1d64ee11eab714faab843", + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x32270, + .uc2_pos = 0x35350, .uc2_length = 0x3d88, + .uc4_pos = 0x390dc, .uc4_length = 0x44a0, + .uc5_pos = 0x3d580, .uc5_length = 0x4ec0, + .pcm4_pos = 0x42444, .pcm4_length = 0x478, + .pcm5_pos = 0x428c0, .pcm5_length = 0x478, + }, + { + .name = "wl.o", + .version = "3.31.15.0", /* 07/28/2003 */ + .md5 = "98dd50a95b02c8bcb3725c770df81dfc", + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x32270, + .uc2_pos = 0x35350, .uc2_length = 0x3d88, + .uc4_pos = 0x390dc, .uc4_length = 0x44a0, + .uc5_pos = 0x3d580, .uc5_length = 0x4ec0, + .pcm4_pos = 0x42444, .pcm4_length = 0x478, + .pcm5_pos = 0x428c0, .pcm5_length = 0x478, + }, + { + .name = "wl.o", + .version = "3.50.21.0", /* 05/11/2003 */ + .md5 = "f71be0e1d14f68c98d916465a300d835", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x38990, + .uc2_pos = 0x3c428, .uc2_length = 0x3db8, + .uc4_pos = 0x401e4, .uc4_length = 0x45d8, + .uc5_pos = 0x447c0, .uc5_length = 0x5050, + .pcm4_pos = 0x49814, .pcm4_length = 0x478, + .pcm5_pos = 0x49c90, .pcm5_length = 0x478, + }, + { + .name = "wl.o", + .version = "3.50.21.10", /* 01/21/2004 */ + .md5 = "191029d5e7097ed7db92cbd6e6131f85", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3a5d0, + .uc2_pos = 0x3e0b8, .uc2_length = 0x3e00, + .uc4_pos = 0x41ebc, .uc4_length = 0x4628, + .uc5_pos = 0x464e8, .uc5_length = 0x5548, + .pcm4_pos = 0x4ba34, .pcm4_length = 0x478, + .pcm5_pos = 0x4beb0, .pcm5_length = 0x478, + }, + { + .name = "wl.o", + .version = "3.60.7.0 ? (1.3.2.0)", /* 02/04/2004 */ + .md5 = "7009220d84c445797443aa0221b7d8a4", /* no bcm version found */ + .flags = BYTE_ORDER_LITTLE_ENDIAN, /* but same fw files are also */ + .iv_pos = 0x545e0, /* in bcmwl5.sys 3.60.7.0, */ + .uc2_pos = 0x581d8, .uc2_length = 0x3e08, + .uc4_pos = 0x5bfe4, .uc4_length = 0x4e58, + .uc5_pos = 0x60e40, .uc5_length = 0x5608, + .pcm4_pos = 0x6644c, .pcm4_length = 0x478, + .pcm5_pos = 0x668c8, .pcm5_length = 0x478, + }, + { + .name = "wl.o", + .version = "3.60.13.0", /* 05/05/2004 */ + .md5 = "275dd4958eb94058d4650f58d534c635", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3b740, + .uc2_pos = 0x3f388, .uc2_length = 0x3e30, + .uc4_pos = 0x431bc, .uc4_length = 0x4e80, + .uc5_pos = 0x48040, .uc5_length = 0x5630, + .pcm4_pos = 0x4d674, .pcm4_length = 0x478, + .pcm5_pos = 0x4daf0, .pcm5_length = 0x478, + }, + { + .name = "wl.o", + .version = "3.60.13.0", /* 08/02/2004 */ + .md5 = "4f20653a0b7c0bb3bd1ee0dd79f77785", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3b730, + .uc2_pos = 0x3f378, .uc2_length = 0x3e30, + .uc4_pos = 0x431ac, .uc4_length = 0x4e80, + .uc5_pos = 0x48030, .uc5_length = 0x5630, + .pcm4_pos = 0x4d664, .pcm4_length = 0x478, + .pcm5_pos = 0x4dae0, .pcm5_length = 0x478, + }, + { + .name = "wl.o", + .version = "3.90.7.0", /* 14/10/2004 */ + .md5 = "f15b59ad4d6f6ad2c7f45193d033aff8", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x4d890, + .uc2_pos = 0x51500, .uc2_length = 0x3ec0, + .uc4_pos = 0x553c4, .uc4_length = 0x4d60, + .uc5_pos = 0x5a128, .uc5_length = 0x5750, + .pcm4_pos = 0x5f87c, .pcm4_length = 0x520, + .pcm5_pos = 0x5fda0, .pcm5_length = 0x520, + }, + { + .name = "wl.o", + .version = "3.90.37.0", /* 15/02/2005 */ + .md5 = "984c42947552652d5ab61b78e7d12227", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x4cf50, + .uc2_pos = 0x50bc0, .uc2_length = 0x3f48, + .uc4_pos = 0x54b0c, .uc4_length = 0x4df0, + .uc5_pos = 0x59900, .uc5_length = 0x57e0, + .pcm4_pos = 0x5f0e4, .pcm4_length = 0x520, + .pcm5_pos = 0x5f608, .pcm5_length = 0x520, + }, + { + .name = "wl_ap.o", + .version = "3.31.16.0", /* 08/06/2003 */ + .md5 = "463633e7bf0efc6c0f8eac2514a71024", + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x32270, + .uc2_pos = 0x35350, .uc2_length = 0x3d88, + .uc4_pos = 0x390dc, .uc4_length = 0x44a0, + .uc5_pos = 0x3d580, .uc5_length = 0x4ec0, + .pcm4_pos = 0x42444, .pcm4_length = 0x478, + .pcm5_pos = 0x428c0, .pcm5_length = 0x478, + }, + { + .name = "wl_ap.o", + .version = "3.90.37.0", /* 15/02/2005 */ + .md5 = "0538296d46a854d2facc9a0db2088180", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3eac0, + .uc2_pos = 0x42730, .uc2_length = 0x3f48, + .uc4_pos = 0x4667c, .uc4_length = 0x4df0, + .uc5_pos = 0x4b470, .uc5_length = 0x57e0, + .pcm4_pos = 0x50c54, .pcm4_length = 0x520, + .pcm5_pos = 0x51178, .pcm5_length = 0x520, + }, + { + .name = "wl_ap.o", + .version = "3.90.37.0", /* 15/02/2005 */ + .md5 = "6c9073531a528dd455b716b5e821e696", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x3eac0, + .uc2_pos = 0x42730, .uc2_length = 0x3f48, + .uc4_pos = 0x4667c, .uc4_length = 0x4df0, + .uc5_pos = 0x4b470, .uc5_length = 0x57e0, + .pcm4_pos = 0x50c54, .pcm4_length = 0x520, + .pcm5_pos = 0x51178, .pcm5_length = 0x520, + }, + { + .name = "wl_apsta.o", + .version = "3.31.16.0", /* 06/08/2003 */ + .md5 = "22b90e4cbeee45ad7f78ff536c65712a", + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x38020, + .uc2_pos = 0x3b100, .uc2_length = 0x3d88, + .uc4_pos = 0x3ee8c, .uc4_length = 0x44a0, + .uc5_pos = 0x43330, .uc5_length = 0x4ec0, + .pcm4_pos = 0x481f4, .pcm4_length = 0x478, + .pcm5_pos = 0x48670, .pcm5_length = 0x478, + }, + { + .name = "wl_apsta.o", + .version = "3.31.16.0", /* 06/08/2003 */ + .md5 = "dfce35a8b5cb6e53e1ab75342c7e7194", + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x38020, + .uc2_pos = 0x3b100, .uc2_length = 0x3d88, + .uc4_pos = 0x3ee8c, .uc4_length = 0x44a0, + .uc5_pos = 0x43330, .uc5_length = 0x4ec0, + .pcm4_pos = 0x481f4, .pcm4_length = 0x478, + .pcm5_pos = 0x48670, .pcm5_length = 0x478, + }, + { + .name = "wl_apsta.o", + .version = "3.90.37.0", /* 15/02/2005 */ + .md5 = "2922e6c48917eacd6c8c094347d2ec4b", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x4ebc0, + .uc2_pos = 0x52830, .uc2_length = 0x3f48, + .uc4_pos = 0x5677c, .uc4_length = 0x4df0, + .uc5_pos = 0x5b570, .uc5_length = 0x57e0, + .pcm4_pos = 0x60d54, .pcm4_length = 0x520, + .pcm5_pos = 0x61278, .pcm5_length = 0x520, + }, + { + .name = "wl_apsta.o", + .version = "3.90.37.0", /* 15/02/2005 */ + .md5 = "f9fa565a766e8befeb495a8a8c0c134b", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x4ebc0, + .uc2_pos = 0x52830, .uc2_length = 0x3f48, + .uc4_pos = 0x5677c, .uc4_length = 0x4df0, + .uc5_pos = 0x5b570, .uc5_length = 0x57e0, + .pcm4_pos = 0x60d54, .pcm4_length = 0x520, + .pcm5_pos = 0x61278, .pcm5_length = 0x520, + }, + { + .name = "wl_apsta.o", + .version = "3.130.20.0", /* 19/05/2005 */ + .md5 = "e08665c5c5b66beb9c3b2dd54aa80cb3", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x56020, + .uc2_pos = 0x59ca0, .uc2_length = 0x3fe0, + .uc4_pos = 0x5dc84, .uc4_length = 0x4e78, + .uc5_pos = 0x62b00, .uc5_length = 0x5700, + .uc11_pos = 0x68204, .uc11_length = 0x54a8, + .pcm4_pos = 0x6d6b0, .pcm4_length = 0x520, + .pcm5_pos = 0x6dbd4, .pcm5_length = 0x520, + }, + { + .name = "wl_sta.o", + .version = "3.31.16.0", /* 08/06/2003 */ + .md5 = "c3e663cb78b2fc299088de69fc11a9a9", + .flags = BYTE_ORDER_LITTLE_ENDIAN | + MISSING_INITVAL_08, + .iv_pos = 0x317b0, + .uc2_pos = 0x34890, .uc2_length = 0x3d88, + .uc4_pos = 0x3861c, .uc4_length = 0x44a0, + .uc5_pos = 0x3cac0, .uc5_length = 0x4ec0, + .pcm4_pos = 0x41984, .pcm4_length = 0x478, + .pcm5_pos = 0x41e00, .pcm5_length = 0x478, + }, + { + .name = "wl_sta.o", + .version = "3.90.37.0", /* 15/02/2005 */ + .md5 = "4631d4d4c3ab943462e1ea24f4dba7bd", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x47040, + .uc2_pos = 0x4acb0, .uc2_length = 0x3f48, + .uc4_pos = 0x4ebfc, .uc4_length = 0x4df0, + .uc5_pos = 0x539f0, .uc5_length = 0x57e0, + .pcm4_pos = 0x591d4, .pcm4_length = 0x520, + .pcm5_pos = 0x596f8, .pcm5_length = 0x520, + }, + { + .name = "wl_sta.o", + .version = "3.90.37.0", /* 15/02/2005 */ + .md5 = "bf824b38b3993e0a8b5a9bf717c428ed", + .flags = BYTE_ORDER_LITTLE_ENDIAN, + .iv_pos = 0x47040, + .uc2_pos = 0x4acb0, .uc2_length = 0x3f48, + .uc4_pos = 0x4ebfc, .uc4_length = 0x4df0, + .uc5_pos = 0x539f0, .uc5_length = 0x57e0, + .pcm4_pos = 0x591d4, .pcm4_length = 0x520, + .pcm5_pos = 0x596f8, .pcm5_length = 0x520, + }, +}; + +#define FILES (sizeof(files) / sizeof(files[0])) diff --git a/target/linux/package/bcm43xx-dscape/fwcutter/md5.c b/target/linux/package/bcm43xx-dscape/fwcutter/md5.c new file mode 100644 index 000000000..ad134146e --- /dev/null +++ b/target/linux/package/bcm43xx-dscape/fwcutter/md5.c @@ -0,0 +1,253 @@ +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ + +/* Brutally hacked by John Walker back from ANSI C to K&R (no + prototypes) to maintain the tradition that Netfone will compile + with Sun's original "cc". */ +/* Ripped out ugly K&R again ;) --mbuesch */ + +#include <memory.h> /* for memcpy() */ +#include "md5.h" + +extern int big_endian_cpu; + +/* + * Note: this code is harmless on little-endian machines, + * but we return early nevertheless. + */ +static void byteReverse(unsigned char *buf, unsigned longs) +{ + uint32_t t; + + if (!big_endian_cpu) + return; + + do { + t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | + ((unsigned) buf[1] << 8 | buf[0]); + *(uint32_t *) buf = t; + buf += 4; + } while (--longs); +} + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +static void MD5Transform(uint32_t *buf, uint32_t *in) +{ + register uint32_t a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void MD5Init(struct MD5Context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; +} + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len) +{ + uint32_t t; + + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + + /* Handle any leading odd-sized chunks */ + + if (t) { + unsigned char *p = (unsigned char *) ctx->in + t; + + t = 64 - t; + if (len < t) { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += t; + len -= t; + } + /* Process data in 64-byte chunks */ + + while (len >= 64) { + memcpy(ctx->in, buf, 64); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += 64; + len -= 64; + } + + /* Handle any remaining bytes of data. */ + + memcpy(ctx->in, buf, len); +} + +/* + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void MD5Final(unsigned char *digest, struct MD5Context *ctx) +{ + unsigned count; + unsigned char *p; + + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } else { + /* Pad block to 56 bytes */ + memset(p, 0, count - 8); + } + byteReverse(ctx->in, 14); + + /* Append length in bits and transform */ + ((uint32_t *) ctx->in)[14] = ctx->bits[0]; + ((uint32_t *) ctx->in)[15] = ctx->bits[1]; + + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + byteReverse((unsigned char *) ctx->buf, 4); + memcpy(digest, ctx->buf, 16); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ +} diff --git a/target/linux/package/bcm43xx-dscape/fwcutter/md5.h b/target/linux/package/bcm43xx-dscape/fwcutter/md5.h new file mode 100644 index 000000000..ee574e413 --- /dev/null +++ b/target/linux/package/bcm43xx-dscape/fwcutter/md5.h @@ -0,0 +1,16 @@ +#ifndef FWCUTTER_MD5_H_ +#define FWCUTTER_MD5_H_ + +#include <stdint.h> + +struct MD5Context { + uint32_t buf[4]; + uint32_t bits[2]; + unsigned char in[64]; +}; + +void MD5Init(struct MD5Context *ctx); +void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len); +void MD5Final(unsigned char *digest, struct MD5Context *ctx); + +#endif /* FWCUTTER_MD5_H_ */ diff --git a/target/linux/package/bcm43xx-dscape/ipkg/kmod-bcm43xx-dscape.control b/target/linux/package/bcm43xx-dscape/ipkg/kmod-bcm43xx-dscape.control new file mode 100644 index 000000000..c07856f1f --- /dev/null +++ b/target/linux/package/bcm43xx-dscape/ipkg/kmod-bcm43xx-dscape.control @@ -0,0 +1,4 @@ +Package: kmod-bcm43xx-dscape +Priority: optional +Section: sys +Description: Free BCM43xx wireless driver (devicescape) |