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

Commit 2b972c2a authored by ravishankar srivatsa's avatar ravishankar srivatsa Committed by android-build-merger
Browse files

Add additional failure modes for SMP PTS test cases

am: fa2780db

Change-Id: Ie808ef38dcd0367b54eee0f66362e4c2dac04407
parents 82dc2811 fa2780db
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line Diff line number Diff line
@@ -53,17 +53,17 @@ TRC_HID_DEV=2
#PTS_SmpOptions=0xD,0x4,0xf,0xf,0x10
#PTS_SmpOptions=0xD,0x4,0xf,0xf,0x10


# SMP Certification Failure Cases
# SMP Certification Failure Cases
# Fail case number range from 1 to 9 will set up remote device for test
# Set any of the following SMP error values (from smp_api_types.h)
# case execution. Setting PTS_SmpFailureCase to 0 means normal operation.
# to induce pairing failues for various PTS SMP test cases.
# Setting PTS_SmpFailureCase to 0 means normal operation.
# Failure modes:
# Failure modes:
#  1 = SMP_CONFIRM_VALUE_ERR
#
#  2 = SMP_PAIR_AUTH_FAIL
#  SMP_PASSKEY_ENTRY_FAIL = 1
#  3 = SMP_PAIR_FAIL_UNKNOWN
#  SMP_PAIR_AUTH_FAIL = 3
#  4 = SMP_PAIR_NOT_SUPPORT
#  SMP_CONFIRM_VALUE_ERR = 4
#  5 = SMP_PASSKEY_ENTRY_FAIL
#  SMP_PAIR_NOT_SUPPORT = 5
#  6 = SMP_REPEATED_ATTEMPTS
#  SMP_PAIR_FAIL_UNKNOWN = 8
#  7 = PIN generation failure?
#  SMP_REPEATED_ATTEMPTS = 9
#  8 = SMP_PASSKEY_ENTRY_FAIL
#  SMP_NUMERIC_COMPAR_FAIL = 12
#  9 = SMP_NUMERIC_COMPAR_FAIL;
#PTS_SmpFailureCase=0
#PTS_SmpFailureCase=0
+20 −32
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
extern fixed_queue_t* btu_general_alarm_queue;
extern fixed_queue_t* btu_general_alarm_queue;


#define SMP_KEY_DIST_TYPE_MAX 4
#define SMP_KEY_DIST_TYPE_MAX 4

const tSMP_ACT smp_distribute_act[] = {smp_generate_ltk, smp_send_id_info,
const tSMP_ACT smp_distribute_act[] = {smp_generate_ltk, smp_send_id_info,
                                       smp_generate_csrk,
                                       smp_generate_csrk,
                                       smp_set_derive_link_key};
                                       smp_set_derive_link_key};
@@ -44,37 +45,14 @@ static bool lmp_version_below(BD_ADDR bda, uint8_t version) {
}
}


static bool pts_test_send_authentication_complete_failure(tSMP_CB* p_cb) {
static bool pts_test_send_authentication_complete_failure(tSMP_CB* p_cb) {
  uint8_t reason = 0;
  uint8_t reason = p_cb->cert_failure;

  if (reason == SMP_PAIR_AUTH_FAIL || reason == SMP_PAIR_FAIL_UNKNOWN ||
  if (p_cb->cert_failure < 2 || p_cb->cert_failure > 6) return false;
      reason == SMP_PAIR_NOT_SUPPORT || reason == SMP_PASSKEY_ENTRY_FAIL ||

      reason == SMP_REPEATED_ATTEMPTS) {
  SMP_TRACE_ERROR("%s failure case = %d", __func__, p_cb->cert_failure);

  switch (p_cb->cert_failure) {
    case 2:
      reason = SMP_PAIR_AUTH_FAIL;
      smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
      break;
    case 3:
      reason = SMP_PAIR_FAIL_UNKNOWN;
      smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
      break;
    case 4:
      reason = SMP_PAIR_NOT_SUPPORT;
      smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
      break;
    case 5:
      reason = SMP_PASSKEY_ENTRY_FAIL;
    smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
    smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
      break;
    case 6:
      reason = SMP_REPEATED_ATTEMPTS;
      smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
      break;
  }

    return true;
    return true;
  ;
  }
  return false;
}
}


