Change script for apply upstream code
[platform/upstream/connectedhomeip.git] / third_party / openthread / repo / examples / platforms / efr32mg21 / crypto / efr32-mbedtls-config.h
1 /*
2  *  Copyright (c) 2019, The OpenThread Authors.
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #ifndef EFR32_MBEDTLS_CONFIG_H
30 #define EFR32_MBEDTLS_CONFIG_H
31
32 #include "em_device.h"
33 #include "em_se.h"
34
35 /**
36  * \def MBEDTLS_AES_ALT
37  *
38  * Enable hardware acceleration for the AES block cipher
39  *
40  * Module:  sl_crypto/src/crypto_aes.c for devices with CRYPTO
41  *          sl_crypto/src/aes_aes.c for devices with AES
42  *
43  * See MBEDTLS_AES_C for more information.
44  */
45 #define MBEDTLS_AES_ALT
46
47 /**
48  * \def MBEDTLS_ENTROPY_HARDWARE_ALT
49  *
50  * Integrate the provided default entropy source into the mbed
51  * TLS entropy infrastructure.
52  *
53  */
54 #define MBEDTLS_ENTROPY_HARDWARE_ALT
55
56 /* Turn on all hardware acceleration provided by the EFR32xG21's built-in SE */
57 #define MBEDTLS_SHA1_ALT
58 #define MBEDTLS_SHA1_PROCESS_ALT
59 #define MBEDTLS_SHA256_ALT
60 #define MBEDTLS_SHA256_PROCESS_ALT
61 #define MBEDTLS_SHA512_ALT
62 #define MBEDTLS_SHA512_PROCESS_ALT
63
64 #define MBEDTLS_CCM_ALT
65 #define MBEDTLS_CMAC_ALT
66
67 /* Turning on ECC acceleration is dependant on not requiring curve25519 when
68  * running on EFR32xG21A devices */
69 #if (defined(_SILICON_LABS_SECURITY_FEATURE) &&                                   \
70      (_SILICON_LABS_SECURITY_FEATURE == _SILICON_LABS_SECURITY_FEATURE_VAULT)) || \
71     !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
72 #define MBEDTLS_ECDH_GEN_PUBLIC_ALT
73 #define MBEDTLS_ECDSA_GENKEY_ALT
74 #define MBEDTLS_ECDH_COMPUTE_SHARED_ALT
75 #define MBEDTLS_ECDSA_SIGN_ALT
76 #define MBEDTLS_ECDSA_VERIFY_ALT
77 /* Incompatibility in header files between mbedTLS version in OT and GSDK means
78  * we can't turn on EC-JPAKE acceleration on EFR32xG21 just yet. Will be fixed
79  * for the next GSDK update */
80 //#define MBEDTLS_ECJPAKE_ALT
81 #endif /* EFR32xG21B or curve25519 not enabled */
82
83 #endif // EFR32_MBEDTLS_CONFIG_H