Mistake on this page? Email us
Data Structures | Macros

Data Structures

struct  smpCfg_t
 Configurable parameters. More...
 
struct  smpDmPair_t
 Data type for SMP_MSG_API_PAIR_REQ and SMP_MSG_API_PAIR_RSP. More...
 
struct  smpDmAuthRsp_t
 Data type for SMP_MSG_API_AUTH_RSP. More...
 
struct  smpDmKeypress_t
 Data type for SMP_MSG_API_USER_KEYPRESS. More...
 
struct  smpDmSecurityReq_t
 Data type for SMP_MSG_API_SECURITY_REQ. More...
 
union  smpDmMsg_t
 Union SMP DM message data types. More...
 

Macros

#define SMP_HDR_LEN   1
 PDU format. More...
 
#define SMP_TIMEOUT   30
 Protocol timeout. More...
 
#define SMP_OOB_LEN   16
 OOB Data length in bytes.
 
#define SMP_PIN_LEN   3
 Passkey Pin lenght in bytes.
 

SMP Events

Events recognized and handled by the SMP state machine.

enum  {
  SMP_MSG_API_PAIR_REQ = 1, SMP_MSG_API_PAIR_RSP, SMP_MSG_API_CANCEL_REQ, SMP_MSG_API_AUTH_RSP,
  SMP_MSG_API_SECURITY_REQ, SMP_MSG_CMD_PKT, SMP_MSG_CMD_PAIRING_FAILED, SMP_MSG_DM_ENCRYPT_CMPL,
  SMP_MSG_DM_ENCRYPT_FAILED, SMP_MSG_DM_CONN_CLOSE, SMP_MSG_WSF_AES_CMPL, SMP_MSG_INT_SEND_NEXT_KEY,
  SMP_MSG_INT_MAX_ATTEMPTS, SMP_MSG_INT_PAIRING_CMPL, SMP_MSG_INT_RSP_TIMEOUT, SMP_MSG_INT_WI_TIMEOUT,
  SMP_MSG_INT_LESC, SMP_MSG_INT_LEGACY, SMP_MSG_INT_JW_NC, SMP_MSG_INT_PASSKEY,
  SMP_MSG_INT_OOB, SMP_MSG_API_USER_CONFIRM, SMP_MSG_API_USER_KEYPRESS, SMP_MSG_API_KEYPRESS_CMPL,
  SMP_MSG_WSF_ECC_CMPL, SMP_MSG_INT_PK_NEXT, SMP_MSG_INT_PK_CMPL, SMP_MSG_WSF_CMAC_CMPL,
  SMP_MSG_DH_CHECK_FAILURE, SMP_MSG_EARLY_CNF, SMP_NUM_MSGS
}
 Event handler messages for SMP state machines. More...
 
enum  { SMP_DB_SERVICE_IND = SMP_NUM_MSGS }
 Additional SMP messages. More...
 

SMP Initialization Functions

Legacy and Secure Connections initialization for Initiator and Responder roles.

void SmpiInit (void)
 Initialize SMP initiator role. More...
 
void SmprInit (void)
 Initialize SMP responder role. More...
 
void SmpiScInit (void)
 Initialize SMP initiator role utilizing BTLE Secure Connections. More...
 
void SmprScInit (void)
 Initialize SMP responder role utilizing BTLE Secure Connections. More...
 
void SmpNonInit (void)
 Use this SMP init function when SMP is not supported. More...
 

SMP DM Interface Functions

Functions that allow the DM to send messages to SMP.

void SmpDmMsgSend (smpDmMsg_t *pMsg)
 This function is called by DM to send a message to SMP. More...
 
void SmpDmEncryptInd (wsfMsgHdr_t *pMsg)
 This function is called by DM to notify SMP of encrypted link status. More...
 
uint8_t * SmpDmGetStk (dmConnId_t connId, uint8_t *pSecLevel)
 Return the STK for the given connection. More...
 
