mbedtls
mbedtls copied to clipboard
Python libraries to generate wrapper code for PSA functions
Write generic Python libraries that can be used to generate wrapper code for PSA functions. We intend to use them for several purposes:
- Generate driver wrappers (replacing the current implementation using Jinja2 templates)
- Generate client-side and server-side IPC code to test client-server usage
- Tracing helpers
- etc.
We have merged the core libraries as part of a security fix:
-
c_wrapper_generator.py
to generate wrapper functions; -
c_parsing_helper.py
to list PSA API functions; - Some code in
generate_psa_wrappers.py
should be lifted out into a new module: methods like_detect_buffer_parameters
will be needed for the client-server stub generator, whereaspoison
stuff will not be.
As part of the security fix, we only reviewed the output of the generator, not the generator code (which was only reviewed for non-harmfulness, not for correctness and maintainability). As a consequence, the goals of this task are:
- Review
c_wrapper_generator.py
andc_parsing_helper.py
. - Extract the code from
tests/scripts/generate_psa_wrappers.py
that's generically useful for all PSA wrapper code into a new module and review it fully.