Skip to content

Commit d8a8074

Browse files
author
itayzafrir
committed
Add common header for crypto service integration
1 parent 7b6f37f commit d8a8074

File tree

5 files changed

+42
-58
lines changed

5 files changed

+42
-58
lines changed

library/psa_crypto.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,8 @@
2626
#endif
2727

2828
#if defined(MBEDTLS_PSA_CRYPTO_C)
29-
/*
30-
* When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM
31-
* (Secure Partition Manager) integration which separates the code into two
32-
* parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing
33-
* Environment). When building for the SPE, an additional header file should be
34-
* included.
35-
*/
36-
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
37-
/*
38-
* PSA_CRYPTO_SECURE means that this file is compiled for the SPE.
39-
* Some headers will be affected by this flag.
40-
*/
41-
#define PSA_CRYPTO_SECURE 1
42-
#include "crypto_spe.h"
43-
#endif
4429

30+
#include "psa_crypto_service_integration.h"
4531
#include "psa/crypto.h"
4632

4733
#include "psa_crypto_core.h"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* Copyright (C) 2019, ARM Limited, All Rights Reserved
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
5+
* not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* This file is part of mbed TLS (https://tls.mbed.org)
17+
*/
18+
19+
#ifndef PSA_CRYPTO_SERVICE_INTEGRATION_H
20+
#define PSA_CRYPTO_SERVICE_INTEGRATION_H
21+
22+
/*
23+
* When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM
24+
* (Secure Partition Manager) integration which separates the code into two
25+
* parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing
26+
* Environment). When building for the SPE, an additional header file should be
27+
* included.
28+
*/
29+
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
30+
/*
31+
* PSA_CRYPTO_SECURE means that this file is compiled for the SPE.
32+
* Some headers will be affected by this flag.
33+
*/
34+
#define PSA_CRYPTO_SECURE 1
35+
#include "crypto_spe.h"
36+
#endif // MBEDTLS_PSA_CRYPTO_SPM
37+
38+
#endif // PSA_CRYPTO_SERVICE_INTEGRATION_H

library/psa_crypto_slot_management.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,8 @@
2626
#endif
2727

2828
#if defined(MBEDTLS_PSA_CRYPTO_C)
29-
/*
30-
* When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM
31-
* (Secure Partition Manager) integration which separates the code into two
32-
* parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing
33-
* Environment). When building for the SPE, an additional header file should be
34-
* included.
35-
*/
36-
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
37-
/*
38-
* PSA_CRYPTO_SECURE means that this file is compiled for the SPE.
39-
* Some headers will be affected by this flag.
40-
*/
41-
#define PSA_CRYPTO_SECURE 1
42-
#include "crypto_spe.h"
43-
#endif
4429

30+
#include "psa_crypto_service_integration.h"
4531
#include "psa/crypto.h"
4632

4733
#include "psa_crypto_core.h"

library/psa_crypto_storage.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,8 @@
2929

3030
#include <stdlib.h>
3131
#include <string.h>
32-
/*
33-
* When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM
34-
* (Secure Partition Manager) integration which separates the code into two
35-
* parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing
36-
* Environment). When building for the SPE, an additional header file should be
37-
* included.
38-
*/
39-
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
40-
/*
41-
* PSA_CRYPTO_SECURE means that this file is compiled for the SPE.
42-
* Some headers will be affected by this flag.
43-
*/
44-
#define PSA_CRYPTO_SECURE 1
45-
#endif
4632

33+
#include "psa_crypto_service_integration.h"
4734
#include "psa/crypto.h"
4835
#include "psa_crypto_storage.h"
4936
#include "psa_crypto_storage_backend.h"

library/psa_crypto_storage_its.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,8 @@
2626
#endif
2727

2828
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C)
29-
/*
30-
* When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM
31-
* (Secure Partition Manager) integration which separates the code into two
32-
* parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing
33-
* Environment). When building for the SPE, an additional header file should be
34-
* included.
35-
*/
36-
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
37-
/*
38-
* PSA_CRYPTO_SECURE means that this file is compiled for the SPE.
39-
* Some headers will be affected by this flag.
40-
*/
41-
#define PSA_CRYPTO_SECURE 1
42-
#endif
4329

30+
#include "psa_crypto_service_integration.h"
4431
#include "psa/crypto.h"
4532
#include "psa_crypto_storage_backend.h"
4633
#include "psa/internal_trusted_storage.h"

0 commit comments

Comments
 (0)