diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-05-31 11:52:28 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-12-03 10:51:18 -0500 |
commit | aeb7d461f9c895bb6d09e9d175696849e9f290c8 (patch) | |
tree | 1e3686ac927351e32303d7f11984bdcc3bc51958 /net | |
parent | 5e3d3d9b3c0119e6ac86bf77c6ff9f6b0d09bcf5 (diff) |
Bluetooth: Detect SMP SC debug keys
We need to be able to detect if the remote side used a debug key for the
pairing. This patch adds the debug key defines and sets a flag to
indicate that a debug key was used. The debug private key (debug_sk) is
also added in this patch but will only be used in a subsequent patch
when local debug key support is implemented.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/smp.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 9e1193174064..ddc76cf45cfb 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -54,6 +54,7 @@ enum { | |||
54 | SMP_FLAG_INITIATOR, | 54 | SMP_FLAG_INITIATOR, |
55 | SMP_FLAG_SC, | 55 | SMP_FLAG_SC, |
56 | SMP_FLAG_REMOTE_PK, | 56 | SMP_FLAG_REMOTE_PK, |
57 | SMP_FLAG_DEBUG_KEY, | ||
57 | }; | 58 | }; |
58 | 59 | ||
59 | struct smp_chan { | 60 | struct smp_chan { |
@@ -92,6 +93,29 @@ struct smp_chan { | |||
92 | struct crypto_hash *tfm_cmac; | 93 | struct crypto_hash *tfm_cmac; |
93 | }; | 94 | }; |
94 | 95 | ||
96 | /* These debug key values are defined in the SMP section of the core | ||
97 | * specification. debug_pk is the public debug key and debug_sk the | ||
98 | * private debug key. | ||
99 | */ | ||
100 | static const u8 debug_pk[64] = { | ||
101 | 0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc, | ||
102 | 0xdb, 0xfd, 0xf4, 0xac, 0x11, 0x91, 0xf4, 0xef, | ||
103 | 0xb9, 0xa5, 0xf9, 0xe9, 0xa7, 0x83, 0x2c, 0x5e, | ||
104 | 0x2c, 0xbe, 0x97, 0xf2, 0xd2, 0x03, 0xb0, 0x20, | ||
105 | |||
106 | 0x8b, 0xd2, 0x89, 0x15, 0xd0, 0x8e, 0x1c, 0x74, | ||
107 | 0x24, 0x30, 0xed, 0x8f, 0xc2, 0x45, 0x63, 0x76, | ||
108 | 0x5c, 0x15, 0x52, 0x5a, 0xbf, 0x9a, 0x32, 0x63, | ||
109 | 0x6d, 0xeb, 0x2a, 0x65, 0x49, 0x9c, 0x80, 0xdc, | ||
110 | }; | ||
111 | |||
112 | static const u8 debug_sk[32] = { | ||
113 | 0xbd, 0x1a, 0x3c, 0xcd, 0xa6, 0xb8, 0x99, 0x58, | ||
114 | 0x99, 0xb7, 0x40, 0xeb, 0x7b, 0x60, 0xff, 0x4a, | ||
115 | 0x50, 0x3f, 0x10, 0xd2, 0xe3, 0xb3, 0xc9, 0x74, | ||
116 | 0x38, 0x5f, 0xc5, 0xa3, 0xd4, 0xf6, 0x49, 0x3f, | ||
117 | }; | ||
118 | |||
95 | static inline void swap_buf(const u8 *src, u8 *dst, size_t len) | 119 | static inline void swap_buf(const u8 *src, u8 *dst, size_t len) |
96 | { | 120 | { |
97 | size_t i; | 121 | size_t i; |
@@ -2000,6 +2024,9 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb) | |||
2000 | else | 2024 | else |
2001 | hcon->pending_sec_level = BT_SECURITY_FIPS; | 2025 | hcon->pending_sec_level = BT_SECURITY_FIPS; |
2002 | 2026 | ||
2027 | if (!memcmp(debug_pk, smp->remote_pk, 64)) | ||
2028 | set_bit(SMP_FLAG_DEBUG_KEY, &smp->flags); | ||
2029 | |||
2003 | /* The Initiating device waits for the non-initiating device to | 2030 | /* The Initiating device waits for the non-initiating device to |
2004 | * send the confirm value. | 2031 | * send the confirm value. |
2005 | */ | 2032 | */ |