diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-01-20 16:24:11 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-01-20 16:28:03 +0200 |
commit | f3db25a05bc36a1d9886902e60853a8872d9a5b2 (patch) | |
tree | a0d4fed70a73f910305e05f733cf356f3bbf1171 /emulator/smp.c | |
parent | 741d28de64048d13455439a206ef114258e716a4 (diff) | |
download | bluez-f3db25a05bc36a1d9886902e60853a8872d9a5b2.tar.gz |
emulator/bthost: Add SMP callback to fetch LTK
Diffstat (limited to 'emulator/smp.c')
-rw-r--r-- | emulator/smp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/emulator/smp.c b/emulator/smp.c index 33799b237..2b4f9a541 100644 --- a/emulator/smp.c +++ b/emulator/smp.c @@ -407,6 +407,20 @@ void smp_data(void *conn_data, const void *data, uint16_t len) } } +int smp_get_ltk(void *smp_data, const uint8_t *rand, uint16_t div, + uint8_t *ltk) +{ + struct smp_conn *conn = smp_data; + static const uint8_t no_ltk[16] = { 0 }; + + if (!memcmp(conn->ltk, no_ltk, 16)) + return -ENOENT; + + memcpy(ltk, conn->ltk, 16); + + return 0; +} + void *smp_conn_add(void *smp_data, uint16_t handle, const uint8_t *ia, const uint8_t *ra, bool conn_init) { |