1 /*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #pragma once
18
19 /* Some C files include this header file */
20 #ifdef __cplusplus
21
22 #include <array>
23 #include <cstdint>
24
25 constexpr int OCTET16_LEN = 16;
26 typedef std::array<uint8_t, OCTET16_LEN> Octet16;
27
28 constexpr int LINK_KEY_LEN = OCTET16_LEN;
29 typedef Octet16 LinkKey; /* Link Key */
30
31 /* Sample LTK from BT Spec 5.1 | Vol 6, Part C 1
32 * 0x4C68384139F574D836BCF34E9DFB01BF */
33 constexpr Octet16 SAMPLE_LTK = {0xbf, 0x01, 0xfb, 0x9d, 0x4e, 0xf3, 0xbc, 0x36,
34 0xd8, 0x74, 0xf5, 0x39, 0x41, 0x38, 0x68, 0x4c};
is_sample_ltk(const Octet16 & ltk)35 inline bool is_sample_ltk(const Octet16& ltk) { return ltk == SAMPLE_LTK; }
36
37 #endif
38
39 #define BT_OCTET8_LEN 8
40 typedef uint8_t BT_OCTET8[BT_OCTET8_LEN]; /* octet array: size 16 */
41
42 #define BT_OCTET32_LEN 32
43 typedef uint8_t BT_OCTET32[BT_OCTET32_LEN]; /* octet array: size 32 */
44
45 #define PIN_CODE_LEN 16
46 typedef uint8_t PIN_CODE[PIN_CODE_LEN]; /* Pin Code (upto 128 bits) MSB is 0 */
47