Maxim Integrated / MaximBLE

Dependents:   BLE_Thermometer MAXWSNENV_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers smp_defs.h Source File

smp_defs.h

Go to the documentation of this file.
00001 /*************************************************************************************************/
00002 /*!
00003  *  \file   smp_defs.h
00004  *        
00005  *  \brief  Security manager constants and definitions from the Bluetooth specification.
00006  *
00007  *          $Date: 2011-10-14 21:35:03 -0700 (Fri, 14 Oct 2011) $
00008  *          $Revision: 191 $
00009  *  
00010  *  Copyright (c) 2010-2016 ARM Limited. All rights reserved.
00011  *
00012  *  SPDX-License-Identifier: LicenseRef-PBL
00013  *
00014  *  Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
00015  *  this file except in compliance with the License.  You may obtain a copy of the License at
00016  *
00017  *  https://www.mbed.com/licenses/PBL-1.0
00018  *
00019  *  See the License for the specific language governing permissions and limitations under the License.
00020  */
00021 /*************************************************************************************************/
00022 #ifndef SMP_DEFS_H
00023 #define SMP_DEFS_H
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /**************************************************************************************************
00030   Macros
00031 **************************************************************************************************/
00032 
00033 /*! PDU format */
00034 #define SMP_HDR_LEN                   1         /*! Attribute PDU header length */
00035 
00036 /*! Protocol timeout */
00037 #define SMP_TIMEOUT                   30        /*! Protocol timeout in seconds */
00038 
00039 /*! Encryption key size */
00040 #define SMP_KEY_SIZE_MAX              16        /*! Maximum encryption key size */
00041 #define SMP_KEY_SIZE_MIN              7         /*! Minimum encryption key size */
00042 
00043 /*! OOB and PIN data lengths in bytes */
00044 #define SMP_OOB_LEN                   16
00045 #define SMP_PIN_LEN                   3
00046 
00047 /*! Error codes */
00048 #define SMP_ERR_PASSKEY_ENTRY         0x01      /*! User input of passkey failed */
00049 #define SMP_ERR_OOB                   0x02      /*! OOB data is not available */
00050 #define SMP_ERR_AUTH_REQ              0x03      /*! Authentication requirements cannot be met */
00051 #define SMP_ERR_CONFIRM_VALUE         0x04      /*! Confirm value does not match */
00052 #define SMP_ERR_PAIRING_NOT_SUP       0x05      /*! Pairing is not supported by the device */
00053 #define SMP_ERR_ENC_KEY_SIZE          0x06      /*! Insufficient encryption key size */
00054 #define SMP_ERR_COMMAND_NOT_SUP       0x07      /*! Command not supported */
00055 #define SMP_ERR_UNSPECIFIED           0x08      /*! Unspecified reason */
00056 #define SMP_ERR_ATTEMPTS              0x09      /*! Repeated attempts */
00057 #define SMP_ERR_INVALID_PARAM         0x0A      /*! Invalid parameter or command length */
00058 
00059 /*! Proprietary internal error codes */
00060 #define SMP_ERR_MEMORY                0xE0      /*! Out of memory */
00061 #define SMP_ERR_TIMEOUT               0xE1      /*! Transaction timeout */
00062 
00063 /*! Command codes */
00064 #define SMP_CMD_PAIR_REQ              0x01      /*! Pairing Request */
00065 #define SMP_CMD_PAIR_RSP              0x02      /*! Pairing Response */
00066 #define SMP_CMD_PAIR_CNF              0x03      /*! Pairing Confirm */
00067 #define SMP_CMD_PAIR_RAND             0x04      /*! Pairing Random */
00068 #define SMP_CMD_PAIR_FAIL             0x05      /*! Pairing Failed */
00069 #define SMP_CMD_ENC_INFO              0x06      /*! Encryption Information */
00070 #define SMP_CMD_MASTER_ID             0x07      /*! Master Identification */
00071 #define SMP_CMD_ID_INFO               0x08      /*! Identity Information */
00072 #define SMP_CMD_ID_ADDR_INFO          0x09      /*! Identity Address Information */
00073 #define SMP_CMD_SIGN_INFO             0x0A      /*! Signing Information */
00074 #define SMP_CMD_SECURITY_REQ          0x0B      /*! Security Request */
00075 #define SMP_CMD_MAX                   0x0C      /*! Command code maximum */
00076 
00077 /*! Command packet lengths */
00078 #define SMP_PAIR_REQ_LEN              7
00079 #define SMP_PAIR_RSP_LEN              7
00080 #define SMP_PAIR_CNF_LEN              17
00081 #define SMP_PAIR_RAND_LEN             17
00082 #define SMP_PAIR_FAIL_LEN             2
00083 #define SMP_ENC_INFO_LEN              17
00084 #define SMP_MASTER_ID_LEN             11
00085 #define SMP_ID_INFO_LEN               17
00086 #define SMP_ID_ADDR_INFO_LEN          8
00087 #define SMP_SIGN_INFO_LEN             17
00088 #define SMP_SECURITY_REQ_LEN          2
00089 
00090 /*! I/O capabilities */
00091 #define SMP_IO_DISP_ONLY              0x00      /*! DisplayOnly */
00092 #define SMP_IO_DISP_YES_NO            0x01      /*! DisplayYesNo */
00093 #define SMP_IO_KEY_ONLY               0x02      /*! KeyboardOnly */
00094 #define SMP_IO_NO_IN_NO_OUT           0x03      /*! NoInputNoOutput */
00095 #define SMP_IO_KEY_DISP               0x04      /*! KeyboardDisplay */
00096 
00097 /*! OOB data present */
00098 #define SMP_OOB_DATA_NONE             0x00
00099 #define SMP_OOB_DATA_PRESENT          0x01
00100 
00101 /*! Authentication/security properties bit mask */
00102 #define SMP_AUTH_BOND_MASK            0x03      /*! Mask for bonding bits */
00103 #define SMP_AUTH_BOND_FLAG            0x01      /*! Bonding requested */
00104 #define SMP_AUTH_MITM_FLAG            0x04      /*! MITM (authenticated pairing) requested */
00105 
00106 /*! Key distribution bit mask */
00107 #define SMP_KEY_DIST_ENC              0x01      /*! Distribute LTK */
00108 #define SMP_KEY_DIST_ID               0x02      /*! Distribute IRK */
00109 #define SMP_KEY_DIST_SIGN             0x04      /*! Distribute CSRK */
00110 #define SMP_KEY_DIST_MASK             (SMP_KEY_DIST_ENC | SMP_KEY_DIST_ID | SMP_KEY_DIST_SIGN)
00111 
00112 /*! Various parameter lengths */
00113 #define SMP_RAND_LEN                  16
00114 #define SMP_CONFIRM_LEN               16
00115 #define SMP_KEY_LEN                   16
00116 #define SMP_RAND8_LEN                 8
00117 
00118 #ifdef __cplusplus
00119 };
00120 #endif
00121 
00122 #endif /* SMP_DEFS_H */