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 #include <cstdint>
20 
21 #include "hci/octets.h"
22 
23 using Octet16 = bluetooth::hci::Octet16;
24 using LinkKey = bluetooth::hci::Octet16; /* Link Key */
25 static constexpr int OCTET16_LEN = bluetooth::hci::kOctet16Length;
26 
27 /* Sample LTK from BT Spec 5.1 | Vol 6, Part C 1
28  * 0x4C68384139F574D836BCF34E9DFB01BF */
29 constexpr Octet16 SAMPLE_LTK = {0xbf, 0x01, 0xfb, 0x9d, 0x4e, 0xf3, 0xbc, 0x36,
30                                 0xd8, 0x74, 0xf5, 0x39, 0x41, 0x38, 0x68, 0x4c};
is_sample_ltk(const Octet16 & ltk)31 inline bool is_sample_ltk(const Octet16& ltk) { return ltk == SAMPLE_LTK; }
32 
33 #define BT_OCTET8_LEN 8
34 typedef uint8_t BT_OCTET8[BT_OCTET8_LEN]; /* octet array: size 16 */
35 
36 #define BT_OCTET32_LEN 32
37 typedef uint8_t BT_OCTET32[BT_OCTET32_LEN]; /* octet array: size 32 */
38 
39 #define PIN_CODE_LEN 16
40 typedef uint8_t PIN_CODE[PIN_CODE_LEN]; /* Pin Code (upto 128 bits) MSB is 0 */
41