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

Commit d8bf2e55 authored by Chris Manton's avatar Chris Manton
Browse files

Enum-ify stack/include/smp_api_types::tSMP_KEYS_BITMASK

Bug: 188297862
Test: gd/cert/run
Tag: #refactor

Change-Id: I8e3d5ad616f4160d789f63d94c3e65c6c54d5eab
parent 5ac56eb1
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -182,19 +182,21 @@ typedef uint8_t tSMP_SEC_LEVEL;
#define SMP_ENCR_KEY_SIZE_MAX 16

/* SMP key types */
#define SMP_SEC_KEY_TYPE_ENC (1 << 0)  /* encryption key */
#define SMP_SEC_KEY_TYPE_ID (1 << 1)   /* identity key */
#define SMP_SEC_KEY_TYPE_CSRK (1 << 2) /* peripheral CSRK */
#define SMP_SEC_KEY_TYPE_LK (1 << 3)   /* BR/EDR link key */
enum tSMP_KEYS_BITMASK : uint8_t {
  SMP_SEC_KEY_TYPE_ENC = (1 << 0),  /* encryption key */
  SMP_SEC_KEY_TYPE_ID = (1 << 1),   /* identity key */
  SMP_SEC_KEY_TYPE_CSRK = (1 << 2), /* peripheral CSRK */
  SMP_SEC_KEY_TYPE_LK = (1 << 3),   /* BR/EDR link key */
};
typedef uint8_t tSMP_KEYS;

#define SMP_BR_SEC_DEFAULT_KEY \
  (SMP_SEC_KEY_TYPE_ENC | SMP_SEC_KEY_TYPE_ID | SMP_SEC_KEY_TYPE_CSRK)
constexpr tSMP_KEYS SMP_BR_SEC_DEFAULT_KEY =
    (SMP_SEC_KEY_TYPE_ENC | SMP_SEC_KEY_TYPE_ID | SMP_SEC_KEY_TYPE_CSRK);

/* default security key distribution value */
#define SMP_SEC_DEFAULT_KEY                                             \
  (SMP_SEC_KEY_TYPE_ENC | SMP_SEC_KEY_TYPE_ID | SMP_SEC_KEY_TYPE_CSRK | \
   SMP_SEC_KEY_TYPE_LK)
constexpr tSMP_KEYS SMP_SEC_DEFAULT_KEY =
    (SMP_SEC_KEY_TYPE_ENC | SMP_SEC_KEY_TYPE_ID | SMP_SEC_KEY_TYPE_CSRK |
     SMP_SEC_KEY_TYPE_LK);

#define SMP_SC_KEY_OUT_OF_RANGE 5 /* out of range */
typedef uint8_t tSMP_SC_KEY_TYPE;