Complete the move of driver wrappers to the dispatch/ directory#809
Complete the move of driver wrappers to the dispatch/ directory#809asmellby wants to merge 15 commits into
Conversation
gilles-peskine-arm
left a comment
There was a problem hiding this comment.
I think this is moving in the direction we want, thanks. But I've asked Ronald to review as well, as he's the architect of the directory structure and build scripts. We're currently focusing on some security fixes for our next release, so it might be a while before he can review.
I'm not sure what users are supposed to be able to do. Whatever it is, it needs to be documented and tested.
I reviewed 56449b8
| set(TF_PSA_CRYPTO_FRAMEWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/framework) | ||
|
|
||
| if(NOT DEFINED TF_PSA_CRYPTO_DISPATCH_DIR) | ||
| set(TF_PSA_CRYPTO_DISPATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dispatch) |
There was a problem hiding this comment.
From prior experience, I think CMakeLists.txt in Mbed TLS will need to know about the new location to populate TF_PSA_CRYPTO_PRIVATE_INCLUDE_DIRS. It isn't properly extracting the information from TF-PSA-Crypto.
Allow supplying a custom dispatch directory using the TF_PSA_CRYPTO_DISPATCH_DIR variable. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Use the dispatch directory for all driver wrapper files. When file generation is enabled, generate into a dispatch/ build directory. Move the generation logic into the dispatch CMakeLists.txt. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The dispatch/include/ directory is added as a public include directory to contain dispatch and driver-specific include files. It is currently empty. In the installed CMake package, the new directory is collapsed into the existing structure to maintain backward compatibility. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The crypto driver context headers are tightly coupled with the dispatch implementation. Move them to the dispatch include directory. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
56449b8 to
e22eb7b
Compare
Let the generated files directly be part of the dispatch target instead of using an intermediate custom target. Directly link drivers with the dispatch target, using the correct flavor for static and shared libraries. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Set the dispatch build directory explicitly to support out-of-tree dispatch directories. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Add a testcase for the use of TF_PSA_CRYPTO_DISPATCH_DIR to set a custom dispatch directory. The custom dispatch in the testcase is created by copying and generating the vanilla dispatch implementation into the test program directory. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Add a testcase for the use of TF_PSA_CRYPTO_DISPATCH_DIR to set a custom dispatch directory when building and installing a CMake package for TF-PSA-Crypto. The custom dispatch in the testcase is created by copying and generating the vanilla dispatch implementation into the test program directory. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Document the new include path and TF_PSA_CRYPTO_DISPATCH_DIR. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Simplify check for the new dispatch location and add new location to check_names.py Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
gilles-peskine-arm
left a comment
There was a problem hiding this comment.
Looks good to me, except I'd like one point clarified in the documentation. I don't know much about CMake, so my review of CMake code is superficial.
Our CI appears to be stuck today (ticket filed), so results might not be available until Monday.
| # calling CMake in order to avoid target name clashes, via the use of | ||
| # TF_PSA_CRYPTO_TARGET_PREFIX. The value of this variable is prefixed to the | ||
| # tfpsacrypto and tfpsacrypto-apidoc targets. | ||
| # - TF_PSA_CRYPTO_DISPATCH_DIR: If set, this directory is used instead of the |
There was a problem hiding this comment.
Please state that this must be an absolute path.
|
Note that the CI isn't happy. There's at least a missing include directory in CMake builds. |
Remove exclusion of driver wrappers from check_names.py Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Make it explicit that this option should be an absolute path. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The dispatch include dir was missing from the doxyfile and from the config check test. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Some test cases (tf_psa_crypto_test_memsan_constant_flow_psa) rely on reusing a generated version of the driver wrapper from a previous CMake invocation. If the driver wrapper doesn't exist in the source directory but does exist in the build directory, use the file from the build directory. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Description
The TF-PSA-Crypto 1.1 release introduced a
dispatchdirectory with the following description:This PR completes the move of generated driver wrapper files and API headers to the dispatch directory.
PR checklist
Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.