aboutsummaryrefslogtreecommitdiff
path: root/interface
diff options
context:
space:
mode:
authorDavid Hu <david.hu@arm.com>2021-04-01 16:34:30 +0800
committerDavid Hu <david.hu@arm.com>2021-04-29 08:56:18 +0200
commit7c2a744b3712f481b9dc7ab89bcc0ef5cb30f5fa (patch)
tree300e04d87a0abc5ae4090bc9074076a6da8f4d39 /interface
parentcd22d1bd7f96ece9f88df87445f7be138de380b3 (diff)
downloadtrusted-firmware-m-7c2a744b3712f481b9dc7ab89bcc0ef5cb30f5fa.tar.gz
Interface: Fix veneer function naming
Some veneer functions are named with "tfm_tfm_" prefix. It is confusing and unfriendly to NS integration. This patch unifies the prefix of all the veneer function as "tfm_" - Fix the duplicated "tfm_" prefixes by checking secure function prefix in tfm_veneer template. - Replace all the "tfm_tfm_" prefixes with "tfm_". Change-Id: Id658486f49f4a6f1f22fd3897be27865889474ae Signed-off-by: David Hu <david.hu@arm.com>
Diffstat (limited to 'interface')
-rw-r--r--interface/include/tfm_veneers.h.template7
-rw-r--r--interface/src/tfm_audit_func_api.c14
-rw-r--r--interface/src/tfm_crypto_func_api.c4
-rw-r--r--interface/src/tfm_firmware_update_func_api.c17
-rw-r--r--interface/src/tfm_its_func_api.c13
-rw-r--r--interface/src/tfm_ps_func_api.c35
6 files changed, 46 insertions, 44 deletions
diff --git a/interface/include/tfm_veneers.h.template b/interface/include/tfm_veneers.h.template
index 502dee28a..ee17d3f95 100644
--- a/interface/include/tfm_veneers.h.template
+++ b/interface/include/tfm_veneers.h.template
@@ -22,7 +22,14 @@ extern "C" {
{% endif %}
/******** {{partition.manifest.name}} ********/
{% for function in partition.manifest.secure_functions%}
+ {% if function.signal.lower().startswith('tfm_') %}
+ {# If signal already contains tfm_ prefix, avoid adding a duplicated one
+ in veneer function name.
+ #}
+psa_status_t {{function.signal.lower()}}_veneer(psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len);
+ {% else %}
psa_status_t tfm_{{function.signal.lower()}}_veneer(psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len);
+ {% endif %}
{% endfor %}
{% if partition.attr.conditional %}
#endif /* {{partition.attr.conditional}} */
diff --git a/interface/src/tfm_audit_func_api.c b/interface/src/tfm_audit_func_api.c
index 4141970a6..e433dffbf 100644
--- a/interface/src/tfm_audit_func_api.c
+++ b/interface/src/tfm_audit_func_api.c
@@ -11,17 +11,17 @@
#include "tfm_ns_interface.h"
#define API_DISPATCH(sfn_name) \
- tfm_ns_interface_dispatch((veneer_fn)tfm_##sfn_name##_veneer, \
+ tfm_ns_interface_dispatch((veneer_fn)sfn_name##_veneer, \
(uint32_t)in_vec, IOVEC_LEN(in_vec), \
(uint32_t)out_vec, IOVEC_LEN(out_vec))
#define API_DISPATCH_NO_INVEC(sfn_name) \
- tfm_ns_interface_dispatch((veneer_fn)tfm_##sfn_name##_veneer, \
+ tfm_ns_interface_dispatch((veneer_fn)sfn_name##_veneer, \
(uint32_t)NULL, 0, \
(uint32_t)out_vec, IOVEC_LEN(out_vec))
#define API_DISPATCH_NO_OUTVEC(sfn_name) \
- tfm_ns_interface_dispatch((veneer_fn)tfm_##sfn_name##_veneer, \
+ tfm_ns_interface_dispatch((veneer_fn)sfn_name##_veneer, \
(uint32_t)in_vec, IOVEC_LEN(in_vec), \
(uint32_t)NULL, 0)
@@ -41,7 +41,7 @@ psa_status_t psa_audit_retrieve_record(const uint32_t record_index,
{.base = buffer, .len = buffer_size},
};
- status = API_DISPATCH(audit_core_retrieve_record);
+ status = API_DISPATCH(tfm_audit_core_retrieve_record);
*record_size = out_vec[0].len;
@@ -56,7 +56,7 @@ psa_status_t psa_audit_get_info(uint32_t *num_records, uint32_t *size)
{.base = size, .len = sizeof(uint32_t)},
};
- status = API_DISPATCH_NO_INVEC(audit_core_get_info);
+ status = API_DISPATCH_NO_INVEC(tfm_audit_core_get_info);
return status;
}
@@ -72,7 +72,7 @@ psa_status_t psa_audit_get_record_info(const uint32_t record_index,
{.base = size, .len = sizeof(uint32_t)},
};
- status = API_DISPATCH(audit_core_get_record_info);
+ status = API_DISPATCH(tfm_audit_core_get_record_info);
return status;
}
@@ -87,7 +87,7 @@ psa_status_t psa_audit_delete_record(const uint32_t record_index,
{.base = token, .len = token_size},
};
- status = API_DISPATCH_NO_OUTVEC(audit_core_delete_record);
+ status = API_DISPATCH_NO_OUTVEC(tfm_audit_core_delete_record);
return status;
}
diff --git a/interface/src/tfm_crypto_func_api.c b/interface/src/tfm_crypto_func_api.c
index 328699715..c8e657670 100644
--- a/interface/src/tfm_crypto_func_api.c
+++ b/interface/src/tfm_crypto_func_api.c
@@ -12,12 +12,12 @@
#include "tfm_ns_interface.h"
#define API_DISPATCH(sfn_name, sfn_id) \
- tfm_ns_interface_dispatch((veneer_fn)tfm_##sfn_name##_veneer,\
+ tfm_ns_interface_dispatch((veneer_fn)sfn_name##_veneer, \
(uint32_t)in_vec, IOVEC_LEN(in_vec), \
(uint32_t)out_vec, IOVEC_LEN(out_vec))
#define API_DISPATCH_NO_OUTVEC(sfn_name, sfn_id) \
- tfm_ns_interface_dispatch((veneer_fn)tfm_##sfn_name##_veneer,\
+ tfm_ns_interface_dispatch((veneer_fn)sfn_name##_veneer, \
(uint32_t)in_vec, IOVEC_LEN(in_vec), \
(uint32_t)NULL, 0)
diff --git a/interface/src/tfm_firmware_update_func_api.c b/interface/src/tfm_firmware_update_func_api.c
index 1d34d0312..487028897 100644
--- a/interface/src/tfm_firmware_update_func_api.c
+++ b/interface/src/tfm_firmware_update_func_api.c
@@ -24,7 +24,7 @@ psa_status_t psa_fwu_write(uint32_t image_id,
{ .base = block, .len = block_size }
};
- status = tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_fwu_write_req_veneer,
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_fwu_write_req_veneer,
(uint32_t)in_vec, IOVEC_LEN(in_vec),
(uint32_t)NULL, 0);
@@ -54,7 +54,7 @@ psa_status_t psa_fwu_install(psa_image_id_t image_id,
return PSA_ERROR_INVALID_ARGUMENT;
}
- status = tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_fwu_install_req_veneer,
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_fwu_install_req_veneer,
(uint32_t)in_vec, IOVEC_LEN(in_vec),
(uint32_t)out_vec, IOVEC_LEN(out_vec));
@@ -73,7 +73,7 @@ psa_status_t psa_fwu_abort(psa_image_id_t image_id)
{ .base = &image_id, .len = sizeof(image_id) }
};
- status = tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_fwu_abort_req_veneer,
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_fwu_abort_req_veneer,
(uint32_t)in_vec, IOVEC_LEN(in_vec),
(uint32_t)NULL, 0);
@@ -95,7 +95,7 @@ psa_status_t psa_fwu_query(psa_image_id_t image_id, psa_image_info_t *info)
{ .base = info, .len = sizeof(*info)}
};
- status = tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_fwu_query_req_veneer,
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_fwu_query_req_veneer,
(uint32_t)in_vec, IOVEC_LEN(in_vec),
(uint32_t)out_vec, IOVEC_LEN(out_vec));
@@ -110,9 +110,10 @@ psa_status_t psa_fwu_request_reboot(void)
{
psa_status_t status;
- status = tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_fwu_request_reboot_req_veneer,
- (uint32_t)NULL, 0,
- (uint32_t)NULL, 0);
+ status = tfm_ns_interface_dispatch(
+ (veneer_fn)tfm_fwu_request_reboot_req_veneer,
+ (uint32_t)NULL, 0,
+ (uint32_t)NULL, 0);
if (status == (psa_status_t)TFM_ERROR_INVALID_PARAMETER) {
return PSA_ERROR_INVALID_ARGUMENT;
@@ -125,7 +126,7 @@ psa_status_t psa_fwu_accept(void)
{
psa_status_t status;
- status = tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_fwu_accept_req_veneer,
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_fwu_accept_req_veneer,
(uint32_t)NULL, 0,
(uint32_t)NULL, 0);
diff --git a/interface/src/tfm_its_func_api.c b/interface/src/tfm_its_func_api.c
index b554a3457..da126d7a2 100644
--- a/interface/src/tfm_its_func_api.c
+++ b/interface/src/tfm_its_func_api.c
@@ -24,7 +24,7 @@ psa_status_t psa_its_set(psa_storage_uid_t uid,
{ .base = &create_flags, .len = sizeof(create_flags) }
};
- status = tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_its_set_req_veneer,
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_its_set_req_veneer,
(uint32_t)in_vec, IOVEC_LEN(in_vec),
(uint32_t)NULL, 0);
@@ -56,7 +56,7 @@ psa_status_t psa_its_get(psa_storage_uid_t uid,
return PSA_ERROR_INVALID_ARGUMENT;
}
- status = tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_its_get_req_veneer,
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_its_get_req_veneer,
(uint32_t)in_vec, IOVEC_LEN(in_vec),
(uint32_t)out_vec, IOVEC_LEN(out_vec));
@@ -82,10 +82,9 @@ psa_status_t psa_its_get_info(psa_storage_uid_t uid,
{ .base = p_info, .len = sizeof(*p_info) }
};
- status = tfm_ns_interface_dispatch(
- (veneer_fn)tfm_tfm_its_get_info_req_veneer,
- (uint32_t)in_vec, IOVEC_LEN(in_vec),
- (uint32_t)out_vec, IOVEC_LEN(out_vec));
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_its_get_info_req_veneer,
+ (uint32_t)in_vec, IOVEC_LEN(in_vec),
+ (uint32_t)out_vec, IOVEC_LEN(out_vec));
if (status == (psa_status_t)TFM_ERROR_INVALID_PARAMETER) {
return PSA_ERROR_INVALID_ARGUMENT;
@@ -100,7 +99,7 @@ psa_status_t psa_its_remove(psa_storage_uid_t uid)
{ .base = &uid, .len = sizeof(uid) }
};
- return tfm_ns_interface_dispatch((veneer_fn)tfm_tfm_its_remove_req_veneer,
+ return tfm_ns_interface_dispatch((veneer_fn)tfm_its_remove_req_veneer,
(uint32_t)in_vec, IOVEC_LEN(in_vec),
(uint32_t)NULL, 0);
}
diff --git a/interface/src/tfm_ps_func_api.c b/interface/src/tfm_ps_func_api.c
index 4674a350a..ea6e1c801 100644
--- a/interface/src/tfm_ps_func_api.c
+++ b/interface/src/tfm_ps_func_api.c
@@ -22,10 +22,9 @@ psa_status_t psa_ps_set(psa_storage_uid_t uid,
{ .base = &create_flags, .len = sizeof(create_flags) }
};
- status = tfm_ns_interface_dispatch(
- (veneer_fn)tfm_tfm_ps_set_req_veneer,
- (uint32_t)in_vec, IOVEC_LEN(in_vec),
- (uint32_t)NULL, 0);
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_ps_set_req_veneer,
+ (uint32_t)in_vec, IOVEC_LEN(in_vec),
+ (uint32_t)NULL, 0);
/* A parameter with a buffer pointer pointer that has data length longer
* than maximum permitted is treated as a secure violation.
@@ -57,10 +56,9 @@ psa_status_t psa_ps_get(psa_storage_uid_t uid,
return PSA_ERROR_INVALID_ARGUMENT;
}
- status = tfm_ns_interface_dispatch(
- (veneer_fn)tfm_tfm_ps_get_req_veneer,
- (uint32_t)in_vec, IOVEC_LEN(in_vec),
- (uint32_t)out_vec, IOVEC_LEN(out_vec));
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_ps_get_req_veneer,
+ (uint32_t)in_vec, IOVEC_LEN(in_vec),
+ (uint32_t)out_vec, IOVEC_LEN(out_vec));
*p_data_length = out_vec[0].len;
@@ -79,10 +77,9 @@ psa_status_t psa_ps_get_info(psa_storage_uid_t uid,
{ .base = p_info, .len = sizeof(*p_info) }
};
- status = tfm_ns_interface_dispatch(
- (veneer_fn)tfm_tfm_ps_get_info_req_veneer,
- (uint32_t)in_vec, IOVEC_LEN(in_vec),
- (uint32_t)out_vec, IOVEC_LEN(out_vec));
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_ps_get_info_req_veneer,
+ (uint32_t)in_vec, IOVEC_LEN(in_vec),
+ (uint32_t)out_vec, IOVEC_LEN(out_vec));
return status;
}
@@ -94,10 +91,9 @@ psa_status_t psa_ps_remove(psa_storage_uid_t uid)
{ .base = &uid, .len = sizeof(uid) }
};
- status = tfm_ns_interface_dispatch(
- (veneer_fn)tfm_tfm_ps_remove_req_veneer,
- (uint32_t)in_vec, IOVEC_LEN(in_vec),
- (uint32_t)NULL, 0);
+ status = tfm_ns_interface_dispatch((veneer_fn)tfm_ps_remove_req_veneer,
+ (uint32_t)in_vec, IOVEC_LEN(in_vec),
+ (uint32_t)NULL, 0);
return status;
}
@@ -135,10 +131,9 @@ uint32_t psa_ps_get_support(void)
{ .base = &support_flags, .len = sizeof(support_flags) }
};
- (void)tfm_ns_interface_dispatch(
- (veneer_fn)tfm_tfm_ps_get_support_req_veneer,
- (uint32_t)NULL, 0,
- (uint32_t)out_vec, IOVEC_LEN(out_vec));
+ (void)tfm_ns_interface_dispatch((veneer_fn)tfm_ps_get_support_req_veneer,
+ (uint32_t)NULL, 0,
+ (uint32_t)out_vec, IOVEC_LEN(out_vec));
return support_flags;
}