Hi Johan, > We need a function in smp.c to generate Resolvable Random Addresses in > order to support privacy. The local RPA will need to be generated before > advertising, scanning or connecting and regenerated at periodic > intervals. This patch adds the necessary function for RPA generation. > > Signed-off-by: Johan Hedberg <johan.hedberg@xxxxxxxxx> > --- > net/bluetooth/smp.c | 17 +++++++++++++++++ > net/bluetooth/smp.h | 1 + > 2 files changed, 18 insertions(+) > > diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c > index 8ef50c790b96..7ec48e3d6065 100644 > --- a/net/bluetooth/smp.c > +++ b/net/bluetooth/smp.c > @@ -124,6 +124,23 @@ bool smp_irk_matches(struct crypto_blkcipher *tfm, u8 irk[16], > return !memcmp(bdaddr->b, hash, 3); > } > > +int smp_generate_rpa(struct crypto_blkcipher *tfm, u8 irk[16], bdaddr_t *rpa) > +{ > + int err; > + > + get_random_bytes(&rpa->b[3], 3); > + > + rpa->b[5] &= 0x7f; I think this one is wrong. You can now end up with RPA or URPA based if the most significant bit coming from the random bytes is set or not. This is not reliably creating a RPA. Regards Marcel -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html