mbed TLS v2.2.0
config-sl-crypto-all-acceleration.h
Go to the documentation of this file.
1 /*
2  * Configuration for enabling CRYPTO hardware acceleration in all mbedtls
3  * modules when running on SiliconLabs devices.
4  *
5  * Copyright (C) 2016, Silicon Labs, http://www.silabs.com
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License"); you may
9  * not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
35 #ifndef MBEDTLS_CONFIG_SL_CRYPTO_ALL_ACCELERATION_H
36 #define MBEDTLS_CONFIG_SL_CRYPTO_ALL_ACCELERATION_H
37 
38 #include "em_device.h"
39 
40 #if !defined(NO_CRYPTO_ACCELERATION)
41 
59 //#define MBEDTLS_SLCL_PLUGINS
60 
84 #if defined(MBEDTLS_SLCL_PLUGINS) && defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
85 //#define MBEDTLS_CRYPTO_DEVICE_PREEMPTION
86 #endif
87 
99 #define MBEDTLS_AES_ALT
100 
113 #if defined(MBEDTLS_SLCL_PLUGINS)
114 #define MBEDTLS_CCM_ALT
115 #endif
116 
128 #if defined(MBEDTLS_SLCL_PLUGINS) && defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
129 #define MBEDTLS_CMAC_C
130 #endif
131 
142 #if defined(MBEDTLS_SLCL_PLUGINS) && defined(MBEDTLS_CMAC_C) && \
143  defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
144 #define MBEDTLS_CMAC_ALT
145 #endif
146 
169 #if defined(MBEDTLS_SLCL_PLUGINS) && defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
170 //#define MBEDTLS_DEVICE_YIELD_WHEN_BUSY
171 #endif
172 
195 #if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
196 #define MBEDTLS_ECP_DEVICE_ALT
197 #define MBEDTLS_ECP_DOUBLE_JAC_ALT
198 #define MBEDTLS_ECP_DEVICE_ADD_MIXED_ALT
199 #define MBEDTLS_ECP_NORMALIZE_JAC_ALT
200 #define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
201 #define MBEDTLS_MPI_MODULAR_DIVISION_ALT
202 #endif
203 
227 #if defined(MBEDTLS_SLCL_PLUGINS) && defined(MBEDTLS_CRYPTO_DEVICE_PREEMPTION) && defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
228 #define MBEDTLS_ECP_ALT
229 #define MBEDTLS_ECP_GROUP_LOAD_ALT
230 #endif
231 
258 #if defined(MBEDTLS_SLCL_PLUGINS) && defined(MBEDTLS_CRYPTO_DEVICE_PREEMPTION) && defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
259 //#define MBEDTLS_ECP_CRITICAL_SHORT
260 #endif
261 
276 #if defined(MBEDTLS_SLCL_PLUGINS) && \
277  (defined(MBEDTLS_AES_ALT) || defined(MBEDTLS_CCM_ALT)) && \
278  defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
279 //#define MBEDTLS_INCLUDE_IO_MODE_DMA
280 #endif
281 
299 #if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
300 #define MBEDTLS_SHA1_ALT
301 #endif
302 
321 #if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
322 #define MBEDTLS_SHA256_ALT
323 #endif
324 
325 #endif /* #if !defined(NO_CRYPTO_ACCELERATION) */
326 
338 #if defined (DWT)
339 #define MBEDTLS_TIMING_ALT
340 #endif
341 
351 #if defined(TRNG_COUNT) && (TRNG_COUNT > 0)
352 #define MBEDTLS_TRNG_C
353 #endif
354 
374 #if defined(TRNG_COUNT) && (TRNG_COUNT > 0) && defined(MBEDTLS_TRNG_C)
375 #define MBEDTLS_TRNG_IGNORE_NOISE_ALARMS
376 #endif
377 
394 #if defined(TRNG_COUNT) && (TRNG_COUNT > 0) && defined(MBEDTLS_TRNG_C)
395 //#define MBEDTLS_TRNG_IGNORE_ALL_ALARMS
396 #endif
397 
408 #if defined(TRNG_COUNT) && (TRNG_COUNT > 0) && defined(MBEDTLS_TRNG_C)
409 #define MBEDTLS_ENTROPY_ALT
410 #define MBEDTLS_ENTROPY_INIT_ALT
411 #define MBEDTLS_ENTROPY_FREE_ALT
412 #endif
413 
414 /* Default ECC configuration for Silicon Labs devices: */
415 
416 /* ECC curves supported by CRYPTO hardware module: */
417 #define MBEDTLS_ECP_DP_SECP192R1_ENABLED
418 #define MBEDTLS_ECP_DP_SECP224R1_ENABLED
419 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
420 
421 /* Save RAM by adjusting to our exact needs */
422 #define MBEDTLS_ECP_MAX_BITS 256
423 #ifndef MBEDTLS_MPI_MAX_SIZE
424 #define MBEDTLS_MPI_MAX_SIZE 32 // 384 bits is 48 bytes
425 #endif
426 
427 /*
428  Set MBEDTLS_ECP_WINDOW_SIZE to configure
429  ECC point multiplication window size, see ecp.h:
430  2 = Save RAM at the expense of speed
431  3 = Improve speed at the expense of RAM
432  4 = Optimize speed at the expense of RAM
433 */
434 #define MBEDTLS_ECP_WINDOW_SIZE 3
435 #define MBEDTLS_ECP_FIXED_POINT_OPTIM 0
436 
437 /* Significant speed benefit at the expense of some ROM */
438 #define MBEDTLS_ECP_NIST_OPTIM
439 
440 /* Include the default mbed TLS config file */
441 #include "mbedtls/config.h"
442 
443 #undef MBEDTLS_FS_IO
444 #define MBEDTLS_NO_PLATFORM_ENTROPY
445 /* Hardware entropy source is not yet supported. Uncomment this macro to
446  provide your own implementation of an entropy collector. */
447 //#define MBEDTLS_ENTROPY_HARDWARE_ALT
448 
449 /* Exclude and/or change default config here. E.g.: */
450 //#undef MBEDTLS_ECP_DP_SECP384R1_ENABLED
451 //#undef MBEDTLS_ECP_DP_SECP521R1_ENABLED
452 //#undef MBEDTLS_ECP_DP_BP384R1_ENABLED
453 //#undef MBEDTLS_ECP_DP_BP512R1_ENABLED
454 //#undef MBEDTLS_SHA512_C
455 
456 #include "mbedtls/check_config.h"
457 
461 #endif /* MBEDTLS_CONFIG_SL_CRYPTO_ALL_ACCELERATION_H */
Compatibility names (set of defines)
Consistency checks for configuration options.