Bluetooth: Use actual encryption key size for SMP over BR/EDR
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 11 Jun 2015 10:52:30 +0000 (13:52 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 12 Jun 2015 09:38:45 +0000 (11:38 +0200)
When pairing over SMP over BR/EDR the generated LTK has by default the
same key size as the BR/EDR Link Key. Make sure we don't set our
Pairing Request/Response max value to anything higher than that.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/smp.c

index d9ed5e8ee6a0c6d76b201defb168c2041c22b3b1..3d0f7d2a06162248a1e6589fe3d59022f9dded0d 100644 (file)
@@ -1705,7 +1705,7 @@ static void build_bredr_pairing_cmd(struct smp_chan *smp,
 
                req->init_key_dist   = local_dist;
                req->resp_key_dist   = remote_dist;
-               req->max_key_size    = SMP_MAX_ENC_KEY_SIZE;
+               req->max_key_size    = conn->hcon->enc_key_size;
 
                smp->remote_key_dist = remote_dist;
 
@@ -1714,7 +1714,7 @@ static void build_bredr_pairing_cmd(struct smp_chan *smp,
 
        memset(rsp, 0, sizeof(*rsp));
 
-       rsp->max_key_size    = SMP_MAX_ENC_KEY_SIZE;
+       rsp->max_key_size    = conn->hcon->enc_key_size;
        rsp->init_key_dist   = req->init_key_dist & remote_dist;
        rsp->resp_key_dist   = req->resp_key_dist & local_dist;