Bluetooth: Mesh: Change friend_cred decision point to friend selection

The network layer previously decided to use the friend credentials if
there was an established friendship. During the friendship setup phase,
the friendship is not considered established until the LPN receives the
first friend poll. Before this happens, the LPN should send a friend
poll message, encrypted with the friendship credentials. This wrongly
gets encrypted with the master credentials.

Change the decision point to whether the LPN has selected a friend,
which happens after the friend offer, and before the friend poll. This
will remain set for the duration of the friendship.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
1 file changed