diff options
Diffstat (limited to 'abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen')
8 files changed, 579 insertions, 0 deletions
diff --git a/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/entries b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/entries new file mode 100644 index 0000000..f2a74e1 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/entries @@ -0,0 +1,96 @@ +9 + +dir +1870 +svn://svn.shaftnet.org/linux-wlan-ng/trunk/add-ons/keygen +svn://svn.shaftnet.org/linux-wlan-ng + + + +2002-10-17T13:10:18.000000Z +1163 +solomon + + +svn:special svn:externals svn:needs-lock + + + + + + + + + + + +7c16ee9a-e2ed-0310-ae25-9f6e1be264fe + +keygen.c +file + + + + +2009-01-07T08:12:58.000000Z +9fc5f9b33c3182b4dd0f975cc46c5302 +2002-10-17T13:10:18.000000Z +1163 +solomon +has-props + + + + + + + + + + + + + + + + + + + + +3571 + +Makefile +file + + + + +2009-01-07T08:12:58.000000Z +2db68c77af844f5bd78e16ffe19a64bd +2002-05-24T12:11:30.000000Z +912 +solomon +has-props + + + + + + + + + + + + + + + + + + + + +1884 + diff --git a/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/format b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/format new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/format @@ -0,0 +1 @@ +9 diff --git a/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/prop-base/Makefile.svn-base b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/prop-base/Makefile.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/prop-base/Makefile.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/prop-base/keygen.c.svn-base b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/prop-base/keygen.c.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/prop-base/keygen.c.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/text-base/Makefile.svn-base b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/text-base/Makefile.svn-base new file mode 100644 index 0000000..0561a9e --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/text-base/Makefile.svn-base @@ -0,0 +1,49 @@ +# Makefile +# +# Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. +# -------------------------------------------------------------------- +# +# linux-wlan +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# Alternatively, the contents of this file may be used under the +# terms of the GNU Public License version 2 (the "GPL"), in which +# case the provisions of the GPL are applicable instead of the +# above. If you wish to allow the use of your version of this file +# only under the terms of the GPL and not to allow others to use +# your version of this file under the MPL, indicate your decision +# by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL. If you do not delete +# the provisions above, a recipient may use your version of this +# file under either the MPL or the GPL. +# +# -------------------------------------------------------------------- +# +# Inquiries regarding the linux-wlan Open Source project can be +# made directly to: +# +# AbsoluteValue Systems Inc. +# info@linux-wlan.com +# http://www.linux-wlan.com +# +# -------------------------------------------------------------------- +# +# Portions of the development of this software were funded by +# Intersil Corporation as part of PRISM(R) chipset product development. +# +# -------------------------------------------------------------------- + + +keygen: + gcc -o keygen keygen.c -lcrypto + + diff --git a/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/text-base/keygen.c.svn-base b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/text-base/keygen.c.svn-base new file mode 100644 index 0000000..fe29738 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/.svn/text-base/keygen.c.svn-base @@ -0,0 +1,183 @@ +/* + * keygen.c + * WEP Key Generators + * + * This program generates WEP keys using de facto standard key + * generators for 40 and 128 bit keys. + * + * Link against OpenSSL's libcrypto.a + * + * I place this code in the public domain. + * May 2001, Tim Newsham + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <openssl/md5.h> + +#define WEPKEYSIZE 5 +#define WEPSTRONGKEYSIZE 13 +#define WEPKEYS 4 +#define WEPKEYSTORE (WEPKEYSIZE * WEPKEYS) +#define WEPSTRONGKEYSTORE (WEPSTRONGKEYSIZE * WEPKEYS) + +/* + * generate four subkeys from a seed using the defacto standard + */ +void +wep_seedkeygen(int val, u_char *keys) +{ + int i; + + for(i = 0; i < WEPKEYSTORE; i++) { + val *= 0x343fd; + val += 0x269ec3; + keys[i] = val >> 16; + } + return; +} + +/* + * generate one key from a string using the de facto standard + * + * resultant key is stored in + * one 128 bit key: keys[0-15] + * + * (NOTE: I'm not sure why, but it seems that only values 0-12 are used, + * resulting in 104 bits of keying, not 128) + */ +void +wep_keygen128(char *str, u_char *keys) +{ + MD5_CTX ctx; + u_char buf[64]; + int i, j; + + /* repeat str until buf is full */ + j = 0; + for(i = 0; i < 64; i++) { + if(str[j] == 0) + j = 0; + buf[i] = str[j++]; + } + + MD5_Init(&ctx); + MD5_Update(&ctx, buf, sizeof buf); + MD5_Final(buf, &ctx); + + memcpy(keys, buf, WEPSTRONGKEYSTORE); + for(i = 0; i < WEPSTRONGKEYSIZE; i++) { + keys[i] = buf[i]; + } + for(; i < WEPSTRONGKEYSTORE; i++) { + keys[i] = 0; + } + return; +} + +/* + * generate four subkeys from a string using the defacto standard + * + * resultant keys are stored in + * four 40 bit keys: keys[0-4], keys[5-9], keys[10-14] and keys[15-20] + */ +void +wep_keygen40(char *str, u_char *keys) +{ + int val, i, shift; + + /* + * seed is generated by xor'ing in the keystring bytes + * into the four bytes of the seed, starting at the little end + */ + val = 0; + for(i = 0; str[i]; i++) { + shift = i & 0x3; + val ^= (str[i] << (shift * 8)); + } + + wep_seedkeygen(val, keys); + return; +} + +void +wep_keyprint40(u_char *keys) +{ + int i; + char sepchar; + + for(i = 0; i < WEPKEYSTORE; i++) { + sepchar = (i % WEPKEYSIZE == WEPKEYSIZE - 1) ? '\n' : ':'; + printf("%02x%c", keys[i], sepchar); + } + return; +} + +void +wep_keyprint128(u_char *keys) +{ + int i; + char sepchar; + + for(i = 0; i < WEPSTRONGKEYSTORE; i++) { + sepchar = (i % WEPSTRONGKEYSIZE == WEPSTRONGKEYSIZE - 1) ? '\n' : ':'; + printf("%02x%c", keys[i], sepchar); + } + return; +} +void +usage(char *prog) +{ + printf("Usage: %s keystring [-s || 5 || 13]\n", prog); + exit(1); +} + +int +main(int argc, char **argv) +{ + u_char keys[WEPKEYSTORE]; + u_char strongkeys[WEPSTRONGKEYSTORE]; + char *prog, *genstr; + int strong, ch; + + prog = argv[0]; + strong = 0; + while((ch = getopt(argc, argv, "s")) != EOF) { + switch(ch) { + case 's': + strong ++; + break; + default: + usage(prog); + } + } + argc -= optind; + argv += optind; + + if(argc==2) + if(!strcmp(argv[1],"13")) + { + strong++; + argc--; + } + else argc--; + + if(argc != 1) + usage(prog); + genstr = argv[0]; + + if(strong) + { + wep_keygen128(genstr, strongkeys); + wep_keyprint128(strongkeys); + } + else + { + wep_keygen40(genstr, keys); + wep_keyprint40(keys); + } + return 0; +} diff --git a/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/Makefile b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/Makefile new file mode 100644 index 0000000..0561a9e --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/Makefile @@ -0,0 +1,49 @@ +# Makefile +# +# Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. +# -------------------------------------------------------------------- +# +# linux-wlan +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# Alternatively, the contents of this file may be used under the +# terms of the GNU Public License version 2 (the "GPL"), in which +# case the provisions of the GPL are applicable instead of the +# above. If you wish to allow the use of your version of this file +# only under the terms of the GPL and not to allow others to use +# your version of this file under the MPL, indicate your decision +# by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL. If you do not delete +# the provisions above, a recipient may use your version of this +# file under either the MPL or the GPL. +# +# -------------------------------------------------------------------- +# +# Inquiries regarding the linux-wlan Open Source project can be +# made directly to: +# +# AbsoluteValue Systems Inc. +# info@linux-wlan.com +# http://www.linux-wlan.com +# +# -------------------------------------------------------------------- +# +# Portions of the development of this software were funded by +# Intersil Corporation as part of PRISM(R) chipset product development. +# +# -------------------------------------------------------------------- + + +keygen: + gcc -o keygen keygen.c -lcrypto + + diff --git a/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/keygen.c b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/keygen.c new file mode 100644 index 0000000..fe29738 --- /dev/null +++ b/abs/core-testing/wlan-ng26-utils-svn/tmp/trunk/add-ons/keygen/keygen.c @@ -0,0 +1,183 @@ +/* + * keygen.c + * WEP Key Generators + * + * This program generates WEP keys using de facto standard key + * generators for 40 and 128 bit keys. + * + * Link against OpenSSL's libcrypto.a + * + * I place this code in the public domain. + * May 2001, Tim Newsham + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <openssl/md5.h> + +#define WEPKEYSIZE 5 +#define WEPSTRONGKEYSIZE 13 +#define WEPKEYS 4 +#define WEPKEYSTORE (WEPKEYSIZE * WEPKEYS) +#define WEPSTRONGKEYSTORE (WEPSTRONGKEYSIZE * WEPKEYS) + +/* + * generate four subkeys from a seed using the defacto standard + */ +void +wep_seedkeygen(int val, u_char *keys) +{ + int i; + + for(i = 0; i < WEPKEYSTORE; i++) { + val *= 0x343fd; + val += 0x269ec3; + keys[i] = val >> 16; + } + return; +} + +/* + * generate one key from a string using the de facto standard + * + * resultant key is stored in + * one 128 bit key: keys[0-15] + * + * (NOTE: I'm not sure why, but it seems that only values 0-12 are used, + * resulting in 104 bits of keying, not 128) + */ +void +wep_keygen128(char *str, u_char *keys) +{ + MD5_CTX ctx; + u_char buf[64]; + int i, j; + + /* repeat str until buf is full */ + j = 0; + for(i = 0; i < 64; i++) { + if(str[j] == 0) + j = 0; + buf[i] = str[j++]; + } + + MD5_Init(&ctx); + MD5_Update(&ctx, buf, sizeof buf); + MD5_Final(buf, &ctx); + + memcpy(keys, buf, WEPSTRONGKEYSTORE); + for(i = 0; i < WEPSTRONGKEYSIZE; i++) { + keys[i] = buf[i]; + } + for(; i < WEPSTRONGKEYSTORE; i++) { + keys[i] = 0; + } + return; +} + +/* + * generate four subkeys from a string using the defacto standard + * + * resultant keys are stored in + * four 40 bit keys: keys[0-4], keys[5-9], keys[10-14] and keys[15-20] + */ +void +wep_keygen40(char *str, u_char *keys) +{ + int val, i, shift; + + /* + * seed is generated by xor'ing in the keystring bytes + * into the four bytes of the seed, starting at the little end + */ + val = 0; + for(i = 0; str[i]; i++) { + shift = i & 0x3; + val ^= (str[i] << (shift * 8)); + } + + wep_seedkeygen(val, keys); + return; +} + +void +wep_keyprint40(u_char *keys) +{ + int i; + char sepchar; + + for(i = 0; i < WEPKEYSTORE; i++) { + sepchar = (i % WEPKEYSIZE == WEPKEYSIZE - 1) ? '\n' : ':'; + printf("%02x%c", keys[i], sepchar); + } + return; +} + +void +wep_keyprint128(u_char *keys) +{ + int i; + char sepchar; + + for(i = 0; i < WEPSTRONGKEYSTORE; i++) { + sepchar = (i % WEPSTRONGKEYSIZE == WEPSTRONGKEYSIZE - 1) ? '\n' : ':'; + printf("%02x%c", keys[i], sepchar); + } + return; +} +void +usage(char *prog) +{ + printf("Usage: %s keystring [-s || 5 || 13]\n", prog); + exit(1); +} + +int +main(int argc, char **argv) +{ + u_char keys[WEPKEYSTORE]; + u_char strongkeys[WEPSTRONGKEYSTORE]; + char *prog, *genstr; + int strong, ch; + + prog = argv[0]; + strong = 0; + while((ch = getopt(argc, argv, "s")) != EOF) { + switch(ch) { + case 's': + strong ++; + break; + default: + usage(prog); + } + } + argc -= optind; + argv += optind; + + if(argc==2) + if(!strcmp(argv[1],"13")) + { + strong++; + argc--; + } + else argc--; + + if(argc != 1) + usage(prog); + genstr = argv[0]; + + if(strong) + { + wep_keygen128(genstr, strongkeys); + wep_keyprint128(strongkeys); + } + else + { + wep_keygen40(genstr, keys); + wep_keyprint40(keys); + } + return 0; +} |