aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-12-22 13:27:17 -0500
committerDavid Vrabel <david.vrabel@csr.com>2008-12-22 13:27:17 -0500
commite43ace891229607c43d35597cbba77c2e40f48d4 (patch)
treece5fb73947a1d7fb5a6bbb8ac9d82f3e20c6a316 /drivers/usb
parentbce83697c5fe84a7a5d38c96fbbe43b4bc028c3e (diff)
uwb: use print_hex_dump()
Use print_hex_dump() instead of the home-grown dump_bytes(). Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/wusbcore/crypto.c34
-rw-r--r--drivers/usb/wusbcore/wa-nep.c16
2 files changed, 23 insertions, 27 deletions
diff --git a/drivers/usb/wusbcore/crypto.c b/drivers/usb/wusbcore/crypto.c
index 9d9128ac8c8e..9ec7fd5da489 100644
--- a/drivers/usb/wusbcore/crypto.c
+++ b/drivers/usb/wusbcore/crypto.c
@@ -51,13 +51,18 @@
51#include <linux/uwb.h> 51#include <linux/uwb.h>
52#include <linux/usb/wusb.h> 52#include <linux/usb/wusb.h>
53#include <linux/scatterlist.h> 53#include <linux/scatterlist.h>
54#include <linux/uwb/debug.h>
55 54
56static int debug_crypto_verify = 0; 55static int debug_crypto_verify = 0;
57 56
58module_param(debug_crypto_verify, int, 0); 57module_param(debug_crypto_verify, int, 0);
59MODULE_PARM_DESC(debug_crypto_verify, "verify the key generation algorithms"); 58MODULE_PARM_DESC(debug_crypto_verify, "verify the key generation algorithms");
60 59
60static void wusb_key_dump(const void *buf, size_t len)
61{
62 print_hex_dump(KERN_ERR, " ", DUMP_PREFIX_OFFSET, 16, 1,
63 buf, len, 0);
64}
65
61/* 66/*
62 * Block of data, as understood by AES-CCM 67 * Block of data, as understood by AES-CCM
63 * 68 *
@@ -396,14 +401,14 @@ static int wusb_oob_mic_verify(void)
396 "mismatch between MIC result and WUSB1.0[A2]\n"); 401 "mismatch between MIC result and WUSB1.0[A2]\n");
397 hs_size = sizeof(stv_hsmic_hs) - sizeof(stv_hsmic_hs.MIC); 402 hs_size = sizeof(stv_hsmic_hs) - sizeof(stv_hsmic_hs.MIC);
398 printk(KERN_ERR "E: Handshake2 in: (%zu bytes)\n", hs_size); 403 printk(KERN_ERR "E: Handshake2 in: (%zu bytes)\n", hs_size);
399 dump_bytes(NULL, &stv_hsmic_hs, hs_size); 404 wusb_key_dump(&stv_hsmic_hs, hs_size);
400 printk(KERN_ERR "E: CCM Nonce in: (%zu bytes)\n", 405 printk(KERN_ERR "E: CCM Nonce in: (%zu bytes)\n",
401 sizeof(stv_hsmic_n)); 406 sizeof(stv_hsmic_n));
402 dump_bytes(NULL, &stv_hsmic_n, sizeof(stv_hsmic_n)); 407 wusb_key_dump(&stv_hsmic_n, sizeof(stv_hsmic_n));
403 printk(KERN_ERR "E: MIC out:\n"); 408 printk(KERN_ERR "E: MIC out:\n");
404 dump_bytes(NULL, mic, sizeof(mic)); 409 wusb_key_dump(mic, sizeof(mic));
405 printk(KERN_ERR "E: MIC out (from WUSB1.0[A.2]):\n"); 410 printk(KERN_ERR "E: MIC out (from WUSB1.0[A.2]):\n");
406 dump_bytes(NULL, stv_hsmic_hs.MIC, sizeof(stv_hsmic_hs.MIC)); 411 wusb_key_dump(stv_hsmic_hs.MIC, sizeof(stv_hsmic_hs.MIC));
407 result = -EINVAL; 412 result = -EINVAL;
408 } else 413 } else
409 result = 0; 414 result = 0;
@@ -471,19 +476,16 @@ static int wusb_key_derive_verify(void)
471 printk(KERN_ERR "E: WUSB key derivation test: " 476 printk(KERN_ERR "E: WUSB key derivation test: "
472 "mismatch between key derivation result " 477 "mismatch between key derivation result "
473 "and WUSB1.0[A1] Errata 2006/12\n"); 478 "and WUSB1.0[A1] Errata 2006/12\n");
474 printk(KERN_ERR "E: keydvt in: key (%zu bytes)\n", 479 printk(KERN_ERR "E: keydvt in: key\n");
475 sizeof(stv_key_a1)); 480 wusb_key_dump(stv_key_a1, sizeof(stv_key_a1));
476 dump_bytes(NULL, stv_key_a1, sizeof(stv_key_a1)); 481 printk(KERN_ERR "E: keydvt in: nonce\n");
477 printk(KERN_ERR "E: keydvt in: nonce (%zu bytes)\n", 482 wusb_key_dump( &stv_keydvt_n_a1, sizeof(stv_keydvt_n_a1));
478 sizeof(stv_keydvt_n_a1)); 483 printk(KERN_ERR "E: keydvt in: hnonce & dnonce\n");
479 dump_bytes(NULL, &stv_keydvt_n_a1, sizeof(stv_keydvt_n_a1)); 484 wusb_key_dump(&stv_keydvt_in_a1, sizeof(stv_keydvt_in_a1));
480 printk(KERN_ERR "E: keydvt in: hnonce & dnonce (%zu bytes)\n",
481 sizeof(stv_keydvt_in_a1));
482 dump_bytes(NULL, &stv_keydvt_in_a1, sizeof(stv_keydvt_in_a1));
483 printk(KERN_ERR "E: keydvt out: KCK\n"); 485 printk(KERN_ERR "E: keydvt out: KCK\n");
484 dump_bytes(NULL, &keydvt_out.kck, sizeof(keydvt_out.kck)); 486 wusb_key_dump(&keydvt_out.kck, sizeof(keydvt_out.kck));
485 printk(KERN_ERR "E: keydvt out: PTK\n"); 487 printk(KERN_ERR "E: keydvt out: PTK\n");
486 dump_bytes(NULL, &keydvt_out.ptk, sizeof(keydvt_out.ptk)); 488 wusb_key_dump(&keydvt_out.ptk, sizeof(keydvt_out.ptk));
487 result = -EINVAL; 489 result = -EINVAL;
488 } else 490 } else
489 result = 0; 491 result = 0;
diff --git a/drivers/usb/wusbcore/wa-nep.c b/drivers/usb/wusbcore/wa-nep.c
index 3f542990c73f..17d2626038be 100644
--- a/drivers/usb/wusbcore/wa-nep.c
+++ b/drivers/usb/wusbcore/wa-nep.c
@@ -51,7 +51,7 @@
51 */ 51 */
52#include <linux/workqueue.h> 52#include <linux/workqueue.h>
53#include <linux/ctype.h> 53#include <linux/ctype.h>
54#include <linux/uwb/debug.h> 54
55#include "wa-hc.h" 55#include "wa-hc.h"
56#include "wusbhc.h" 56#include "wusbhc.h"
57 57
@@ -139,13 +139,10 @@ static void wa_notif_dispatch(struct work_struct *ws)
139 /* FIXME: unimplemented WA NOTIFs */ 139 /* FIXME: unimplemented WA NOTIFs */
140 /* fallthru */ 140 /* fallthru */
141 default: 141 default:
142 if (printk_ratelimit()) { 142 dev_err(dev, "HWA: unknown notification 0x%x, "
143 dev_err(dev, "HWA: unknown notification 0x%x, " 143 "%zu bytes; discarding\n",
144 "%zu bytes; discarding\n", 144 notif_hdr->bNotifyType,
145 notif_hdr->bNotifyType, 145 (size_t)notif_hdr->bLength);
146 (size_t)notif_hdr->bLength);
147 dump_bytes(dev, notif_hdr, 16);
148 }
149 break; 146 break;
150 } 147 }
151 } 148 }
@@ -160,12 +157,9 @@ out:
160 * discard the data, as this should not happen. 157 * discard the data, as this should not happen.
161 */ 158 */
162exhausted_buffer: 159exhausted_buffer:
163 if (!printk_ratelimit())
164 goto out;
165 dev_warn(dev, "HWA: device sent short notification, " 160 dev_warn(dev, "HWA: device sent short notification, "
166 "%d bytes missing; discarding %d bytes.\n", 161 "%d bytes missing; discarding %d bytes.\n",
167 missing, (int)size); 162 missing, (int)size);
168 dump_bytes(dev, itr, size);
169 goto out; 163 goto out;
170} 164}
171 165