Skip to content

Commit 276fde4

Browse files
committed
Enable PSA Crypto APIs by default
Since this example is not useful without PSA Crypto APIs, enable PSA Crypto APIs by default via an Mbed TLS user configuration file, along with a default implmentation of the PSA Entropy Injection API that uses PSA storage (ITS).
1 parent 2e88cf7 commit 276fde4

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

mbed_app.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"platform.stdio-convert-newlines": true,
55
"target.extra_labels_add": ["PSA"]
66
}
7-
}
7+
},
8+
"macros": [
9+
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_user_config.h\""
10+
]
811
}
912

mbedtls_user_config.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (C) 2006-2018, Arm Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* 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, WITHOUT
13+
* 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+
* This file is part of Mbed TLS (https://tls.mbed.org)
18+
*/
19+
20+
/* Enable PSA APIs, which this example depends on. */
21+
#if !defined(MBEDTLS_PSA_CRYPTO_C)
22+
# define MBEDTLS_PSA_CRYPTO_C
23+
#endif
24+
25+
/* Enable the default implementation of the PSA entropy injection API if we are
26+
* building for an SPE. */
27+
#if defined(COMPONENT_PSA_SRV_IMPL) || defined(COMPONENT_PSA_SRV_EMUL)
28+
# define MBEDTLS_ENTROPY_NV_SEED
29+
# define MBEDTLS_PSA_HAS_ITS_IO
30+
# define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbed_default_seed_read
31+
# define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbed_default_seed_write
32+
#endif

0 commit comments

Comments
 (0)