OOB: Generate random for LE
Bug: 184377951
Test: Compiles, test app.
Tag: #feature
Change-Id: I92c1fa84383f2a30fbea1f858417393aefe1d302
diff --git a/system/stack/Android.bp b/system/stack/Android.bp
index 9b0ce5f..71c4444 100644
--- a/system/stack/Android.bp
+++ b/system/stack/Android.bp
@@ -207,6 +207,7 @@
shared_libs: [
"libcutils",
"liblog",
+ "libcrypto",
],
required: [
"libldacBT_enc",
@@ -365,6 +366,7 @@
],
shared_libs: [
"libcutils",
+ "libcrypto",
],
static_libs: [
"liblog",
diff --git a/system/stack/smp/smp_api.cc b/system/stack/smp/smp_api.cc
index 2d14ba4..d738899 100644
--- a/system/stack/smp/smp_api.cc
+++ b/system/stack/smp/smp_api.cc
@@ -29,6 +29,8 @@
#include "bt_utils.h"
#include "stack_config.h"
+#include "gd/os/log.h"
+#include "gd/os/rand.h"
#include "hcimsgs.h"
#include "l2c_api.h"
#include "l2cdefs.h"
@@ -565,6 +567,7 @@
const std::array<unsigned char, 16>&,
const std::array<unsigned char, 16>&)>
callback) {
+ smp_cb.local_random = bluetooth::os::GenerateRandom<16>();
smp_cb.selected_association_model = SMP_MODEL_SEC_CONN_OOB;
smp_calculate_local_commitment(&smp_cb);
std::move(callback).Run(BT_TRANSPORT_LE, true, smp_cb.commitment,