Maxim Integrated / MaximBLE

Dependents:   BLE_Thermometer MAXWSNENV_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers wsf_sec.h Source File

wsf_sec.h

Go to the documentation of this file.
00001 /*************************************************************************************************/
00002 /*!
00003  *  \file   wsf_sec.h
00004  *        
00005  *  \brief  AES and random number security service API.
00006  *
00007  *          $Date: 2011-10-14 21:35:03 -0700 (Fri, 14 Oct 2011) $
00008  *          $Revision: 191 $
00009  *  
00010  *  Copyright (c) 2010-2016 ARM Limited. All rights reserved.
00011  *
00012  *  SPDX-License-Identifier: LicenseRef-PBL
00013  *
00014  *  Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
00015  *  this file except in compliance with the License.  You may obtain a copy of the License at
00016  *
00017  *  https://www.mbed.com/licenses/PBL-1.0
00018  *
00019  *  See the License for the specific language governing permissions and limitations under the License.
00020 
00021  */
00022 /*************************************************************************************************/
00023 #ifndef WSF_SEC_H
00024 #define WSF_SEC_H
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 /**************************************************************************************************
00031   Data Types
00032 **************************************************************************************************/
00033 
00034 /*! AES callback parameters structure */
00035 typedef struct
00036 {
00037   wsfMsgHdr_t    hdr;              /*! header */
00038   uint8_t       *pCiphertext ;     /*! pointer to 16 bytes of ciphertext data */
00039 } wsfSecAes_t ;
00040 
00041 /*! AES callback function type */
00042 typedef void (*wsfSecAesCback_t )(wsfSecAes_t  *pMsg);
00043 
00044 /**************************************************************************************************
00045   Function Declarations
00046 **************************************************************************************************/
00047 
00048 /*************************************************************************************************/
00049 /*!
00050  *  \fn     WsfSecInit
00051  *        
00052  *  \brief  Initialize the security service.  This function should only be called once
00053  *          upon system initialization.
00054  *
00055  *  \return None.
00056  */
00057 /*************************************************************************************************/
00058 void WsfSecInit(void);
00059 
00060 /*************************************************************************************************/
00061 /*!
00062  *  \fn     WsfSecRandInit
00063  *        
00064  *  \brief  Initialize the random number service.  This function should only be called once
00065  *          upon system initialization.
00066  *
00067  *  \return None.
00068  */
00069 /*************************************************************************************************/
00070 void WsfSecRandInit(void);
00071 
00072 /*************************************************************************************************/
00073 /*!
00074  *  \fn     WsfSecAes
00075  *        
00076  *  \brief  Execute an AES calculation.  When the calculation completes, a WSF message will be
00077  *          sent to the specified handler.  This function returns a token value that
00078  *          the client can use to match calls to this function with messages.
00079  *
00080  *  \param  pKey        Pointer to 16 byte key.
00081  *  \param  pPlaintext  Pointer to 16 byte plaintext.
00082  *  \param  handlerId   WSF handler ID.
00083  *  \param  param       Client-defined parameter returned in message.
00084  *  \param  event       Event for client's WSF handler.
00085  *
00086  *  \return Token value.
00087  */
00088 /*************************************************************************************************/
00089 uint8_t WsfSecAes(uint8_t *pKey, uint8_t *pPlaintext, wsfHandlerId_t handlerId,
00090                   uint16_t param, uint8_t event);
00091 
00092 /*************************************************************************************************/
00093 /*!
00094  *  \fn     WsfSecRand
00095  *        
00096  *  \brief  This function returns up to 16 bytes of random data to a buffer provided by the
00097  *          client.
00098  *
00099  *  \param  pRand       Pointer to returned random data.
00100  *  \param  randLen     Length of random data.
00101  *
00102  *  \return None.
00103  */
00104 /*************************************************************************************************/
00105 void WsfSecRand(uint8_t *pRand, uint8_t randLen);
00106 
00107 #ifdef __cplusplus
00108 };
00109 #endif
00110 
00111 #endif /* WSF_SEC_H */