1 /** 2 **************************************************************************************** 3 * 4 * @file smp_common.h 5 * 6 * @brief Header file - Security Manager Protocol Common Definitions and Functions. 7 * 8 * Copyright (C) RivieraWaves 2009-2016 9 * 10 * 11 **************************************************************************************** 12 */ 13 14 /** 15 **************************************************************************************** 16 * @addtogroup SMP_COMMON 17 * @ingroup SMP 18 * @{ 19 **************************************************************************************** 20 */ 21 22 #ifndef SMP_COMMON_H_ 23 #define SMP_COMMON_H_ 24 25 /* 26 * INCLUDE FILES 27 **************************************************************************************** 28 */ 29 30 #include "rwip_config.h" 31 32 #include <stdbool.h> // Standard Boolean Definitions 33 #include <stdint.h> // Standard Integer Definitions 34 35 #include "co_utils.h" 36 #include "co_bt.h" // Common Bluetooth Definitions 37 38 /* 39 * DEFINES 40 **************************************************************************************** 41 */ 42 43 /// Mask applied to a Pairing Failed error triggered by us. 44 #define SMP_PAIR_FAIL_REASON_MASK (0x60) 45 /// Mask applied to a Pairing Failed error triggered by the peer device. 46 #define SMP_PAIR_FAIL_REASON_REM_MASK (0x70) 47 48 /* 49 * MACROS 50 **************************************************************************************** 51 */ 52 53 /// Mask a Pairing Failed reason value with the provided mask. 54 #define SMP_GEN_PAIR_FAIL_REASON(mask, reason) (mask | reason) 55 /// Extract the mask from a masked Pairing Failed reason value. 56 #define SMP_GET_PAIR_FAIL_MASK(reason) (0xF0 & reason) 57 /// Extract the Pairing Failed reason value from a masked Pairing Failed reason value. 58 #define SMP_GET_PAIR_FAIL_REASON(reason) (0x0F & reason) 59 60 /* 61 * ENUMERATIONS 62 **************************************************************************************** 63 */ 64 65 /** 66 * SMP Pairing Failed Reasons 67 */ 68 enum smp_pair_fail_reason 69 { 70 71 /** 72 * Passkey Entry Failed (0x01) 73 * The user input of passkey failed, for example, the user cancelled the operation. 74 */ 75 SMP_ERROR_PASSKEY_ENTRY_FAILED = 0x01, 76 /** 77 * OOB Not Available (0x02) 78 * The OOB Data is not available. 79 */ 80 SMP_ERROR_OOB_NOT_AVAILABLE, 81 /** 82 * Authentication Requirements (0x03) 83 * The pairing procedure cannot be performed as authentication requirements cannot be 84 * met due to IO capabilities of one or both devices. 85 */ 86 SMP_ERROR_AUTH_REQ, 87 /** 88 * Confirm Value Failed (0x04) 89 * The confirm value does not match the calculated confirm value. 90 */ 91 SMP_ERROR_CONF_VAL_FAILED, 92 /** 93 * Pairing Not Supported (0x05) 94 * Pairing is not supported by the device. 95 */ 96 SMP_ERROR_PAIRING_NOT_SUPP, 97 /** 98 * Encryption Key Size (0x06) 99 * The resultant encryption key size is insufficient for the security requirements of 100 * this device. 101 */ 102 SMP_ERROR_ENC_KEY_SIZE, 103 /** 104 * Command Not Supported (0x07) 105 * The SMP command received is not supported on this device. 106 */ 107 SMP_ERROR_CMD_NOT_SUPPORTED, 108 /** 109 * Unspecified Reason (0x08) 110 * Pairing failed due to an unspecified reason. 111 */ 112 SMP_ERROR_UNSPECIFIED_REASON, 113 /** 114 * Repeated Attempts (0x09) 115 * Pairing or Authentication procedure is disallowed because too little time has elapsed 116 * since last pairing request or security request. 117 */ 118 SMP_ERROR_REPEATED_ATTEMPTS, 119 /** 120 * Invalid Parameters (0x0A) 121 * The command length is invalid or a parameter is outside of the specified range. 122 */ 123 SMP_ERROR_INVALID_PARAM, 124 /** 125 * DHKey Check Failed (0x0B) 126 * Indicates to the remote device that the DHKey Check value received doesn't 127 * match the one calculated by the local device. 128 */ 129 SMP_ERROR_DHKEY_CHECK_FAILED, 130 /** 131 * Numeric Comparison Failed (0x0C) 132 * Indicates that the confirm values in the numeric comparison protocol do not match. 133 */ 134 SMP_ERROR_NUMERIC_COMPARISON_FAILED, 135 /** 136 * BR/EDR pairing in progress (0x0D) 137 * Indicates that the pairing over the LE transport failed due to a Pairing Request sent 138 * over the BR/EDR transport in process. 139 */ 140 SMP_ERROR_BREDR_PAIRING_IN_PROGRESS, 141 /** 142 * Cross-transport Key Derivation/Generation not allowed (0x0E) 143 * 144 * Indicates that the BR/EDR Link Key generated on the BR/EDR transport cannot be 145 * used to derive and distribute keys for the LE transport. 146 */ 147 SMP_ERROR_CROSS_TRANSPORT_KEY_GENERATION_NOT_ALLOWED, 148 }; 149 150 151 /* 152 * STRUCTURES 153 **************************************************************************************** 154 */ 155 156 157 #endif // (SMP_COMMON_H_) 158 159 /// @} SMP_COMMON 160