/*******************************************************************************
/*******************************************************************************
@@ -1556,12 +1534,21 @@ void smp_process_peer_nonce(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
  SMP_TRACE_DEBUG("%s start ", __func__);
  SMP_TRACE_DEBUG("%s start ", __func__);


  // PTS Testing failure modes
  // PTS Testing failure modes
  if (p_cb->cert_failure == 1) {
  if (p_cb->cert_failure == SMP_CONFIRM_VALUE_ERR) {
    SMP_TRACE_ERROR("%s failure case = %d", __func__, p_cb->cert_failure);
    SMP_TRACE_ERROR("%s failure case = %d", __func__, p_cb->cert_failure);
    reason = p_cb->failure = SMP_CONFIRM_VALUE_ERR;
    reason = p_cb->failure = SMP_CONFIRM_VALUE_ERR;
    smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
    smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
    return;
    return;
  }
  }
  // PTS Testing failure modes (for LT)
  if ((p_cb->cert_failure == SMP_NUMERIC_COMPAR_FAIL) &&
      (p_cb->selected_association_model == SMP_MODEL_SEC_CONN_JUSTWORKS) &&
      (p_cb->role == HCI_ROLE_SLAVE)) {
    SMP_TRACE_ERROR("%s failure case = %d", __func__, p_cb->cert_failure);
    reason = p_cb->failure = SMP_NUMERIC_COMPAR_FAIL;
    smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
    return;
  }


  switch (p_cb->selected_association_model) {
  switch (p_cb->selected_association_model) {
    case SMP_MODEL_SEC_CONN_JUSTWORKS:
    case SMP_MODEL_SEC_CONN_JUSTWORKS:
@@ -1589,7 +1576,8 @@ void smp_process_peer_nonce(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
      break;
      break;
    case SMP_MODEL_SEC_CONN_PASSKEY_ENT:
    case SMP_MODEL_SEC_CONN_PASSKEY_ENT:
    case SMP_MODEL_SEC_CONN_PASSKEY_DISP:
    case SMP_MODEL_SEC_CONN_PASSKEY_DISP:
      if (!smp_check_commitment(p_cb) && p_cb->cert_failure != 9) {
      if (!smp_check_commitment(p_cb) &&
          p_cb->cert_failure != SMP_NUMERIC_COMPAR_FAIL) {
        reason = p_cb->failure = SMP_CONFIRM_VALUE_ERR;
        reason = p_cb->failure = SMP_CONFIRM_VALUE_ERR;
        smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
        smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
        break;
        break;
+3 −4
Original line number Original line Diff line number Diff line
@@ -212,10 +212,9 @@ bool SMP_PairCancel(BD_ADDR bd_addr) {
  bool status = false;
  bool status = false;


  // PTS SMP failure test cases
  // PTS SMP failure test cases
  if (p_cb->cert_failure == 7)
  if (p_cb->cert_failure == SMP_PASSKEY_ENTRY_FAIL ||
    err_code = SMP_PASSKEY_ENTRY_FAIL;
      p_cb->cert_failure == SMP_NUMERIC_COMPAR_FAIL)
  else if (p_cb->cert_failure == 8)
    err_code = p_cb->cert_failure;
    err_code = SMP_NUMERIC_COMPAR_FAIL;


  BTM_TRACE_EVENT("SMP_CancelPair state=%d flag=0x%x ", p_cb->state,
  BTM_TRACE_EVENT("SMP_CancelPair state=%d flag=0x%x ", p_cb->state,
                  p_cb->flags);
                  p_cb->flags);