void SmpScGetCancelMsgWithReattempt (dmConnId_t connId, wsfMsgHdr_t *pHdr, uint8_t status)
 Format a cancel message with consideration for the attempts counter. More...
 
void SmpDbInit (void)
 Initialize the SMP Database. More...
 
void SmpScEnableZeroDhKey (bool_t enable)
 Called to force the DhKey to zero for qualification test purposes. More...
 

SMP Encryption Key Size

#define SMP_KEY_SIZE_MAX   16
 Maximum encryption key size.
 
#define SMP_KEY_SIZE_MIN   7
 Minimum encryption key size.
 

SMP Error Codes

SMP PDU status codes

#define SMP_ERR_PASSKEY_ENTRY   0x01
 User input of passkey failed.
 
#define SMP_ERR_OOB   0x02
 OOB data is not available.
 
#define SMP_ERR_AUTH_REQ   0x03
 Authentication requirements cannot be met.
 
#define SMP_ERR_CONFIRM_VALUE   0x04
 Confirm value does not match.
 
#define SMP_ERR_PAIRING_NOT_SUP   0x05
 Pairing is not supported by the device.
 
#define SMP_ERR_ENC_KEY_SIZE   0x06
 Insufficient encryption key size.
 
#define SMP_ERR_COMMAND_NOT_SUP   0x07
 Command not supported.
 
#define SMP_ERR_UNSPECIFIED   0x08
 Unspecified reason.
 
#define SMP_ERR_ATTEMPTS   0x09
 Repeated attempts.
 
#define SMP_ERR_INVALID_PARAM   0x0A
 Invalid parameter or command length.
 
#define SMP_ERR_DH_KEY_CHECK   0x0B
 DH Key check did not match.
 
#define SMP_ERR_NUMERIC_COMPARISON   0x0C
 Numeric comparison did not match.
 
#define SMP_ERR_BR_EDR_IN_PROGRESS   0x0D
 BR/EDR in progress.
 
#define SMP_ERR_CROSS_TRANSPORT   0x0E
 BR/EDR cross transport key generation not allowed.
 

Proprietary Error Codes

Internal error codes not sent in any SMP PDU.

#define SMP_ERR_MEMORY   0xE0
 Out of memory.
 
#define SMP_ERR_TIMEOUT   0xE1
 Transaction timeout.
 

SMP PDU Codes

SMP PDU Code describing command received or sent.

#define SMP_CMD_PAIR_REQ   0x01
 Pairing request.
 
#define SMP_CMD_PAIR_RSP   0x02
 Pairing response.
 
#define SMP_CMD_PAIR_CNF   0x03
 Pairing confirm.
 
#define SMP_CMD_PAIR_RAND   0x04
 Pairing random.
 
#define SMP_CMD_PAIR_FAIL   0x05
 Pairing failed.
 
#define SMP_CMD_ENC_INFO   0x06
 Encryption information.
 
#define SMP_CMD_MASTER_ID   0x07
 Master identification.
 
#define SMP_CMD_ID_INFO   0x08
 Identity information.
 
#define SMP_CMD_ID_ADDR_INFO   0x09
 Identity address information.
 
#define SMP_CMD_SIGN_INFO   0x0A
 Signing information.
 
#define SMP_CMD_SECURITY_REQ   0x0B
 Security fequest.
 
#define SMP_CMD_PUBLIC_KEY   0x0C
 Public Kkey.
 
#define SMP_CMD_DHKEY_CHECK   0x0D
 DH Key check.
 
#define SMP_CMD_KEYPRESS   0x0E
 User key press.
 
#define SMP_CMD_MAX   0x0F
 Command code maximum.
 

SMP PDU Packet Lengths

Fixed length of the PDU to be sent.

#define SMP_PAIR_REQ_LEN   7
 Pairing request message length.
 
#define SMP_PAIR_RSP_LEN   7
 Pairing response message length.
 
#define SMP_PAIR_CNF_LEN   17
 Pairing confirmation message length.
 
#define SMP_PAIR_RAND_LEN   17
 Pairing random message length.
 
