xref: /aosp_15_r20/external/pigweed/pw_bluetooth/public/pw_bluetooth/low_energy/security_mode.h (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2022 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 #pragma once
15 
16 #include <cstdint>
17 
18 namespace pw::bluetooth::low_energy {
19 
20 // The LE Security Mode of a BLE device determines the possible security
21 // properties of the device. The security mode does not make specific guarantees
22 // about the current security properties of a device's connections; it sets
23 // restrictions on the allowable security properties. See Core Spec v5.2 Vol. 3,
24 // Part C 10.2 for more details.
25 enum class SecurityMode : uint8_t {
26   // In LE Security Mode 1, communication is secured by encryption, and
27   // BLE-based services may specify varying requirements for authentication, key
28   // size, or Secure Connections protection on the encryption keys.
29   kMode1 = 0,
30 
31   // In Secure Connections Only mode, all secure communication must use 128 bit,
32   // authenticated, and LE Secure Connections-generated encryption keys. If
33   // these encryption key properties cannot be satisfied by a device due to
34   // system constraints, any connection involving such a device will not be able
35   // to secure the link at all. This mode does not prevent unencrypted
36   // communication; it merely enforces stricter policies on all encrypted
37   // communication.
38   kSecureConnectionsOnly = 1
39 };
40 
41 }  // namespace pw::bluetooth::low_energy
42