bthost: Use bt_crypto_random_bytes to generate a Pairing Random
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 17 Dec 2020 00:28:00 +0000 (16:28 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:34 +0000 (19:08 +0530)
This makes it more consistent with how stacks are implemented instead
of setting the response all zero which is not secure.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
emulator/smp.c

index 7c05ba3..f339e15 100755 (executable)
@@ -857,6 +857,8 @@ void *smp_conn_add(void *smp_data, uint16_t handle, const uint8_t *ia,
        memcpy(conn->ia, ia, 6);
        memcpy(conn->ra, ra, 6);
 
+       bt_crypto_random_bytes(smp->crypto, conn->prnd, sizeof(conn->prnd));
+
        return conn;
 }