1 /***************************************************************************//**
2 * \file cy_cryptolite_config.h
3 * \version 2.30
4 *
5 * \brief
6 *  This file provides default configuration parameters
7 *  for the Cryptolite PDL driver.
8 *
9 ********************************************************************************
10 * Copyright 2022 Cypress Semiconductor Corporation
11 * SPDX-License-Identifier: Apache-2.0
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 *    http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *******************************************************************************/
25 
26 
27 #if !defined(CY_CRYPTOLITE_CONFIG_H)
28 #define CY_CRYPTOLITE_CONFIG_H
29 
30 #if defined(CY_CRYPTOLITE_USER_CONFIG_FILE)
31 
32 #include CY_CRYPTOLITE_USER_CONFIG_FILE
33 
34 #else
35 /* Default configuration:
36  *
37  * - SHA256
38  * - HMAC
39  * - RSA encrypt/decrypt
40  * - RSA PKCS#1.l5 verification
41  * - ECP multiplication
42  * - ECDSA verification
43  */
44 /*SHA and HMAC*/
45 #define CY_CRYPTOLITE_CFG_SHA_C
46 #define CY_CRYPTOLITE_CFG_HMAC_C
47 #define CY_CRYPTOLITE_CFG_SHA2_256_ENABLED
48 
49 #define CY_CRYPTOLITE_CFG_TRNG_C
50 #define CY_CRYPTOLITE_CFG_AES_C
51 
52 /* AES Cipher modes */
53 #define CY_CRYPTOLITE_CFG_CIPHER_MODE_CBC
54 #define CY_CRYPTOLITE_CFG_CIPHER_MODE_CFB
55 #define CY_CRYPTOLITE_CFG_CIPHER_MODE_CTR
56 
57 /* RSA functionality */
58 #define CY_CRYPTOLITE_CFG_RSA_C
59 /* RSA PKCS 1.5 verification */
60 #define CY_CRYPTOLITE_CFG_RSA_VERIFY_ENABLED
61 /* RSA Max Key size */
62 #define CY_CRYPTOLITE_CFG_RSA_MAX_KEY_4096
63 /* RSA verify SHA mode */
64 #define CY_CRYPTOLITE_CFG_RSA_VERIFY_SHA1
65 #define CY_CRYPTOLITE_CFG_RSA_VERIFY_SHA256
66 #define CY_CRYPTOLITE_CFG_RSA_VERIFY_SHA512
67 
68 /* Only NIST-P curves are currently supported */
69 #define CY_CRYPTOLITE_CFG_ECP_C
70 
71 //#define CY_CRYPTOLITE_CFG_ECP_DP_SECP192R1_ENABLED
72 //#define CY_CRYPTOLITE_CFG_ECP_DP_SECP224R1_ENABLED
73 #define CY_CRYPTOLITE_CFG_ECP_DP_SECP256R1_ENABLED
74 #define CY_CRYPTOLITE_CFG_ECP_DP_SECP384R1_ENABLED
75 //#define CY_CRYPTOLITE_CFG_ECP_DP_SECP521R1_ENABLED
76 
77 /* ECDSA functionality */
78 #define CY_CRYPTOLITE_CFG_ECDSA_C
79 /* ECDSA verification */
80 #define CY_CRYPTOLITE_CFG_ECDSA_VERIFY_C
81 
82 #endif
83 
84 #include "cy_device_headers.h"
85 
86 /* Check hardware configuration */
87 #if !defined(CY_IP_MXCRYPTOLITE)
88 #error "CY_IP_MXCRYPTOLITE configuration not available"
89 #endif /* !defined(CY_IP_MXCRYPTOLITE) */
90 
91 /* Check SHA configuration */
92 #if defined(CY_CRYPTOLITE_CFG_SHA2_256_ENABLED) \
93      && !defined(CY_CRYPTOLITE_CFG_SHA_C)
94 #error "CY_CRYPTOLITE_CFG_SHA_C is not defined to use SHA digests"
95 #endif
96 
97 #if defined(CY_CRYPTOLITE_CFG_SHA_C) && (!defined(CY_CRYPTOLITE_CFG_SHA2_256_ENABLED))
98 #error "CY_CRYPTOLITE_CFG_SHA_C is defined but no SHA mode is selected"
99 #endif
100 
101 /* Check HMAC configuration */
102 #if defined(CY_CRYPTOLITE_CFG_HMAC_C) && !defined(CY_CRYPTOLITE_CFG_SHA_C)
103 #error "CY_CRYPTOLITE_CFG_SHA_C is not defined to use HMAC calculation"
104 #endif /* defined(CY_CRYPTOLITE_CFG_HMAC_C) && !defined(CY_CRYPTOLITE_CFG_SHA_C) */
105 
106 /* Check RSA verify configuration */
107 #if defined(CY_CRYPTOLITE_CFG_RSA_VERIFY_ENABLED) && !defined(CY_CRYPTOLITE_CFG_RSA_C)
108 #error "CY_CRYPTOLITE_CFG_RSA_C is not defined to use RSA verification functionality"
109 #endif
110 
111 #if defined(CY_CRYPTOLITE_CFG_RSA_VERIFY_ENABLED) && !defined(CY_CRYPTOLITE_CFG_SHA_C)
112 #error "CY_CRYPTOLITE_CFG_SHA_C is not defined to use RSA verification functionality"
113 #endif
114 
115 /* Check ECDSA configuration */
116 #if (defined(CY_CRYPTOLITE_CFG_ECDSA_VERIFY_C) && !defined(CY_CRYPTOLITE_CFG_ECDSA_C))
117 #error "CY_CRYPTOLITE_CFG_ECDSA_C is not defined to use ECDSA functionalities"
118 #endif
119 
120 #if defined(CY_CRYPTOLITE_CFG_ECDSA_C) && !defined(CY_CRYPTOLITE_CFG_ECP_C)
121 #define CY_CRYPTOLITE_CFG_ECP_C
122 #endif /* defined(CY_CRYPTOLITE_CFG_ECDSA_C) && !defined(CY_CRYPTOLITE_CFG_ECP_C) */
123 
124 /* Check ECP configuration */
125 #if !(defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP192R1_ENABLED) || \
126      defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP224R1_ENABLED) || \
127      defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP256R1_ENABLED) || \
128      defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP384R1_ENABLED) || \
129      defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP521R1_ENABLED)) \
130      && defined(CY_CRYPTOLITE_CFG_ECP_C)
131 #error "CY_CRYPTOLITE_CFG_ECP_C is defined but no curve is selected"
132 #endif
133 
134 #if (defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP192R1_ENABLED) || \
135      defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP224R1_ENABLED) || \
136      defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP256R1_ENABLED) || \
137      defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP384R1_ENABLED) || \
138      defined(CY_CRYPTOLITE_CFG_ECP_DP_SECP521R1_ENABLED)) \
139      && !defined(CY_CRYPTOLITE_CFG_ECP_C)
140 #error "CY_CRYPTOLITE_CFG_ECP_C is not defined to use ECP functionality"
141 #endif
142 
143 #endif /* #if !defined(CY_CRYPTOLITE_CONFIG_H) */
144 
145 /* [] END OF FILE */
146