Skip to content

Commit fa5df14

Browse files
LDong-ArmPatater
authored andcommitted
psa: Add mbedtls_svc_key_id.h
In order for Mbed TLS to use the PSA Crypto API, definitions of `MBEDTLS_SVC_KEY_ID_INIT`, `mbedtls_svc_key_id_t` and `mbedtls_svc_key_id_is_null()` need to be present but are not provided by the PSA headers from TF-M. To solve this issue, this commit copies those definitions from Mbed TLS's original `psa/crypto_types.h` and `psa/crypto_values.h` into a separate `mbedtls_svc_key_id.h` for TF-M PSA.
1 parent f275a83 commit fa5df14

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* \file mbedtls_svc_key_id.h
3+
*
4+
* Excerpted from Mbed TLS for internal use by Mbed TLS's PSK key exchange to
5+
* interface with generic PSA Crypto implementations.
6+
*
7+
*/
8+
/*
9+
* Copyright The Mbed TLS Contributors
10+
* SPDX-License-Identifier: Apache-2.0
11+
*
12+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
13+
* not use this file except in compliance with the License.
14+
* You may obtain a copy of the License at
15+
*
16+
* http://www.apache.org/licenses/LICENSE-2.0
17+
*
18+
* Unless required by applicable law or agreed to in writing, software
19+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
* See the License for the specific language governing permissions and
22+
* limitations under the License.
23+
*/
24+
25+
#ifndef MBEDTLS_SVC_KEY_ID_H
26+
#define MBEDTLS_SVC_KEY_ID_H
27+
28+
#ifdef __cplusplus
29+
extern "C" {
30+
#endif
31+
32+
typedef psa_key_id_t mbedtls_svc_key_id_t;
33+
34+
#define MBEDTLS_SVC_KEY_ID_INIT ( (psa_key_id_t)0 )
35+
36+
/** Check whether a key identifier is null.
37+
*
38+
* \param key Key identifier.
39+
*
40+
* \return Non-zero if the key identifier is null, zero otherwise.
41+
*/
42+
static inline int mbedtls_svc_key_id_is_null( mbedtls_svc_key_id_t key )
43+
{
44+
return( key == 0 );
45+
}
46+
47+
/**@}*/
48+
49+
#ifdef __cplusplus
50+
}
51+
#endif
52+
53+
#endif /* MBEDTLS_SVC_KEY_ID_H */
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* \file mbedtls_svc_key_id.h
3+
*
4+
* Excerpted from Mbed TLS for internal use by Mbed TLS's PSK key exchange to
5+
* interface with generic PSA Crypto implementations.
6+
*
7+
*/
8+
/*
9+
* Copyright The Mbed TLS Contributors
10+
* SPDX-License-Identifier: Apache-2.0
11+
*
12+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
13+
* not use this file except in compliance with the License.
14+
* You may obtain a copy of the License at
15+
*
16+
* http://www.apache.org/licenses/LICENSE-2.0
17+
*
18+
* Unless required by applicable law or agreed to in writing, software
19+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
* See the License for the specific language governing permissions and
22+
* limitations under the License.
23+
*/
24+
25+
#ifndef MBEDTLS_SVC_KEY_ID_H
26+
#define MBEDTLS_SVC_KEY_ID_H
27+
28+
#ifdef __cplusplus
29+
extern "C" {
30+
#endif
31+
32+
typedef psa_key_id_t mbedtls_svc_key_id_t;
33+
34+
#define MBEDTLS_SVC_KEY_ID_INIT ( (psa_key_id_t)0 )
35+
36+
/** Check whether a key identifier is null.
37+
*
38+
* \param key Key identifier.
39+
*
40+
* \return Non-zero if the key identifier is null, zero otherwise.
41+
*/
42+
static inline int mbedtls_svc_key_id_is_null( mbedtls_svc_key_id_t key )
43+
{
44+
return( key == 0 );
45+
}
46+
47+
/**@}*/
48+
49+
#ifdef __cplusplus
50+
}
51+
#endif
52+
53+
#endif /* MBEDTLS_SVC_KEY_ID_H */

0 commit comments

Comments
 (0)