No changes

Fork of nRF51822 by Nordic Semiconductor

Committer:
vcoubard
Date:
Mon Jan 11 10:19:13 2016 +0000
Revision:
558:c4b56f9d6f3b
Parent:
387:b13ab9a7ddb9
Child:
597:bcd5e287c494
Synchronized with git rev b2cb5663
Author: Marcus Chang
Added SecurityManager::setLinkSecurity call for elevating security settings on a particular connection.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 558:c4b56f9d6f3b 1 /* mbed Microcontroller Library
vcoubard 558:c4b56f9d6f3b 2 * Copyright (c) 2006-2013 ARM Limited
vcoubard 558:c4b56f9d6f3b 3 *
vcoubard 558:c4b56f9d6f3b 4 * Licensed under the Apache License, Version 2.0 (the "License");
vcoubard 558:c4b56f9d6f3b 5 * you may not use this file except in compliance with the License.
vcoubard 558:c4b56f9d6f3b 6 * You may obtain a copy of the License at
vcoubard 558:c4b56f9d6f3b 7 *
vcoubard 558:c4b56f9d6f3b 8 * http://www.apache.org/licenses/LICENSE-2.0
vcoubard 558:c4b56f9d6f3b 9 *
vcoubard 558:c4b56f9d6f3b 10 * Unless required by applicable law or agreed to in writing, software
vcoubard 558:c4b56f9d6f3b 11 * distributed under the License is distributed on an "AS IS" BASIS,
vcoubard 558:c4b56f9d6f3b 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vcoubard 558:c4b56f9d6f3b 13 * See the License for the specific language governing permissions and
vcoubard 558:c4b56f9d6f3b 14 * limitations under the License.
vcoubard 558:c4b56f9d6f3b 15 */
vcoubard 558:c4b56f9d6f3b 16
vcoubard 558:c4b56f9d6f3b 17 #ifndef _BTLE_SECURITY_H_
vcoubard 558:c4b56f9d6f3b 18 #define _BTLE_SECURITY_H_
vcoubard 558:c4b56f9d6f3b 19
vcoubard 558:c4b56f9d6f3b 20 #include "ble/Gap.h"
vcoubard 558:c4b56f9d6f3b 21 #include "ble/SecurityManager.h"
vcoubard 558:c4b56f9d6f3b 22
vcoubard 558:c4b56f9d6f3b 23 /**
vcoubard 558:c4b56f9d6f3b 24 * Enable Nordic's Device Manager, which brings in functionality from the
vcoubard 558:c4b56f9d6f3b 25 * stack's Security Manager. The Security Manager implements the actual
vcoubard 558:c4b56f9d6f3b 26 * cryptographic algorithms and protocol exchanges that allow two devices to
vcoubard 558:c4b56f9d6f3b 27 * securely exchange data and privately detect each other.
vcoubard 558:c4b56f9d6f3b 28 *
vcoubard 558:c4b56f9d6f3b 29 * @param[in] enableBonding Allow for bonding.
vcoubard 558:c4b56f9d6f3b 30 * @param[in] requireMITM Require protection for man-in-the-middle attacks.
vcoubard 558:c4b56f9d6f3b 31 * @param[in] iocaps To specify IO capabilities of this peripheral,
vcoubard 558:c4b56f9d6f3b 32 * such as availability of a display or keyboard to
vcoubard 558:c4b56f9d6f3b 33 * support out-of-band exchanges of security data.
vcoubard 558:c4b56f9d6f3b 34 * @param[in] passkey To specify a static passkey.
vcoubard 558:c4b56f9d6f3b 35 *
vcoubard 558:c4b56f9d6f3b 36 * @return BLE_ERROR_NONE on success.
vcoubard 558:c4b56f9d6f3b 37 */
vcoubard 558:c4b56f9d6f3b 38 ble_error_t btle_initializeSecurity(bool enableBonding = true,
vcoubard 558:c4b56f9d6f3b 39 bool requireMITM = true,
vcoubard 558:c4b56f9d6f3b 40 SecurityManager::SecurityIOCapabilities_t iocaps = SecurityManager::IO_CAPS_NONE,
vcoubard 558:c4b56f9d6f3b 41 const SecurityManager::Passkey_t passkey = NULL);
vcoubard 558:c4b56f9d6f3b 42
vcoubard 558:c4b56f9d6f3b 43 /**
vcoubard 558:c4b56f9d6f3b 44 * Get the security status of a link.
vcoubard 558:c4b56f9d6f3b 45 *
vcoubard 558:c4b56f9d6f3b 46 * @param[in] connectionHandle
vcoubard 558:c4b56f9d6f3b 47 * Handle to identify the connection.
vcoubard 558:c4b56f9d6f3b 48 * @param[out] securityStatusP
vcoubard 558:c4b56f9d6f3b 49 * security status.
vcoubard 558:c4b56f9d6f3b 50 *
vcoubard 558:c4b56f9d6f3b 51 * @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure.
vcoubard 558:c4b56f9d6f3b 52 */
vcoubard 558:c4b56f9d6f3b 53 ble_error_t btle_getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP);
vcoubard 558:c4b56f9d6f3b 54
vcoubard 558:c4b56f9d6f3b 55 /**
vcoubard 558:c4b56f9d6f3b 56 * Set the security mode on a connection. Useful for elevating the security mode
vcoubard 558:c4b56f9d6f3b 57 * once certain conditions are met, e.g., a particular service is found.
vcoubard 558:c4b56f9d6f3b 58 *
vcoubard 558:c4b56f9d6f3b 59 * @param[in] connectionHandle
vcoubard 558:c4b56f9d6f3b 60 * Handle to identify the connection.
vcoubard 558:c4b56f9d6f3b 61 * @param[in] securityMode
vcoubard 558:c4b56f9d6f3b 62 * security mode.
vcoubard 558:c4b56f9d6f3b 63 *
vcoubard 558:c4b56f9d6f3b 64 * @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure.
vcoubard 558:c4b56f9d6f3b 65 */
vcoubard 558:c4b56f9d6f3b 66 ble_error_t btle_setLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::SecurityMode_t securityMode);
vcoubard 558:c4b56f9d6f3b 67
vcoubard 558:c4b56f9d6f3b 68 /**
vcoubard 558:c4b56f9d6f3b 69 * Function for deleting all peer device context and all related bonding
vcoubard 558:c4b56f9d6f3b 70 * information from the database.
vcoubard 558:c4b56f9d6f3b 71 *
vcoubard 558:c4b56f9d6f3b 72 * @retval BLE_ERROR_NONE On success, else an error code indicating reason for failure.
vcoubard 558:c4b56f9d6f3b 73 * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization and/or
vcoubard 558:c4b56f9d6f3b 74 * application registration.
vcoubard 558:c4b56f9d6f3b 75 */
vcoubard 558:c4b56f9d6f3b 76 ble_error_t btle_purgeAllBondingState(void);
vcoubard 558:c4b56f9d6f3b 77
rgrover1 134:df7e7964a9c3 78 #endif /* _BTLE_SECURITY_H_ */