Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125131
b: refs/heads/master
c: e43ace8
h: refs/heads/master
i:
  125129: bd2dd5a
  125127: 327328e
v: v3
  • Loading branch information
David Vrabel committed Dec 22, 2008
1 parent 9974c8c commit 8ff74cd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 48 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bce83697c5fe84a7a5d38c96fbbe43b4bc028c3e
refs/heads/master: e43ace891229607c43d35597cbba77c2e40f48d4
34 changes: 18 additions & 16 deletions trunk/drivers/usb/wusbcore/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,18 @@
#include <linux/uwb.h>
#include <linux/usb/wusb.h>
#include <linux/scatterlist.h>
#include <linux/uwb/debug.h>

static int debug_crypto_verify = 0;

module_param(debug_crypto_verify, int, 0);
MODULE_PARM_DESC(debug_crypto_verify, "verify the key generation algorithms");

static void wusb_key_dump(const void *buf, size_t len)
{
print_hex_dump(KERN_ERR, " ", DUMP_PREFIX_OFFSET, 16, 1,
buf, len, 0);
}

/*
* Block of data, as understood by AES-CCM
*
Expand Down Expand Up @@ -396,14 +401,14 @@ static int wusb_oob_mic_verify(void)
"mismatch between MIC result and WUSB1.0[A2]\n");
hs_size = sizeof(stv_hsmic_hs) - sizeof(stv_hsmic_hs.MIC);
printk(KERN_ERR "E: Handshake2 in: (%zu bytes)\n", hs_size);
dump_bytes(NULL, &stv_hsmic_hs, hs_size);
wusb_key_dump(&stv_hsmic_hs, hs_size);
printk(KERN_ERR "E: CCM Nonce in: (%zu bytes)\n",
sizeof(stv_hsmic_n));
dump_bytes(NULL, &stv_hsmic_n, sizeof(stv_hsmic_n));
wusb_key_dump(&stv_hsmic_n, sizeof(stv_hsmic_n));
printk(KERN_ERR "E: MIC out:\n");
dump_bytes(NULL, mic, sizeof(mic));
wusb_key_dump(mic, sizeof(mic));
printk(KERN_ERR "E: MIC out (from WUSB1.0[A.2]):\n");
dump_bytes(NULL, stv_hsmic_hs.MIC, sizeof(stv_hsmic_hs.MIC));
wusb_key_dump(stv_hsmic_hs.MIC, sizeof(stv_hsmic_hs.MIC));
result = -EINVAL;
} else
result = 0;
Expand Down Expand Up @@ -471,19 +476,16 @@ static int wusb_key_derive_verify(void)
printk(KERN_ERR "E: WUSB key derivation test: "
"mismatch between key derivation result "
"and WUSB1.0[A1] Errata 2006/12\n");
printk(KERN_ERR "E: keydvt in: key (%zu bytes)\n",
sizeof(stv_key_a1));
dump_bytes(NULL, stv_key_a1, sizeof(stv_key_a1));
printk(KERN_ERR "E: keydvt in: nonce (%zu bytes)\n",
sizeof(stv_keydvt_n_a1));
dump_bytes(NULL, &stv_keydvt_n_a1, sizeof(stv_keydvt_n_a1));
printk(KERN_ERR "E: keydvt in: hnonce & dnonce (%zu bytes)\n",
sizeof(stv_keydvt_in_a1));
dump_bytes(NULL, &stv_keydvt_in_a1, sizeof(stv_keydvt_in_a1));
printk(KERN_ERR "E: keydvt in: key\n");
wusb_key_dump(stv_key_a1, sizeof(stv_key_a1));
printk(KERN_ERR "E: keydvt in: nonce\n");
wusb_key_dump( &stv_keydvt_n_a1, sizeof(stv_keydvt_n_a1));
printk(KERN_ERR "E: keydvt in: hnonce & dnonce\n");
wusb_key_dump(&stv_keydvt_in_a1, sizeof(stv_keydvt_in_a1));
printk(KERN_ERR "E: keydvt out: KCK\n");
dump_bytes(NULL, &keydvt_out.kck, sizeof(keydvt_out.kck));
wusb_key_dump(&keydvt_out.kck, sizeof(keydvt_out.kck));
printk(KERN_ERR "E: keydvt out: PTK\n");
dump_bytes(NULL, &keydvt_out.ptk, sizeof(keydvt_out.ptk));
wusb_key_dump(&keydvt_out.ptk, sizeof(keydvt_out.ptk));
result = -EINVAL;
} else
result = 0;
Expand Down
16 changes: 5 additions & 11 deletions trunk/drivers/usb/wusbcore/wa-nep.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*/
#include <linux/workqueue.h>
#include <linux/ctype.h>
#include <linux/uwb/debug.h>

#include "wa-hc.h"
#include "wusbhc.h"

Expand Down Expand Up @@ -139,13 +139,10 @@ static void wa_notif_dispatch(struct work_struct *ws)
/* FIXME: unimplemented WA NOTIFs */
/* fallthru */
default:
if (printk_ratelimit()) {
dev_err(dev, "HWA: unknown notification 0x%x, "
"%zu bytes; discarding\n",
notif_hdr->bNotifyType,
(size_t)notif_hdr->bLength);
dump_bytes(dev, notif_hdr, 16);
}
dev_err(dev, "HWA: unknown notification 0x%x, "
"%zu bytes; discarding\n",
notif_hdr->bNotifyType,
(size_t)notif_hdr->bLength);
break;
}
}
Expand All @@ -160,12 +157,9 @@ static void wa_notif_dispatch(struct work_struct *ws)
* discard the data, as this should not happen.
*/
exhausted_buffer:
if (!printk_ratelimit())
goto out;
dev_warn(dev, "HWA: device sent short notification, "
"%d bytes missing; discarding %d bytes.\n",
missing, (int)size);
dump_bytes(dev, itr, size);
goto out;
}

Expand Down
21 changes: 1 addition & 20 deletions trunk/drivers/uwb/uwb-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* Copyright (C) 2005-2006 Intel Corporation
* Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
* Copyright (C) 2008 Cambridge Silicon Radio Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
Expand Down Expand Up @@ -36,26 +37,6 @@

#include "uwb-internal.h"

void dump_bytes(struct device *dev, const void *_buf, size_t rsize)
{
const char *buf = _buf;
char line[32];
size_t offset = 0;
int cnt, cnt2;
for (cnt = 0; cnt < rsize; cnt += 8) {
size_t rtop = rsize - cnt < 8 ? rsize - cnt : 8;
for (offset = cnt2 = 0; cnt2 < rtop; cnt2++) {
offset += scnprintf(line + offset, sizeof(line) - offset,
"%02x ", buf[cnt + cnt2] & 0xff);
}
if (dev)
dev_info(dev, "%s\n", line);
else
printk(KERN_INFO "%s\n", line);
}
}
EXPORT_SYMBOL_GPL(dump_bytes);

/*
* Debug interface
*
Expand Down

0 comments on commit 8ff74cd

Please sign in to comment.