JSON upgrade to give function names

Function names can be provided against entry points.
This helps to ensure easy migration for misnamed functions.

Signed-off-by: Archana <archana.madhavan@silabs.com>
Signed-off-by: Asfandyar Orakzai <asfandyar.orakzai@silabs.com>
This commit is contained in:
Archana 2022-01-09 09:30:32 +05:30 committed by Asfandyar Orakzai
parent e829cd6953
commit 05efa17549
4 changed files with 20 additions and 3 deletions

View file

@ -12,7 +12,8 @@
{
"_comment": "The mbedTLS opaque driver supports copy key/ get builtin key",
"depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
"entry_points": ["copy_key","get_builtin_key"]
"entry_points": ["copy_key","get_builtin_key"],
"name": {"copy_key":"mbedtls_test_opaque_copy_key", "get_builtin_key":"mbedtls_test_opaque_get_builtin_key"}
}
]
}]

View file

@ -4,10 +4,18 @@
"headers": ["test/drivers/test_driver.h"],
"capabilities": [
{
"_comment": "The mbedTLS transparent driver supports import key/export key/export_public key",
"_comment": "The mbedTLS transparent driver supports import key/export key",
"depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
"entry_points": ["import_key", "export_key", "export_public_key"],
"entry_points": ["import_key", "export_key"],
"fallback": true
},
{
"_comment": "The mbedTLS transparent driver supports export_public key",
"depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
"entry_points": ["export_public_key"],
"fallback": true,
"name": {"export_public_key":"mbedtls_test_transparent_export_public_key"}
}
]
}]

View file

@ -3,7 +3,11 @@
#if ({% if capability.depend_on is defined -%}{{ capability.depend_on }} {% else -%} {{ 1 }} {% endif %})
{%- filter indent(width = nest_indent) %}
case {{ driver.location }}:
{% if capability.name is defined and entry_point in capability.name.keys() -%}
return({{ capability.name[entry_point]}}({{entry_point_attributes(driver) | indent(20)}}));
{% else -%}
return({{driver.prefix}}_{{driver.type}}_{{entry_point}}({{entry_point_attributes(driver) | indent(20)}}));
{% endif -%}
{% endfilter -%}
#endif
{% endfor %}

View file

@ -2,7 +2,11 @@
{% for capability in driver.capabilities if entry_point in capability.entry_points -%}
#if ({% if capability.depend_on is defined -%}{{ capability.depend_on }} {% else -%} {{ 1 }} {% endif %})
{%- filter indent(width = nest_indent) %}
{% if capability.name is defined and entry_point in capability.name.keys() -%}
status = {{ capability.name[entry_point]}}({{entry_point_attributes(driver) | indent(20)}});
{% else -%}
status = {{driver.prefix}}_{{driver.type}}_{{entry_point}}({{entry_point_attributes(driver) | indent(20)}});
{% endif -%}
if( status != PSA_ERROR_NOT_SUPPORTED )
return( status );