aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* scripts/run-*-example.sh: Set kernel core pattern, to be sure of name and ↵Sven Gothel2021-11-022-0/+2
| | | | location (current dir) of core file.
* Bump jaulib v0.7.0Sven Gothel2021-11-021-0/+0
|
* Bump jaulib commit 68ed3fb1192c141cc343bcf998cc7a0c40be88b5Sven Gothel2021-11-021-0/+0
|
* Bump jaulib 62fd2799eec1ee9c70ab21653b6e0468efe55740Sven Gothel2021-11-011-0/+0
|
* Bump jaulib (more ringbuffer testing: multithreading w/ value checks)Sven Gothel2021-11-011-0/+0
|
* Bump jaulib .. (testing only)Sven Gothel2021-11-011-0/+0
|
* Adapt to jau::ringbuffer API changeSven Gothel2021-10-318-17/+17
|
* Bump jaulib v0.7.0-pre 9b07e31bbdba2bda8c6f71c1721aa2039f1d9e2eSven Gothel2021-10-311-0/+0
|
* Bump README.md (BTAdapter's Slave Peripheral SMP Key Management)Sven Gothel2021-10-291-0/+3
|
* Adding blues-btreset.sh: Reset and 'disable' one or more adapter ..Sven Gothel2021-10-291-0/+14
|
* BTDevice::hciSMPMsgCallback: Only accept SMPPDUMsg::Opcode::SECURITY_REQUEST ↵Sven Gothel2021-10-291-3/+5
| | | | | | | | | | in vanilla or FAIL SMPPairingState In pre-pairing, it may occur that the slave adapter sends the SECURITY_REQUEST out, but pre-pairing is still setup and working. Hence ignore this request if SMPPairingState has progressed, BT Spec agrees here (only once before pairing).
* Add BTAdapter's Slave Peripheral SMP Key ManagementSven Gothel2021-10-298-109/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To have full SMP key persitency in peripheral slave mode, BTAdapter requires fine grained control over - Passing stored keys to BTDevice's PairingData (w/o uploading them) - Uploading BTDevice's PairingData to the adapter This required interaction in certain places, only enabled if adapter is BTRole::Slave (peripheral): - BTAdapter::mgmtEvDeviceConnectedHCI() Only issue unpairDevice() if not pre-paired. Unpairing is required for new pairing to avoid DHKey Check failures! - BTAdapter::mgmtEvDeviceDisconnectedHCI() - First unpairDevice() will be issued via notifyDisconnect() - Set and upload stored keys for disconnected device (if existing), preparing for next connect. - BTAdapter::sendDevicePairingState() - SMPPairingState::COMPLETED && not SMPPairingState::PRE_PAIRED: Store keys - SMPPairingState::COMPLETED && SMPPairingState::PRE_PAIRED: Refresh keys to BTDevice (set), no upload! - SMPPairingState::FAILED: Remove and delete keys +++ BTAdapter::setSMPKeyPath(path) allows user to enable the persistent key storage by setting its local filesystem path. It will also read all key files (SMPKeyBin) and if valid and matching with the adapter, uploads them for pre-pairing. See dbt_peripheral00.cpp: adapter->setSMPKeyPath(ADAPTER_KEY_PATH); +++
* BTDevice::mtx_pairing: mutex -> recurse_mutex, preparing for BTAdapter's ↵Sven Gothel2021-10-292-19/+11
| | | | peripheral key management
* Move SMPKeyBin 'apply' to BTDevice, splitting functionality: setting + ↵Sven Gothel2021-10-2911-583/+540
| | | | | | | | | | | | | | | | | | | | | | | | | | uploading keys (required for peripheral BTAdapter key management) SMPKeyBin has the key apply action revoked. SMPKeyBin is reduced to store keys, address and security settings, as well adding persistence (read/write to filesystem). BTDevice::setSMPKeyBin(SMPKeyBin&) shall be used copy the key data over and BTDevice::uploadKeys() to upload them to the adapter for pre-pairing. See dbt_scanner10.cpp's use of convenient API (same efficiency as before) device->uploadKeys(KEY_PATH, req_sec_level, true /* verbose_ */); BTDevice::setSMPKeyBin(SMPKeyBin&) fully restored BTDevice's PairingData - keys - key caps - user security level and IOCaps +++ The reduced 'set<Name>Key(..)' methods only - copy the key to BTDevice's PairingData - set the KeyType bit for keys_<role>_[init|resp], fully restoring key caps
* BTAdapter::[get|set]SecureConnections*() align and complete on Java sideSven Gothel2021-10-294-0/+24
|
* SMPKeyBin: Entangle filename with instance: write(..) takes path instead of ↵Sven Gothel2021-10-283-26/+40
| | | | filename; Add member getFilename(path) and remove(path)
* Bump jaulib v0.6.1Sven Gothel2021-10-281-0/+0
|
* Remove BTDevice::pair() declaration (left over from TinyB removal)Sven Gothel2021-10-281-9/+0
|
* Issue BTDevice::unpair() directly when device is discovered, disconnected ↵Sven Gothel2021-10-2811-46/+89
| | | | | | | | | | | | | | | | | | | | | | | | and connected as peripheral This enforces a consistent and stable security workflow. - when a BTRole::Slave BTDevice is discovered, see AdapterStatusListener::deviceFound(). - when a BTRole::Slave BTDevice is disconnected, see AdapterStatusListener::deviceDisconnected(). - when a BTRole::Master BTDevice gets connected, see AdapterStatusListener::deviceConnected(). +++ Especially when connected as peripheral without unpair in SC mode, the peripheral fails the DHKey Check. TODO: Provide a persistent pre-pairing mechanism via SMPKeyBin for peripheral mode. +++ Note: Our existing example code to connect to a remote slave/peripheral, already performed the unpair on deviceFound(..) and deviceDisconnected(). These calls have now being removed, as they are performed directly by Direct-BT. The example code uploads pre-existing keys for pre-pairing when device is found, if existing.
* BTManager::unpairDevice(..): Return HCIStatusCode directly; ↵Sven Gothel2021-10-283-10/+11
| | | | BTDevice::unpair(): Add DBG_PRINT on failure; BTDevice::clearSMPStates() reduce to one DBG_PRINT
* BTGattHandler::disconnect: Fix NPE (oops)Sven Gothel2021-10-281-1/+1
|
* dbt_peripheral00: Peripheral in SC mode needs unpair(), i.e. erase all keys ..Sven Gothel2021-10-281-3/+5
|
* BTDevice::updatePairingState: Tidy up PASSKEY + NUMERIC_COMPARE default ↵Sven Gothel2021-10-281-2/+2
| | | | replies DBT_PRINT
* MgmtTypes.hpp: Link USER_CONFIRM_REQUEST and USER_CONFIRM_REPLY to BT Spec HCISven Gothel2021-10-281-0/+5
|
* dbt_scanner10: PASSKEY_EXPECTED, NUMERIC_COMPARE_EXPECTED: Lookup ↵Sven Gothel2021-10-281-2/+2
| | | | BTSecurityRegistry by start-of name as well
* DBGattServer: Add convenience functions to zero values and reset ↵Sven Gothel2021-10-282-18/+27
| | | | ClientCharConfig
* Bump jaulibSven Gothel2021-10-281-0/+0
|
* dbt_peripheral00: initAdapter(): Fail on failed setupSven Gothel2021-10-281-0/+1
|
* BTAdapter::startAdvertising: Fix ERR_PRINT typoSven Gothel2021-10-281-1/+1
|
* Add BTAdapter::getSecureConnectionsEnabled()Sven Gothel2021-10-281-0/+10
|
* dbt_peripheral: Fix initial setup: Move power-off settings post initialize ↵Sven Gothel2021-10-281-19/+25
| | | | (name + SC)
* Add DBGattServer::Listener::disconnect(..) for cleanup, example: Full ↵Sven Gothel2021-10-273-18/+97
| | | | cleanup incl. CCCD regs
* BTAdapter::mgmtEvDeviceConnectedHCI(..): Re-add calling notifyLEFeatures(..) ↵Sven Gothel2021-10-271-0/+14
| | | | | | from BTRole::Slave (peripheral) BlueZ/Kernel not reliably sending out HCI_LE_REMOTE_FEATURES
* SMPKeyBin: Add helper to load all SMPKeyBin files from a directory, filter ↵Sven Gothel2021-10-274-8/+108
| | | | for one adapter and apply them all (peripheral pre-pairing)
* Add BTAdapter::setSMPKeyBin(..): Allowing to upload keys for peripheral mode ↵Sven Gothel2021-10-272-0/+97
| | | | | | pre-connection FIXME: Pass keys to BTDevice instance after connection!
* BTGattHandler::send(..): Fix IllegalArgumentException message: Msg PDU size ↵Sven Gothel2021-10-271-2/+2
| | | | > usedMTU
* BTDevice::setLinkKey(): Upload LK not implemented on Bluez/Kernel for LE ↵Sven Gothel2021-10-271-0/+11
| | | | address, just ignore (LTK is enough)
* BTDevice::PairingData::toString(): Fix newline for IRKSven Gothel2021-10-271-1/+1
|
* Fix MgmtLinkKeyInfo::getLinkKey() offsetSven Gothel2021-10-271-1/+1
|
* BTDevice::processDeviceReady(..) Delay revisedSven Gothel2021-10-271-13/+15
| | | | | | | | Give remote slave (peripheral, Gatt-Server) 'some time' (100ms) to complete connection and listening to our Gatt-Client requests. We give the Gatt-Server a slightly longer period after newly paired encryption keys (150ms).
* BTDevice::PairingData::toString(): fix newlineSven Gothel2021-10-271-2/+2
|
* Fix BTDevice::clearSMPStates(..) invocation (round 3)Sven Gothel2021-10-271-2/+2
| | | | | | | | | clearSMPStates() call from BTDevice::disconnect() is - redundant - may cause a deadlock due to mtx_pairing lock Issued at ctor(), manual unpair() and notifyDisconnect() notifyDisconnect() will be called at all times, even if disconnect() fails!
* SMPTypes.cpp: Adding SMPIdentityResolvingKey implementation codeSven Gothel2021-10-271-0/+36
|
* SMPKeyBin (Version 5, C++/Java): Add IRK and (set/get) and also set CSRKSven Gothel2021-10-274-12/+216
|
* BTDevice: SMP Keys (C++/Java): Have setter update PairingData::keys_*_has; ↵Sven Gothel2021-10-275-10/+227
| | | | Expose SMPIdentityResolvingKey (IRK) adding get/set methods; Add setSignatureResolvingKey();
* Add SMPIdentityResolvingKey (C++/Java): Prepare to expose IRKSven Gothel2021-10-272-2/+282
|
* Fix BTDevice::clearSMPStates(..) invocation (round 2)Sven Gothel2021-10-271-2/+2
| | | | | | | | | - BTDevice::notifyConnected(..): Don't issue clearSMPStates() to have valid content from manual settings. Previous disconnect commands should have cleaned these. - BTDevice::remove(): Don't issue clearSMPStates(), disconnect(..) will. - BTDevice::disconnect(): Issue clearSMPStates()!
* Revise BTDevice::PairingData Handling; Fix HCITypes/MgmtTypes Encryption Key ↵Sven Gothel2021-10-274-216/+310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semantics Revise BTDevice::PairingData Handling - BTDevice::PairingData - Add SMPIdentityResolvingKey, replacing uint128_t - Use 'BDAddressAndType id_address_init, id_address_resp' - Add 'toString(const BDAddressAndType& addressAndType, const BTRole& role)' for unified string representation - Add 'encryption_enabled' - checkPairingKeyDistributionComplete() - bring back strict KEY checking (w/ IRK + SIGN) - requires encryption_enabled - drop printKeyDistributionStatus() - BTDevice::updatePairingState() - #if CONSIDER_HCI_CMD_FOR_SMP_STATE - Never override SMP key induced data - Only take HCI Encryption keys in SC mode - In SC mode, LTK is for both, Server + Slave - Add early (pre-pair) MgmtEvent::Opcode::HCI_LE_ENABLE_ENC - Move checkPairingKeyDistributionComplete() and DBG_PRINT to end of switch/if branches, cleaning up workflow. - Reset claimed_state also if any key is invalid (fix) - DBG_PRINT BTDevice::PairingData::toString() - BTDevice::hciSMPMsgCallback() - Move DBG_PRINT to end of switch/if branches, cleaning up workflow. - DBG_PRINT BTDevice::PairingData::toString() ++++ Fix HCITypes/MgmtTypes Encryption Key Semantics, i.e. HCILEEnableEncryptionCmd, HCILELTKReplyAckCmd and HCILELTKReqEvent (+ Mgmt mappings) HCILEEnableEncryptionCmd: - This command shall only be used when the local device’s role is BTRole::Master (initiator). - Encryption key belongs to the remote device having role BTRole::Slave (responder). - The encryption key matches the LTK from SMP messaging in SC mode only! HCILELTKReplyAckCmd: - This command shall only be used when the local device’s role is BTRole::Slave (responder). - LTK belongs to the local device having role BTRole::Slave (responder). - The LTK matches the LTK from SMP messaging in SC mode only! HCILELTKReqEvent - This event shall only be generated when the local device’s role is BTRole::Slave (responder, adapter in peripheral mode). - Rand and Ediv belong to the local device having role BTRole::Slave (responder). - Rand and Ediv matches the LTK from SMP messaging in SC mode only!
* BTDevice: Refine handling define CONSIDER_HCI_CMD_FOR_SMP_STATE (disable ↵Sven Gothel2021-10-271-9/+4
| | | | code in BTDevice::updatePairingState)
* SMPHandler CONSIDER_HCI_CMD_FOR_SMP_STATE=0 (disabled): Continue SC ↵Sven Gothel2021-10-271-1/+1
| | | | | | Peripheral testing w/ 'normal' SMP messaging, .. drop the HCI security related commands for now.