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

Commit 515a967a authored by weichinweng's avatar weichinweng Committed by Automerger Merge Worker
Browse files

Move Common Criteria mode dependency to Android only. am: 5afd2892 am: d977f0cf

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1614945

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If0cb85bd38944980daf2093e4589f456b8ea87b0
parents 211d78b9 d977f0cf
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@
#include "common/address_obfuscator.h"
#include "common/metric_id_allocator.h"
#include "common/metrics.h"
#include "common/os_utils.h"
#include "device/include/interop.h"
#include "gd/common/init_flags.h"
#include "main/shim/dumpsys.h"
@@ -189,11 +190,13 @@ static int disable(void) {
static void cleanup(void) { stack_manager_get_interface()->clean_up_stack(); }

bool is_restricted_mode() { return restricted_mode; }
bool is_common_criteria_mode() { return common_criteria_mode; }
bool is_common_criteria_mode() {
  return is_bluetooth_uid() && common_criteria_mode;
}
// if common criteria mode disable, will always return
// CONFIG_COMPARE_ALL_PASS(0b11) indicate don't check config checksum.
int get_common_criteria_config_compare_result() {
  return common_criteria_mode ? common_criteria_config_compare_result
  return is_common_criteria_mode() ? common_criteria_config_compare_result
                                   : CONFIG_COMPARE_ALL_PASS;
}

+3 −7
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@
#include "btif_keystore.h"
#include "common/address_obfuscator.h"
#include "common/metric_id_allocator.h"
#include "common/os_utils.h"
#include "main/shim/config.h"
#include "main/shim/shim.h"
#include "osi/include/alarm.h"
@@ -96,9 +95,6 @@ static bool config_checksum_pass(int check_bit) {
  return ((get_common_criteria_config_compare_result() & check_bit) ==
          check_bit);
}
static bool btif_is_common_criteria_mode() {
  return is_bluetooth_uid() && is_common_criteria_mode();
}
static bool btif_in_encrypt_key_name_list(std::string key);

static const int CONFIG_FILE_COMPARE_PASS = 1;
@@ -558,7 +554,7 @@ bool btif_config_get_bin(const std::string& section, const std::string& key,
    sscanf(ptr, "%02hhx", &value[*length]);
  }

  if (btif_is_common_criteria_mode()) {
  if (is_common_criteria_mode()) {
    if (!value_str_from_config->empty() && in_encrypt_key_name_list &&
        !is_key_encrypted) {
      get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key(
@@ -611,7 +607,7 @@ bool btif_config_set_bin(const std::string& section, const std::string& key,
  }

  std::string value_str;
  if ((length > 0) && btif_is_common_criteria_mode() &&
  if ((length > 0) && is_common_criteria_mode() &&
      btif_in_encrypt_key_name_list(key)) {
    get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key(
        section + "-" + key, str);
@@ -721,7 +717,7 @@ static void btif_config_write(UNUSED_ATTR uint16_t event,
  std::unique_lock<std::recursive_mutex> lock(config_lock);
  rename(CONFIG_FILE_PATH, CONFIG_BACKUP_PATH);
  config_save(btif_config_cache.PersistentSectionCopy(), CONFIG_FILE_PATH);
  if (btif_is_common_criteria_mode()) {
  if (is_common_criteria_mode()) {
    get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key(
        CONFIG_FILE_PREFIX, CONFIG_FILE_HASH);
  }
+3 −0
Original line number Diff line number Diff line
@@ -129,6 +129,9 @@ fluoride_defaults {
                "android.hardware.bluetooth@1.0",
                "android.hardware.bluetooth@1.1",
            ],
            cflags: [
                "-DOS_ANDROID",
            ],
        },
    },
}