From f68533d3b6fc4c01dcafba34d9fc954efbd44e37 Mon Sep 17 00:00:00 2001
From: Sven Gothel
- * Vol 3 (Host), Part H (SM): 3 (SMP), 3.5 Pairing Methods + * Vol 3 (Host), Part H (SM): 3 (SMP), 3.5.6 Pairing Public Key ** * Opcode::PAIRING_PUBLIC_KEY @@ -1030,16 +1031,24 @@ namespace direct_bt { /** * Returns the 256-bit Public Key X value (32 octets) */ - jau::uint256_t getPublicKeyXValuePtr() const noexcept { return pdu.get_uint256_nc(1); } + jau::uint256_t getPubKeyX() const noexcept { return pdu.get_uint256_nc(1); } /** * Returns the 256-bit Public Key Y value (32 octets) */ - jau::uint256_t getPublicKeyYValuePtr() const noexcept { return pdu.get_uint256_nc(1+32); } + jau::uint256_t getPubKeyY() const noexcept { return pdu.get_uint256_nc(1+32); } std::string getName() const noexcept override { return "SMPPairPubKey"; } + + protected: + std::string valueString() const noexcept override { + return "size "+std::to_string(getDataSize())+", pk_x "+ + jau::bytesHexString(pdu.get_ptr_nc(1), 0, 32, true /* lsbFirst */, false /* leading0X */)+ + ", pk_y "+ + jau::bytesHexString(pdu.get_ptr_nc(1+32), 0, 32, true /* lsbFirst */, false /* leading0X */); + } }; /** @@ -1081,7 +1090,7 @@ namespace direct_bt { /** * Returns the 128-bit DHKey Check value (16 octets) */ - jau::uint128_t getDHKeyCheckValuePtr() const noexcept { return pdu.get_uint128_nc(1); } + jau::uint128_t getDHKeyCheck() const noexcept { return pdu.get_uint128_nc(1); } std::string getName() const noexcept override { return "SMPPairDHKeyCheck"; @@ -1089,7 +1098,8 @@ namespace direct_bt { protected: std::string valueString() const noexcept override { - return "size "+std::to_string(getDataSize())+", data anon"; // FIXME: Shareable? + return "size "+std::to_string(getDataSize())+", dhkey_chk "+ + jau::bytesHexString(pdu.get_ptr_nc(1), 0, getDataSize(), true /* lsbFirst */, false /* leading0X */); } }; @@ -1157,6 +1167,8 @@ namespace direct_bt { * Vol 3, Part H: 3.6.2 Encryption Information message. *
* Vol 3 (Host), Part H (SM): 3 (SMP), 3.6 SECURITY IN BLUETOOTH LOW ENERGY + * Vol 3 (Host), Part H (SM): 3 (SMP), 3.6.1 Key distribution and generation + * Vol 3 (Host), Part H (SM): 2 (SM), 2.4.1 Definition of keys and values ** * Opcode::ENCRYPTION_INFORMATION @@ -1167,9 +1179,12 @@ namespace direct_bt { * * * Message is used in the LE legacy pairing Transport Specific Key Distribution - * to distribute LTK that is used when encrypting future connections. + * to distribute Long Term Key (LTK) that is used when encrypting future connections. + *
+ * The message shall only be sent when the link has been encrypted or re-encrypted using the generated LTK. + *
*- * The message shall only be sent when the link has been encrypted or re-encrypted using the generated STK. + * Legacy: #1 in distribution, first value. *
*/ class SMPEncInfoMsg : public SMPPDUMsg @@ -1195,18 +1210,19 @@ namespace direct_bt { * Returns the 128-bit Long Term Key (16 octets) ** The generated LTK value being distributed, - * see Vol 3, Part H, 2.4.2.3 SM - Generation of CSRK - LE legacy pairing - generation of LTK, EDIV and Rand. + * see Vol 3, Part H, 2.4.2.3 SM - LE legacy pairing - generation of LTK, EDIV and Rand. *
*/ - jau::uint128_t getLongTermKeyPtr() const noexcept { return pdu.get_uint128_nc(1); } + jau::uint128_t getLTK() const noexcept { return pdu.get_uint128_nc(1); } std::string getName() const noexcept override { return "SMPEncInfo"; } protected: - std::string valueString() const noexcept override { - return "size "+std::to_string(getDataSize())+", data anon"; + std::string valueString() const noexcept override { // hex-fmt aligned with btmon + return "size "+std::to_string(getDataSize())+", ltk "+ + jau::bytesHexString(pdu.get_ptr_nc(1), 0, getDataSize(), true /* lsbFirst */, false /* leading0X */); } }; @@ -1214,6 +1230,8 @@ namespace direct_bt { * Vol 3, Part H: 3.6.3 Master Identification message. ** Vol 3 (Host), Part H (SM): 3 (SMP), 3.6 SECURITY IN BLUETOOTH LOW ENERGY + * Vol 3 (Host), Part H (SM): 3 (SMP), 3.6.1 Key distribution and generation + * Vol 3 (Host), Part H (SM): 2 (SM), 2.4.1 Definition of keys and values ** * Opcode::MASTER_IDENTIFICATION @@ -1225,10 +1243,13 @@ namespace direct_bt { * * * Message is used in the LE legacy pairing Transport Specific Key Distribution phase - * to distribute EDIV and Rand which are used when encrypting future connections. + * to distribute Encrypted Diversifier (EDIV) and Random Number (Rand) which are used when encrypting future connections. * *
- * The message shall only be sent when the link has been encrypted or re-encrypted using the generated STK. + * The message shall only be sent when the link has been encrypted or re-encrypted using the generated LTK. + *
+ *+ * Legacy: #2 in distribution *
*/ class SMPMasterIdentMsg : public SMPPDUMsg @@ -1272,8 +1293,11 @@ namespace direct_bt { } protected: - std::string valueString() const noexcept override { - return "size "+std::to_string(getDataSize())+", data anon"; + std::string valueString() const noexcept override { // hex-fmt aligned with btmon + return "size "+std::to_string(getDataSize())+", ediv "+ + jau::bytesHexString(pdu.get_ptr_nc(1), 0, 2, false /* lsbFirst */, true /* leading0X */)+ + ", rand "+ + jau::bytesHexString(pdu.get_ptr_nc(1+2), 0, 8, false /* lsbFirst */, true /* leading0X */); } }; @@ -1281,6 +1305,9 @@ namespace direct_bt { * Vol 3, Part H: 3.6.4 Identify Information message. ** Vol 3 (Host), Part H (SM): 3 (SMP), 3.6 SECURITY IN BLUETOOTH LOW ENERGY + * Vol 3 (Host), Part H (SM): 3 (SMP), 3.6.1 Key distribution and generation + * Vol 3 (Host), Part H (SM): 2 (SM), 2.4.1 Definition of keys and values + * Vol 3 (Host), Part H (SM): 2 (SM), 2.4.2.1 Generation of IRK ** * Opcode::IDENTITY_INFORMATION @@ -1290,9 +1317,13 @@ namespace direct_bt { * jau::uint128_t identity_resolving_key * * - * Message is used in the Transport Specific Key Distribution phase to distribute IRK. + * Message is used in the Transport Specific Key Distribution phase to distribute Identity Resolving Key (IRK). + *
+ * The message shall only be sent when the link has been encrypted or re-encrypted using the generated key. + *
*
- * The message shall only shall only be sent when the link has been encrypted or re-encrypted using the generated key.
+ * Legacy: #3 in distribution
+ * Secure Connection: #1 in distribution, first value.
*
* Vol 3 (Host), Part H (SM): 3 (SMP), 3.6 SECURITY IN BLUETOOTH LOW ENERGY + * Vol 3 (Host), Part H (SM): 3 (SMP), 3.6.1 Key distribution and generation ** * Opcode::IDENTITY_ADDRESS_INFORMATION @@ -1353,6 +1386,10 @@ namespace direct_bt { *
* The message shall only be sent when the link has been encrypted or re-encrypted using the generated key. *
+ *
+ * Legacy: #4 in distribution
+ * Secure Connection: #2 in distribution
+ *
* Vol 3 (Host), Part H (SM): 3 (SMP), 3.6 SECURITY IN BLUETOOTH LOW ENERGY + * Vol 3 (Host), Part H (SM): 3 (SMP), 3.6.1 Key distribution and generation + * Vol 3 (Host), Part H (SM): 2 (SM), 2.4.1 Definition of keys and values + * Vol 3 (Host), Part H (SM): 2 (SM), 2.4.2.2 Generation of CSRK ** * Opcode::SIGNING_INFORMATION @@ -1408,9 +1448,14 @@ namespace direct_bt { * jau::uint128_t signature_key * * - * Message is used in the Transport Specific Key Distribution to distribute the CSRK which a device uses to sign data. + * Message is used in the Transport Specific Key Distribution + * to distribute the Connection Signature Resolving Key (CSRK), which a device uses to sign data. *
- * The message shall only shall only be sent when the link has been encrypted or re-encrypted using the generated key. + * The message shall only be sent when the link has been encrypted or re-encrypted using the generated key. + *
+ *
+ * Legacy: #5 in distribution, last value.
+ * Secure Connection: #3 in distribution, last value.
*
- * The 128-bit IRK value being distributed, - * see Vol 3, Part H, 2.4.2.1 SM - Definition of keys and values - Generation of IRK. + * The 128-bit CSRK value being distributed, + * see Vol 3, Part H, 2.4.2.2 SM - Definition of keys and values - Generation of CSRK. *
*/ - jau::uint128_t getIRKPtr() const noexcept { return pdu.get_uint128_nc(1); } + jau::uint128_t getCSRK() const noexcept { return pdu.get_uint128_nc(1); } std::string getName() const noexcept override { return "SMPSignInfo"; } protected: - std::string valueString() const noexcept override { - return "size "+std::to_string(getDataSize())+", data anon"; + std::string valueString() const noexcept override { // hex-fmt aligned with btmon + return "size "+std::to_string(getDataSize())+", csrk "+ + jau::bytesHexString(pdu.get_ptr_nc(1), 0, getDataSize(), true /* lsbFirst */, false /* leading0X */); } }; -- cgit v1.2.3