Fawwaz Nadzmy / mbed-STM

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Tue Nov 08 17:45:16 2016 +0000
Revision:
150:02e0a0aed4ec
Parent:
149:156823d33999
This updates the lib to the mbed lib v129

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /*************************************************************************************************/
<> 144:ef7eb2e8f9f7 2 /*!
<> 144:ef7eb2e8f9f7 3 * \file smp_defs.h
<> 150:02e0a0aed4ec 4 *
<> 144:ef7eb2e8f9f7 5 * \brief Security manager constants and definitions from the Bluetooth specification.
<> 144:ef7eb2e8f9f7 6 *
<> 150:02e0a0aed4ec 7 * $Date: 2015-10-15 10:06:43 -0700 (Thu, 15 Oct 2015) $
<> 144:ef7eb2e8f9f7 8 * $Revision: 4216 $
<> 150:02e0a0aed4ec 9 *
<> 150:02e0a0aed4ec 10 * Copyright (c) 2010 Wicentric, Inc., all rights reserved.
<> 150:02e0a0aed4ec 11 * Wicentric confidential and proprietary.
<> 144:ef7eb2e8f9f7 12 *
<> 150:02e0a0aed4ec 13 * IMPORTANT. Your use of this file is governed by a Software License Agreement
<> 150:02e0a0aed4ec 14 * ("Agreement") that must be accepted in order to download or otherwise receive a
<> 150:02e0a0aed4ec 15 * copy of this file. You may not use or copy this file for any purpose other than
<> 150:02e0a0aed4ec 16 * as described in the Agreement. If you do not agree to all of the terms of the
<> 150:02e0a0aed4ec 17 * Agreement do not use this file and delete all copies in your possession or control;
<> 150:02e0a0aed4ec 18 * if you do not have a copy of the Agreement, you must contact Wicentric, Inc. prior
<> 150:02e0a0aed4ec 19 * to any use, copying or further distribution of this software.
<> 144:ef7eb2e8f9f7 20 */
<> 144:ef7eb2e8f9f7 21 /*************************************************************************************************/
<> 144:ef7eb2e8f9f7 22 #ifndef SMP_DEFS_H
<> 144:ef7eb2e8f9f7 23 #define SMP_DEFS_H
<> 144:ef7eb2e8f9f7 24
<> 144:ef7eb2e8f9f7 25 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 26 extern "C" {
<> 144:ef7eb2e8f9f7 27 #endif
<> 144:ef7eb2e8f9f7 28
<> 144:ef7eb2e8f9f7 29 /**************************************************************************************************
<> 144:ef7eb2e8f9f7 30 Macros
<> 144:ef7eb2e8f9f7 31 **************************************************************************************************/
<> 144:ef7eb2e8f9f7 32
<> 144:ef7eb2e8f9f7 33 /*! PDU format */
<> 144:ef7eb2e8f9f7 34 #define SMP_HDR_LEN 1 /*! Attribute PDU header length */
<> 144:ef7eb2e8f9f7 35
<> 144:ef7eb2e8f9f7 36 /*! Protocol timeout */
<> 144:ef7eb2e8f9f7 37 #define SMP_TIMEOUT 30 /*! Protocol timeout in seconds */
<> 144:ef7eb2e8f9f7 38
<> 144:ef7eb2e8f9f7 39 /*! Encryption key size */
<> 144:ef7eb2e8f9f7 40 #define SMP_KEY_SIZE_MAX 16 /*! Maximum encryption key size */
<> 144:ef7eb2e8f9f7 41 #define SMP_KEY_SIZE_MIN 7 /*! Minimum encryption key size */
<> 144:ef7eb2e8f9f7 42
<> 144:ef7eb2e8f9f7 43 /*! OOB and PIN data lengths in bytes */
<> 144:ef7eb2e8f9f7 44 #define SMP_OOB_LEN 16
<> 144:ef7eb2e8f9f7 45 #define SMP_PIN_LEN 3
<> 144:ef7eb2e8f9f7 46
<> 144:ef7eb2e8f9f7 47 /*! Error codes */
<> 144:ef7eb2e8f9f7 48 #define SMP_ERR_PASSKEY_ENTRY 0x01 /*! User input of passkey failed */
<> 144:ef7eb2e8f9f7 49 #define SMP_ERR_OOB 0x02 /*! OOB data is not available */
<> 144:ef7eb2e8f9f7 50 #define SMP_ERR_AUTH_REQ 0x03 /*! Authentication requirements cannot be met */
<> 144:ef7eb2e8f9f7 51 #define SMP_ERR_CONFIRM_VALUE 0x04 /*! Confirm value does not match */
<> 144:ef7eb2e8f9f7 52 #define SMP_ERR_PAIRING_NOT_SUP 0x05 /*! Pairing is not supported by the device */
<> 144:ef7eb2e8f9f7 53 #define SMP_ERR_ENC_KEY_SIZE 0x06 /*! Insufficient encryption key size */
<> 144:ef7eb2e8f9f7 54 #define SMP_ERR_COMMAND_NOT_SUP 0x07 /*! Command not supported */
<> 144:ef7eb2e8f9f7 55 #define SMP_ERR_UNSPECIFIED 0x08 /*! Unspecified reason */
<> 144:ef7eb2e8f9f7 56 #define SMP_ERR_ATTEMPTS 0x09 /*! Repeated attempts */
<> 144:ef7eb2e8f9f7 57 #define SMP_ERR_INVALID_PARAM 0x0A /*! Invalid parameter or command length */
<> 144:ef7eb2e8f9f7 58 #define SMP_ERR_DH_KEY_CHECK 0x0B /*! DH Key check did not match */
<> 144:ef7eb2e8f9f7 59 #define SMP_ERR_NUMERIC_COMPARISON 0x0C /*! Numeric comparison did not match */
<> 144:ef7eb2e8f9f7 60 #define SMP_ERR_BR_EDR_IN_PROGRESS 0x0D /*! BR/EDR in progress */
<> 144:ef7eb2e8f9f7 61 #define SMP_ERR_CROSS_TRANSPORT 0x0E /*! BR/EDR Cross transport key generation not allowed */
<> 144:ef7eb2e8f9f7 62
<> 144:ef7eb2e8f9f7 63 /*! Proprietary internal error codes */
<> 144:ef7eb2e8f9f7 64 #define SMP_ERR_MEMORY 0xE0 /*! Out of memory */
<> 144:ef7eb2e8f9f7 65 #define SMP_ERR_TIMEOUT 0xE1 /*! Transaction timeout */
<> 144:ef7eb2e8f9f7 66
<> 144:ef7eb2e8f9f7 67 /*! Command codes */
<> 144:ef7eb2e8f9f7 68 #define SMP_CMD_PAIR_REQ 0x01 /*! Pairing Request */
<> 144:ef7eb2e8f9f7 69 #define SMP_CMD_PAIR_RSP 0x02 /*! Pairing Response */
<> 144:ef7eb2e8f9f7 70 #define SMP_CMD_PAIR_CNF 0x03 /*! Pairing Confirm */
<> 144:ef7eb2e8f9f7 71 #define SMP_CMD_PAIR_RAND 0x04 /*! Pairing Random */
<> 144:ef7eb2e8f9f7 72 #define SMP_CMD_PAIR_FAIL 0x05 /*! Pairing Failed */
<> 144:ef7eb2e8f9f7 73 #define SMP_CMD_ENC_INFO 0x06 /*! Encryption Information */
<> 144:ef7eb2e8f9f7 74 #define SMP_CMD_MASTER_ID 0x07 /*! Master Identification */
<> 144:ef7eb2e8f9f7 75 #define SMP_CMD_ID_INFO 0x08 /*! Identity Information */
<> 144:ef7eb2e8f9f7 76 #define SMP_CMD_ID_ADDR_INFO 0x09 /*! Identity Address Information */
<> 144:ef7eb2e8f9f7 77 #define SMP_CMD_SIGN_INFO 0x0A /*! Signing Information */
<> 144:ef7eb2e8f9f7 78 #define SMP_CMD_SECURITY_REQ 0x0B /*! Security Request */
<> 144:ef7eb2e8f9f7 79 #define SMP_CMD_PUBLIC_KEY 0x0C /*! Public Key */
<> 144:ef7eb2e8f9f7 80 #define SMP_CMD_DHKEY_CHECK 0x0D /*! DH Key Check */
<> 144:ef7eb2e8f9f7 81 #define SMP_CMD_KEYPRESS 0x0E /*! User Key Press */
<> 144:ef7eb2e8f9f7 82 #define SMP_CMD_MAX 0x0F /*! Command code maximum */
<> 144:ef7eb2e8f9f7 83
<> 144:ef7eb2e8f9f7 84 /*! Command packet lengths */
<> 144:ef7eb2e8f9f7 85 #define SMP_PAIR_REQ_LEN 7
<> 144:ef7eb2e8f9f7 86 #define SMP_PAIR_RSP_LEN 7
<> 144:ef7eb2e8f9f7 87 #define SMP_PAIR_CNF_LEN 17
<> 144:ef7eb2e8f9f7 88 #define SMP_PAIR_RAND_LEN 17
<> 144:ef7eb2e8f9f7 89 #define SMP_PAIR_FAIL_LEN 2
<> 144:ef7eb2e8f9f7 90 #define SMP_ENC_INFO_LEN 17
<> 144:ef7eb2e8f9f7 91 #define SMP_MASTER_ID_LEN 11
<> 144:ef7eb2e8f9f7 92 #define SMP_ID_INFO_LEN 17
<> 144:ef7eb2e8f9f7 93 #define SMP_ID_ADDR_INFO_LEN 8
<> 144:ef7eb2e8f9f7 94 #define SMP_SIGN_INFO_LEN 17
<> 144:ef7eb2e8f9f7 95 #define SMP_SECURITY_REQ_LEN 2
<> 144:ef7eb2e8f9f7 96 #define SMP_PUB_KEY_MSG_LEN (1 + 2*SMP_PUB_KEY_LEN)
<> 144:ef7eb2e8f9f7 97 #define SMP_DHKEY_CHECK_MSG_LEN (1 + SMP_DHKEY_CHECK_LEN)
<> 144:ef7eb2e8f9f7 98 #define SMP_KEYPRESS_MSG_LEN 2
<> 144:ef7eb2e8f9f7 99
<> 144:ef7eb2e8f9f7 100 /*! I/O capabilities */
<> 144:ef7eb2e8f9f7 101 #define SMP_IO_DISP_ONLY 0x00 /*! DisplayOnly */
<> 144:ef7eb2e8f9f7 102 #define SMP_IO_DISP_YES_NO 0x01 /*! DisplayYesNo */
<> 144:ef7eb2e8f9f7 103 #define SMP_IO_KEY_ONLY 0x02 /*! KeyboardOnly */
<> 144:ef7eb2e8f9f7 104 #define SMP_IO_NO_IN_NO_OUT 0x03 /*! NoInputNoOutput */
<> 144:ef7eb2e8f9f7 105 #define SMP_IO_KEY_DISP 0x04 /*! KeyboardDisplay */
<> 144:ef7eb2e8f9f7 106
<> 144:ef7eb2e8f9f7 107 /*! OOB data present */
<> 144:ef7eb2e8f9f7 108 #define SMP_OOB_DATA_NONE 0x00
<> 144:ef7eb2e8f9f7 109 #define SMP_OOB_DATA_PRESENT 0x01
<> 144:ef7eb2e8f9f7 110
<> 144:ef7eb2e8f9f7 111 /*! Authentication/security properties bit mask */
<> 144:ef7eb2e8f9f7 112 #define SMP_AUTH_BOND_MASK 0x03 /*! Mask for bonding bits */
<> 144:ef7eb2e8f9f7 113 #define SMP_AUTH_BOND_FLAG 0x01 /*! Bonding requested */
<> 144:ef7eb2e8f9f7 114 #define SMP_AUTH_MITM_FLAG 0x04 /*! MITM (authenticated pairing) requested */
<> 144:ef7eb2e8f9f7 115 #define SMP_AUTH_SC_FLAG 0x08 /*! LE Secure Connections requested */
<> 144:ef7eb2e8f9f7 116 #define SMP_AUTH_KP_FLAG 0x10 /*! Keypress notifications requested */
<> 144:ef7eb2e8f9f7 117
<> 144:ef7eb2e8f9f7 118 /*! Key distribution bit mask */
<> 144:ef7eb2e8f9f7 119 #define SMP_KEY_DIST_ENC 0x01 /*! Distribute LTK */
<> 144:ef7eb2e8f9f7 120 #define SMP_KEY_DIST_ID 0x02 /*! Distribute IRK */
<> 144:ef7eb2e8f9f7 121 #define SMP_KEY_DIST_SIGN 0x04 /*! Distribute CSRK */
<> 144:ef7eb2e8f9f7 122 #define SMP_KEY_DIST_MASK (SMP_KEY_DIST_ENC | SMP_KEY_DIST_ID | SMP_KEY_DIST_SIGN)
<> 144:ef7eb2e8f9f7 123
<> 144:ef7eb2e8f9f7 124 /*! LESC Passkey keypress types */
<> 144:ef7eb2e8f9f7 125 #define SMP_PASSKEY_ENTRY_STARTED 0x00 /*! Passkey entry started keypress type */
<> 144:ef7eb2e8f9f7 126 #define SMP_PASSKEY_DIGIT_ENTERED 0x01 /*! Passkey digit entered keypress type */
<> 144:ef7eb2e8f9f7 127 #define SMP_PASSKEY_DIGIT_ERASED 0x02 /*! Passkey digit erased keypress type */
<> 144:ef7eb2e8f9f7 128 #define SMP_PASSKEY_CLEARED 0x03 /*! Passkey cleared keypress type */
<> 144:ef7eb2e8f9f7 129 #define SMP_PASSKEY_ENTRY_COMPLETED 0x04 /*! Passkey entry complete keypress type */
<> 144:ef7eb2e8f9f7 130
<> 144:ef7eb2e8f9f7 131 /*! Various parameter lengths */
<> 144:ef7eb2e8f9f7 132 #define SMP_RAND_LEN 16
<> 144:ef7eb2e8f9f7 133 #define SMP_CONFIRM_LEN 16
<> 144:ef7eb2e8f9f7 134 #define SMP_KEY_LEN 16
<> 144:ef7eb2e8f9f7 135 #define SMP_RAND8_LEN 8
<> 144:ef7eb2e8f9f7 136 #define SMP_PRIVATE_KEY_LEN 32
<> 144:ef7eb2e8f9f7 137 #define SMP_PUB_KEY_LEN 32
<> 144:ef7eb2e8f9f7 138 #define SMP_DHKEY_LEN 32
<> 144:ef7eb2e8f9f7 139 #define SMP_DHKEY_CHECK_LEN 16
<> 144:ef7eb2e8f9f7 140
<> 144:ef7eb2e8f9f7 141 /* CMAC Input Lengths */
<> 144:ef7eb2e8f9f7 142 #define SMP_F4_TEXT_LEN (SMP_PUB_KEY_LEN * 2 + 1)
<> 144:ef7eb2e8f9f7 143 #define SMP_G2_TEXT_LEN (SMP_PUB_KEY_LEN * 2 + SMP_RAND_LEN)
<> 144:ef7eb2e8f9f7 144 #define SMP_F5_TKEY_TEXT_LEN (SMP_DHKEY_LEN)
<> 144:ef7eb2e8f9f7 145 #define SMP_F5_TEXT_LEN (9 + 2*BDA_ADDR_LEN + 2*SMP_RAND_LEN)
<> 144:ef7eb2e8f9f7 146 #define SMP_F6_TEXT_LEN (2*BDA_ADDR_LEN + 3*SMP_RAND_LEN + 5)
<> 144:ef7eb2e8f9f7 147
<> 144:ef7eb2e8f9f7 148 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 149 };
<> 144:ef7eb2e8f9f7 150 #endif
<> 144:ef7eb2e8f9f7 151
<> 144:ef7eb2e8f9f7 152 #endif /* SMP_DEFS_H */