Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
SMPTypes.cpp
Go to the documentation of this file.
1/*
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2020 Gothel Software e.K.
4 * Copyright (c) 2020 ZAFENA AB
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26#include <cstring>
27#include <string>
28#include <memory>
29#include <cstdint>
30#include <vector>
31#include <cstdio>
32
33#include <jau/debug.hpp>
34
35#include "SMPTypes.hpp"
36#include "SMPCrypto.hpp"
37
38using namespace direct_bt;
39
40template<typename T>
41static void append_bitstr(std::string& out, T mask, T bit, const std::string& bitstr, bool& comma) {
42 if( bit == ( mask & bit ) ) {
43 if( comma ) { out.append(", "); }
44 out.append(bitstr); comma = true;
45 }
46}
47#define APPEND_BITSTR(U,V,M) append_bitstr(out, M, U::V, #V, comma);
48
49#define PAIRSTATE_ENUM(X) \
50 X(NONE) \
51 X(FAILED) \
52 X(REQUESTED_BY_RESPONDER) \
53 X(FEATURE_EXCHANGE_STARTED) \
54 X(FEATURE_EXCHANGE_COMPLETED) \
55 X(PASSKEY_EXPECTED) \
56 X(NUMERIC_COMPARE_EXPECTED) \
57 X(PASSKEY_NOTIFY) \
58 X(OOB_EXPECTED) \
59 X(KEY_DISTRIBUTION) \
60 X(COMPLETED)
61
62#define CASE_TO_STRING_PAIRSTATE(V) case SMPPairingState::V: return #V;
63
64std::string direct_bt::to_string(const SMPPairingState state) noexcept {
65 switch(state) {
67 default: ; // fall through intended
68 }
69 return "Unknown SMP PairingState";
70}
71
72std::string direct_bt::toPassKeyString(const std::uint32_t passKey) noexcept {
73 std::string pin;
74 pin.reserve(6+1); // including EOS for snprintf
75 pin.resize(6);
76 snprintf(&pin[0], pin.capacity(), "%06u", passKey%1000000u );
77 return pin;
78}
79
80#define IOCAP_ENUM(X) \
81 X(DISPLAY_ONLY) \
82 X(DISPLAY_YES_NO) \
83 X(KEYBOARD_ONLY) \
84 X(NO_INPUT_NO_OUTPUT) \
85 X(KEYBOARD_DISPLAY) \
86 X(UNSET)
87
88#define CASE_TO_STRING_IOCAP(V) case SMPIOCapability::V: return #V;
89
90std::string direct_bt::to_string(const SMPIOCapability ioc) noexcept {
91 switch(ioc) {
93 default: ; // fall through intended
94 }
95 return "Unknown SMP IOCapability";
96}
97
98std::string direct_bt::to_string(const SMPOOBDataFlag v) noexcept {
99 switch(v) {
100 case SMPOOBDataFlag::OOB_AUTH_DATA_NOT_PRESENT: return "OOB_AUTH_DATA_NOT_PRESENT";
101 case SMPOOBDataFlag::OOB_AUTH_DATA_REMOTE_PRESENT: return "OOB_AUTH_DATA_REMOTE_PRESENT";
102 default: ; // fall through intended
103 }
104 return "Unknown SMP OOBDataFlag";
105}
106
107
108std::string direct_bt::to_string(const SMPAuthReqs mask) noexcept {
109 std::string out("[");
110 if( is_set(mask, SMPAuthReqs::BONDING) ) {
111 out.append("Bonding");
112 } else {
113 out.append("No bonding");
114 }
115 if( is_set(mask, SMPAuthReqs::BONDING_RFU) ) {
116 out.append(", ");
117 out.append("Bonding Reserved");
118 }
119 out.append(", ");
120 if( is_set(mask, SMPAuthReqs::MITM) ) {
121 out.append("MITM");
122 } else {
123 out.append("No MITM");
124 }
125 out.append(", ");
126 if( is_set(mask, SMPAuthReqs::SECURE_CONNECTIONS) ) {
127 out.append("SC");
128 } else {
129 out.append("Legacy");
130 }
131 out.append(", ");
132 if( is_set(mask, SMPAuthReqs::KEYPRESS) ) {
133 out.append("Keypresses");
134 } else {
135 out.append("No keypresses");
136 }
137 if( is_set(mask, SMPAuthReqs::CT2_H7_FUNC_SUPPORT) ) {
138 out.append(", ");
139 out.append("CT2_H7");
140 }
141 if( is_set(mask, SMPAuthReqs::RFU_1) ) {
142 out.append(", ");
143 out.append("RFU_1");
144 }
145 if( is_set(mask, SMPAuthReqs::RFU_2) ) {
146 out.append(", ");
147 out.append("RFU_2");
148 }
149 out.append("]");
150 return out;
151}
152
154 const SMPAuthReqs authReqs_ini, const SMPIOCapability ioCap_ini, const SMPOOBDataFlag oobFlag_ini,
155 const SMPAuthReqs authReqs_res, const SMPIOCapability ioCap_res, const SMPOOBDataFlag oobFlag_res) noexcept
156{
157 // BT Core Spec v5.2: Vol 3, Part H (SM): 2.3.1 Security Properties
158
159 if( !use_sc ) {
160 // BT Core Spec v5.2: Vol 3, Part H (SM): 2.3.5.1 Selecting key generation method Table 2.6 (STK, le_sc_all_supported==false)
161 // LE Secure Connections is _NOT_ supported by both devices.
162
163 // Authenticated via OOB, if both support OOB
164 if( SMPOOBDataFlag::OOB_AUTH_DATA_REMOTE_PRESENT == oobFlag_ini &&
165 SMPOOBDataFlag::OOB_AUTH_DATA_REMOTE_PRESENT == oobFlag_res )
166 {
167 return PairingMode::OUT_OF_BAND;
168 }
169
170 // Authenticated via IOCapabilities, if any of them has requested MITM
171 if( is_set( authReqs_ini, SMPAuthReqs::MITM ) ||
172 is_set( authReqs_res, SMPAuthReqs::MITM ) )
173 {
174 return getPairingMode(use_sc, ioCap_ini, ioCap_res);
175 }
176
177 // Unauthenticated pairing
178 return PairingMode::JUST_WORKS;
179
180 } else {
181 // BT Core Spec v5.2: Vol 3, Part H (SM): 2.3.5.1 Selecting key generation method Table 2.7 (LTK, le_sc_all_supported==true)
182 // LE Secure Connections is supported by both devices.
183
184 // Authenticated via OOB, if any of them supports OOB
185 if( SMPOOBDataFlag::OOB_AUTH_DATA_REMOTE_PRESENT == oobFlag_ini ||
186 SMPOOBDataFlag::OOB_AUTH_DATA_REMOTE_PRESENT == oobFlag_res )
187 {
188 return PairingMode::OUT_OF_BAND;
189 }
190
191 // Authenticated via IOCapabilities, if any of them has requested MITM
192 if( is_set( authReqs_ini, SMPAuthReqs::MITM ) ||
193 is_set( authReqs_res, SMPAuthReqs::MITM ) )
194 {
195 return getPairingMode(use_sc, ioCap_ini, ioCap_res);
196 }
197
198 // Unauthenticated pairing
199 return PairingMode::JUST_WORKS;
200 }
201}
202
203/**
204 * Mapping SMPIOCapability from initiator and responder to PairingMode.
205 *
206 * Notable, the following is deduced from
207 * BT Core Spec v5.2: Vol 3, Part H (SM): 2.3.5.1 Selecting key generation method Table 2.8
208 * and differs a little from BlueZ smp.c implementation.
209 *
210 * Index values, using SMPIOCapabilities as follows:
211 DISPLAY_ONLY = 0x00,
212 DISPLAY_YES_NO = 0x01,
213 KEYBOARD_ONLY = 0x02,
214 NO_INPUT_NO_OUTPUT = 0x03,
215 KEYBOARD_DISPLAY = 0x04
216 *
217 */
218#define PM_JUST__WORKS PairingMode::JUST_WORKS
219#define PM_PASSKEY_INI PairingMode::PASSKEY_ENTRY_ini // Passkey Entry input by initiator. Responder produces and display artifact.
220#define PM_PASSKEY_RES PairingMode::PASSKEY_ENTRY_res // Passkey Entry input by responder. Initiator produces and display artifact.
221#define PM_PASSKEY_ALL PairingMode::PASSKEY_ENTRY_ini // Passkey Entry input by initiator and responder. Using input from initiator!
222#define PM_NUMCOMP_INI PairingMode::NUMERIC_COMPARE_ini // Comparison of PIN input by initiator. Responder produces and display artifact.
223#define PM_NUMCOMP_RES PairingMode::NUMERIC_COMPARE_res // Comparison of PIN input by responder. Initiator produces and display artifact.
224#define PM_NUMCOMP_ANY PairingMode::NUMERIC_COMPARE_ini // Comparison of PIN input by any device. Using input from initiator!
225
226static const PairingMode legacy_pairing[5 /* ioCap_res */][5 /* ioCap_ini */] = {
227 /* Responder / Initiator DISPLAY_ONLY DISPLAY_YES_NO KEYBOARD_ONLY NO_INPUT_NO_OUT KEYBOARD_DISPLAY */
233};
234static const PairingMode seccon_pairing[5 /* ioCap_res */][5 /* ioCap_ini */] = {
235 /* Responder / Initiator DISPLAY_ONLY DISPLAY_YES_NO KEYBOARD_ONLY NO_INPUT_NO_OUT KEYBOARD_DISPLAY */
241};
242
244 const SMPIOCapability ioCap_ini, const SMPIOCapability ioCap_res) noexcept
245{
246 // BT Core Spec v5.2: Vol 3, Part H (SM): 2.3.5.1 Selecting key generation method Table 2.8
247 const uint8_t ioCap_ini_int = number(ioCap_ini);
248 const uint8_t ioCap_res_int = number(ioCap_res);
249 if( ioCap_ini_int > 4) {
250 ABORT("Invalid ioCap_init %s, %d", to_string(ioCap_ini).c_str(), ioCap_ini_int);
251 }
252 if( ioCap_res_int > 4) {
253 ABORT("Invalid ioCap_resp %s, %d", to_string(ioCap_res).c_str(), ioCap_res_int);
254 }
255 if( use_sc ) {
256 return seccon_pairing[ioCap_res_int][ioCap_ini_int];
257 } else {
258 return legacy_pairing[ioCap_res_int][ioCap_ini_int];
259 }
260}
261
262
263#define KEYDISTFMT_ENUM(X,M) \
264 X(SMPKeyType,ENC_KEY,M) \
265 X(SMPKeyType,ID_KEY,M) \
266 X(SMPKeyType,SIGN_KEY,M) \
267 X(SMPKeyType,LINK_KEY,M) \
268 X(SMPKeyType,RFU_1,M) \
269 X(SMPKeyType,RFU_2,M) \
270 X(SMPKeyType,RFU_3,M) \
271 X(SMPKeyType,RFU_4,M)
272
273std::string direct_bt::to_string(const SMPKeyType mask) noexcept {
274 std::string out("[");
275 bool comma = false;
277 out.append("]");
278 return out;
279}
280
281#define LTKPROP_ENUM(X,M) \
282 X(SMPLongTermKey::Property,RESPONDER,M) \
283 X(SMPLongTermKey::Property,AUTH,M) \
284 X(SMPLongTermKey::Property,SC,M)
285
286std::string SMPLongTermKey::getPropertyString(const Property mask) noexcept {
287 std::string out("[");
288 bool comma = false;
290 out.append("]");
291 return out;
292}
293
294bool SMPLongTermKey::isResponder() const noexcept {
295 return ( SMPLongTermKey::Property::RESPONDER & properties ) != SMPLongTermKey::Property::NONE;
296}
297
298#define IRKPROP_ENUM(X,M) \
299 X(SMPIdentityResolvingKey::Property,RESPONDER,M) \
300 X(SMPIdentityResolvingKey::Property,AUTH,M)
301
302std::string SMPIdentityResolvingKey::getPropertyString(const Property mask) noexcept {
303 std::string out("[");
304 bool comma = false;
306 out.append("]");
307 return out;
308}
309
311 return ( SMPIdentityResolvingKey::Property::RESPONDER & properties ) != SMPIdentityResolvingKey::Property::NONE;
312}
313
314bool SMPIdentityResolvingKey::matches(const EUI48& rpa) noexcept {
315 return smp_crypto_rpa_irk_matches(irk, rpa); // irk.id_address == this->addressAndType
316}
317
318bool SMPIdentityResolvingKey::matches(const jau::uint128dp_t& irk, const EUI48& rpa) noexcept {
319 return smp_crypto_rpa_irk_matches(irk, rpa);
320}
321
322#define CSRKPROP_ENUM(X,M) \
323 X(SMPSignatureResolvingKey::Property,RESPONDER,M) \
324 X(SMPSignatureResolvingKey::Property,AUTH,M)
325
327 std::string out("[");
328 bool comma = false;
330 out.append("]");
331 return out;
332}
333
335 return ( SMPSignatureResolvingKey::Property::RESPONDER & properties ) != SMPSignatureResolvingKey::Property::NONE;
336}
337
338#define SMP_LINKKEYTYPE_ENUM(X) \
339 X(COMBI) \
340 X(LOCAL_UNIT) \
341 X(REMOTE_UNIT) \
342 X(DBG_COMBI) \
343 X(UNAUTH_COMBI_P192) \
344 X(AUTH_COMBI_P192) \
345 X(CHANGED_COMBI) \
346 X(UNAUTH_COMBI_P256) \
347 X(AUTH_COMBI_P256) \
348 X(NONE)
349
350#define SMP_LINKKEYTYPE_TO_STRING(V) case SMPLinkKey::KeyType::V: return #V;
351
352std::string SMPLinkKey::getTypeString(const KeyType type) noexcept {
353 switch(type) {
355 default: ; // fall through intended
356 }
357 return "Unknown SMPLinkKeyType";
358}
359
360#define OPCODE_ENUM(X) \
361 X(UNDEFINED) \
362 X(PAIRING_REQUEST) \
363 X(PAIRING_RESPONSE) \
364 X(PAIRING_CONFIRM) \
365 X(PAIRING_RANDOM) \
366 X(PAIRING_FAILED) \
367 X(ENCRYPTION_INFORMATION) \
368 X(MASTER_IDENTIFICATION) \
369 X(IDENTITY_INFORMATION) \
370 X(IDENTITY_ADDRESS_INFORMATION) \
371 X(SIGNING_INFORMATION) \
372 X(SECURITY_REQUEST) \
373 X(PAIRING_PUBLIC_KEY) \
374 X(PAIRING_DHKEY_CHECK) \
375 X(PAIRING_KEYPRESS_NOTIFICATION)
376
377#define CASE_TO_STRING_OPCODE(V) case Opcode::V: return #V;
378
379std::string SMPPDUMsg::getOpcodeString(const Opcode opc) noexcept {
380 switch(opc) {
382 default: ; // fall through intended
383 }
384 return "Unknown SMP Opcode";
385}
386
387std::string SMPPairFailedMsg::getReasonCodeString(const ReasonCode reasonCode) noexcept {
388 switch(reasonCode) {
389 case ReasonCode::UNDEFINED: return "Undefined";
390 case ReasonCode::PASSKEY_ENTRY_FAILED: return "Passkey Entry Failed";
391 case ReasonCode::OOB_NOT_AVAILABLE: return "OOB Not Available";
392 case ReasonCode::AUTHENTICATION_REQUIREMENTS: return "Authentication Requirements";
393 case ReasonCode::CONFIRM_VALUE_FAILED: return "Confirm Value Failed";
394 case ReasonCode::PAIRING_NOT_SUPPORTED: return "Pairing Not Supported";
395 case ReasonCode::ENCRYPTION_KEY_SIZE: return "Encryption Key Size";
396 case ReasonCode::COMMON_NOT_SUPPORTED: return "Common Not Supported";
397 case ReasonCode::UNSPECIFIED_REASON: return "Unspecified Reason";
398 case ReasonCode::REPEATED_ATTEMPTS: return "Repeated Attempts";
399 case ReasonCode::INVALID_PARAMTERS: return "Invalid Paramters";
400 case ReasonCode::DHKEY_CHECK_FAILED: return "DHKey Check Failed";
401 case ReasonCode::NUMERIC_COMPARISON_FAILED: return "Numeric Comparison Failed";
402 case ReasonCode::BREDR_PAIRING_IN_PROGRESS: return "BR/EDR pairing in process";
403 case ReasonCode::CROSSXPORT_KEY_DERIGEN_NOT_ALLOWED: return "Cross-transport Key Derivation/Generation not allowed";
404 default: ; // fall through intended
405 }
406 return "Reason reserved for future use";
407}
408
409#define TYPECODE_ENUM(X) \
410 X(PASSKEY_ENTRY_STARTED) \
411 X(PASSKEY_DIGIT_ENTERED) \
412 X(PASSKEY_DIGIT_ERASED) \
413 X(PASSKEY_CLEARED) \
414 X(PASSKEY_ENTRY_COMPLETED)
415
416#define CASE_TO_STRING_TYPECODE(V) case TypeCode::V: return #V;
417
419 switch(tc) {
421 default: ; // fall through intended
422 }
423 return "Unknown TypeCode";
424}
425
426std::unique_ptr<const SMPPDUMsg> SMPPDUMsg::getSpecialized(const uint8_t * buffer, jau::nsize_t const buffer_size) noexcept {
427 const SMPPDUMsg::Opcode opc = static_cast<SMPPDUMsg::Opcode>(*buffer);
428 switch( opc ) {
429 case Opcode::PAIRING_REQUEST: return std::make_unique<SMPPairingMsg>(true /* request */, buffer, buffer_size);
430 case Opcode::PAIRING_RESPONSE: return std::make_unique<SMPPairingMsg>(false /* request */, buffer, buffer_size);
431 case Opcode::PAIRING_CONFIRM: return std::make_unique<SMPPairConfirmMsg>(buffer, buffer_size);
432 case Opcode::PAIRING_RANDOM: return std::make_unique<SMPPairRandMsg>(buffer, buffer_size);
433 case Opcode::PAIRING_FAILED: return std::make_unique<SMPPairFailedMsg>(buffer, buffer_size);
434 case Opcode::ENCRYPTION_INFORMATION: return std::make_unique<SMPEncInfoMsg>(buffer, buffer_size);
435 case Opcode::MASTER_IDENTIFICATION: return std::make_unique<SMPMasterIdentMsg>(buffer, buffer_size);
436 case Opcode::IDENTITY_INFORMATION: return std::make_unique<SMPIdentInfoMsg>(buffer, buffer_size);
437 case Opcode::IDENTITY_ADDRESS_INFORMATION: return std::make_unique<SMPIdentAddrInfoMsg>(buffer, buffer_size);
438 case Opcode::SIGNING_INFORMATION: return std::make_unique<SMPSignInfoMsg>(buffer, buffer_size);
439 case Opcode::SECURITY_REQUEST: return std::make_unique<SMPSecurityReqMsg>(buffer, buffer_size);
440 case Opcode::PAIRING_PUBLIC_KEY: return std::make_unique<SMPPairPubKeyMsg>(buffer, buffer_size);
441 case Opcode::PAIRING_DHKEY_CHECK: return std::make_unique<SMPPairDHKeyCheckMsg>(buffer, buffer_size);
442 case Opcode::PAIRING_KEYPRESS_NOTIFICATION: return std::make_unique<SMPPasskeyNotification>(buffer, buffer_size);
443 default: return std::make_unique<SMPPDUMsg>(buffer, buffer_size);
444 }
445}
#define CSRKPROP_ENUM(X, M)
Definition: SMPTypes.cpp:322
#define KEYDISTFMT_ENUM(X, M)
Definition: SMPTypes.cpp:263
static void append_bitstr(std::string &out, T mask, T bit, const std::string &bitstr, bool &comma)
Definition: SMPTypes.cpp:41
#define OPCODE_ENUM(X)
Definition: SMPTypes.cpp:360
#define CASE_TO_STRING_TYPECODE(V)
Definition: SMPTypes.cpp:416
#define PM_NUMCOMP_ANY
Definition: SMPTypes.cpp:224
#define PM_PASSKEY_RES
Definition: SMPTypes.cpp:220
#define SMP_LINKKEYTYPE_ENUM(X)
Definition: SMPTypes.cpp:338
#define SMP_LINKKEYTYPE_TO_STRING(V)
Definition: SMPTypes.cpp:350
#define CASE_TO_STRING_PAIRSTATE(V)
Definition: SMPTypes.cpp:62
#define PM_PASSKEY_INI
Definition: SMPTypes.cpp:219
#define PAIRSTATE_ENUM(X)
Definition: SMPTypes.cpp:49
#define PM_JUST__WORKS
Mapping SMPIOCapability from initiator and responder to PairingMode.
Definition: SMPTypes.cpp:218
#define PM_PASSKEY_ALL
Definition: SMPTypes.cpp:221
static const PairingMode legacy_pairing[5][5]
Definition: SMPTypes.cpp:226
#define CASE_TO_STRING_OPCODE(V)
Definition: SMPTypes.cpp:377
static const PairingMode seccon_pairing[5][5]
Definition: SMPTypes.cpp:234
#define LTKPROP_ENUM(X, M)
Definition: SMPTypes.cpp:281
#define CASE_TO_STRING_IOCAP(V)
Definition: SMPTypes.cpp:88
#define APPEND_BITSTR(U, V, M)
Definition: SMPTypes.cpp:47
#define IRKPROP_ENUM(X, M)
Definition: SMPTypes.cpp:298
#define IOCAP_ENUM(X)
Definition: SMPTypes.cpp:80
#define TYPECODE_ENUM(X)
Definition: SMPTypes.cpp:409
static std::string getOpcodeString(const Opcode opc) noexcept
Definition: SMPTypes.cpp:379
static std::unique_ptr< const SMPPDUMsg > getSpecialized(const uint8_t *buffer, jau::nsize_t const buffer_size) noexcept
Return a newly created specialized instance pointer to base class.
Definition: SMPTypes.cpp:426
Opcode
SMP Command Codes Vol 3, Part H (SM): 3.3.
Definition: SMPTypes.hpp:845
static std::string getReasonCodeString(const ReasonCode reasonCode) noexcept
Definition: SMPTypes.cpp:387
static std::string getTypeCodeString(const TypeCode tc) noexcept
Definition: SMPTypes.cpp:418
#define ABORT(...)
Use for unconditional ::abort() call with given messages, prefix '[elapsed_time] ABORT @ file:line fu...
Definition: debug.hpp:101
std::string to_string(const alphabet &v) noexcept
Definition: base_codec.hpp:97
SMPAuthReqs
SMP Authentication Requirements Bits, denotes specific bits or whole protocol uint8_t bit-mask.
Definition: SMPTypes.hpp:283
SMPPairingState
SMP Pairing Process state definition.
Definition: SMPTypes.hpp:107
SMPKeyType
SMP Key Type for Distribution, indicates keys distributed in the Transport Specific Key Distribution ...
Definition: SMPTypes.hpp:415
std::string toPassKeyString(const std::uint32_t passKey) noexcept
Returns given passKey ranging [0..999999] as a canonical string, e.g.
Definition: SMPTypes.cpp:72
SMPOOBDataFlag
Vol 3, Part H, 2.3.3 OOB authentication data.
Definition: SMPTypes.hpp:253
SMPIOCapability
Vol 3, Part H, 2.3.2 IO capabilities.
Definition: SMPTypes.hpp:209
PairingMode getPairingMode(const bool use_sc, const SMPAuthReqs authReqs_ini, const SMPIOCapability ioCap_ini, const SMPOOBDataFlag oobFlag_ini, const SMPAuthReqs authReqs_res, const SMPIOCapability ioCap_res, const SMPOOBDataFlag oobFlag_res) noexcept
Returns the PairingMode derived from both devices' sets of SMPAuthReqs, SMPIOCapability and SMPOOBDat...
Definition: SMPTypes.cpp:153
std::string to_string(const DiscoveryPolicy v) noexcept
Definition: BTAdapter.cpp:58
PairingMode
Bluetooth secure pairing mode.
Definition: BTTypes0.hpp:317
constexpr uint32_t number(const iostate rhs) noexcept
Definition: byte_stream.hpp:72
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
Definition: int_types.hpp:53
constexpr bool is_set(const cpu_family_t mask, const cpu_family_t bit) noexcept
Definition: cpuid.hpp:122
bool smp_crypto_rpa_irk_matches(const jau::uint128dp_t irk, const EUI48 &rpa) noexcept
Returns true if the given IRK matches the given random private address (RPA).
Definition: SMPCrypto.cpp:167
Property properties
SMPIdentityResolvingKey::Property bit mask.
Definition: SMPTypes.hpp:636
bool isResponder() const noexcept
Definition: SMPTypes.cpp:310
static std::string getPropertyString(const Property mask) noexcept
Definition: SMPTypes.cpp:302
bool matches(const EUI48 &rpa) noexcept
Returns true if this IRK matches the given random private address (RPA).
Definition: SMPTypes.cpp:314
static std::string getTypeString(const KeyType type) noexcept
Definition: SMPTypes.cpp:352
Property properties
SMPLongTermKey::Property bit mask.
Definition: SMPTypes.hpp:552
bool isResponder() const noexcept
Definition: SMPTypes.cpp:334
static std::string getPropertyString(const Property mask) noexcept
Definition: SMPTypes.cpp:326
Property properties
SMPSignatureResolvingKey::Property bit mask.
Definition: SMPTypes.hpp:712
A packed 48 bit EUI-48 identifier, formerly known as MAC-48 or simply network device MAC address (Med...
Definition: eui48.hpp:324
A 128-bit packed uint8_t data array.
Definition: int_types.hpp:114