• Johan Hedberg's avatar
    Bluetooth: Fix differentiating stored master vs slave LTK types · 98a0b845
    Johan Hedberg authored
    If LTK distribution happens in both directions we will have two LTKs for
    the same remote device: one which is used when we're connecting as
    master and another when we're connecting as slave. When looking up LTKs
    from the locally stored list we shouldn't blindly return the first match
    but also consider which type of key is in question. If we do not do this
    we may end up selecting an incorrect encryption key for a connection.
    
    This patch fixes the issue by always specifying to the LTK lookup
    functions whether we're looking for a master or a slave key.
    Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
    Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    98a0b845
hci_core.c 99.8 KB