Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
sns_silib.h
00001 /************************************************************************************** 00002 * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved * 00003 * * 00004 * This file and the related binary are licensed under the following license: * 00005 * * 00006 * ARM Object Code and Header Files License, v1.0 Redistribution. * 00007 * * 00008 * Redistribution and use of object code, header files, and documentation, without * 00009 * modification, are permitted provided that the following conditions are met: * 00010 * * 00011 * 1) Redistributions must reproduce the above copyright notice and the * 00012 * following disclaimer in the documentation and/or other materials * 00013 * provided with the distribution. * 00014 * * 00015 * 2) Unless to the extent explicitly permitted by law, no reverse * 00016 * engineering, decompilation, or disassembly of is permitted. * 00017 * * 00018 * 3) Redistribution and use is permitted solely for the purpose of * 00019 * developing or executing applications that are targeted for use * 00020 * on an ARM-based product. * 00021 * * 00022 * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * 00023 * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * 00024 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, * 00025 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * 00026 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * 00028 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * 00029 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * 00030 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * 00031 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 00032 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 00033 **************************************************************************************/ 00034 00035 00036 /*! 00037 @file 00038 @brief This file contains all of the enums and definitions that are used for the 00039 CryptoCell Lib init and finish APIs, as well as the APIs themselves. 00040 @defgroup sns_silib CryptoCell library basic APIs 00041 @{ 00042 @ingroup cryptocell_api 00043 00044 */ 00045 00046 #ifndef __SNS_SILIB_H__ 00047 #define __SNS_SILIB_H__ 00048 00049 #include "ssi_pal_types.h" 00050 #include "crys_rnd.h" 00051 00052 #ifdef __cplusplus 00053 extern "C" 00054 { 00055 #endif 00056 00057 /*! Definitions for error returns from SaSi_LibInit or SaSi_LibFini functions. */ 00058 typedef enum { 00059 SA_SILIB_RET_OK = 0, /*!< Success defintion.*/ 00060 SA_SILIB_RET_EINVAL_CTX_PTR , /*!< Illegal context pointer.*/ 00061 SA_SILIB_RET_EINVAL_WORK_BUF_PTR , /*!< Illegal work buffer pointer.*/ 00062 SA_SILIB_RET_HAL , /*!< Error returned from HAL layer.*/ 00063 SA_SILIB_RET_PAL , /*!< Error returned from PAL layer.*/ 00064 SA_SILIB_RET_RND_INST_ERR , /*!< RND instantiation faied.*/ 00065 SA_SILIB_RET_EINVAL_HW_VERSION , /*!< Invalid HW version. */ 00066 SA_SILIB_RET_EINVAL_HW_SIGNATURE , /*!< Invalid HW signature. */ 00067 SA_SILIB_RESERVE32B = 0x7FFFFFFFL /*!< Reserved.*/ 00068 } SA_SilibRetCode_t ; 00069 00070 00071 /*! Internal defintion for the product register. */ 00072 #define DX_VERSION_PRODUCT_BIT_SHIFT 0x18UL 00073 /*! Internal defintion for the product register size. */ 00074 #define DX_VERSION_PRODUCT_BIT_SIZE 0x8UL 00075 00076 00077 00078 /*! 00079 @brief This function Perform global initialization of the ARM CryptoCell 3xx runtime library; 00080 it must be called once per ARM CryptoCell for 3xx cold boot cycle. 00081 Among other initializations, this function calls CRYS_RND_Instantiation and CRYS_RND_SetGenerateVectorFunc 00082 to initialize the TRNG and the primary RND context. An initialized RND context is required for calling RND 00083 APIs and asymmetric cryptography key generation and signatures. The primary context returned by this 00084 function can be used as a single global context for all RND needs. Alternatively, other contexts may 00085 be initialized and used with a more limited scope (for specific applications or specific threads). 00086 \note The Mutexes, if used, are initialized by this API. Therefore, unlike the other APIs in the library, 00087 this API is not thread-safe. 00088 @return SA_SILIB_RET_OK on success. 00089 @return A non-zero value in case of failure. 00090 */ 00091 SA_SilibRetCode_t SaSi_LibInit(void *rnd_ctx, /*!< [in/out] Pointer to the RND state buffer, 00092 allocated by the user. 00093 This state must be saved and provided as parameter to any API that 00094 uses the RND module.*/ 00095 CRYS_RND_WorkBuff_t *rndWorkBuff_ptr /*!< [in] Scratchpad for the RND module's work. */); 00096 00097 /*! 00098 @brief This function finalize the library operations. It frees the associated resources (mutexes) and call hal and pal terminate functions. 00099 the function also call CRYS_RND_UnInstantiation to clean the rnd state. 00100 @return SA_SILIB_RET_OK on success. 00101 @return A non-zero value in case of failure. 00102 */ 00103 SA_SilibRetCode_t SaSi_LibFini(void *rnd_ctx /*!< [in/out] Pointer to the RND state buffer that was 00104 initialized in SaSi_LibInit.*/); 00105 00106 #ifdef __cplusplus 00107 } 00108 #endif 00109 /** 00110 @} 00111 */ 00112 #endif /*__DX_CCLIB_H__*/ 00113
Generated on Tue Jul 12 2022 13:54:51 by
