blob: cbd65369f0d3644c475473745813cb95f81390a2 [file] [log] [blame]
jothikumar maniad5b37d2023-06-06 20:25:39 +08001/** @file
2 * Copyright (c) 2023, Arm Limited or its affiliates. All rights reserved.
3 * SPDX-License-Identifier : Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16**/
17
18#ifndef MANAGER_CRYPTO_CONFIG_H
19#define MANAGER_CRYPTO_CONFIG_H
20
21#include <psa_adac_config.h>
22
23#define MBEDTLS_PSA_CRYPTO_C
24
25/* System support */
26#define MBEDTLS_PLATFORM_C
27#define MBEDTLS_PLATFORM_MEMORY
28#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
29
30#if defined(PSA_ADAC_RSA3072) || defined(PSA_ADAC_RSA4096)
31#define MBEDTLS_RSA_C
32#define MBEDTLS_PKCS1_V21
33#define MBEDTLS_OID_C
34#define MBEDTLS_BIGNUM_C
35#define MBEDTLS_GENPRIME
36
37/* Support RSA key sizes up to 4096 bit */
38#define MBEDTLS_MPI_MAX_SIZE 512
39#endif
40
41/* PSA ADAC */
42#if defined(PSA_ADAC_EC_P256) || defined(PSA_ADAC_EC_P521)
43#define MBEDTLS_ECDSA_C
44#define MBEDTLS_ECDSA_DETERMINISTIC
45#define MBEDTLS_ECP_C
46#define MBEDTLS_ASN1_PARSE_C
47#define MBEDTLS_ASN1_WRITE_C
48#define MBEDTLS_HMAC_DRBG_C
49#if defined(PSA_ADAC_EC_P256)
50#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
51#endif
52#if defined(PSA_ADAC_EC_P521)
53#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
54#endif
55#endif
56
57#ifdef PSA_ADAC_CMAC
58#define MBEDTLS_CMAC_C
59#endif
60
61#ifdef PSA_ADAC_HMAC
62#define MBEDTLS_HKDF_C
63#endif
64
65/* Needed by PSA Crypto API Implementation */
66#define MBEDTLS_CTR_DRBG_C
67#define MBEDTLS_ENTROPY_C
68#define MBEDTLS_AES_C
69
70#define MBEDTLS_MD_C
71#define MBEDTLS_SHA256_C
72#define MBEDTLS_SHA512_C
73
74/* Add CCM on Windows */
75#if defined(_MSC_VER)
76#define MBEDTLS_CCM_C
77#endif
78
79/* Needed by manager */
80#define MBEDTLS_ASN1_PARSE_C
81#define MBEDTLS_ASN1_WRITE_C
82#define MBEDTLS_PK_WRITE_C
83#define MBEDTLS_PK_PARSE_C
84#define MBEDTLS_PK_C
85#define MBEDTLS_PEM_PARSE_C
86#define MBEDTLS_BASE64_C
87#define MBEDTLS_CIPHER_C
88#define MBEDTLS_FS_IO
89
90/* Optimizations */
91#define MBEDTLS_AESNI_C
92#define MBEDTLS_HAVE_ASM
93
94#include "mbedtls/check_config.h"
95
96#endif /* MBEDTLS_CONFIG_BOOT_H */