#define SMP_PAIR_FAIL_LEN   2
 Pairing fail message length.
 
#define SMP_ENC_INFO_LEN   17
 Encryption information message length.
 
#define SMP_MASTER_ID_LEN   11
 Master identification messagelength.
 
#define SMP_ID_INFO_LEN   17
 Identity information message length.
 
#define SMP_ID_ADDR_INFO_LEN   8
 Identity address information message length.
 
#define SMP_SIGN_INFO_LEN   17
 Signing information message length.
 
#define SMP_SECURITY_REQ_LEN   2
 Security request message length.
 
#define SMP_PUB_KEY_MSG_LEN   (1 + 2*SMP_PUB_KEY_LEN)
 Public key message length.
 
#define SMP_DHKEY_CHECK_MSG_LEN   (1 + SMP_DHKEY_CHECK_LEN)
 Diffie-Hellman key check message length.
 
#define SMP_KEYPRESS_MSG_LEN   2
 Keypress message length.
 

SMP I/O Capabilities

I/O capabilities codes to be set for SMP_CMD_PAIR_REQ and SMP_CMD_PAIR_RSP

#define SMP_IO_DISP_ONLY   0x00
 Display only.
 
#define SMP_IO_DISP_YES_NO   0x01
 Display yes/no.
 
#define SMP_IO_KEY_ONLY   0x02
 Keyboard only.
 
#define SMP_IO_NO_IN_NO_OUT   0x03
 No input, no output.
 
#define SMP_IO_KEY_DISP   0x04
 Keyboard display.
 

SMP OOB Data Flag

Out-of-Band codes to be set for SMP_CMD_PAIR_REQ and SMP_CMD_PAIR_RSP

#define SMP_OOB_DATA_NONE   0x00
 No OOB data from the remote device is present.
 
#define SMP_OOB_DATA_PRESENT   0x01
 OOB data from the remote device is present.
 

SMP Authentication Requirements Flags

Authentication Requirements Flags to be set for SMP_CMD_PAIR_REQ and SMP_CMD_PAIR_RSP.

#define SMP_AUTH_BOND_MASK   0x03
 Mask for bonding bits.
 
#define SMP_AUTH_BOND_FLAG   0x01
 Bonding requested.
 
#define SMP_AUTH_MITM_FLAG   0x04
 MITM (authenticated pairing) requested.
 
#define SMP_AUTH_SC_FLAG   0x08
 LE Secure Connections requested.
 
#define SMP_AUTH_KP_FLAG   0x10
 Keypress notifications requested.
 

SMP Key Distribution Flags

Flags of security keys this device is requesting to be distribution once pairing completes.

#define SMP_KEY_DIST_ENC   0x01
 Distribute LTK.
 
#define SMP_KEY_DIST_ID   0x02
 Distribute IRK.
 
#define SMP_KEY_DIST_SIGN   0x04
 Distribute CSRK.
 
#define SMP_KEY_DIST_MASK   (SMP_KEY_DIST_ENC | SMP_KEY_DIST_ID | SMP_KEY_DIST_SIGN)
 Key distribution mask.
 

SMP LE Secure Connection Keypress Codes

Keypress codes found in SMP_CMD_KEYPRESS PDU to be sent on the respective action when the SMP_AUTH_KP_FLAG is set in both the SMP_CMD_PAIR_REQ and SMP_CMD_PAIR_RSP.

#define SMP_PASSKEY_ENTRY_STARTED   0x00
 Passkey entry started keypress type.
 
#define SMP_PASSKEY_DIGIT_ENTERED   0x01
 Passkey digit entered keypress type.
 
#define SMP_PASSKEY_DIGIT_ERASED   0x02
 Passkey digit erased keypress type.
 
#define SMP_PASSKEY_CLEARED   0x03
 Passkey cleared keypress type.
 
#define SMP_PASSKEY_ENTRY_COMPLETED   0x04
 Passkey entry complete keypress type.
 

