diff options
author | Sven Gothel <[email protected]> | 2020-12-10 09:46:45 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-12-10 09:46:45 +0100 |
commit | de11465791d2766525febcaa6934154a31d9c733 (patch) | |
tree | 203db2f9f4b336f5d883608eb6af8c4cc66475b9 /api | |
parent | ab86d222890076ce26b8638411e490c047add780 (diff) |
SMPLongTermKeyInfo: Encode RESPONDER (or INITIATOR) within its Property bit mask, determining key role; ...
DBTDevice::setLongTermKeyInfo() writes given key to pairing_data.ltk_resp or pairing_data.ltk_init
to reflect proper state.
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/DBTDevice.hpp | 5 | ||||
-rw-r--r-- | api/direct_bt/DBTManager.hpp | 3 | ||||
-rw-r--r-- | api/direct_bt/MgmtTypes.hpp | 11 | ||||
-rw-r--r-- | api/direct_bt/SMPTypes.hpp | 8 |
4 files changed, 15 insertions, 12 deletions
diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp index a870dfd2..c72e801c 100644 --- a/api/direct_bt/DBTDevice.hpp +++ b/api/direct_bt/DBTDevice.hpp @@ -456,11 +456,10 @@ namespace direct_bt { /** * Sets the long term ket (LTK) info of this device to reuse pre-paired encryption. - * @param ltk the pre-paired encryption - * @param responder true will set the responder's LTK info (remote device, LL slave), otherwise the initiator's (the LL master). + * @param ltk the pre-paired encryption LTK * @return ::HCIStatusCode::SUCCESS if successful, otherwise the appropriate error code. */ - HCIStatusCode setLongTermKeyInfo(const SMPLongTermKeyInfo& ltk, const bool responder) noexcept; + HCIStatusCode setLongTermKeyInfo(const SMPLongTermKeyInfo& ltk) noexcept; /** * Unpairs this device from the adapter while staying connected. diff --git a/api/direct_bt/DBTManager.hpp b/api/direct_bt/DBTManager.hpp index 4908906b..1697146e 100644 --- a/api/direct_bt/DBTManager.hpp +++ b/api/direct_bt/DBTManager.hpp @@ -441,8 +441,7 @@ namespace direct_bt { MgmtStatus uploadLinkKey(const uint16_t dev_id, const bool debug_keys, const MgmtLinkKeyInfo &key) noexcept; HCIStatusCode uploadLongTermKey(const uint16_t dev_id, const MgmtLongTermKeyInfo &key) noexcept; - HCIStatusCode uploadLongTermKeyInfo(const uint16_t dev_id, const EUI48& address, BDAddressType address_type, - const SMPLongTermKeyInfo& ltk, const bool responder) noexcept; + HCIStatusCode uploadLongTermKeyInfo(const uint16_t dev_id, const EUI48& address, BDAddressType address_type, const SMPLongTermKeyInfo& ltk) noexcept; MgmtStatus userPasskeyReply(const uint16_t dev_id, const EUI48 &address, const BDAddressType addressType, const uint32_t passkey) noexcept; MgmtStatus userPasskeyNegativeReply(const uint16_t dev_id, const EUI48 &address, const BDAddressType addressType) noexcept; diff --git a/api/direct_bt/MgmtTypes.hpp b/api/direct_bt/MgmtTypes.hpp index 7af223d7..66844551 100644 --- a/api/direct_bt/MgmtTypes.hpp +++ b/api/direct_bt/MgmtTypes.hpp @@ -185,7 +185,7 @@ namespace direct_bt { std::string toString() const noexcept { return "LK[address["+address.toString()+", "+getBDAddressTypeString(address_type)+ "], type "+getMgmtLinkKeyTypeString(key_type).c_str()+ - ", key "+jau::uint128HexString(key)+ + ", key "+jau::bytesHexString(key.data, 0, sizeof(key), true /* lsbFirst */, false /* leading0X */)+ ", pinLen "+jau::uint8HexString(pin_length)+ "]"; } @@ -239,13 +239,16 @@ namespace direct_bt { std::string toString() const noexcept { return "IRK[address["+address.toString()+", "+getBDAddressTypeString(address_type)+ - "], irk "+jau::uint128HexString(irk)+ + "], irk "+jau::bytesHexString(irk.data, 0, sizeof(irk), true /* lsbFirst */, false /* leading0X */)+ "]"; } } ); /** * Used for MgmtEvtNewSignatureResolvingKey + * <p> + * One way for ATT Signed Write. + * </p> */ __pack( struct MgmtSignatureResolvingKeyInfo { EUI48 address; @@ -256,7 +259,7 @@ namespace direct_bt { std::string toString() const noexcept { return "CSRK[address["+address.toString()+", "+getBDAddressTypeString(address_type)+ "], type "+getMgmtCSRKTypeString(key_type).c_str()+ - ", csrk "+jau::uint128HexString(csrk)+ + ", csrk "+jau::bytesHexString(csrk.data, 0, sizeof(csrk), true /* lsbFirst */, false /* leading0X */)+ "]"; } } ); @@ -1863,7 +1866,7 @@ namespace direct_bt { /** * uint8_t store_hint, * EUI48 random_address; - * MgmtIdentityResolvingKey key + * MgmtSignatureResolvingKeyInfo key */ class MgmtEvtNewSignatureResolvingKey : public MgmtEvent { diff --git a/api/direct_bt/SMPTypes.hpp b/api/direct_bt/SMPTypes.hpp index 99153982..45526620 100644 --- a/api/direct_bt/SMPTypes.hpp +++ b/api/direct_bt/SMPTypes.hpp @@ -439,10 +439,12 @@ namespace direct_bt { enum class Property : uint8_t { /** No specific property */ NONE = 0x00, + /** Responder Key (LL slave). Absence indicates Initiator Key (LL master). */ + RESPONDER = 0x01, /** Authentication used. */ - AUTH = 0x01, + AUTH = 0x02, /** Secure Connection used. */ - SC = 0x02 + SC = 0x04 }; static constexpr uint8_t number(const Property rhs) noexcept { return static_cast<uint8_t>(rhs); @@ -1587,7 +1589,7 @@ namespace direct_bt { * </pre> * * Message is used in the Transport Specific Key Distribution - * to distribute the Connection Signature Resolving Key (CSRK), which a device uses to sign data. + * to distribute the Connection Signature Resolving Key (CSRK), which a device uses to sign data (ATT Signed Write). * <p> * The message shall only be sent when the link has been encrypted or re-encrypted using the generated key. * </p> |