Skip to content

Commit 9f35f29

Browse files
authored
Merge pull request #14582 from LDong-Arm/TF-Mv1.3.0_update
Update TF-M to v1.3.0
2 parents 331473a + 032fe4a commit 9f35f29

32 files changed

+1158
-707
lines changed

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_V8M/src/tfm_ns_interface.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017-2019, Arm Limited. All rights reserved.
2+
* Copyright (c) 2017-2021, Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*
@@ -25,16 +25,12 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn,
2525
int32_t result;
2626

2727
/* TFM request protected by NS lock */
28-
if (os_wrapper_mutex_acquire(ns_lock_handle, OS_WRAPPER_WAIT_FOREVER)
29-
!= OS_WRAPPER_SUCCESS) {
30-
return (int32_t)TFM_ERROR_GENERIC;
31-
}
28+
while (os_wrapper_mutex_acquire(ns_lock_handle, OS_WRAPPER_WAIT_FOREVER)
29+
!= OS_WRAPPER_SUCCESS);
3230

3331
result = fn(arg0, arg1, arg2, arg3);
3432

35-
if (os_wrapper_mutex_release(ns_lock_handle) != OS_WRAPPER_SUCCESS) {
36-
return (int32_t)TFM_ERROR_GENERIC;
37-
}
33+
while (os_wrapper_mutex_release(ns_lock_handle) != OS_WRAPPER_SUCCESS);
3834