SMP Value Length Constants

Lengths of various keys and values.

#define SMP_RAND_LEN   16
 Random number length.
 
#define SMP_CONFIRM_LEN   16
 Confirm number length.
 
#define SMP_KEY_LEN   16
 Key length.
 
#define SMP_RAND8_LEN   8
 Random 8-byte number length.
 
#define SMP_PRIVATE_KEY_LEN   32
 Secure connections private key length.
 
#define SMP_PUB_KEY_LEN   32
 Secure connecdtions public key length.
 
#define SMP_DHKEY_LEN   32
 Secure connection Diffie-Hellman key length.
 
#define SMP_DHKEY_CHECK_LEN   16
 Secure connection Diffie-Hellman key check length.
 

CMAC Input Lengths Constants

Input lengths of SMP cryptopgraphic toolbox functions.

#define SMP_F4_TEXT_LEN   (SMP_PUB_KEY_LEN * 2 + 1)
 F4 input length.
 
#define SMP_G2_TEXT_LEN   (SMP_PUB_KEY_LEN * 2 + SMP_RAND_LEN)
 G2 input length.
 
#define SMP_F5_TKEY_TEXT_LEN   (SMP_DHKEY_LEN)
 F5 Temporary key input length.
 
#define SMP_F5_TEXT_LEN   (9 + 2*BDA_ADDR_LEN + 2*SMP_RAND_LEN)
 F5 input length.
 
#define SMP_F6_TEXT_LEN   (2*BDA_ADDR_LEN + 3*SMP_RAND_LEN + 5)
 F6 input length.
 

Detailed Description

Macro Definition Documentation

#define SMP_HDR_LEN   1

PDU format.

Attribute PDU header length.

Definition at line 34 of file smp_defs.h.

#define SMP_TIMEOUT   30

Protocol timeout.

Protocol timeout in seconds.

Definition at line 37 of file smp_defs.h.

Enumeration Type Documentation

anonymous enum

Event handler messages for SMP state machines.

Enumerator
SMP_MSG_API_PAIR_REQ 

API pairing request.

SMP_MSG_API_PAIR_RSP 

API pairing response.

SMP_MSG_API_CANCEL_REQ 

API cancel request.

SMP_MSG_API_AUTH_RSP 

API pin response.

SMP_MSG_API_SECURITY_REQ 

API security request.

SMP_MSG_CMD_PKT 

SMP command packet received.

SMP_MSG_CMD_PAIRING_FAILED 

SMP pairing failed packet received.

SMP_MSG_DM_ENCRYPT_CMPL 

Link encrypted.

SMP_MSG_DM_ENCRYPT_FAILED 

Link encryption failed.

SMP_MSG_DM_CONN_CLOSE 

Connection closed.

SMP_MSG_WSF_AES_CMPL 

AES calculation complete.

SMP_MSG_INT_SEND_NEXT_KEY 

Send next key to be distributed.

SMP_MSG_INT_MAX_ATTEMPTS 

Maximum pairing attempts reached.

SMP_MSG_INT_PAIRING_CMPL 

Pairing complete.

SMP_MSG_INT_RSP_TIMEOUT 

Pairing protocol response timeout.

SMP_MSG_INT_WI_TIMEOUT 

Pairing protocol wait interval timeout.

SMP_MSG_INT_LESC 

Pair with Secure Connections.

SMP_MSG_INT_LEGACY 

Pair with Legacy Security.

SMP_MSG_INT_JW_NC 

LESC Just-Works/Numeric Comparison pairing.

SMP_MSG_INT_PASSKEY 

LESC Passkey pairing.

SMP_MSG_INT_OOB 

LESC Out-of-Band Pairing.

SMP_MSG_API_USER_CONFIRM 

User confirms valid numeric comparison.

SMP_MSG_API_USER_KEYPRESS 

User keypress in passkey pairing.

SMP_MSG_API_KEYPRESS_CMPL 

User keypress complete in passkey pairing.

SMP_MSG_WSF_ECC_CMPL 

