blob: 7a803d619afd03a48c709d43fb3e161068d8b054 [file] [log] [blame]
Jens Wiklandera97bc4a2018-05-18 15:49:22 +02001/* SPDX-License-Identifier: BSD-2-Clause */
2/* Copyright (c) 2018, Linaro Limited */
Jens Wiklandere789ada2018-11-05 21:06:50 +01003#ifndef __MBEDTLS_CONFIG_KERNEL_H
4#define __MBEDTLS_CONFIG_KERNEL_H
5
6#ifdef CFG_CORE_MBEDTLS_MPI
Jens Wiklanderc6e2ead2018-11-09 13:29:03 +01007#ifdef ARM32
8#define MBEDTLS_HAVE_INT32
9#endif
10#ifdef ARM64
11#define MBEDTLS_HAVE_INT64
12#endif
Jens Wiklandere789ada2018-11-05 21:06:50 +010013#define MBEDTLS_BIGNUM_C
14#define MBEDTLS_GENPRIME
15#endif
16
Edison Ai77327d72017-12-15 16:38:30 +080017/* Test if Mbedtls is the primary crypto lib */
18#ifdef CFG_CRYPTOLIB_NAME_mbedtls
19
Jens Wiklanderdddd6a22019-03-28 16:51:29 +010020#if defined(CFG_CRYPTO_MD5)
21#define MBEDTLS_MD5_C
22#define MBEDTLS_MD_C
23#endif
24
25#if defined(CFG_CRYPTO_SHA1)
26#define MBEDTLS_SHA1_C
27#define MBEDTLS_MD_C
28#endif
29
30#if defined(CFG_CRYPTO_SHA224) || defined(CFG_CRYPTO_SHA256)
31#define MBEDTLS_SHA256_C
32#define MBEDTLS_MD_C
33#endif
34
35#if defined(CFG_CRYPTO_SHA384) || defined(CFG_CRYPTO_SHA512)
36#define MBEDTLS_SHA512_C
37#define MBEDTLS_MD_C
38#endif
39
Edison Ai2b716cc2017-10-01 14:51:16 +020040#if defined(CFG_CRYPTO_HMAC)
41#define MBEDTLS_MD_C
42#endif
43
Edison Aid2e5e902018-01-09 16:37:54 +080044#if defined(CFG_CRYPTO_AES)
45#define MBEDTLS_AES_C
46#define MBEDTLS_AES_ROM_TABLES
47#endif
48
49#if defined(CFG_CRYPTO_DES)
50#define MBEDTLS_DES_C
51#endif
52
53#if defined(CFG_CRYPTO_CBC)
54#define MBEDTLS_CIPHER_MODE_CBC
55#endif
56
57#if defined(CFG_CRYPTO_CTR)
58#define MBEDTLS_CIPHER_MODE_CTR
59#endif
60
Edison Aiebc81cd2017-12-27 14:02:42 +080061#if defined(CFG_CRYPTO_CMAC)
62#define MBEDTLS_CMAC_C
63#define MBEDTLS_CIPHER_C
64#endif
65
Edison Ai000fae52017-09-14 14:17:40 +080066#if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_DSA) || \
67 defined(CFG_CRYPTO_DH) || defined(CFG_CRYPTO_ECC)
68#define MBEDTLS_BIGNUM_C
69#endif
70
Edison Ai77327d72017-12-15 16:38:30 +080071#endif /*CFG_CRYPTOLIB_NAME_mbedtls*/
72
Jens Wiklandere789ada2018-11-05 21:06:50 +010073#include <mbedtls/check_config.h>
74
75#endif /* __MBEDTLS_CONFIG_KERNEL_H */