Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
SMPCrypto.hpp
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#ifndef SMP_CRYPTO_HPP_
27#define SMP_CRYPTO_HPP_
28
29#include <jau/int_types.hpp>
30#include <jau/byte_util.hpp>
31#include <jau/eui48.hpp>
32
33#include "BTAddress.hpp"
34
35namespace direct_bt {
36 /** Returns true if the given IRK matches the given random private address (RPA). */
37 bool smp_crypto_rpa_irk_matches(const jau::uint128dp_t irk, const EUI48& rpa) noexcept;
38
40 const BDAddressAndType& a1, const BDAddressAndType& a2,
41 jau::uint128dp_t& mackey, jau::uint128dp_t& ltk) noexcept;
42
43} // namespace direct_bt
44
45#endif /* SMP_CRYPTO_HPP_ */
Unique Bluetooth EUI48 address and BDAddressType tuple.
Definition: BTAddress.hpp:175
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
bool smp_crypto_f5(const jau::uint256dp_t w, const jau::uint128dp_t n1, const jau::uint128dp_t n2, const BDAddressAndType &a1, const BDAddressAndType &a2, jau::uint128dp_t &mackey, jau::uint128dp_t &ltk) noexcept
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
A 256-bit packed uint8_t data array.
Definition: int_types.hpp:158