WSF ECC operation complete.

SMP_MSG_INT_PK_NEXT 

Continue to next passkey bit.

SMP_MSG_INT_PK_CMPL 

Passkey operation complete.

SMP_MSG_WSF_CMAC_CMPL 

WSF CMAC operation complete.

SMP_MSG_DH_CHECK_FAILURE 

DHKey check failure.

SMP_MSG_EARLY_CNF 

An early Confirm from the initiator in passkey pairing.

SMP_NUM_MSGS 

Number of SMP message types.

Definition at line 42 of file smp_api.h.

43 {
44  SMP_MSG_API_PAIR_REQ = 1, /*!< \brief API pairing request */
45  SMP_MSG_API_PAIR_RSP, /*!< \brief API pairing response */
46  SMP_MSG_API_CANCEL_REQ, /*!< \brief API cancel request */
47  SMP_MSG_API_AUTH_RSP, /*!< \brief API pin response */
48  SMP_MSG_API_SECURITY_REQ, /*!< \brief API security request */
49  SMP_MSG_CMD_PKT, /*!< \brief SMP command packet received */
50  SMP_MSG_CMD_PAIRING_FAILED, /*!< \brief SMP pairing failed packet received */
51  SMP_MSG_DM_ENCRYPT_CMPL, /*!< \brief Link encrypted */
52  SMP_MSG_DM_ENCRYPT_FAILED, /*!< \brief Link encryption failed */
53  SMP_MSG_DM_CONN_CLOSE, /*!< \brief Connection closed */
54  SMP_MSG_WSF_AES_CMPL, /*!< \brief AES calculation complete */
55  SMP_MSG_INT_SEND_NEXT_KEY, /*!< \brief Send next key to be distributed */
56  SMP_MSG_INT_MAX_ATTEMPTS, /*!< \brief Maximum pairing attempts reached */
57  SMP_MSG_INT_PAIRING_CMPL, /*!< \brief Pairing complete */
58  SMP_MSG_INT_RSP_TIMEOUT, /*!< \brief Pairing protocol response timeout */
59  SMP_MSG_INT_WI_TIMEOUT, /*!< \brief Pairing protocol wait interval timeout */
60  SMP_MSG_INT_LESC, /*!< \brief Pair with Secure Connections */
61  SMP_MSG_INT_LEGACY, /*!< \brief Pair with Legacy Security */
62  SMP_MSG_INT_JW_NC, /*!< \brief LESC Just-Works/Numeric Comparison pairing */
63  SMP_MSG_INT_PASSKEY, /*!< \brief LESC Passkey pairing */
64  SMP_MSG_INT_OOB, /*!< \brief LESC Out-of-Band Pairing */
65  SMP_MSG_API_USER_CONFIRM, /*!< \brief User confirms valid numeric comparison */
66  SMP_MSG_API_USER_KEYPRESS, /*!< \brief User keypress in passkey pairing */
67  SMP_MSG_API_KEYPRESS_CMPL, /*!< \brief User keypress complete in passkey pairing */
68  SMP_MSG_WSF_ECC_CMPL, /*!< \brief WSF ECC operation complete */
69  SMP_MSG_INT_PK_NEXT, /*!< \brief Continue to next passkey bit */
70  SMP_MSG_INT_PK_CMPL, /*!< \brief Passkey operation complete */
71  SMP_MSG_WSF_CMAC_CMPL, /*!< \brief WSF CMAC operation complete */
72  SMP_MSG_DH_CHECK_FAILURE, /*!< \brief DHKey check failure */
73  SMP_MSG_EARLY_CNF, /*!< \brief An early Confirm from the initiator in passkey pairing */
74  SMP_NUM_MSGS /*!< \brief Number of SMP message types. */
75 };
Link encryption failed.
Definition: smp_api.h:52
API security request.
Definition: smp_api.h:48
API pin response.
Definition: smp_api.h:47
Continue to next passkey bit.
Definition: smp_api.h:69
LESC Just-Works/Numeric Comparison pairing.
Definition: smp_api.h:62
LESC Out-of-Band Pairing.
Definition: smp_api.h:64
User keypress in passkey pairing.
Definition: smp_api.h:66
An early Confirm from the initiator in passkey pairing.
Definition: smp_api.h:73
API cancel request.
Definition: smp_api.h:46
LESC Passkey pairing.
Definition: smp_api.h:63
User confirms valid numeric comparison.
Definition: smp_api.h:65
AES calculation complete.
Definition: smp_api.h:54
WSF CMAC operation complete.
Definition: smp_api.h:71
Maximum pairing attempts reached.
Definition: smp_api.h:56
WSF ECC operation complete.
Definition: smp_api.h:68
Passkey operation complete.
Definition: smp_api.h:70
Pairing protocol wait interval timeout.
Definition: smp_api.h:59
SMP command packet received.
Definition: smp_api.h:49
Send next key to be distributed.
Definition: smp_api.h:55
Link encrypted.
Definition: smp_api.h:51
User keypress complete in passkey pairing.
Definition: smp_api.h:67
Connection closed.
Definition: smp_api.h:53
SMP pairing failed packet received.
Definition: smp_api.h:50
Pair with Legacy Security.
Definition: smp_api.h:61
DHKey check failure.
Definition: smp_api.h:72
API pairing response.
Definition: smp_api.h:45
API pairing request.
Definition: smp_api.h:44
Number of SMP message types.
Definition: smp_api.h:74
Pair with Secure Connections.
Definition: smp_api.h:60
Pairing complete.
Definition: smp_api.h:57
Pairing protocol response timeout.
Definition: smp_api.h:58
anonymous enum

