Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019, Arm Limited. All rights reserved.
* Copyright (c) 2017-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
Expand All @@ -25,16 +25,12 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn,
int32_t result;

/* TFM request protected by NS lock */
if (os_wrapper_mutex_acquire(ns_lock_handle, OS_WRAPPER_WAIT_FOREVER)
!= OS_WRAPPER_SUCCESS) {
return (int32_t)TFM_ERROR_GENERIC;
}
while (os_wrapper_mutex_acquire(ns_lock_handle, OS_WRAPPER_WAIT_FOREVER)
!= OS_WRAPPER_SUCCESS);

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

if (os_wrapper_mutex_release(ns_lock_handle) != OS_WRAPPER_SUCCESS) {
return (int32_t)TFM_ERROR_GENERIC;
}
while (os_wrapper_mutex_release(ns_lock_handle) != OS_WRAPPER_SUCCESS);

return result;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8635d8a23341
TF-Mv1.3.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* \file mbedtls_ecc_group_to_psa.h
*
* Excerpted from Mbed TLS for internal use by Mbed TLS's PK module to
* interface with generic PSA Crypto implementations.
*
*/
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef MBEDTLS_ECC_GROUP_TO_PSA_H
#define MBEDTLS_ECC_GROUP_TO_PSA_H

//#include "mbedtls/platform_util.h"

//#include "crypto_compat.h"

#ifdef __cplusplus
extern "C" {
#endif

/** \defgroup psa_tls_helpers TLS helper functions
* @{
*/

#if defined(MBEDTLS_ECP_C)
#include <mbedtls/ecp.h>

/** Convert an ECC curve identifier from the Mbed TLS encoding to PSA.
*
* \note This function is provided solely for the convenience of
* Mbed TLS and may be removed at any time without notice.
*
* \param grpid An Mbed TLS elliptic curve identifier
* (`MBEDTLS_ECP_DP_xxx`).
* \param[out] bits On success, the bit size of the curve.
*
* \return The corresponding PSA elliptic curve identifier
* (`PSA_ECC_FAMILY_xxx`).
* \return \c 0 on failure (\p grpid is not recognized).
*/
static inline psa_ecc_family_t mbedtls_ecc_group_to_psa( mbedtls_ecp_group_id grpid,
size_t *bits )
{
switch( grpid )
{
case MBEDTLS_ECP_DP_SECP192R1:
*bits = 192;
return( PSA_ECC_FAMILY_SECP_R1 );
case MBEDTLS_ECP_DP_SECP224R1:
*bits = 224;
return( PSA_ECC_FAMILY_SECP_R1 );
case MBEDTLS_ECP_DP_SECP256R1:
*bits = 256;
return( PSA_ECC_FAMILY_SECP_R1 );
case MBEDTLS_ECP_DP_SECP384R1:
*bits = 384;
return( PSA_ECC_FAMILY_SECP_R1 );
case MBEDTLS_ECP_DP_SECP521R1:
*bits = 521;
return( PSA_ECC_FAMILY_SECP_R1 );
case MBEDTLS_ECP_DP_BP256R1:
*bits = 256;
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
case MBEDTLS_ECP_DP_BP384R1:
*bits = 384;
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
case MBEDTLS_ECP_DP_BP512R1:
*bits = 512;
return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
case MBEDTLS_ECP_DP_CURVE25519:
*bits = 255;
return( PSA_ECC_FAMILY_MONTGOMERY );
case MBEDTLS_ECP_DP_SECP192K1:
*bits = 192;
return( PSA_ECC_FAMILY_SECP_K1 );
case MBEDTLS_ECP_DP_SECP224K1:
*bits = 224;
return( PSA_ECC_FAMILY_SECP_K1 );
case MBEDTLS_ECP_DP_SECP256K1:
*bits = 256;
return( PSA_ECC_FAMILY_SECP_K1 );
case MBEDTLS_ECP_DP_CURVE448:
*bits = 448;
return( PSA_ECC_FAMILY_MONTGOMERY );
default:
*bits = 0;
return( 0 );
}
}

#endif /* MBEDTLS_ECP_C */

/**@}*/

#ifdef __cplusplus
}
#endif

#endif /* MBEDTLS_ECC_GROUP_TO_PSA_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2020-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/

#ifndef __OS_WRAPPER_MSG_QUEUE_H__
#define __OS_WRAPPER_MSG_QUEUE_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>

#include "common.h"

/**
* \brief Create and initialize a message queue
*
* \param[in] msg_size The maximum message size in bytes
* \param[in] msg_count The maximum number of messages in queue
*
* \return Returns handle of the message queue created, or NULL in case of error
*/
void *os_wrapper_msg_queue_create(size_t msg_size, uint8_t msg_count);

/**
* \brief Send a message via message queue
*
* \param[in] mq_handle The handle of message queue
* \param[in] msg_ptr The pointer to the message to be sent
*
* \return \ref OS_WRAPPER_SUCCESS if the message is successfully sent, or
* \ref OS_WRAPPER_ERROR in case of error
*
* \note The message size must be the same as the value set in
* \ref os_wrapper_msg_queue_create.
*
* \note Time out value is not specified here. Whether the function is blocked
* or returns instantly depends on the actual implementation and usage
* scenario.
*/
int32_t os_wrapper_msg_queue_send(void *mq_handle,
const void *msg_ptr);

/**
* \brief Receive a message from message queue
*
* \param[in] mq_handle The handle of message queue
* \param[in] msg_ptr The pointer to buffer for message to be received
*
* \return \ref OS_WRAPPER_SUCCESS if the message is successfully received, or
* \ref OS_WRAPPER_ERROR in case of error
*
* \note The message size is the same as the value set in
* \ref os_wrapper_msg_queue_create.
*
* \note The function should be blocked until a message is received from message
* queue, unless an error occurs.
*/
int32_t os_wrapper_msg_queue_receive(void *mq_handle,
void *msg_ptr);

#ifdef __cplusplus
}
#endif

#endif /* __OS_WRAPPER_MSG_QUEUE_H__ */
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Arm Limited. All rights reserved.
* Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
Expand All @@ -21,9 +21,10 @@ extern "C" {

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

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