Caching the advertising data and the scan response.
Fork of MaximBLE by
exactLE/wsf/include/wsf_sec.h@0:b562096246b3, 2016-03-03 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
enginerd | 0:b562096246b3 | 1 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 2 | /*! |
enginerd | 0:b562096246b3 | 3 | * \file wsf_sec.h |
enginerd | 0:b562096246b3 | 4 | * |
enginerd | 0:b562096246b3 | 5 | * \brief AES and random number security service API. |
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 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 23 | #ifndef WSF_SEC_H |
enginerd | 0:b562096246b3 | 24 | #define WSF_SEC_H |
enginerd | 0:b562096246b3 | 25 | |
enginerd | 0:b562096246b3 | 26 | #ifdef __cplusplus |
enginerd | 0:b562096246b3 | 27 | extern "C" { |
enginerd | 0:b562096246b3 | 28 | #endif |
enginerd | 0:b562096246b3 | 29 | |
enginerd | 0:b562096246b3 | 30 | /************************************************************************************************** |
enginerd | 0:b562096246b3 | 31 | Data Types |
enginerd | 0:b562096246b3 | 32 | **************************************************************************************************/ |
enginerd | 0:b562096246b3 | 33 | |
enginerd | 0:b562096246b3 | 34 | /*! AES callback parameters structure */ |
enginerd | 0:b562096246b3 | 35 | typedef struct |
enginerd | 0:b562096246b3 | 36 | { |
enginerd | 0:b562096246b3 | 37 | wsfMsgHdr_t hdr; /*! header */ |
enginerd | 0:b562096246b3 | 38 | uint8_t *pCiphertext; /*! pointer to 16 bytes of ciphertext data */ |
enginerd | 0:b562096246b3 | 39 | } wsfSecAes_t; |
enginerd | 0:b562096246b3 | 40 | |
enginerd | 0:b562096246b3 | 41 | /*! AES callback function type */ |
enginerd | 0:b562096246b3 | 42 | typedef void (*wsfSecAesCback_t)(wsfSecAes_t *pMsg); |
enginerd | 0:b562096246b3 | 43 | |
enginerd | 0:b562096246b3 | 44 | /************************************************************************************************** |
enginerd | 0:b562096246b3 | 45 | Function Declarations |
enginerd | 0:b562096246b3 | 46 | **************************************************************************************************/ |
enginerd | 0:b562096246b3 | 47 | |
enginerd | 0:b562096246b3 | 48 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 49 | /*! |
enginerd | 0:b562096246b3 | 50 | * \fn WsfSecInit |
enginerd | 0:b562096246b3 | 51 | * |
enginerd | 0:b562096246b3 | 52 | * \brief Initialize the security service. This function should only be called once |
enginerd | 0:b562096246b3 | 53 | * upon system initialization. |
enginerd | 0:b562096246b3 | 54 | * |
enginerd | 0:b562096246b3 | 55 | * \return None. |
enginerd | 0:b562096246b3 | 56 | */ |
enginerd | 0:b562096246b3 | 57 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 58 | void WsfSecInit(void); |
enginerd | 0:b562096246b3 | 59 | |
enginerd | 0:b562096246b3 | 60 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 61 | /*! |
enginerd | 0:b562096246b3 | 62 | * \fn WsfSecRandInit |
enginerd | 0:b562096246b3 | 63 | * |
enginerd | 0:b562096246b3 | 64 | * \brief Initialize the random number service. This function should only be called once |
enginerd | 0:b562096246b3 | 65 | * upon system initialization. |
enginerd | 0:b562096246b3 | 66 | * |
enginerd | 0:b562096246b3 | 67 | * \return None. |
enginerd | 0:b562096246b3 | 68 | */ |
enginerd | 0:b562096246b3 | 69 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 70 | void WsfSecRandInit(void); |
enginerd | 0:b562096246b3 | 71 | |
enginerd | 0:b562096246b3 | 72 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 73 | /*! |
enginerd | 0:b562096246b3 | 74 | * \fn WsfSecAes |
enginerd | 0:b562096246b3 | 75 | * |
enginerd | 0:b562096246b3 | 76 | * \brief Execute an AES calculation. When the calculation completes, a WSF message will be |
enginerd | 0:b562096246b3 | 77 | * sent to the specified handler. This function returns a token value that |
enginerd | 0:b562096246b3 | 78 | * the client can use to match calls to this function with messages. |
enginerd | 0:b562096246b3 | 79 | * |
enginerd | 0:b562096246b3 | 80 | * \param pKey Pointer to 16 byte key. |
enginerd | 0:b562096246b3 | 81 | * \param pPlaintext Pointer to 16 byte plaintext. |
enginerd | 0:b562096246b3 | 82 | * \param handlerId WSF handler ID. |
enginerd | 0:b562096246b3 | 83 | * \param param Client-defined parameter returned in message. |
enginerd | 0:b562096246b3 | 84 | * \param event Event for client's WSF handler. |
enginerd | 0:b562096246b3 | 85 | * |
enginerd | 0:b562096246b3 | 86 | * \return Token value. |
enginerd | 0:b562096246b3 | 87 | */ |
enginerd | 0:b562096246b3 | 88 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 89 | uint8_t WsfSecAes(uint8_t *pKey, uint8_t *pPlaintext, wsfHandlerId_t handlerId, |
enginerd | 0:b562096246b3 | 90 | uint16_t param, uint8_t event); |
enginerd | 0:b562096246b3 | 91 | |
enginerd | 0:b562096246b3 | 92 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 93 | /*! |
enginerd | 0:b562096246b3 | 94 | * \fn WsfSecRand |
enginerd | 0:b562096246b3 | 95 | * |
enginerd | 0:b562096246b3 | 96 | * \brief This function returns up to 16 bytes of random data to a buffer provided by the |
enginerd | 0:b562096246b3 | 97 | * client. |
enginerd | 0:b562096246b3 | 98 | * |
enginerd | 0:b562096246b3 | 99 | * \param pRand Pointer to returned random data. |
enginerd | 0:b562096246b3 | 100 | * \param randLen Length of random data. |
enginerd | 0:b562096246b3 | 101 | * |
enginerd | 0:b562096246b3 | 102 | * \return None. |
enginerd | 0:b562096246b3 | 103 | */ |
enginerd | 0:b562096246b3 | 104 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 105 | void WsfSecRand(uint8_t *pRand, uint8_t randLen); |
enginerd | 0:b562096246b3 | 106 | |
enginerd | 0:b562096246b3 | 107 | #ifdef __cplusplus |
enginerd | 0:b562096246b3 | 108 | }; |
enginerd | 0:b562096246b3 | 109 | #endif |
enginerd | 0:b562096246b3 | 110 | |
enginerd | 0:b562096246b3 | 111 | #endif /* WSF_SEC_H */ |