Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc83b6d2 authored by Marvin Younan's avatar Marvin Younan Committed by Gerrit Code Review
Browse files

Revert "RootCanal: Tie the random number generator to the dual mode controller instance"

This reverts commit d17ebbdc.

Reason for revert: Culprit verified for b/284342022

Change-Id: Ic8c4f3ca4e25197cdd7775bfaa5b6c7d1ce86a7c
parent d17ebbdc
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@


#include <algorithm>
#include <algorithm>
#include <memory>
#include <memory>
#include <random>


#include "crypto/crypto.h"
#include "crypto/crypto.h"
#include "log.h"
#include "log.h"
@@ -2245,12 +2246,17 @@ void DualModeController::LeEncrypt(CommandView command) {
      kNumCommandPackets, ErrorCode::SUCCESS, encrypted_data));
      kNumCommandPackets, ErrorCode::SUCCESS, encrypted_data));
}
}


static std::random_device rd{};
static std::mt19937_64 s_mt{rd()};

void DualModeController::LeRand(CommandView command) {
void DualModeController::LeRand(CommandView command) {
  auto command_view = bluetooth::hci::LeRandView::Create(command);
  auto command_view = bluetooth::hci::LeRandView::Create(command);
  ASSERT(command_view.IsValid());
  ASSERT(command_view.IsValid());


  uint64_t random_val = s_mt();

  send_event_(bluetooth::hci::LeRandCompleteBuilder::Create(
  send_event_(bluetooth::hci::LeRandCompleteBuilder::Create(
      kNumCommandPackets, ErrorCode::SUCCESS, random_generator_()));
      kNumCommandPackets, ErrorCode::SUCCESS, random_val));
}
}


void DualModeController::LeReadSupportedStates(CommandView command) {
void DualModeController::LeReadSupportedStates(CommandView command) {
+1 −4
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@


#include <cstdint>
#include <cstdint>
#include <memory>
#include <memory>
#include <random>
#include <string>
#include <string>
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
@@ -563,6 +562,7 @@ class DualModeController : public Device {
  void WriteConnectionAcceptTimeout(CommandView command);
  void WriteConnectionAcceptTimeout(CommandView command);


  // Vendor-specific Commands
  // Vendor-specific Commands

  void LeGetVendorCapabilities(CommandView command);
  void LeGetVendorCapabilities(CommandView command);
  void LeEnergyInfo(CommandView command);
  void LeEnergyInfo(CommandView command);
  void LeMultiAdv(CommandView command);
  void LeMultiAdv(CommandView command);
@@ -606,9 +606,6 @@ class DualModeController : public Device {
  // with RootCanal.
  // with RootCanal.
  bluetooth::hci::LoopbackMode loopback_mode_{LoopbackMode::NO_LOOPBACK};
  bluetooth::hci::LoopbackMode loopback_mode_{LoopbackMode::NO_LOOPBACK};


  // Random value generator, always seeded with 0 to be deterministic.
  std::mt19937_64 random_generator_{0};

  // Flag set to true after the HCI Reset command has been received
  // Flag set to true after the HCI Reset command has been received
  // the first time.
  // the first time.
  bool controller_reset_{false};
  bool controller_reset_{false};