Additional SMP messages.

Enumerator
SMP_DB_SERVICE_IND 

SMP DB Service timer indication.

Definition at line 80 of file smp_api.h.

81 {
82  SMP_DB_SERVICE_IND = SMP_NUM_MSGS /*!< \brief SMP DB Service timer indication */
83 };
SMP DB Service timer indication.
Definition: smp_api.h:82
Number of SMP message types.
Definition: smp_api.h:74

Function Documentation

void SmpiInit ( void  )

Initialize SMP initiator role.

Returns
None.
void SmprInit ( void  )

Initialize SMP responder role.

Returns
None.
void SmpiScInit ( void  )

Initialize SMP initiator role utilizing BTLE Secure Connections.

Returns
None.
void SmprScInit ( void  )

Initialize SMP responder role utilizing BTLE Secure Connections.

Returns
None.
void SmpNonInit ( void  )

Use this SMP init function when SMP is not supported.

Returns
None.
void SmpDmMsgSend ( smpDmMsg_t pMsg)

This function is called by DM to send a message to SMP.

Parameters
pMsgPointer to message structure.
Returns
None.
void SmpDmEncryptInd ( wsfMsgHdr_t *  pMsg)

This function is called by DM to notify SMP of encrypted link status.

Parameters
pMsgPointer to HCI message structure.
Returns
None.
uint8_t* SmpDmGetStk ( dmConnId_t  connId,
uint8_t *  pSecLevel 
)

Return the STK for the given connection.

Parameters
connIdConnection identifier.
pSecLevelReturns the security level of pairing when STK was created.
Returns
Pointer to STK or NULL if not available.
void SmpScGetCancelMsgWithReattempt ( dmConnId_t  connId,
wsfMsgHdr_t *  pHdr,
uint8_t  status 
)

Format a cancel message with consideration for the attempts counter.

Parameters
connIdConnection Id.
pHdrPointer to header of message to fill.
statusStatus to include.
Returns
none.
void SmpDbInit ( void  )

Initialize the SMP Database.

Returns
None.
void SmpScEnableZeroDhKey ( bool_t  enable)

Called to force the DhKey to zero for qualification test purposes.

Parameters
enableTRUE - Force DhKey to zero. FALSE - Use calculated key
Returns
None.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.