View | Details | Raw Unified | Return to bug 21245
Collapse All | Expand All

(-)wicontrol.8 (-8 / +4 lines)
Lines 238-251 Link Here
238
digits (i.e. "0x1234512345"). For
238
digits (i.e. "0x1234512345"). For
239
WaveLAN Turbo Silver cards, the key is restricted to 40 bits, hence
239
WaveLAN Turbo Silver cards, the key is restricted to 40 bits, hence
240
the key can be either a 5 character text string or 10 hex digits.
240
the key can be either a 5 character text string or 10 hex digits.
241
For WaveLAN Turbo Gold cards, the key can be up to 128 bits,
241
For WaveLAN Turbo Gold cards, the key can also be 104 bits,
242
which means the key can be specified as either a 16 character text
242
which means the key can be specified as either a 13 character text
243
string or 32 hex digits.
243
string or 26 hex digits in addition to the formats supported by the
244
.Pp
244
Silver cards.
245
Note: currently, the field in the structure used to program the key
246
into the NIC is only 14 bytes long, not 16.
247
I'm not sure how this is
248
supposed to allow 128 bits of key info for the gold cards.
249
.It Fl i Ar iface Fl T Ar 1|2|3|4
245
.It Fl i Ar iface Fl T Ar 1|2|3|4
250
Specify which of the four WEP encryption keys will be used to
246
Specify which of the four WEP encryption keys will be used to
251
encrypt transmitted packets.
247
encrypt transmitted packets.
(-)wicontrol.c (-7 / +30 lines)
Lines 49-54 Link Here
49
#include <string.h>
49
#include <string.h>
50
#include <stdlib.h>
50
#include <stdlib.h>
51
#include <unistd.h>
51
#include <unistd.h>
52
#include <ctype.h>
52
#include <errno.h>
53
#include <errno.h>
53
#include <err.h>
54
#include <err.h>
54
55
Lines 282-287 Link Here
282
	char			*key;
283
	char			*key;
283
	int			idx;
284
	int			idx;
284
{
285
{
286
	int			keylen;
285
	struct wi_req		wreq;
287
	struct wi_req		wreq;
286
	struct wi_ltv_keys	*keys;
288
	struct wi_ltv_keys	*keys;
287
	struct wi_key		*k;
289
	struct wi_key		*k;
Lines 301-309 Link Here
301
	wi_getval(iface, &wreq);
303
	wi_getval(iface, &wreq);
302
	keys = (struct wi_ltv_keys *)&wreq;
304
	keys = (struct wi_ltv_keys *)&wreq;
303
305
304
	if (strlen(key) > 14) {
306
	keylen = strlen(key);
305
		err(1, "encryption key must be no "
307
	if (key[0] == '0' && (key[1] == 'x' || key[1] == 'X')) {
306
		    "more than 14 characters long");
308
		if(keylen != 2 && keylen != 12 && keylen != 28) {
309
			err(1, "encryption key must be 0, 10, or 26 "
310
			    "hex digits long");
311
		}
312
	} else {
313
		if (keylen != 0 && keylen != 5 && keylen != 13) {
314
			err(1, "encryption key must be 0, 5, or 13 "
315
			    "bytes long");
316
		}
307
	}
317
	}
308
318
309
	if (idx > 3)
319
	if (idx > 3)
Lines 323-328 Link Here
323
	struct wi_req		*wreq;
333
	struct wi_req		*wreq;
324
{
334
{
325
	int			i, j;
335
	int			i, j;
336
	int			isprintable;
326
	struct wi_key		*k;
337
	struct wi_key		*k;
327
	struct wi_ltv_keys	*keys;
338
	struct wi_ltv_keys	*keys;
328
	char			*ptr;
339
	char			*ptr;
Lines 332-343 Link Here
332
	for (i = 0; i < 4; i++) {
343
	for (i = 0; i < 4; i++) {
333
		k = &keys->wi_keys[i];
344
		k = &keys->wi_keys[i];
334
		ptr = (char *)k->wi_keydat;
345
		ptr = (char *)k->wi_keydat;
346
		isprintable = 1;
335
		for (j = 0; j < k->wi_keylen; j++) {
347
		for (j = 0; j < k->wi_keylen; j++) {
336
			if (ptr[i] == '\0')
348
			if (!isprint(ptr[j])) {
337
				ptr[i] = ' ';
349
				isprintable = 0;
350
				break;
351
			}
352
		}
353
		if(isprintable) {
354
			ptr[j] = '\0';
355
			printf("[ %s ]", ptr);
356
		} else {
357
			printf("[ 0x");
358
			for (j = 0; j < k->wi_keylen; j++) {
359
				printf("%02x", ptr[j] & 0xFF);
360
			}
361
			printf(" ]");
362
					
338
		}
363
		}
339
		ptr[j] = '\0';
340
		printf("[ %s ]", ptr);
341
	}
364
	}
342
365
343
	return;
366
	return;

Return to bug 21245