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

Commit 78a5e2d8 authored by Chris Manton's avatar Chris Manton
Browse files

Enum-ify stack/include/smp_api_types::SMP_AUTH_

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: I8992cea91fff8c793f2caa32545b43c3759d71bb
parent 44514156
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -112,22 +112,23 @@ typedef uint8_t tSMP_OOB_FLAG;
enum { SMP_OOB_INVALID_TYPE, SMP_OOB_PEER, SMP_OOB_LOCAL, SMP_OOB_BOTH };
typedef uint8_t tSMP_OOB_DATA_TYPE;

#define SMP_AUTH_NO_BOND 0x00
#define SMP_AUTH_BOND 0x01

enum : uint8_t {
  SMP_AUTH_NO_BOND = 0x00,
  /* no MITM, No Bonding, encryption only */
  SMP_AUTH_NB_ENC_ONLY = 0x00,  //(SMP_AUTH_MASK | BTM_AUTH_SP_NO)
  SMP_AUTH_BOND = (1u << 0),
  SMP_AUTH_UNUSED = (1u << 1),
  /* SMP Authentication requirement */
#define SMP_AUTH_YN_BIT (1 << 2)
#define SMP_SC_SUPPORT_BIT (1 << 3)
#define SMP_KP_SUPPORT_BIT (1 << 4)
#define SMP_H7_SUPPORT_BIT (1 << 5)
  SMP_AUTH_YN_BIT = (1u << 2),
  SMP_SC_SUPPORT_BIT = (1u << 3),
  SMP_KP_SUPPORT_BIT = (1u << 4),
  SMP_H7_SUPPORT_BIT = (1u << 5),
};

#define SMP_AUTH_MASK                                                          \
  (SMP_AUTH_BOND | SMP_AUTH_YN_BIT | SMP_SC_SUPPORT_BIT | SMP_KP_SUPPORT_BIT | \
   SMP_H7_SUPPORT_BIT)

/* no MITM, No Bonding, encryption only */
#define SMP_AUTH_NB_ENC_ONLY 0x00  //(SMP_AUTH_MASK | BTM_AUTH_SP_NO)

/* Secure Connections, no MITM, no Bonding */
#define SMP_AUTH_SC_ENC_ONLY (SMP_H7_SUPPORT_BIT | SMP_SC_SUPPORT_BIT)