Mistake on this page?
Report an issue in GitHub or email us
sns_silib.h
Go to the documentation of this file.
1 /**************************************************************************************
2 * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
3 * *
4 * This file and the related binary are licensed under the following license: *
5 * *
6 * ARM Object Code and Header Files License, v1.0 Redistribution. *
7 * *
8 * Redistribution and use of object code, header files, and documentation, without *
9 * modification, are permitted provided that the following conditions are met: *
10 * *
11 * 1) Redistributions must reproduce the above copyright notice and the *
12 * following disclaimer in the documentation and/or other materials *
13 * provided with the distribution. *
14 * *
15 * 2) Unless to the extent explicitly permitted by law, no reverse *
16 * engineering, decompilation, or disassembly of is permitted. *
17 * *
18 * 3) Redistribution and use is permitted solely for the purpose of *
19 * developing or executing applications that are targeted for use *
20 * on an ARM-based product. *
21 * *
22 * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
23 * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
24 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
25 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
33 **************************************************************************************/
34 
35 
36 /*!
37 @file
38 @brief This file contains all of the enums and definitions that are used for the
39  CryptoCell Lib init and finish APIs, as well as the APIs themselves.
40 @defgroup sns_silib CryptoCell library basic APIs
41 @{
42 @ingroup cryptocell_api
43 
44 */
45 
46 #ifndef __SNS_SILIB_H__
47 #define __SNS_SILIB_H__
48 
49 #include "ssi_pal_types.h"
50 #include "crys_rnd.h"
51 
52 #ifdef __cplusplus
53 extern "C"
54 {
55 #endif
56 
57 /*! Definitions for error returns from SaSi_LibInit or SaSi_LibFini functions. */
58 typedef enum {
59  SA_SILIB_RET_OK = 0, /*!< Success defintion.*/
60  SA_SILIB_RET_EINVAL_CTX_PTR, /*!< Illegal context pointer.*/
61  SA_SILIB_RET_EINVAL_WORK_BUF_PTR, /*!< Illegal work buffer pointer.*/
62  SA_SILIB_RET_HAL, /*!< Error returned from HAL layer.*/
63  SA_SILIB_RET_PAL, /*!< Error returned from PAL layer.*/
64  SA_SILIB_RET_RND_INST_ERR, /*!< RND instantiation faied.*/
65  SA_SILIB_RET_EINVAL_HW_VERSION, /*!< Invalid HW version. */
66  SA_SILIB_RET_EINVAL_HW_SIGNATURE, /*!< Invalid HW signature. */
67  SA_SILIB_RESERVE32B = 0x7FFFFFFFL /*!< Reserved.*/
69 
70 
71 /*! Internal defintion for the product register. */
72 #define DX_VERSION_PRODUCT_BIT_SHIFT 0x18UL
73 /*! Internal defintion for the product register size. */
74 #define DX_VERSION_PRODUCT_BIT_SIZE 0x8UL
75 
76 
77 
78 /*!
79 @brief This function Perform global initialization of the ARM CryptoCell 3xx runtime library;
80 it must be called once per ARM CryptoCell for 3xx cold boot cycle.
81 Among other initializations, this function calls CRYS_RND_Instantiation and CRYS_RND_SetGenerateVectorFunc
82 to initialize the TRNG and the primary RND context. An initialized RND context is required for calling RND
83 APIs and asymmetric cryptography key generation and signatures. The primary context returned by this
84 function can be used as a single global context for all RND needs. Alternatively, other contexts may
85 be initialized and used with a more limited scope (for specific applications or specific threads).
86 \note The Mutexes, if used, are initialized by this API. Therefore, unlike the other APIs in the library,
87 this API is not thread-safe.
88 @return SA_SILIB_RET_OK on success.
89 @return A non-zero value in case of failure.
90 */
91 SA_SilibRetCode_t SaSi_LibInit(void *rnd_ctx, /*!< [in/out] Pointer to the RND state buffer,
92  allocated by the user.
93  This state must be saved and provided as parameter to any API that
94  uses the RND module.*/
95  CRYS_RND_WorkBuff_t *rndWorkBuff_ptr /*!< [in] Scratchpad for the RND module's work. */);
96 
97 /*!
98 @brief This function finalize the library operations. It frees the associated resources (mutexes) and call hal and pal terminate functions.
99 the function also call CRYS_RND_UnInstantiation to clean the rnd state.
100 @return SA_SILIB_RET_OK on success.
101 @return A non-zero value in case of failure.
102 */
103 SA_SilibRetCode_t SaSi_LibFini(void *rnd_ctx /*!< [in/out] Pointer to the RND state buffer that was
104  initialized in SaSi_LibInit.*/);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 /**
110 @}
111  */
112 #endif /*__DX_CCLIB_H__*/
113 
SA_SilibRetCode_t SaSi_LibInit(void *rnd_ctx, CRYS_RND_WorkBuff_t *rndWorkBuff_ptr)
This function Perform global initialization of the ARM CryptoCell 3xx runtime library; it must be cal...
SA_SilibRetCode_t
Definition: sns_silib.h:58
This file contains the CRYS APIs used for random number generation. The random-number generation modu...
This file contains the platform dependent definitions and types.
SA_SilibRetCode_t SaSi_LibFini(void *rnd_ctx)
This function finalize the library operations. It frees the associated resources (mutexes) and call h...
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.