67 #define DISPLAY_ONLY 0x00
68 #define DISPLAY_YES_NO 0x01
69 #define KEYBOARD_ONLY 0x02
70 #define NO_INPUT_NO_OUTPUT 0x03
71 #define KEYBOARD_DISPLAY 0x04
74 #define SM_AUTH_MITM_MASK(a) (((a) & 0x04) >> 2)
79 #define SM_PASSKEY_TYPE_INPUT 0x01
80 #define SM_PASSKEY_TYPE_DISPLAY 0x02
87 #define SM_AUTH_REQ_NO_BONDING 0x00
88 #define SM_AUTH_REQ_BONDING 0x01
93 #define SM_AUTH_STATE_AUTHENTICATED 0x04
94 #define SM_AUTH_STATE_BONDING 0x01
95 #define SM_AUTH_STATE_SECURECONNECTION 0x08
97 #define SM_ECC_KEY_LEN 32 // ECC Key length in bytes
100 #define SM_ECC_KEYS_NOT_AVAILABLE 0xFF // Initial state of recycled keys before they exist.
101 #define SM_ECC_KEYS_REGNENERATE_NEVER 0xFF // Never regenerate the keys.
102 #define SM_ECC_KEYS_REGENERATE_ALWAYS 0x00 // Always regenerate the keys.
107 #define SM_ECC_KEYS_EVENT 0x00 // ECC Keys
108 #define SM_DH_KEY_EVENT 0x01 // Diffie-Hellman key
144 uint8 privateKey[SM_ECC_KEY_LEN];
145 uint8 publicKeyX[SM_ECC_KEY_LEN];
146 uint8 publicKeyY[SM_ECC_KEY_LEN];
157 uint8 dhKey[SM_ECC_KEY_LEN];
165 unsigned int sEncKey:1;
166 unsigned int sIdKey:1;
167 unsigned int sSign:1;
168 unsigned int sLinkKey:1;
169 unsigned int sReserved:4;
170 unsigned int mEncKey:1;
171 unsigned int mIdKey:1;
172 unsigned int mSign:1;
173 unsigned int mLinkKey:1;
174 unsigned int mReserved:4;
183 uint8 sK[SM_ECC_KEY_LEN];
184 uint8 pK_x[SM_ECC_KEY_LEN];
185 uint8 pK_y[SM_ECC_KEY_LEN];
241 unsigned int bonding:2;
245 unsigned int reserved:3;
276 extern void SM_RegisterTask( uint8 taskID );
299 extern bStatus_t SM_GetDHKey( uint8 *secretKey, uint8 *publicKeyX,
313 extern bStatus_t SM_GetScConfirmOob( uint8 *publicKey, uint8 *oob, uint8 *pOut );
343 uint16 connectionHandle,
360 uint16 div, uint8 *pRandNum,
391 #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
414 #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
460 uint8 authentication,
500 extern void SM_Init( uint8 task_id );
512 extern uint16 SM_ProcessEvent( uint8 task_id, uint16 events );
uint8 oobAvailable
True if remote Out-of-band key available.
Definition: sm.h:194
uint8 opcode
SM_DH_KEY_EVENT.
Definition: sm.h:156
bStatus_t SM_PasskeyUpdate(uint8 *pPasskey, uint16 connectionHandle)
Update the passkey for the pairing process.
This API allows the software components in the Z-Stack to be written independently of the specifics o...
bStatus_t SM_ResolveRandomAddrs(uint8 *pIRK, uint8 *pAddr)
Resolve a Private Resolvable Address.
uint8 isSCOnlyMode
TRUE if Secure Connections Only Mode. Secure Connections only.
Definition: sm.h:199
#define B_RANDOM_NUM_SIZE
BLE Random Number Size.
Definition: bcomdef.h:149
bStatus_t SM_StartPairing(uint8 initiator, uint8 taskID, uint16 connectionHandle, smLinkSecurityReq_t *pSecReqs)
Start the pairing process. This function is also called if the device is already bound.
bStatus_t SM_NewRandKey(uint8 taskID)
Generate a key with a random value.
uint8 maxEncKeySize
Maximum Encryption Key size (7-16 bytes)
Definition: sm.h:203
uint8 addrType
Address type for BD_ADDR.
Definition: sm.h:223
void SM_SetECCRegenerationCount(uint8 count)
Update the regeneration count for ECC key re-usage.
uint8 authReq
Authentication Requirements.
Definition: sm.h:201
bStatus_t SM_ResponderInit(void)
Initialize SM Responder on a slave device.
bStatus_t SM_GetEccKeys(void)
Get ECC private and public keys. Keys are returned through the callback registered in SM_RegisterCb...
void(* smCB_t)(uint8 *secretKey, uint8 *publicKeyX, uint8 *publicKeyY)
Definition: sm.h:252
uint8 keySize
LTK Key Size (7-16 bytes)
Definition: sm.h:214
uint8 ioCaps
I/O Capabilities (ie.
Definition: sm.h:193
osal_event_hdr_t hdr
SM_MSG_EVENT and status.
Definition: sm.h:142
LE Generate DHKey Complete Event.
Definition: hci.h:1168
smEccKeys_t eccKeys
Optionally specified ECC keys for pairing. Secure Connections only.
Definition: sm.h:200
uint8 isUsed
FALSE if not used. USE_PKEYS if public keys only. USE_ALL_KEYS if public and private keys...
Definition: sm.h:182
Type definitions and macros for BLE stack.
uint8 opcode
SM_ECC_KEYS_EVENT.
Definition: sm.h:143
OSAL Event Header.
Definition: osal.h:110
uint8 localOobAvailable
True if local Out-of-band key available. Secure Connections only.
Definition: sm.h:197
uint16 div
LTK Diversifier.
Definition: sm.h:212
bStatus_t SM_CalcRandomAddr(uint8 *pIRK, uint8 *pNewAddr)
Calculate a new Private Resolvable address.
osal_event_hdr_t hdr
SM_MSG_EVENT and status.
Definition: sm.h:155
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:131
bStatus_t SM_StartEncryption(uint16 connHandle, uint8 *pLTK, uint16 div, uint8 *pRandNum, uint8 keyLen)
Send Start Encrypt through HCI.
bStatus_t SM_InitiatorInit(void)
Initialize SM Initiator on a master device.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:243
bStatus_t SM_GenerateAuthenSig(uint8 *pData, uint16 len, uint8 *pAuthenSig)
Generate an outgoing Authentication Signature.
uint32 signCounter
Sign Counter.
Definition: sm.h:233
LE Read P256 Public Key Complete Event.
Definition: hci.h:1159
bStatus_t SM_VerifyAuthenSig(uint16 connHandle, uint8 authentication, uint8 *pData, uint16 len, uint8 *pAuthenSig)
Verify an Authentication Signature.
#define KEYLEN
Default key length.
Definition: bcomdef.h:134
osal_event_hdr_t hdr
SM_NEW_RAND_KEY_EVENT and status.
Definition: sm.h:123
keyDist_t keyDist
Key Distribution mask.
Definition: sm.h:202
bStatus_t SM_Encrypt(uint8 *pKey, uint8 *pPlainText, uint8 *pResult)
Encrypt the plain text data with the key..