mirror of
https://github.com/espressif/mbedtls.git
synced 2025-05-10 03:39:03 +08:00
Update and document mbedtls extensions
Signed-off-by: Archana <archana.madhavan@silabs.com> Signed-off-by: Asfandyar Orakzai <asfandyar.orakzai@silabs.com>
This commit is contained in:
parent
1776dd9022
commit
a2cac3224d
@ -36,6 +36,12 @@ A driver therefore consists of:
|
|||||||
|
|
||||||
Mbed TLS calls driver entry points [as specified in the PSA Cryptography Driver Interface specification](psa-driver-interface.html#driver-entry-points) except as otherwise indicated in this section.
|
Mbed TLS calls driver entry points [as specified in the PSA Cryptography Driver Interface specification](psa-driver-interface.html#driver-entry-points) except as otherwise indicated in this section.
|
||||||
|
|
||||||
|
## Mbed TLS extensions
|
||||||
|
|
||||||
|
The driver description can include Mbed TLS extensions (marked by the namespace "mbedtls"). Mbed TLS extensions are meant to extend/help integrating the driver into the library's infrastructure.
|
||||||
|
* `"mbedtls/h_condition"` (optional, string) can include complex preprocessor definitions to conditionally include header files for a given driver.
|
||||||
|
* `"mbedtls/c_condition"` (optional, string) can include complex preprocessor definitions to conditionally enable dispatch capabilities for a driver.
|
||||||
|
|
||||||
## Building and testing your driver
|
## Building and testing your driver
|
||||||
|
|
||||||
<!-- TODO -->
|
<!-- TODO -->
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"type": ["integer","string"],
|
"type": ["integer","string"],
|
||||||
"pattern": "^(0x|0X)?[a-fA-F0-9]+$"
|
"pattern": "^(0x|0X)?[a-fA-F0-9]+$"
|
||||||
},
|
},
|
||||||
"mbedtls/h_depend_on": {
|
"mbedtls/h_condition": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"headers": {
|
"headers": {
|
||||||
@ -36,7 +36,7 @@
|
|||||||
"_comment": {
|
"_comment": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"mbedtls/c_depend_on": {
|
"mbedtls/c_condition": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"entry_points": {
|
"entry_points": {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"const": ["transparent"]
|
"const": ["transparent"]
|
||||||
},
|
},
|
||||||
"mbedtls/h_depend_on": {
|
"mbedtls/h_condition": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"headers": {
|
"headers": {
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"_comment": {
|
"_comment": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"mbedtls/c_depend_on": {
|
"mbedtls/c_condition": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"entry_points": {
|
"entry_points": {
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
"prefix": "mbedtls_test",
|
"prefix": "mbedtls_test",
|
||||||
"type": "opaque",
|
"type": "opaque",
|
||||||
"location": "0x7fffff",
|
"location": "0x7fffff",
|
||||||
"mbedtls/h_depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
"mbedtls/h_condition": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
||||||
"headers": ["test/drivers/test_driver.h"],
|
"headers": ["test/drivers/test_driver.h"],
|
||||||
"capabilities": [
|
"capabilities": [
|
||||||
{
|
{
|
||||||
"_comment": "The Mbed TLS opaque driver supports import key/export key/export_public key",
|
"_comment": "The Mbed TLS opaque driver supports import key/export key/export_public key",
|
||||||
"mbedtls/c_depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
"mbedtls/c_condition": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
||||||
"entry_points": ["import_key", "export_key", "export_public_key"]
|
"entry_points": ["import_key", "export_key", "export_public_key"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_comment": "The Mbed TLS opaque driver supports copy key/ get builtin key",
|
"_comment": "The Mbed TLS opaque driver supports copy key/ get builtin key",
|
||||||
"mbedtls/c_depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
"mbedtls/c_condition": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
||||||
"entry_points": ["copy_key", "get_builtin_key"],
|
"entry_points": ["copy_key", "get_builtin_key"],
|
||||||
"names": {"copy_key":"mbedtls_test_opaque_copy_key", "get_builtin_key":"mbedtls_test_opaque_get_builtin_key"}
|
"names": {"copy_key":"mbedtls_test_opaque_copy_key", "get_builtin_key":"mbedtls_test_opaque_get_builtin_key"}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
{
|
{
|
||||||
"prefix": "mbedtls_test",
|
"prefix": "mbedtls_test",
|
||||||
"type": "transparent",
|
"type": "transparent",
|
||||||
"mbedtls/h_depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
"mbedtls/h_condition": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
||||||
"headers": ["test/drivers/test_driver.h"],
|
"headers": ["test/drivers/test_driver.h"],
|
||||||
"capabilities": [
|
"capabilities": [
|
||||||
{
|
{
|
||||||
"_comment": "The Mbed TLS transparent driver supports import key/export key",
|
"_comment": "The Mbed TLS transparent driver supports import key/export key",
|
||||||
"mbedtls/c_depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
"mbedtls/c_condition": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
||||||
"entry_points": ["import_key", "export_key"],
|
"entry_points": ["import_key", "export_key"],
|
||||||
"fallback": true
|
"fallback": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_comment": "The Mbed TLS transparent driver supports export_public key",
|
"_comment": "The Mbed TLS transparent driver supports export_public key",
|
||||||
"mbedtls/c_depend_on": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
"mbedtls/c_condition": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
||||||
"entry_points": ["export_public_key"],
|
"entry_points": ["export_public_key"],
|
||||||
"fallback": true,
|
"fallback": true,
|
||||||
"names": {"export_public_key":"mbedtls_test_transparent_export_public_key"}
|
"names": {"export_public_key":"mbedtls_test_transparent_export_public_key"}
|
||||||
|
@ -7,7 +7,7 @@ Expected inputs:
|
|||||||
-#}
|
-#}
|
||||||
{% for driver in drivers if driver.type == "opaque" -%}
|
{% for driver in drivers if driver.type == "opaque" -%}
|
||||||
{% for capability in driver.capabilities if entry_point in capability.entry_points -%}
|
{% for capability in driver.capabilities if entry_point in capability.entry_points -%}
|
||||||
#if ({% if capability['mbedtls/c_depend_on'] is defined -%}{{ capability['mbedtls/c_depend_on'] }} {% else -%} {{ 1 }} {% endif %})
|
#if ({% if capability['mbedtls/c_condition'] is defined -%}{{ capability['mbedtls/c_condition'] }} {% else -%} {{ 1 }} {% endif %})
|
||||||
{%- filter indent(width = nest_indent) %}
|
{%- filter indent(width = nest_indent) %}
|
||||||
case {{ driver.location }}:
|
case {{ driver.location }}:
|
||||||
return( {{ entry_point_name(capability, entry_point, driver) }}({{entry_point_param(driver) | indent(20)}}));
|
return( {{ entry_point_name(capability, entry_point, driver) }}({{entry_point_param(driver) | indent(20)}}));
|
||||||
|
@ -7,7 +7,7 @@ Expected inputs:
|
|||||||
-#}
|
-#}
|
||||||
{% for driver in drivers if driver.type == "transparent" -%}
|
{% for driver in drivers if driver.type == "transparent" -%}
|
||||||
{% for capability in driver.capabilities if entry_point in capability.entry_points -%}
|
{% for capability in driver.capabilities if entry_point in capability.entry_points -%}
|
||||||
#if ({% if capability['mbedtls/c_depend_on'] is defined -%}{{ capability['mbedtls/c_depend_on'] }} {% else -%} {{ 1 }} {% endif %})
|
#if ({% if capability['mbedtls/c_condition'] is defined -%}{{ capability['mbedtls/c_condition'] }} {% else -%} {{ 1 }} {% endif %})
|
||||||
{%- filter indent(width = nest_indent) %}
|
{%- filter indent(width = nest_indent) %}
|
||||||
status = {{ entry_point_name(capability, entry_point, driver) }}({{entry_point_param(driver) | indent(20)}});
|
status = {{ entry_point_name(capability, entry_point, driver) }}({{entry_point_param(driver) | indent(20)}});
|
||||||
|
|
||||||
|
@ -39,13 +39,13 @@
|
|||||||
#if defined(MBEDTLS_PSA_CRYPTO_DRIVERS)
|
#if defined(MBEDTLS_PSA_CRYPTO_DRIVERS)
|
||||||
{% for driver in drivers -%}
|
{% for driver in drivers -%}
|
||||||
/* Headers for {{driver.prefix}} {{driver.type}} driver */
|
/* Headers for {{driver.prefix}} {{driver.type}} driver */
|
||||||
{% if driver['mbedtls/h_depend_on'] is defined -%}
|
{% if driver['mbedtls/h_condition'] is defined -%}
|
||||||
#if {{ driver['mbedtls/h_depend_on'] }}
|
#if {{ driver['mbedtls/h_condition'] }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% for header in driver.headers -%}
|
{% for header in driver.headers -%}
|
||||||
#include "{{ header }}"
|
#include "{{ header }}"
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if driver['mbedtls/h_depend_on'] is defined -%}
|
{% if driver['mbedtls/h_condition'] is defined -%}
|
||||||
#endif
|
#endif
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user