Maxim Integrated Bluetooth LE Library

Dependents:   BLE_Thermometer MAXWSNENV_demo

Committer:
enginerd
Date:
Thu Mar 03 14:13:21 2016 +0000
Revision:
0:b562096246b3
Initial commit of Maxim Integrated Bluetooth LE Library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
enginerd 0:b562096246b3 1 /*************************************************************************************************/
enginerd 0:b562096246b3 2 /*!
enginerd 0:b562096246b3 3 * \file smp_defs.h
enginerd 0:b562096246b3 4 *
enginerd 0:b562096246b3 5 * \brief Security manager constants and definitions from the Bluetooth specification.
enginerd 0:b562096246b3 6 *
enginerd 0:b562096246b3 7 * $Date: 2011-10-14 21:35:03 -0700 (Fri, 14 Oct 2011) $
enginerd 0:b562096246b3 8 * $Revision: 191 $
enginerd 0:b562096246b3 9 *
enginerd 0:b562096246b3 10 * Copyright (c) 2010-2016 ARM Limited. All rights reserved.
enginerd 0:b562096246b3 11 *
enginerd 0:b562096246b3 12 * SPDX-License-Identifier: LicenseRef-PBL
enginerd 0:b562096246b3 13 *
enginerd 0:b562096246b3 14 * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
enginerd 0:b562096246b3 15 * this file except in compliance with the License. You may obtain a copy of the License at
enginerd 0:b562096246b3 16 *
enginerd 0:b562096246b3 17 * https://www.mbed.com/licenses/PBL-1.0
enginerd 0:b562096246b3 18 *
enginerd 0:b562096246b3 19 * See the License for the specific language governing permissions and limitations under the License.
enginerd 0:b562096246b3 20 */
enginerd 0:b562096246b3 21 /*************************************************************************************************/
enginerd 0:b562096246b3 22 #ifndef SMP_DEFS_H
enginerd 0:b562096246b3 23 #define SMP_DEFS_H
enginerd 0:b562096246b3 24
enginerd 0:b562096246b3 25 #ifdef __cplusplus
enginerd 0:b562096246b3 26 extern "C" {
enginerd 0:b562096246b3 27 #endif
enginerd 0:b562096246b3 28
enginerd 0:b562096246b3 29 /**************************************************************************************************
enginerd 0:b562096246b3 30 Macros
enginerd 0:b562096246b3 31 **************************************************************************************************/
enginerd 0:b562096246b3 32
enginerd 0:b562096246b3 33 /*! PDU format */
enginerd 0:b562096246b3 34 #define SMP_HDR_LEN 1 /*! Attribute PDU header length */
enginerd 0:b562096246b3 35
enginerd 0:b562096246b3 36 /*! Protocol timeout */
enginerd 0:b562096246b3 37 #define SMP_TIMEOUT 30 /*! Protocol timeout in seconds */
enginerd 0:b562096246b3 38
enginerd 0:b562096246b3 39 /*! Encryption key size */
enginerd 0:b562096246b3 40 #define SMP_KEY_SIZE_MAX 16 /*! Maximum encryption key size */
enginerd 0:b562096246b3 41 #define SMP_KEY_SIZE_MIN 7 /*! Minimum encryption key size */
enginerd 0:b562096246b3 42
enginerd 0:b562096246b3 43 /*! OOB and PIN data lengths in bytes */
enginerd 0:b562096246b3 44 #define SMP_OOB_LEN 16
enginerd 0:b562096246b3 45 #define SMP_PIN_LEN 3
enginerd 0:b562096246b3 46
enginerd 0:b562096246b3 47 /*! Error codes */
enginerd 0:b562096246b3 48 #define SMP_ERR_PASSKEY_ENTRY 0x01 /*! User input of passkey failed */
enginerd 0:b562096246b3 49 #define SMP_ERR_OOB 0x02 /*! OOB data is not available */
enginerd 0:b562096246b3 50 #define SMP_ERR_AUTH_REQ 0x03 /*! Authentication requirements cannot be met */
enginerd 0:b562096246b3 51 #define SMP_ERR_CONFIRM_VALUE 0x04 /*! Confirm value does not match */
enginerd 0:b562096246b3 52 #define SMP_ERR_PAIRING_NOT_SUP 0x05 /*! Pairing is not supported by the device */
enginerd 0:b562096246b3 53 #define SMP_ERR_ENC_KEY_SIZE 0x06 /*! Insufficient encryption key size */
enginerd 0:b562096246b3 54 #define SMP_ERR_COMMAND_NOT_SUP 0x07 /*! Command not supported */
enginerd 0:b562096246b3 55 #define SMP_ERR_UNSPECIFIED 0x08 /*! Unspecified reason */
enginerd 0:b562096246b3 56 #define SMP_ERR_ATTEMPTS 0x09 /*! Repeated attempts */
enginerd 0:b562096246b3 57 #define SMP_ERR_INVALID_PARAM 0x0A /*! Invalid parameter or command length */
enginerd 0:b562096246b3 58
enginerd 0:b562096246b3 59 /*! Proprietary internal error codes */
enginerd 0:b562096246b3 60 #define SMP_ERR_MEMORY 0xE0 /*! Out of memory */
enginerd 0:b562096246b3 61 #define SMP_ERR_TIMEOUT 0xE1 /*! Transaction timeout */
enginerd 0:b562096246b3 62
enginerd 0:b562096246b3 63 /*! Command codes */
enginerd 0:b562096246b3 64 #define SMP_CMD_PAIR_REQ 0x01 /*! Pairing Request */
enginerd 0:b562096246b3 65 #define SMP_CMD_PAIR_RSP 0x02 /*! Pairing Response */
enginerd 0:b562096246b3 66 #define SMP_CMD_PAIR_CNF 0x03 /*! Pairing Confirm */
enginerd 0:b562096246b3 67 #define SMP_CMD_PAIR_RAND 0x04 /*! Pairing Random */
enginerd 0:b562096246b3 68 #define SMP_CMD_PAIR_FAIL 0x05 /*! Pairing Failed */
enginerd 0:b562096246b3 69 #define SMP_CMD_ENC_INFO 0x06 /*! Encryption Information */
enginerd 0:b562096246b3 70 #define SMP_CMD_MASTER_ID 0x07 /*! Master Identification */
enginerd 0:b562096246b3 71 #define SMP_CMD_ID_INFO 0x08 /*! Identity Information */
enginerd 0:b562096246b3 72 #define SMP_CMD_ID_ADDR_INFO 0x09 /*! Identity Address Information */
enginerd 0:b562096246b3 73 #define SMP_CMD_SIGN_INFO 0x0A /*! Signing Information */
enginerd 0:b562096246b3 74 #define SMP_CMD_SECURITY_REQ 0x0B /*! Security Request */
enginerd 0:b562096246b3 75 #define SMP_CMD_MAX 0x0C /*! Command code maximum */
enginerd 0:b562096246b3 76
enginerd 0:b562096246b3 77 /*! Command packet lengths */
enginerd 0:b562096246b3 78 #define SMP_PAIR_REQ_LEN 7
enginerd 0:b562096246b3 79 #define SMP_PAIR_RSP_LEN 7
enginerd 0:b562096246b3 80 #define SMP_PAIR_CNF_LEN 17
enginerd 0:b562096246b3 81 #define SMP_PAIR_RAND_LEN 17
enginerd 0:b562096246b3 82 #define SMP_PAIR_FAIL_LEN 2
enginerd 0:b562096246b3 83 #define SMP_ENC_INFO_LEN 17
enginerd 0:b562096246b3 84 #define SMP_MASTER_ID_LEN 11
enginerd 0:b562096246b3 85 #define SMP_ID_INFO_LEN 17
enginerd 0:b562096246b3 86 #define SMP_ID_ADDR_INFO_LEN 8
enginerd 0:b562096246b3 87 #define SMP_SIGN_INFO_LEN 17
enginerd 0:b562096246b3 88 #define SMP_SECURITY_REQ_LEN 2
enginerd 0:b562096246b3 89
enginerd 0:b562096246b3 90 /*! I/O capabilities */
enginerd 0:b562096246b3 91 #define SMP_IO_DISP_ONLY 0x00 /*! DisplayOnly */
enginerd 0:b562096246b3 92 #define SMP_IO_DISP_YES_NO 0x01 /*! DisplayYesNo */
enginerd 0:b562096246b3 93 #define SMP_IO_KEY_ONLY 0x02 /*! KeyboardOnly */
enginerd 0:b562096246b3 94 #define SMP_IO_NO_IN_NO_OUT 0x03 /*! NoInputNoOutput */
enginerd 0:b562096246b3 95 #define SMP_IO_KEY_DISP 0x04 /*! KeyboardDisplay */
enginerd 0:b562096246b3 96
enginerd 0:b562096246b3 97 /*! OOB data present */
enginerd 0:b562096246b3 98 #define SMP_OOB_DATA_NONE 0x00
enginerd 0:b562096246b3 99 #define SMP_OOB_DATA_PRESENT 0x01
enginerd 0:b562096246b3 100
enginerd 0:b562096246b3 101 /*! Authentication/security properties bit mask */
enginerd 0:b562096246b3 102 #define SMP_AUTH_BOND_MASK 0x03 /*! Mask for bonding bits */
enginerd 0:b562096246b3 103 #define SMP_AUTH_BOND_FLAG 0x01 /*! Bonding requested */
enginerd 0:b562096246b3 104 #define SMP_AUTH_MITM_FLAG 0x04 /*! MITM (authenticated pairing) requested */
enginerd 0:b562096246b3 105
enginerd 0:b562096246b3 106 /*! Key distribution bit mask */
enginerd 0:b562096246b3 107 #define SMP_KEY_DIST_ENC 0x01 /*! Distribute LTK */
enginerd 0:b562096246b3 108 #define SMP_KEY_DIST_ID 0x02 /*! Distribute IRK */
enginerd 0:b562096246b3 109 #define SMP_KEY_DIST_SIGN 0x04 /*! Distribute CSRK */
enginerd 0:b562096246b3 110 #define SMP_KEY_DIST_MASK (SMP_KEY_DIST_ENC | SMP_KEY_DIST_ID | SMP_KEY_DIST_SIGN)
enginerd 0:b562096246b3 111
enginerd 0:b562096246b3 112 /*! Various parameter lengths */
enginerd 0:b562096246b3 113 #define SMP_RAND_LEN 16
enginerd 0:b562096246b3 114 #define SMP_CONFIRM_LEN 16
enginerd 0:b562096246b3 115 #define SMP_KEY_LEN 16
enginerd 0:b562096246b3 116 #define SMP_RAND8_LEN 8
enginerd 0:b562096246b3 117
enginerd 0:b562096246b3 118 #ifdef __cplusplus
enginerd 0:b562096246b3 119 };
enginerd 0:b562096246b3 120 #endif
enginerd 0:b562096246b3 121
enginerd 0:b562096246b3 122 #endif /* SMP_DEFS_H */