diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-09-18 10:16:01 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-09-18 10:16:01 +0300 |
commit | 5b1a876e42c82ec00534be575bb9659224077900 (patch) | |
tree | badb8da9b50bac445f1d2f4a404afadac15cf485 /emulator/smp.c | |
parent | 6b7560c085edc760535f91c75aa63af8ecda9641 (diff) | |
download | bluez-5b1a876e42c82ec00534be575bb9659224077900.tar.gz |
emulator/smp: Set correct pairing response values
Diffstat (limited to 'emulator/smp.c')
-rw-r--r-- | emulator/smp.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/emulator/smp.c b/emulator/smp.c index 2e1bd6e03..9b08d502c 100644 --- a/emulator/smp.c +++ b/emulator/smp.c @@ -97,16 +97,18 @@ static bool verify_random(struct smp_conn *conn, const uint8_t rnd[16]) static void pairing_req(struct smp_conn *conn, const void *data, uint16_t len) { struct bthost *bthost = conn->smp->bthost; - static const uint8_t rsp[] = { 0x02, /* Pairing Response */ - 0x03, /* NoInputNoOutput */ - 0x00, /* OOB Flag */ - 0x01, /* Bonding - no MITM */ - 0x10, /* Max key size */ - 0x00, /* Init. key dist. */ - 0x01, /* Rsp. key dist. */ - }; + uint8_t rsp[7]; memcpy(conn->preq, data, sizeof(conn->preq)); + + rsp[0] = 0x02; /* Pairing Response */ + rsp[1] = bthost_get_io_capability(bthost); + rsp[2] = 0x00; /* OOB Flag */ + rsp[3] = bthost_get_auth_req(bthost); + rsp[4] = 0x10; /* Max key size */ + rsp[5] = 0x00; /* Init. key dist. */ + rsp[6] = conn->preq[6] & 0x01; /* Rsp. key dist. */ + memcpy(conn->prsp, rsp, sizeof(rsp)); bthost_send_cid(bthost, conn->handle, SMP_CID, rsp, sizeof(rsp)); |