SmartSnippets DA1459x SDK
crypto_ecc_provider_params.h
Go to the documentation of this file.
1 
42 #ifndef SDK_CRYPTO_INCLUDE_CRYPTO_ECC_PROVIDER_PARAMS_H_
43 #define SDK_CRYPTO_INCLUDE_CRYPTO_ECC_PROVIDER_PARAMS_H_
44 
45 #include <stdbool.h>
46 
47 #define HW_ECC_ID 0
48 #define UECC_LIB_ID 1
49 #define SODIUM_LIB_ID 2
50 
54 typedef enum {
55  HW_ECC = HW_ECC_ID,
56  UECC_LIB = UECC_LIB_ID,
57  SODIUM_LIB = SODIUM_LIB_ID,
58  CRYPTO_ECC_PROVIDER_LAST_VALUE,
60 
64 typedef enum {
65  ECC_CRYPTO_SECP160R1 =0,
66  ECC_CRYPTO_SECP192R1 =1,
67  ECC_CRYPTO_SECP224R1 =2,
68  ECC_CRYPTO_SECP256R1 =3,
69  ECC_CRYPTO_SECP256K1 =4,
70  ECC_CRYPTO_CURVE25519 =5,
71  ECC_CRYPTO_LAST_VALUE
73 
77 typedef enum {
86 
94 #define dg_ALLOW_DYNAMIC_LIB_PROVIDER 0
95 
96 /*
97  * Set in order to provide the selected curve.
98  */
99 #define dg_USE_CURVE_SECP160R1 1
100 #define dg_USE_CURVE_SECP192R1 1
101 #define dg_USE_CURVE_SECP224R1 1
102 #define dg_USE_CURVE_SECP256R1 1
103 #define dg_USE_CURVE_SECP256K1 1
104 #define dg_USE_CURVE_25519 1
105 
106 /*
107  * Set in order to use the selected ecc library providers.
108  */
109 #define dg_USE_HW_ECC 0
110 #define dg_USE_UECC_LIB 1
111 #define dg_USE_SODIUM_LIB 1
112 
113 /* Check hw_ecc module availability.*/
114 #if ( ((!dg_USE_HW_ECC)&&(dg_configUSE_HW_ECC)) || ((dg_USE_HW_ECC)&&(!dg_configUSE_HW_ECC)) )
115 #error "In order to (exclude/include) hw_ecc, dg_configUSE_HW_ECC must also be set to (0/1) in config_*.h"
116 #endif
117 /*
118  * Set default library provider for each curve.
119  * If dynamic library selection is disabled these libraries will be used
120  * for the ecc implementation for each curve.
121  * If dynamic library selection is enabled these libraries will be the
122  * initialized values of the lib provider index table and if a library
123  * provider is not explicitly set before using a certain curve, this is
124  * the library that will try to implement the ecc functionality.
125  */
126 #define CURVE_SECP160R1_DEFAULT_LIB_PROVIDER UECC_LIB_ID
127 #define CURVE_SECP192R1_DEFAULT_LIB_PROVIDER UECC_LIB_ID
128 #define CURVE_SECP224R1_DEFAULT_LIB_PROVIDER UECC_LIB_ID
129 #define CURVE_SECP256R1_DEFAULT_LIB_PROVIDER UECC_LIB_ID
130 #define CURVE_SECP256K1_DEFAULT_LIB_PROVIDER UECC_LIB_ID
131 #define CURVE_25519_DEFAULT_LIB_PROVIDER SODIUM_LIB_ID
132 
139 extern ECC_CRYPTO_LIB_PROVIDER curve_lib_provider_index[ECC_CRYPTO_LAST_VALUE];
140 
147 extern const bool lib_provider_truthtable[ECC_CRYPTO_LAST_VALUE][CRYPTO_ECC_PROVIDER_LAST_VALUE];
148 
149 
150 #endif /* SDK_CRYPTO_INCLUDE_CRYPTO_ECC_PROVIDER_PARAMS_H_ */
151 
SODIUM_LIB
Definition: crypto_ecc_provider_params.h:57
CRYPTO_ECC_PROVIDER_RET_OK
Definition: crypto_ecc_provider_params.h:78
CRYPTO_ECC_PROVIDER_RET_MUTEX_LOCKED
Definition: crypto_ecc_provider_params.h:83
CRYPTO_ECC_PROVIDER_RET
CRYPTO_ECC_PROVIDER_RET
ECC Provider API return codes.
Definition: crypto_ecc_provider_params.h:77
lib_provider_truthtable
const bool lib_provider_truthtable[ECC_CRYPTO_LAST_VALUE][CRYPTO_ECC_PROVIDER_LAST_VALUE]
Truth table informs if a curve is provided by the respective library.
curve_lib_provider_index
ECC_CRYPTO_LIB_PROVIDER curve_lib_provider_index[ECC_CRYPTO_LAST_VALUE]
Index table informs which curve is implemented by which library provider.
CRYPTO_ECC_PROVIDER_RET_ERROR
Definition: crypto_ecc_provider_params.h:84
CRYPTO_ECC_PROVIDER_RET_INIT_FAIL
Definition: crypto_ecc_provider_params.h:79
CRYPTO_ECC_PROVIDER_RET_NOT_PROVIDED
Definition: crypto_ecc_provider_params.h:80
CRYPTO_ECC_PROVIDER_RET_INVALID_LIB
Definition: crypto_ecc_provider_params.h:81
ECC_CRYPTO_LIB_PROVIDER
ECC_CRYPTO_LIB_PROVIDER
ECC library providers.
Definition: crypto_ecc_provider_params.h:54
UECC_LIB
Definition: crypto_ecc_provider_params.h:56
HW_ECC
Definition: crypto_ecc_provider_params.h:55
CRYPTO_ECC_PROVIDER_RET_INVALID_CURVE
Definition: crypto_ecc_provider_params.h:82
CRYPTO_ECC_CURVE
CRYPTO_ECC_CURVE
ECC supported curves type.
Definition: crypto_ecc_provider_params.h:64