3935
return result;
4036
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8635d8a23341
1+
TF-Mv1.3.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/**
2+
* \file mbedtls_ecc_group_to_psa.h
3+
*
4+
* Excerpted from Mbed TLS for internal use by Mbed TLS's PK module 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_ECC_GROUP_TO_PSA_H
26+
#define MBEDTLS_ECC_GROUP_TO_PSA_H
27+
28+
//#include "mbedtls/platform_util.h"
29+
30+
//#include "crypto_compat.h"
31+
32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
36+
/** \defgroup psa_tls_helpers TLS helper functions
37+
* @{
38+
*/
39+
40+
#if defined(MBEDTLS_ECP_C)
41+
#include <mbedtls/ecp.h>
42+
43+
/** Convert an ECC curve identifier from the Mbed TLS encoding to PSA.
44+
*
45+
* \note This function is provided solely for the convenience of
46+
* Mbed TLS and may be removed at any time without notice.
47+
*
48+
* \param grpid An Mbed TLS elliptic curve identifier
49+
* (`MBEDTLS_ECP_DP_xxx`).
50+
* \param[out] bits On success, the bit size of the curve.
51+
*
52+
* \return The corresponding PSA elliptic curve identifier
53+
* (`PSA_ECC_FAMILY_xxx`).
54+
* \return \c 0 on failure (\p grpid is not recognized).
55+
*/
56+
static inline psa_ecc_family_t mbedtls_ecc_group_to_psa( mbedtls_ecp_group_id grpid,
57+
size_t *bits )
58+
{
59+
switch( grpid )
60+
{
61+
case MBEDTLS_ECP_DP_SECP192R1:
62+
*bits = 192;
63+
return( PSA_ECC_FAMILY_SECP_R1 );
64+
case MBEDTLS_ECP_DP_SECP224R1:
65+
*bits = 224;
66+
return( PSA_ECC_FAMILY_SECP_R1 );
67+
case MBEDTLS_ECP_DP_SECP256R1:
68+
*bits = 256;
69+
return( PSA_ECC_FAMILY_SECP_R1 );
70+
case MBEDTLS_ECP_DP_SECP384R1:
71+
*bits = 384;
72+
return( PSA_ECC_FAMILY_SECP_R1 );
73+
case MBEDTLS_ECP_DP_SECP521R1:
74+
*bits = 521;
75+
return( PSA_ECC_FAMILY_SECP_R1 );
76+
case MBEDTLS_ECP_DP_BP256R1:
77+
*bits = 256;
78+
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
79+
case MBEDTLS_ECP_DP_BP384R1:
80+
*bits = 384;
81+
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
82+
case MBEDTLS_ECP_DP_BP512R1:
83+
*bits = 512;
84+
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
85+
case MBEDTLS_ECP_DP_CURVE25519:
86+
*bits = 255;
87+
return( PSA_ECC_FAMILY_MONTGOMERY );
88+
case MBEDTLS_ECP_DP_SECP192K1:
89+
*bits = 192;
90+
return( PSA_ECC_FAMILY_SECP_K1 );
91+
case MBEDTLS_ECP_DP_SECP224K1:
92+
*bits = 224;
93+
return( PSA_ECC_FAMILY_SECP_K1 );
94+
case MBEDTLS_ECP_DP_SECP256K1:
95+
*bits = 256;
96+
return( PSA_ECC_FAMILY_SECP_K1 );
97+
case MBEDTLS_ECP_DP_CURVE448:
98+
*bits = 448;
99+
return( PSA_ECC_FAMILY_MONTGOMERY );
100+
default:
101+
*bits = 0;
102+
return( 0 );
103+
}
104+
}
105+
106+
#endif /* MBEDTLS_ECP_C */
107+
108+
/**@}*/
109+
110+
#ifdef __cplusplus
111+
}
112+
#endif
113+
114+
#endif /* MBEDTLS_ECC_GROUP_TO_PSA_H */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (c) 2020-2021, Arm Limited. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*
6+
*/
7+
8+
#ifndef __OS_WRAPPER_MSG_QUEUE_H__
9+
#define __OS_WRAPPER_MSG_QUEUE_H__
10+
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif
14+
15+
#include <stddef.h>
16+
17+
#include "common.h"
18+
19+
/**
20+
* \brief Create and initialize a message queue
21+
*
22+
* \param[in] msg_size The maximum message size in bytes
23+
* \param[in] msg_count The maximum number of messages in queue
24+
*
25+
* \return Returns handle of the message queue created, or NULL in case of error
26+
*/
27+
void *os_wrapper_msg_queue_create(size_t msg_size, uint8_t msg_count);
28+
29+
/**
30+
* \brief Send a message via message queue
31+
*
32+
* \param[in] mq_handle The handle of message queue
33+
* \param[in] msg_ptr The pointer to the message to be sent
34+
*
35+
* \return \ref OS_WRAPPER_SUCCESS if the message is successfully sent, or
36+
* \ref OS_WRAPPER_ERROR in case of error
37+
*
38+
* \note The message size must be the same as the value set in
39+
* \ref os_wrapper_msg_queue_create.
40+
*
41+
* \note Time out value is not specified here. Whether the function is blocked
42+
* or returns instantly depends on the actual implementation and usage
43+
* scenario.
44+
*/
45+
int32_t os_wrapper_msg_queue_send(void *mq_handle,
46+
const void *msg_ptr);
47+
48+
/**
49+
* \brief Receive a message from message queue
50+
*
51+
* \param[in] mq_handle The handle of message queue
52+
* \param[in] msg_ptr The pointer to buffer for message to be received
53+
*
54+
* \return \ref OS_WRAPPER_SUCCESS if the message is successfully received, or
55+
* \ref OS_WRAPPER_ERROR in case of error
56+
*
57+
* \note The message size is the same as the value set in
58+
* \ref os_wrapper_msg_queue_create.
59+
*
60+
* \note The function should be blocked until a message is received from message
61+
* queue, unless an error occurs.
62+
*/
63+
int32_t os_wrapper_msg_queue_receive(void *mq_handle,
64+
void *msg_ptr);
65+
66+
#ifdef __cplusplus
67+
}
68+
#endif
69+
70+
#endif /* __OS_WRAPPER_MSG_QUEUE_H__ */

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/psa/client.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2020, Arm Limited. All rights reserved.
2+
* Copyright (c) 2018-2021, Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*
@@ -21,9 +21,10 @@ extern "C" {
2121

2222
/**
2323
* The version of the PSA Framework API that is being used to build the calling
24-
* firmware.
24+
* firmware. Only part of features of FF-M v1.1 have been implemented. FF-M v1.1
25+
* is compatible with v1.0.
2526
*/
26-
#define PSA_FRAMEWORK_VERSION (0x0100u)
27+
#define PSA_FRAMEWORK_VERSION (0x0101u)
2728

2829
/**
2930
* Return value from psa_version() if the requested RoT Service is not present
@@ -130,7 +131,7 @@ psa_handle_t psa_connect(uint32_t sid, uint32_t version);
130131
* Must be zero( \ref PSA_IPC_CALL) or positive.
131132
* \param[in] in_vec Array of input \ref psa_invec structures.
132133
* \param[in] in_len Number of input \ref psa_invec structures.
133-
* \param[in/out] out_vec Array of output \ref psa_outvec structures.
134+
* \param[in,out] out_vec Array of output \ref psa_outvec structures.
134135
* \param[in] out_len Number of output \ref psa_outvec structures.
135136
*
136137
* \retval >=0 RoT Service-specific status value.

0 commit comments

Comments
 (0)